Combined Code
movieClip 3 indi {
}
frame 1 {
function simpanMedal() {
Cookies = SharedObject.getLocal('xmonsterTownDefense');
i = 1;
while (i <= simpanSemua2.length) {
Cookies.data['monsterData' + (12 + i)] = eval(simpanSemua2[i]);
++i;
}
Cookies.data.monsterData51 = eval(simpanSemua[51]);
}
function simpanData() {
Cookies = SharedObject.getLocal('xmonsterTownDefense');
i = 1;
while (i <= simpanSemua.length) {
Cookies.data['monsterData' + i] = eval(simpanSemua[i]);
++i;
}
i = 1;
while (i <= 25) {
Cookies.data['keBangunan' + i] = _root['keBangunan' + i];
Cookies.data['xgold' + i] = _root['xgold' + i];
Cookies.data['xiron' + i] = _root['xiron' + i];
Cookies.data['xwood' + i] = _root['xwood' + i];
Cookies.data['xtech' + i] = _root['xtech' + i];
Cookies.data['xworker' + i] = _root['xworker' + i];
Cookies.data['xwelfare' + i] = _root['xwelfare' + i];
Cookies.data['xmana' + i] = _root['xmana' + i];
Cookies.data['xfood' + i] = _root['xfood' + i];
Cookies.data['xbareman' + i] = _root['xbareman' + i];
Cookies.data['xswordman' + i] = _root['xswordman' + i];
Cookies.data['xarrowman' + i] = _root['xarrowman' + i];
Cookies.data['xspearman' + i] = _root['xspearman' + i];
Cookies.data['xbaremanPowerLow' + i] = _root['xbaremanPowerLow' + i];
Cookies.data['xswordmanPowerLow' + i] = _root['xswordmanPowerLow' + i];
Cookies.data['xarrowmanPowerLow' + i] = _root['xarrowmanPowerLow' + i];
Cookies.data['xspearmanPowerLow' + i] = _root['xspearmanPowerLow' + i];
Cookies.data['xbaremanPower' + i] = _root['xbaremanPower' + i];
Cookies.data['xswordmanPower' + i] = _root['xswordmanPower' + i];
Cookies.data['xarrowmanPower' + i] = _root['xarrowmanPower' + i];
Cookies.data['xspearmanPower' + i] = _root['xspearmanPower' + i];
Cookies.data['xbaremanPowerMax' + i] = _root['xbaremanPowerMax' + i];
Cookies.data['xswordmanPowerMax' + i] = _root['xswordmanPowerMax' + i];
Cookies.data['xarrowmanPowerMax' + i] = _root['xarrowmanPowerMax' + i];
Cookies.data['xspearmanPowerMax' + i] = _root['xspearmanPowerMax' + i];
Cookies.data['xtank' + i] = _root['xtank' + i];
Cookies.data['xcopter' + i] = _root['xcopter' + i];
Cookies.data['xmonbot' + i] = _root['xmonbot' + i];
Cookies.data['xsword' + i] = _root['xsword' + i];
Cookies.data['xarrow' + i] = _root['xarrow' + i];
Cookies.data['xspear' + i] = _root['xspear' + i];
Cookies.data['xarrowTrap' + i] = _root['xarrowTrap' + i];
Cookies.data['xcatapult' + i] = _root['xcatapult' + i];
Cookies.data['xfireTrap' + i] = _root['xfireTrap' + i];
Cookies.data['xarrowRain' + i] = _root['xarrowRain' + i];
Cookies.data['xmeteorid' + i] = _root['xmeteorid' + i];
Cookies.data['xacidRain' + i] = _root['xacidRain' + i];
Cookies.data['xearthquake' + i] = _root['xearthquake' + i];
Cookies.data['ximmune' + i] = _root['ximmune' + i];
Cookies.data['xinvisible' + i] = _root['xinvisible' + i];
Cookies.data['xspecialAttack' + i] = _root['xspecialAttack' + i];
Cookies.data['xduplicate' + i] = _root['xduplicate' + i];
Cookies.data['xwall' + i] = _root['xwall' + i];
Cookies.data['xspike' + i] = _root['xspike' + i];
Cookies.data['xspiderWeb' + i] = _root['xspiderWeb' + i];
Cookies.data['xtowerGuard' + i] = _root['xtowerGuard' + i];
Cookies.data['xzombieTrap' + i] = _root['xzombieTrap' + i];
Cookies.data['risetArmory' + i] = _root['risetArmory' + i];
Cookies.data['risetFactory' + i] = _root['risetFactory' + i];
Cookies.data['risetPark' + i] = _root['risetPark' + i];
Cookies.data['risetTemple' + i] = _root['risetTemple' + i];
Cookies.data['risetFortress' + i] = _root['risetFortress' + i];
Cookies.data['risetLibrary' + i] = _root['risetLibrary' + i];
Cookies.data['risetCatapult' + i] = _root['risetCatapult' + i];
Cookies.data['risetFireTrap' + i] = _root['risetFireTrap' + i];
Cookies.data['risetTank' + i] = _root['risetTank' + i];
Cookies.data['risetCopter' + i] = _root['risetCopter' + i];
Cookies.data['risetMonbot' + i] = _root['risetMonbot' + i];
Cookies.data['risetInvisible' + i] = _root['risetInvisible' + i];
Cookies.data['risetSpecialAttack' + i] = _root['risetSpecialAttack' + i];
Cookies.data['risetDuplicate' + i] = _root['risetDuplicate' + i];
Cookies.data['risetZombie' + i] = _root['risetZombie' + i];
Cookies.data['risetFastBuild' + i] = _root['risetFastBuild' + i];
Cookies.data['risetRawPlus' + i] = _root['risetRawPlus' + i];
Cookies.data['risetGoldPlus' + i] = _root['risetGoldPlus' + i];
Cookies.data['autoBareman' + i] = _root['autoBareman' + i];
Cookies.data['autoSwordman' + i] = _root['autoSwordman' + i];
Cookies.data['autoArrowman' + i] = _root['autoArrowman' + i];
Cookies.data['autoSpearman' + i] = _root['autoSpearman' + i];
Cookies.data['autoSword' + i] = _root['autoSword' + i];
Cookies.data['autoArrow' + i] = _root['autoArrow' + i];
Cookies.data['autoSpear' + i] = _root['autoSpear' + i];
Cookies.data['autoTank' + i] = _root['autoTank' + i];
Cookies.data['autoCopter' + i] = _root['autoCopter' + i];
Cookies.data['autoMonbot' + i] = _root['autoMonbot' + i];
Cookies.data['rangerAktif' + i] = _root['rangerAktif' + i];
Cookies.data['tirelessAktif' + i] = _root['tirelessAktif' + i];
Cookies.data['armorPlusAktif' + i] = _root['armorPlusAktif' + i];
Cookies.data['speedPlusAktif' + i] = _root['speedPlusAktif' + i];
Cookies.data['entertainmentAktif' + i] = _root['entertainmentAktif' + i];
Cookies.data['fastBuildAktif' + i] = _root['fastBuildAktif' + i];
Cookies.data['rawPlusAktif' + i] = _root['rawPlusAktif' + i];
Cookies.data['goldPlusAktif' + i] = _root['goldPlusAktif' + i];
Cookies.data['kotaMilik' + i] = _root['kotaMilik' + i];
Cookies.data['xnamaKota' + i] = xnamaKota[i];
++i;
}
i = 1;
while (i <= 50) {
j = 1;
while (j <= 25) {
Cookies.data['xtipeBuilding' + i + '-' + j] = xtipeBuilding[i][j];
Cookies.data['xposXBuilding' + i + '-' + j] = xposXBuilding[i][j];
Cookies.data['xposYBuilding' + i + '-' + j] = xposYBuilding[i][j];
Cookies.data['xlevelBuilding' + i + '-' + j] = xlevelBuilding[i][j];
Cookies.data['xsudahJadiBuilding' + i + '-' + j] = xsudahJadiBuilding[i][j];
Cookies.data['xdelayBuatBuilding' + i + '-' + j] = xdelayBuatBuilding[i][j];
++j;
}
++i;
}
Cookies.flush();
}
function loadData() {
Cookies = SharedObject.getLocal('xmonsterTownDefense');
i = 1;
while (i <= simpanSemua.length) {
_root[simpanSemua[i]] = Cookies.data['monsterData' + i];
++i;
}
xnamaKota = new Array();
i = 1;
while (i <= 25) {
_root['keBangunan' + i] = Cookies.data['keBangunan' + i];
_root['xgold' + i] = Cookies.data['xgold' + i];
_root['xiron' + i] = Cookies.data['xiron' + i];
_root['xwood' + i] = Cookies.data['xwood' + i];
_root['xtech' + i] = Cookies.data['xtech' + i];
_root['xworker' + i] = Cookies.data['xworker' + i];
_root['xwelfare' + i] = Cookies.data['xwelfare' + i];
_root['xmana' + i] = Cookies.data['xmana' + i];
_root['xfood' + i] = Cookies.data['xfood' + i];
_root['xbareman' + i] = Cookies.data['xbareman' + i];
_root['xswordman' + i] = Cookies.data['xswordman' + i];
_root['xarrowman' + i] = Cookies.data['xarrowman' + i];
_root['xspearman' + i] = Cookies.data['xspearman' + i];
_root['xbaremanPowerLow' + i] = Cookies.data['xbaremanPowerLow' + i];
_root['xswordmanPowerLow' + i] = Cookies.data['xswordmanPowerLow' + i];
_root['xarrowmanPowerLow' + i] = Cookies.data['xarrowmanPowerLow' + i];
_root['xspearmanPowerLow' + i] = Cookies.data['xspearmanPowerLow' + i];
_root['xbaremanPower' + i] = Cookies.data['xbaremanPower' + i];
_root['xswordmanPower' + i] = Cookies.data['xswordmanPower' + i];
_root['xarrowmanPower' + i] = Cookies.data['xarrowmanPower' + i];
_root['xspearmanPower' + i] = Cookies.data['xspearmanPower' + i];
_root['xbaremanPowerMax' + i] = Cookies.data['xbaremanPowerMax' + i];
_root['xswordmanPowerMax' + i] = Cookies.data['xswordmanPowerMax' + i];
_root['xarrowmanPowerMax' + i] = Cookies.data['xarrowmanPowerMax' + i];
_root['xspearmanPowerMax' + i] = Cookies.data['xspearmanPowerMax' + i];
_root['xtank' + i] = Cookies.data['xtank' + i];
_root['xcopter' + i] = Cookies.data['xcopter' + i];
_root['xmonbot' + i] = Cookies.data['xmonbot' + i];
_root['xsword' + i] = Cookies.data['xsword' + i];
_root['xarrow' + i] = Cookies.data['xarrow' + i];
_root['xspear' + i] = Cookies.data['xspear' + i];
_root['xarrowTrap' + i] = Cookies.data['xarrowTrap' + i];
_root['xcatapult' + i] = Cookies.data['xcatapult' + i];
_root['xfireTrap' + i] = Cookies.data['xfireTrap' + i];
_root['xarrowRain' + i] = Cookies.data['xarrowRain' + i];
_root['xmeteorid' + i] = Cookies.data['xmeteorid' + i];
_root['xacidRain' + i] = Cookies.data['xacidRain' + i];
_root['xearthquake' + i] = Cookies.data['xearthquake' + i];
_root['ximmune' + i] = Cookies.data['ximmune' + i];
_root['xinvisible' + i] = Cookies.data['xinvisible' + i];
_root['xspecialAttack' + i] = Cookies.data['xspecialAttack' + i];
_root['xduplicate' + i] = Cookies.data['xduplicate' + i];
_root['xwall' + i] = Cookies.data['xwall' + i];
_root['xspike' + i] = Cookies.data['xspike' + i];
_root['xspiderWeb' + i] = Cookies.data['xspiderWeb' + i];
_root['xtowerGuard' + i] = Cookies.data['xtowerGuard' + i];
_root['xzombieTrap' + i] = Cookies.data['xzombieTrap' + i];
_root['risetArmory' + i] = Cookies.data['risetArmory' + i];
_root['risetFactory' + i] = Cookies.data['risetFactory' + i];
_root['risetPark' + i] = Cookies.data['risetPark' + i];
_root['risetTemple' + i] = Cookies.data['risetTemple' + i];
_root['risetFortress' + i] = Cookies.data['risetFortress' + i];
_root['risetLibrary' + i] = Cookies.data['risetLibrary' + i];
_root['risetCatapult' + i] = Cookies.data['risetCatapult' + i];
_root['risetFireTrap' + i] = Cookies.data['risetFireTrap' + i];
_root['risetTank' + i] = Cookies.data['risetTank' + i];
_root['risetCopter' + i] = Cookies.data['risetCopter' + i];
_root['risetMonbot' + i] = Cookies.data['risetMonbot' + i];
_root['risetInvisible' + i] = Cookies.data['risetInvisible' + i];
_root['risetSpecialAttack' + i] = Cookies.data['risetSpecialAttack' + i];
_root['risetDuplicate' + i] = Cookies.data['risetDuplicate' + i];
_root['risetZombie' + i] = Cookies.data['risetZombie' + i];
_root['risetFastBuild' + i] = Cookies.data['risetFastBuild' + i];
_root['risetRawPlus' + i] = Cookies.data['risetRawPlus' + i];
_root['risetGoldPlus' + i] = Cookies.data['risetGoldPlus' + i];
_root['autoBareman' + i] = Cookies.data['autoBareman' + i];
_root['autoSwordman' + i] = Cookies.data['autoSwordman' + i];
_root['autoArrowman' + i] = Cookies.data['autoArrowman' + i];
_root['autoSpearman' + i] = Cookies.data['autoSpearman' + i];
_root['autoSword' + i] = Cookies.data['autoSword' + i];
_root['autoArrow' + i] = Cookies.data['autoArrow' + i];
_root['autoSpear' + i] = Cookies.data['autoSpear' + i];
_root['autoTank' + i] = Cookies.data['autoTank' + i];
_root['autoCopter' + i] = Cookies.data['autoCopter' + i];
_root['autoMonbot' + i] = Cookies.data['autoMonbot' + i];
_root['rangerAktif' + i] = Cookies.data['rangerAktif' + i];
_root['tirelessAktif' + i] = Cookies.data['tirelessAktif' + i];
_root['armorPlusAktif' + i] = Cookies.data['armorPlusAktif' + i];
_root['speedPlusAktif' + i] = Cookies.data['speedPlusAktif' + i];
_root['entertainmentAktif' + i] = Cookies.data['entertainmentAktif' + i];
_root['fastBuildAktif' + i] = Cookies.data['fastBuildAktif' + i];
_root['rawPlusAktif' + i] = Cookies.data['rawPlusAktif' + i];
_root['goldPlusAktif' + i] = Cookies.data['goldPlusAktif' + i];
_root['kotaMilik' + i] = Cookies.data['kotaMilik' + i];
xnamaKota[i] = Cookies.data['xnamaKota' + i];
++i;
}
xtipeBuilding = new Array();
xposXBuilding = new Array();
xposYBuilding = new Array();
xlevelBuilding = new Array();
xsudahJadiBuilding = new Array();
xdelayBuatBuilding = new Array();
i = 1;
while (i <= 50) {
xtipeBuilding[i] = new Array();
xposXBuilding[i] = new Array();
xposYBuilding[i] = new Array();
xlevelBuilding[i] = new Array();
xsudahJadiBuilding[i] = new Array();
xdelayBuatBuilding[i] = new Array();
j = 1;
while (j <= 25) {
xtipeBuilding[i][j] = 0;
xposXBuilding[i][j] = 0;
xposYBuilding[i][j] = 0;
xlevelBuilding[i][j] = 0;
xsudahJadiBuilding[i][j] = false;
xdelayBuatBuilding[i][j] = 0;
++j;
}
++i;
}
i = 1;
while (i <= 50) {
j = 1;
while (j <= 25) {
xtipeBuilding[i][j] = Cookies.data['xtipeBuilding' + i + '-' + j];
xposXBuilding[i][j] = Cookies.data['xposXBuilding' + i + '-' + j];
xposYBuilding[i][j] = Cookies.data['xposYBuilding' + i + '-' + j];
xlevelBuilding[i][j] = Cookies.data['xlevelBuilding' + i + '-' + j];
xsudahJadiBuilding[i][j] = Cookies.data['xsudahJadiBuilding' + i + '-' + j];
xdelayBuatBuilding[i][j] = Cookies.data['xdelayBuatBuilding' + i + '-' + j];
++j;
}
++i;
}
Cookies.flush();
}
function initMedal() {
menangGame = 0;
dapatMedal1 = false;
dapatMedal2 = false;
dapatMedal3 = false;
dapatMedal4 = false;
dapatMedal5 = false;
dapatMedal6 = false;
dapatMedal7 = false;
dapatMedal8 = false;
dapatMedal9 = false;
dapatMedal10 = false;
dapatMedal11 = false;
dapatMedal12 = false;
dapatMedal13 = false;
dapatMedal14 = false;
dapatMedal15 = false;
dapatMedal16 = false;
dapatMedal17 = false;
dapatMedal18 = false;
dapatMedal19 = false;
dapatMedal20 = false;
dapatMedal21 = false;
dapatMedal22 = false;
dapatMedal23 = false;
dapatMedal24 = false;
dapatMedal25 = false;
dapatMedal26 = false;
dapatMedal27 = false;
dapatMedal28 = false;
dapatMedal29 = false;
dapatMedal30 = false;
dapatMedal31 = false;
}
function initAwal() {
xday = 1;
bykKota = 25;
maxBangunan = 50;
awalKaliMain = true;
keKota = 1;
tingkatSulit = 1;
pilihAbility = 1;
speedGame = 1;
speedBattle = 1;
kalahMusuh = 0;
initSerangan = 100;
penambahanSerangan = 100;
randSerangan = random(10) + 1;
initSeranganHuman = 75;
sudahSerangAlvetia = false;
penambahanSerangan2 = 75;
autoSave = false;
pengkalianMusuh = 0.75;
sideQuestKe = 0;
pilihSkenario = 1;
killMusuh = 0;
winBattle = 0;
tidakKalah = 0;
suaraNyala = true;
sudahSerangFinal = false;
akanSerangKota = false;
awalKaliSerang = true;
sudahTutorial = false;
i = 1;
while (i <= bykKota) {
_root['keBangunan' + i] = 1;
_root['xgold' + i] = 0;
_root['xiron' + i] = 0;
_root['xwood' + i] = 0;
_root['xtech' + i] = 0;
_root['xworker' + i] = 0;
_root['xwelfare' + i] = 30;
_root['xmana' + i] = 0;
_root['xfood' + i] = 50;
_root['xbareman' + i] = 0;
_root['xswordman' + i] = 0;
_root['xarrowman' + i] = 0;
_root['xspearman' + i] = 0;
_root['xbaremanPowerLow' + i] = 100;
_root['xswordmanPowerLow' + i] = 120;
_root['xarrowmanPowerLow' + i] = 135;
_root['xspearmanPowerLow' + i] = 150;
_root['xbaremanPower' + i] = 100;
_root['xswordmanPower' + i] = 120;
_root['xarrowmanPower' + i] = 135;
_root['xspearmanPower' + i] = 150;
_root['xbaremanPowerMax' + i] = 150;
_root['xswordmanPowerMax' + i] = 170;
_root['xarrowmanPowerMax' + i] = 185;
_root['xspearmanPowerMax' + i] = 200;
_root['xtank' + i] = 0;
_root['xcopter' + i] = 0;
_root['xmonbot' + i] = 0;
_root['xsword' + i] = 0;
_root['xarrow' + i] = 0;
_root['xspear' + i] = 0;
_root['xarrowTrap' + i] = 0;
_root['xcatapult' + i] = 0;
_root['xfireTrap' + i] = 0;
_root['xarrowRain' + i] = 0;
_root['xmeteorid' + i] = 0;
_root['xacidRain' + i] = 0;
_root['xearthquake' + i] = 0;
_root['ximmune' + i] = 0;
_root['xinvisible' + i] = 0;
_root['xspecialAttack' + i] = 0;
_root['xduplicate' + i] = 0;
_root['xwall' + i] = 0;
_root['xspike' + i] = 0;
_root['xspiderWeb' + i] = 0;
_root['xtowerGuard' + i] = 0;
_root['xzombieTrap' + i] = 0;
_root['risetArmory' + i] = false;
_root['risetFactory' + i] = false;
_root['risetPark' + i] = false;
_root['risetTemple' + i] = false;
_root['risetFortress' + i] = false;
_root['risetLibrary' + i] = false;
_root['risetCatapult' + i] = false;
_root['risetFireTrap' + i] = false;
_root['risetTank' + i] = false;
_root['risetCopter' + i] = false;
_root['risetMonbot' + i] = false;
_root['risetInvisible' + i] = false;
_root['risetSpecialAttack' + i] = false;
_root['risetDuplicate' + i] = false;
_root['risetZombie' + i] = false;
_root['risetFastBuild' + i] = false;
_root['risetRawPlus' + i] = false;
_root['risetGoldPlus' + i] = false;
_root['autoBareman' + i] = false;
_root['autoSwordman' + i] = false;
_root['autoArrowman' + i] = false;
_root['autoSpearman' + i] = false;
_root['autoSword' + i] = false;
_root['autoArrow' + i] = false;
_root['autoSpear' + i] = false;
_root['autoTank' + i] = false;
_root['autoCopter' + i] = false;
_root['autoMonbot' + i] = false;
_root['rangerAktif' + i] = false;
_root['tirelessAktif' + i] = false;
_root['armorPlusAktif' + i] = false;
_root['speedPlusAktif' + i] = false;
_root['entertainmentAktif' + i] = false;
_root['fastBuildAktif' + i] = false;
_root['rawPlusAktif' + i] = false;
_root['goldPlusAktif' + i] = false;
_root['kotaMilik' + i] = 0;
++i;
}
xtipeBuilding = new Array();
xposXBuilding = new Array();
xposYBuilding = new Array();
xlevelBuilding = new Array();
xsudahJadiBuilding = new Array();
xdelayBuatBuilding = new Array();
i = 1;
while (i <= maxBangunan) {
xtipeBuilding[i] = new Array();
xposXBuilding[i] = new Array();
xposYBuilding[i] = new Array();
xlevelBuilding[i] = new Array();
xsudahJadiBuilding[i] = new Array();
xdelayBuatBuilding[i] = new Array();
j = 1;
while (j <= bykKota) {
xtipeBuilding[i][j] = 0;
xposXBuilding[i][j] = 0;
xposYBuilding[i][j] = 0;
xlevelBuilding[i][j] = 0;
xsudahJadiBuilding[i][j] = false;
xdelayBuatBuilding[i][j] = 0;
++j;
}
++i;
}
xnamaKota = new Array('', 'Saleandria', 'Malgeris', 'Ascelon', 'Austinepolis', 'Taltimorum', 'Kyblos', 'Jonstantipolis', 'Hallasium', 'Aboracum', 'Auguscopolis', 'Hevalia', 'Gustonia', 'Mondinium', 'Lusesia', 'Midiolanum', 'Regialepolis', 'Riberias', 'Varingtonium', 'Yigornia', 'Craetoria', 'Nova Alvetia', 'Mapathonia ', 'Dafnia', 'Hustonipolis', 'Edessaria');
}
function initPertamaKali() {
koneksiKota = new Array();
i = 1;
while (i <= bykKota) {
koneksiKota[i] = new Array();
++i;
}
maxKoneksi = 5;
koneksiKota[1][1] = 2;
koneksiKota[1][2] = 12;
koneksiKota[2][1] = 1;
koneksiKota[2][2] = 3;
koneksiKota[2][3] = 4;
koneksiKota[2][4] = 9;
koneksiKota[3][1] = 2;
koneksiKota[3][2] = 4;
koneksiKota[4][1] = 2;
koneksiKota[4][2] = 3;
koneksiKota[4][3] = 5;
koneksiKota[5][1] = 4;
koneksiKota[5][2] = 6;
koneksiKota[6][1] = 5;
koneksiKota[6][2] = 25;
koneksiKota[7][1] = 8;
koneksiKota[7][2] = 14;
koneksiKota[7][3] = 15;
koneksiKota[8][1] = 7;
koneksiKota[8][2] = 9;
koneksiKota[8][3] = 10;
koneksiKota[8][4] = 18;
koneksiKota[8][5] = 23;
koneksiKota[9][1] = 2;
koneksiKota[9][2] = 8;
koneksiKota[9][3] = 10;
koneksiKota[10][1] = 8;
koneksiKota[10][2] = 9;
koneksiKota[10][3] = 24;
koneksiKota[10][4] = 25;
koneksiKota[11][1] = 12;
koneksiKota[11][2] = 13;
koneksiKota[12][1] = 1;
koneksiKota[12][2] = 11;
koneksiKota[13][1] = 11;
koneksiKota[13][2] = 14;
koneksiKota[14][1] = 7;
koneksiKota[14][2] = 13;
koneksiKota[14][3] = 15;
koneksiKota[14][4] = 16;
koneksiKota[15][1] = 7;
koneksiKota[15][2] = 14;
koneksiKota[15][3] = 16;
koneksiKota[15][4] = 17;
koneksiKota[16][1] = 14;
koneksiKota[16][2] = 15;
koneksiKota[16][3] = 19;
koneksiKota[17][1] = 15;
koneksiKota[17][2] = 18;
koneksiKota[17][3] = 19;
koneksiKota[18][1] = 8;
koneksiKota[18][2] = 17;
koneksiKota[18][3] = 22;
koneksiKota[19][1] = 16;
koneksiKota[19][2] = 17;
koneksiKota[19][3] = 20;
koneksiKota[20][1] = 19;
koneksiKota[20][2] = 21;
koneksiKota[21][1] = 20;
koneksiKota[22][1] = 18;
koneksiKota[22][2] = 23;
koneksiKota[23][1] = 8;
koneksiKota[23][2] = 22;
koneksiKota[23][3] = 24;
koneksiKota[24][1] = 10;
koneksiKota[24][2] = 23;
koneksiKota[24][3] = 25;
koneksiKota[25][1] = 6;
koneksiKota[25][2] = 10;
koneksiKota[25][3] = 24;
xnamaMedal = new Array('', 'Have 5000 or more golds in one town', 'Have 2000 or more irons in one town', 'Have 2000 or more woods in one town', 'Have total 50 or more buildings', 'Kill at least 50 enemy units', 'Have 100 or more tech points in one town', 'Have 100 or more mana\'s in one town', 'Have 100 or more welfares in one town', 'Win at least 10 battles', 'Unbeatable in battle 5 times in a row', 'Have at least 500 soldiers in one town', 'Have at least 5 tanks in one town', 'Have at least 5 copters in one town', 'Have at least 5 monbots in one town', 'Be a Monster\'s King', 'Have 50000 or more golds in one town', 'Have 20000 or more irons in one town', 'Have 20000 or more woods in one town', 'Have 300 or more buildings', 'Kill at least 500 enemy units', 'Have 500 or more tech points in one town', 'Have 500 or more mana\'s in one town', 'Have 500 or more welfares in one town', 'Win at least 100 battles', 'Unbeatable in battle 25 times in a row', 'Have at least 4000 soldiers in one town', 'Have at least 20 tanks in one town', 'Have at least 20 copters in one town', 'Have at least 20 monbots in one town', 'Be a Monster\'s Emperor', 'Complete all tasks');
}
function cekNyawaHuman() {
if (tipeAttackMusuh == 'attack' && kotaSerang == 21) {
if (kondisiPreview == 'gate1') {
musuhNyawa *= 3;
} else {
if (kondisiPreview == 'gate2') {
musuhNyawa *= 3.5;
} else {
if (kondisiPreview == 'gate3') {
musuhNyawa *= 4;
} else {
if (kondisiPreview == 'gate4') {
musuhNyawa *= 4.5;
} else {
musuhNyawa *= 4;
}
}
}
}
musuhNyawa *= 0.5;
} else {
bykKotaHuman = 0;
i = 1;
while (i <= bykKota) {
if (_root['kotaMilik' + i] == 2) {
++bykKotaHuman;
}
++i;
}
if (bykKotaHuman == 1) {
musuhNyawa *= 6;
} else {
if (bykKotaHuman == 2) {
musuhNyawa *= 5;
} else {
if (bykKotaHuman == 3) {
musuhNyawa *= 1.5;
} else {
if (bykKotaHuman == 4) {
musuhNyawa *= 1;
} else {
if (bykKotaHuman == 5) {
musuhNyawa *= 1.1;
} else {
if (bykKotaHuman == 6) {
musuhNyawa *= 1.2;
} else {
if (bykKotaHuman == 7) {
musuhNyawa *= 1.3;
} else {
if (bykKotaHuman == 8) {
musuhNyawa *= 1.4;
} else {
if (bykKotaHuman == 9) {
musuhNyawa *= 1.5;
} else {
if (bykKotaHuman == 10) {
musuhNyawa *= 1.6;
} else {
if (bykKotaHuman == 11) {
musuhNyawa *= 1.7;
} else {
if (bykKotaHuman == 12) {
musuhNyawa *= 1.8;
} else {
if (bykKotaHuman == 13) {
musuhNyawa *= 1.9;
} else {
if (bykKotaHuman == 14) {
musuhNyawa *= 2;
} else {
if (bykKotaHuman == 15) {
musuhNyawa *= 2.1;
} else {
if (bykKotaHuman == 16) {
musuhNyawa *= 2;
} else {
if (bykKotaHuman == 17) {
musuhNyawa *= 2.1;
} else {
if (bykKotaHuman == 18) {
musuhNyawa *= 2.2;
} else {
if (bykKotaHuman == 19) {
musuhNyawa *= 2.3;
} else {
if (bykKotaHuman == 20) {
musuhNyawa *= 2.5;
} else {
if (bykKotaHuman == 21) {
musuhNyawa *= 3;
} else {
if (bykKotaHuman == 22) {
musuhNyawa *= 4;
} else {
if (bykKotaHuman == 23) {
musuhNyawa *= 5;
} else {
if (bykKotaHuman == 24) {
musuhNyawa *= 6;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
if (kalahMusuh >= 4) {
musuhNyawa *= kalahMusuh - 2;
}
musuhNyawa *= 0.5;
}
function cekJumlahTankMusuh() {
if (tipeAttackMusuh == 'attack' && kotaSerang == 21) {
if (kondisiPreview == 'gate1') {
maxTankMusuh = 3;
} else {
if (kondisiPreview == 'gate2') {
maxTankMusuh = 4;
} else {
if (kondisiPreview == 'gate3') {
maxTankMusuh = 5;
} else {
if (kondisiPreview == 'gate4') {
maxTankMusuh = 6;
} else {
maxTankMusuh = 5;
}
}
}
}
} else {
bykKotaHuman = 0;
i = 1;
while (i <= bykKota) {
if (_root['kotaMilik' + i] == 2) {
++bykKotaHuman;
}
++i;
}
maxTankMusuh = 0;
if (bykKotaHuman == 1) {
maxTankMusuh = 6;
} else {
if (bykKotaHuman == 2) {
maxTankMusuh = 6;
} else {
if (bykKotaHuman == 3) {
maxTankMusuh = 5;
} else {
if (bykKotaHuman == 4) {
maxTankMusuh = 5;
} else {
if (bykKotaHuman == 5) {
maxTankMusuh = 4;
} else {
if (bykKotaHuman == 6) {
maxTankMusuh = 3;
} else {
if (bykKotaHuman == 7) {
maxTankMusuh = 2;
} else {
if (bykKotaHuman == 8) {
maxTankMusuh = 1;
} else {
if (bykKotaHuman == 9) {
maxTankMusuh = 1;
} else {
if (bykKotaHuman == 10) {
maxTankMusuh = 1;
} else {
if (bykKotaHuman == 11) {
maxTankMusuh = 1;
} else {
if (bykKotaHuman == 12) {
maxTankMusuh = 1;
} else {
if (bykKotaHuman == 13) {
maxTankMusuh = 1;
} else {
if (bykKotaHuman == 14) {
maxTankMusuh = 1;
} else {
if (bykKotaHuman == 15) {
maxTankMusuh = 1;
} else {
if (bykKotaHuman == 16) {
maxTankMusuh = 1;
} else {
if (bykKotaHuman == 17) {
maxTankMusuh = 2;
} else {
if (bykKotaHuman == 18) {
maxTankMusuh = 2;
} else {
if (bykKotaHuman == 19) {
maxTankMusuh = 3;
} else {
if (bykKotaHuman == 20) {
maxTankMusuh = 3;
} else {
if (bykKotaHuman == 21) {
maxTankMusuh = 4;
} else {
if (bykKotaHuman == 22) {
maxTankMusuh = 4;
} else {
if (bykKotaHuman == 23) {
maxTankMusuh = 5;
} else {
if (bykKotaHuman == 24) {
maxTankMusuh = 6;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
if (kalahMusuh >= 4) {
maxTankMusuh *= kalahMusuh - 2;
}
if (tingkatSulit == 1) {
maxTankMusuh *= 1;
} else {
if (tingkatSulit == 2) {
maxTankMusuh *= 1.5;
} else {
if (tingkatSulit == 3) {
maxTankMusuh *= 2;
}
}
}
maxTankMusuh = Math.ceil(maxTankMusuh);
}
function backBuilding() {
myMusic.stop();
myMusic = new Sound(zmusic);
myMusic.attachSound('backBuilding');
myMusic.start(0, 1);
myMusic.setVolume(volume1);
myMusic.onSoundComplete = backBuilding;
}
function backBuilding2() {
myMusic.stop();
myMusic = new Sound(zmusic);
myMusic.attachSound('backBuilding2');
myMusic.start(1, 1);
myMusic.setVolume(volume1);
myMusic.onSoundComplete = backBuilding2;
}
function backBattle1() {
myMusic.stop();
myMusic = new Sound(zmusic);
myMusic.attachSound('backBattle1');
myMusic.start(0, 1);
myMusic.setVolume(volume1);
myMusic.onSoundComplete = backBattle1;
}
function backBattle2() {
myMusic.stop();
myMusic = new Sound(zmusic);
myMusic.attachSound('backBattle2');
myMusic.start(0, 1);
myMusic.setVolume(volume1);
myMusic.onSoundComplete = backBattle2;
}
function backPukul() {
randPukul = random(2) + 1;
mySound = new Sound(zsound);
mySound.attachSound('backPukul' + randPukul);
mySound.start(0, 1);
mySound.setVolume(volume2);
}
function backBangun() {
mySound = new Sound(zsound);
mySound.attachSound('backBangun');
mySound.start(0, 1);
mySound.setVolume(volume2 * 2);
}
function backBangun2() {
mySound = new Sound(zsound);
mySound.attachSound('backBangun2');
mySound.start(0, 1);
mySound.setVolume(volume2 * 2);
}
function backPanah() {
mySound = new Sound(zsound);
mySound.attachSound('backPanah');
mySound.start(0, 1);
mySound.setVolume(volume2);
}
function backSword() {
mySound = new Sound(zsound);
mySound.attachSound('backSword');
mySound.start(0, 1);
mySound.setVolume(volume2);
}
function backSpear() {
mySound = new Sound(zsound);
mySound.attachSound('backSpear');
mySound.start(0, 1);
mySound.setVolume(volume2);
}
function backTembak() {
mySound = new Sound(zsound);
mySound.attachSound('backTembak');
mySound.start(0, 1);
mySound.setVolume(volume2);
}
function backGempa() {
mySound = new Sound(zsound);
mySound.attachSound('backGempa');
mySound.start(0, 1);
mySound.setVolume(volume2);
}
function backMonbot() {
mySound = new Sound(zsound);
mySound.attachSound('backMonbot');
mySound.start(0, 1);
mySound.setVolume(volume2);
}
function backBatuLempar() {
mySound = new Sound(zsound);
mySound.attachSound('backBatuLempar');
mySound.start(0, 1);
mySound.setVolume(volume2);
}
function backBolaLempar() {
mySound = new Sound(zsound);
mySound.attachSound('backBolaLempar');
mySound.start(0, 1);
mySound.setVolume(volume2);
}
function backPanahLempar() {
mySound = new Sound(zsound);
mySound.attachSound('backPanahLempar');
mySound.start(0, 1);
mySound.setVolume(volume2);
}
function backZombie() {
mySound = new Sound(zsound);
mySound.attachSound('backZombie');
mySound.start(0, 1);
mySound.setVolume(volume2);
}
function backLaba() {
mySound = new Sound(zsound);
mySound.attachSound('backLaba');
mySound.start(0, 1);
mySound.setVolume(volume2);
}
function backMati() {
randMati = random(3) + 1;
mySound = new Sound(zsound);
mySound.attachSound('backMati' + randMati);
mySound.start(0, 1);
mySound.setVolume(volume2);
}
function backMatiMonbot() {
mySound = new Sound(zsound);
mySound.attachSound('backMatiMonbot');
mySound.start(0, 1);
mySound.setVolume(volume2);
}
function backLedak() {
mySound = new Sound(zsound);
mySound.attachSound('backLedak');
mySound.start(0, 1);
mySound.setVolume(volume2 * 0.5);
}
function backLempar() {
mySound = new Sound(zsound);
mySound.attachSound('backLempar');
mySound.start(0, 1);
mySound.setVolume(volume2);
}
function backComet() {
mySound = new Sound(zsound);
mySound.attachSound('backComet');
mySound.start(0, 1);
mySound.setVolume(volume2);
}
function backAcid() {
mySound = new Sound(zsound);
mySound.attachSound('backAcid');
mySound.start(0, 1);
mySound.setVolume(volume2);
}
function backSpell1() {
mySound = new Sound(zsound);
mySound.attachSound('backSpell1');
mySound.start(0, 1);
mySound.setVolume(volume2);
}
function backSpell2() {
mySound = new Sound(zsound);
mySound.attachSound('backSpell2');
mySound.start(0, 1);
mySound.setVolume(volume2);
}
function backSpell3() {
mySound = new Sound(zsound);
mySound.attachSound('backSpell3');
mySound.start(0, 1);
mySound.setVolume(volume2);
}
function backSpell4() {
mySound = new Sound(zsound);
mySound.attachSound('backSpell4');
mySound.start(0, 1);
mySound.setVolume(volume2);
}
function backMoney() {
mySound = new Sound(zsound);
mySound.attachSound('backMoney');
mySound.start(0, 1);
mySound.setVolume(volume2 * 2);
}
function backTrain() {
mySound = new Sound(zsound);
mySound.attachSound('backTrain');
mySound.start(0, 1);
mySound.setVolume(volume2);
}
function backCreate() {
mySound = new Sound(zsound);
mySound.attachSound('backCreate');
mySound.start(0, 1);
mySound.setVolume(volume2);
}
function backDeal() {
mySound = new Sound(zsound);
mySound.attachSound('backDeal');
mySound.start(0, 1);
mySound.setVolume(volume2 * 2);
}
function backTerompet() {
mySound = new Sound(zsound);
mySound.attachSound('backTerompet');
mySound.start(0, 1);
mySound.setVolume(volume2);
}
stop();
fscommand('fullscreen', false);
fscommand('allowscale', true);
fscommand('showmenu', false);
Stage.showMenu = false;
qualityGame = 1;
_quality = 'HIGH';
adaSuara = true;
zmusic = attachMovie('indi', 'zmusic', 1099904);
zmusic._x = -500;
zmusic._y = -500;
zsound = attachMovie('indi', 'zsound', 1099905);
zsound._x = -750;
zsound._y = -750;
volume1 = 100;
volume2 = 30;
simpanSemua = new Array('', 'xday', 'bykKota', 'maxBangunan', 'awalKaliMain', 'keKota', 'sudahSimpan', 'tingkatSulit', 'pilihAbility', 'speedGame', 'suaraNyala', 'initSerangan', 'penambahanSerangan', 'dapatMedal1', 'dapatMedal2', 'dapatMedal3', 'dapatMedal4', 'dapatMedal5', 'dapatMedal6', 'dapatMedal7', 'dapatMedal8', 'dapatMedal9', 'dapatMedal10', 'dapatMedal11', 'dapatMedal12', 'dapatMedal13', 'dapatMedal14', 'dapatMedal15', 'dapatMedal16', 'dapatMedal17', 'dapatMedal18', 'dapatMedal19', 'dapatMedal20', 'dapatMedal21', 'dapatMedal22', 'dapatMedal23', 'dapatMedal24', 'dapatMedal25', 'dapatMedal26', 'dapatMedal27', 'dapatMedal28', 'dapatMedal29', 'dapatMedal30', 'dapatMedal31', 'awalKaliSerang', 'initSeranganHuman', 'penambahanSerangan2', 'sudahSerangFinal', 'killMusuh', 'winBattle', 'tidakKalah', 'menangGame', 'sudahTutorial', 'kalahMusuh', 'speedBattle', 'autoSave', 'pengkalianMusuh', 'sideQuestKe', 'sudahSerangAlvetia', 'pilihSkenario');
simpanSemua2 = new Array('', 'dapatMedal1', 'dapatMedal2', 'dapatMedal3', 'dapatMedal4', 'dapatMedal5', 'dapatMedal6', 'dapatMedal7', 'dapatMedal8', 'dapatMedal9', 'dapatMedal10', 'dapatMedal11', 'dapatMedal12', 'dapatMedal13', 'dapatMedal14', 'dapatMedal15', 'dapatMedal16', 'dapatMedal17', 'dapatMedal18', 'dapatMedal19', 'dapatMedal20', 'dapatMedal21', 'dapatMedal22', 'dapatMedal23', 'dapatMedal24', 'dapatMedal25', 'dapatMedal26', 'dapatMedal27', 'dapatMedal28', 'dapatMedal29', 'dapatMedal30', 'dapatMedal31');
loadData();
if (xday == undefined) {
initMedal();
initAwal();
simpanData();
}
initPertamaKali();
}
// unknown tag 88 length 93
movieClip 12 {
}
movieClip 14 {
}
movieClip 17 {
}
movieClip 21 {
}
// unknown tag 88 length 143
movieClip 26 {
}
button 27 {
on (release) {
getURL('http://www.maxgames.com/', '_blank');
}
}
movieClip 29 {
}
movieClip 31 {
}
movieClip 33 {
}
// unknown tag 88 length 197
button 38 {
on (press) {
_root.play();
}
}
movieClip 39 {
frame 1 {
function loading() {
if (_root.getBytesLoaded() / _root.getBytesTotal() >= 1) {
play();
loadLeft.text = '0';
loadBar.scaleX = 1;
delete this.onEnterFrame;
loadLeft.text = '0';
loadBar._xscale = 100;
} else {
loadBar._xscale = (_root.getBytesLoaded() / _root.getBytesTotal()) * 100;
loadLeft.text = String(Math.ceil((_root.getBytesTotal() - _root.getBytesLoaded()) / 100000) / 10);
}
}
_root.stop();
stop();
this.onEnterFrame = loading;
}
frame 40 {
stop();
}
}
frame 2 {
gotoAndStop(31);
}
movieClip 48 {
}
movieClip 49 {
frame 1 {
stop();
}
}
// unknown tag 88 length 64
movieClip 52 {
}
movieClip 54 {
}
movieClip 96 bangunan_mc {
frame 1 {
stop();
}
}
movieClip 99 {
}
movieClip 103 bar_mc {
frame 1 {
stop();
}
frame 2 {
play();
}
frame 30 {
removeMovieClip(this);
}
}
movieClip 108 {
frame 1 {
stop();
}
}
movieClip 111 {
frame 1 {
stop();
}
}
movieClip 114 {
frame 1 {
stop();
}
}
movieClip 117 {
frame 1 {
stop();
}
}
movieClip 120 {
frame 1 {
stop();
}
}
movieClip 123 {
frame 1 {
stop();
}
}
movieClip 127 {
frame 1 {
stop();
}
}
movieClip 132 {
frame 1 {
stop();
}
}
movieClip 136 {
frame 1 {
stop();
}
}
movieClip 139 {
frame 1 {
stop();
}
}
movieClip 143 {
frame 1 {
stop();
}
}
movieClip 145 {
}
movieClip 148 {
frame 1 {
stop();
}
}
movieClip 153 {
frame 1 {
stop();
}
}
movieClip 155 {
}
movieClip 158 {
frame 1 {
stop();
}
}
movieClip 161 {
frame 1 {
stop();
}
}
movieClip 163 {
}
movieClip 164 {
frame 1 {
stop();
}
}
movieClip 167 {
frame 1 {
stop();
}
}
movieClip 169 {
frame 1 {
stop();
}
}
movieClip 171 {
}
movieClip 174 {
}
movieClip 177 {
frame 1 {
stop();
}
}
movieClip 179 {
frame 1 {
this.onRelease = function () {
getURL('http://www.maxgames.com', '_blank');
};
}
}
movieClip 181 {
}
movieClip 185 {
frame 1 {
stop();
}
}
movieClip 196 {
frame 1 {
stop();
}
}
movieClip 208 {
}
movieClip 243 {
}
movieClip 339 {
frame 1 {
stop();
}
}
movieClip 427 {
frame 1 {
stop();
}
}
movieClip 467 {
frame 1 {
stop();
}
}
movieClip 481 {
frame 1 {
stop();
}
}
movieClip 506 {
frame 1 {
stop();
}
}
movieClip 513 {
frame 1 {
stop();
}
}
movieClip 515 {
frame 1 {
stop();
}
}
movieClip 517 {
frame 1 {
stop();
}
}
movieClip 519 {
frame 1 {
stop();
}
}
movieClip 521 {
frame 1 {
stop();
}
}
movieClip 524 {
frame 1 {
stop();
}
}
movieClip 527 {
frame 1 {
stop();
}
}
movieClip 529 {
frame 1 {
stop();
}
}
movieClip 531 {
frame 1 {
stop();
}
}
movieClip 533 {
frame 1 {
stop();
}
}
movieClip 536 {
frame 1 {
stop();
}
}
movieClip 537 {
frame 1 {
stop();
}
}
movieClip 538 {
frame 1 {
stop();
}
}
movieClip 541 {
frame 1 {
stop();
}
}
movieClip 544 {
frame 1 {
stop();
}
}
movieClip 555 {
frame 1 {
stop();
}
}
movieClip 558 {
frame 1 {
stop();
}
}
movieClip 560 {
frame 1 {
stop();
}
}
movieClip 562 {
frame 1 {
stop();
}
}
movieClip 564 {
frame 1 {
stop();
}
}
movieClip 565 {
frame 1 {
stop();
}
}
movieClip 566 {
frame 1 {
stop();
}
}
movieClip 567 {
frame 1 {
stop();
}
}
movieClip 568 {
frame 1 {
stop();
}
}
movieClip 570 {
frame 1 {
stop();
}
}
movieClip 574 {
frame 1 {
stop();
}
}
movieClip 575 {
frame 1 {
stop();
}
}
movieClip 576 {
frame 1 {
stop();
}
}
movieClip 578 {
frame 1 {
stop();
}
}
movieClip 580 {
frame 1 {
stop();
}
}
movieClip 582 {
frame 1 {
stop();
}
}
movieClip 583 {
frame 1 {
stop();
}
}
movieClip 623 {
}
movieClip 695 {
frame 1 {
stop();
}
}
movieClip 733 {
frame 1 {
stop();
}
}
movieClip 734 {
}
movieClip 762 {
frame 1 {
stop();
}
}
movieClip 764 {
}
movieClip 778 {
frame 1 {
stop();
}
}
movieClip 795 {
frame 1 {
stop();
}
}
movieClip 797 {
frame 1 {
stop();
}
}
movieClip 799 {
frame 1 {
stop();
}
}
movieClip 801 {
frame 1 {
stop();
}
}
movieClip 803 {
frame 1 {
stop();
}
}
movieClip 807 {
frame 1 {
stop();
}
}
movieClip 809 {
frame 1 {
stop();
}
}
movieClip 811 {
frame 1 {
stop();
}
}
movieClip 813 {
frame 1 {
stop();
}
}
movieClip 818 {
frame 1 {
stop();
}
}
movieClip 820 {
frame 1 {
stop();
}
}
movieClip 822 {
frame 1 {
stop();
}
}
movieClip 828 {
frame 1 {
stop();
}
}
movieClip 830 {
frame 1 {
stop();
}
}
movieClip 832 {
frame 1 {
stop();
}
}
movieClip 834 {
frame 1 {
stop();
}
}
movieClip 847 {
frame 1 {
stop();
}
}
movieClip 849 {
frame 1 {
stop();
}
}
movieClip 851 {
frame 1 {
stop();
}
}
movieClip 861 {
frame 1 {
stop();
}
}
movieClip 863 {
frame 1 {
stop();
}
}
movieClip 865 {
frame 1 {
stop();
}
}
movieClip 881 {
frame 1 {
stop();
}
}
movieClip 883 {
frame 1 {
stop();
}
}
movieClip 887 {
frame 1 {
stop();
}
}
movieClip 889 {
frame 1 {
stop();
}
}
movieClip 891 {
frame 1 {
stop();
}
}
movieClip 893 {
frame 1 {
stop();
}
}
movieClip 895 {
frame 1 {
stop();
}
}
movieClip 897 {
frame 1 {
stop();
}
}
movieClip 906 {
frame 1 {
stop();
}
}
movieClip 908 {
frame 1 {
stop();
}
}
movieClip 910 {
frame 1 {
stop();
}
}
movieClip 912 {
frame 1 {
stop();
}
}
movieClip 914 {
frame 1 {
stop();
}
}
movieClip 919 ui_mc {
frame 1 {
stop();
}
}
movieClip 921 {
}
movieClip 922 {
}
movieClip 923 {
}
movieClip 927 {
}
movieClip 928 {
}
movieClip 929 {
}
movieClip 960 {
frame 1 {
stop();
}
}
movieClip 962 {
frame 1 {
stop();
}
}
movieClip 972 {
frame 1 {
stop();
}
}
movieClip 978 {
frame 1 {
stop();
}
}
movieClip 984 {
frame 1 {
stop();
}
}
movieClip 990 {
frame 1 {
stop();
}
}
movieClip 996 {
frame 1 {
stop();
}
}
movieClip 1032 {
frame 1 {
stop();
}
}
movieClip 1036 {
frame 1 {
stop();
}
}
movieClip 1040 {
frame 1 {
stop();
}
}
movieClip 1045 {
frame 1 {
stop();
}
}
movieClip 1050 {
frame 1 {
stop();
}
}
movieClip 1056 {
frame 1 {
stop();
}
}
movieClip 1072 {
frame 1 {
stop();
}
}
movieClip 1076 {
frame 1 {
stop();
}
}
movieClip 1078 {
frame 1 {
stop();
}
}
movieClip 1081 {
}
movieClip 1082 {
frame 1 {
stop();
}
}
movieClip 1085 {
frame 1 {
stop();
}
}
movieClip 1088 {
frame 1 {
stop();
}
}
movieClip 1108 {
frame 1 {
stop();
}
frame 10 {
stop();
}
}
movieClip 1139 {
}
movieClip 1142 {
}
movieClip 1146 {
frame 1 {
stop();
}
}
movieClip 1150 {
frame 1 {
stop();
}
}
movieClip 1162 {
frame 1 {
stop();
}
}
movieClip 1165 {
frame 1 {
stop();
}
}
movieClip 1167 {
frame 1 {
stop();
}
}
movieClip 1169 {
frame 1 {
stop();
}
}
movieClip 1171 {
frame 1 {
stop();
}
}
movieClip 1173 {
frame 1 {
stop();
}
}
movieClip 1174 {
frame 1 {
stop();
}
}
movieClip 1176 {
frame 1 {
stop();
}
}
movieClip 1177 {
frame 1 {
stop();
}
}
movieClip 1178 {
frame 1 {
stop();
}
}
movieClip 1183 {
frame 1 {
stop();
}
}
movieClip 1185 {
frame 1 {
stop();
}
}
movieClip 1187 {
frame 1 {
stop();
}
frame 10 {
stop();
}
}
movieClip 1189 {
frame 1 {
stop();
}
}
movieClip 1190 {
frame 1 {
stop();
}
}
movieClip 1191 {
frame 1 {
stop();
}
}
movieClip 1197 {
}
movieClip 1223 {
frame 1 {
stop();
}
}
movieClip 1226 {
frame 1 {
stop();
}
frame 10 {
stop();
}
}
movieClip 1246 {
frame 1 {
stop();
}
frame 10 {
stop();
}
}
movieClip 1249 {
}
movieClip 1253 {
}
movieClip 1258 {
}
movieClip 1262 {
}
movieClip 1274 {
}
movieClip 1288 {
frame 1 {
stop();
}
frame 10 {
stop();
}
}
movieClip 1290 {
frame 1 {
stop();
}
}
movieClip 1301 {
}
movieClip 1307 {
frame 1 {
stop();
}
}
movieClip 1313 {
frame 1 {
stop();
}
}
movieClip 1322 {
frame 1 {
stop();
}
frame 10 {
stop();
}
}
movieClip 1324 {
frame 1 {
stop();
}
}
movieClip 1327 {
}
movieClip 1329 {
}
movieClip 1331 {
frame 1 {
stop();
}
}
movieClip 1335 {
frame 1 {
stop();
}
}
movieClip 1356 {
frame 1 {
stop();
}
}
movieClip 1377 {
frame 1 {
stop();
}
frame 10 {
stop();
}
}
movieClip 1428 {
frame 1 {
stop();
}
}
movieClip 1430 box_mc {
frame 1 {
stop();
}
}
movieClip 1432 {
}
movieClip 1434 {
}
movieClip 1435 masking_mc {
frame 1 {
stop();
}
}
movieClip 1448 {
}
movieClip 1450 {
frame 1 {
stop();
}
}
movieClip 1453 obyekAtas1 {
}
movieClip 1455 obyekAtas2 {
}
movieClip 1457 obyekAtas3 {
}
movieClip 1459 obyekBawah1 {
}
movieClip 1461 obyekBawah2 {
}
movieClip 1463 obyekBawah3 {
}
movieClip 1467 obyekAtas4 {
}
movieClip 1475 obyekAtas5 {
}
movieClip 1476 obyekBawah5 {
}
movieClip 1480 obyekAtas6 {
}
movieClip 1481 obyekBawah4 {
}
movieClip 1482 obyekBawah6 {
}
movieClip 1484 obyekBawah7 {
}
movieClip 1488 obyekAtas7 {
}
movieClip 1491 obyekAtas8 {
}
movieClip 1493 obyekBawah8 {
}
movieClip 1497 obyekAtas9 {
}
movieClip 1498 obyekBawah9 {
}
movieClip 1499 obyekAtas10 {
}
movieClip 1500 obyekBawah10 {
}
movieClip 1506 obyekAtas11 {
}
movieClip 1507 obyekBawah11 {
}
movieClip 1508 obyekAtas12 {
}
movieClip 1509 obyekBawah12 {
}
movieClip 1510 obyekBawah13 {
}
movieClip 1514 obyekAtas13 {
}
movieClip 1516 obyekAtas14 {
}
movieClip 1518 obyekBawah14 {
}
movieClip 1521 obyekAtas15 {
}
movieClip 1522 obyekBawah15 {
}
movieClip 1524 obyekAtas16 {
}
movieClip 1526 obyekBawah16 {
}
movieClip 1529 obyekAtas17 {
}
movieClip 1531 obyekBawah17 {
}
movieClip 1533 obyekAtas18 {
}
movieClip 1534 obyekBawah18 {
}
movieClip 1536 obyekAtas19 {
}
movieClip 1538 obyekBawah19 {
}
movieClip 1541 obyekAtas20 {
}
movieClip 1542 obyekBawah20 {
}
movieClip 1547 obyekAtas21 {
}
movieClip 1548 obyekBawah21 {
}
movieClip 1550 obyekAtas22 {
}
movieClip 1551 obyekBawah22 {
}
movieClip 1552 obyekAtas23 {
}
movieClip 1553 obyekBawah23 {
}
movieClip 1555 obyekAtas24 {
}
movieClip 1557 obyekBawah24 {
}
movieClip 1561 obyekAtas25 {
}
movieClip 1562 obyekBawah25 {
}
movieClip 1569 {
}
movieClip 1573 {
}
movieClip 1580 {
frame 3 {
_root.cekSerangJagoan(_parent);
_root.backPukul();
}
}
movieClip 1590 {
frame 5 {
_root.backMati();
}
frame 29 {
removeMovieClip(_parent);
}
}
movieClip 1591 soldier1 {
frame 1 {
stop();
}
}
movieClip 1596 {
}
movieClip 1600 {
}
movieClip 1607 {
frame 3 {
_root.cekSerangJagoan(_parent);
_root.backSword();
}
}
movieClip 1619 {
frame 5 {
_root.backMati();
}
frame 28 {
removeMovieClip(_parent);
}
}
movieClip 1620 soldier2 {
frame 1 {
stop();
}
}
movieClip 1625 {
}
movieClip 1629 {
}
movieClip 1636 {
frame 7 {
_root.cekSerangJagoan(_parent);
_root.backPanah();
}
}
movieClip 1647 {
frame 5 {
_root.backMati();
}
frame 28 {
removeMovieClip(_parent);
}
}
movieClip 1648 soldier3 {
frame 1 {
stop();
}
}
movieClip 1653 {
}
movieClip 1657 {
}
movieClip 1664 {
frame 3 {
_root.cekSerangJagoan(_parent);
_root.backSpear();
}
}
movieClip 1675 {
frame 6 {
_root.backMati();
}
frame 30 {
removeMovieClip(_parent);
}
}
movieClip 1676 soldier4 {
frame 1 {
stop();
}
}
movieClip 1682 {
}
movieClip 1688 {
}
movieClip 1704 {
frame 5 {
_root.cekSerangJagoan(_parent);
_root.backTembak();
}
}
movieClip 1725 {
frame 1 {
_root.backLedak();
}
frame 25 {
removeMovieClip(_parent);
}
}
movieClip 1726 soldier5 {
frame 1 {
stop();
}
}
movieClip 1730 {
}
movieClip 1732 {
}
movieClip 1739 {
frame 2 {
_root.cekSerangJagoan(_parent);
_root.backTembak();
}
}
movieClip 1742 {
frame 1 {
_root.backLedak();
}
frame 29 {
removeMovieClip(_parent);
}
}
movieClip 1743 soldier6 {
frame 1 {
stop();
}
}
movieClip 1748 {
}
movieClip 1756 {
}
movieClip 1765 {
frame 15 {
_root.cekSerangJagoan(_parent);
_root.backMonbot();
}
}
movieClip 1778 {
frame 6 {
_root.backMatiMonbot();
}
frame 22 {
_root.backLedak();
}
frame 34 {
removeMovieClip(_parent);
}
}
movieClip 1779 soldier7 {
frame 1 {
stop();
}
}
movieClip 1784 {
}
movieClip 1790 {
}
movieClip 1797 {
frame 3 {
_root.cekSerangMusuh(_parent);
_root.backSword();
}
}
movieClip 1808 {
frame 5 {
_root.backMati();
}
frame 29 {
removeMovieClip(_parent);
}
}
movieClip 1809 musuh1 {
frame 1 {
stop();
}
}
movieClip 1814 {
}
movieClip 1820 {
}
movieClip 1829 {
frame 12 {
_root.cekSerangMusuh(_parent);
_root.backPanah();
}
}
movieClip 1840 {
frame 5 {
_root.backMati();
}
frame 30 {
removeMovieClip(_parent);
}
}
movieClip 1841 musuh2 {
frame 1 {
stop();
}
}
movieClip 1846 {
}
movieClip 1852 {
}
movieClip 1860 {
frame 7 {
_root.cekSerangMusuh(_parent);
_root.backSpear();
}
}
movieClip 1871 {
frame 6 {
_root.backMati();
}
frame 31 {
removeMovieClip(_parent);
}
}
movieClip 1872 musuh3 {
frame 1 {
stop();
}
}
movieClip 1875 {
}
movieClip 1879 {
}
movieClip 1896 {
frame 5 {
_root.cekSerangMusuh(_parent);
_root.backTembak();
}
}
movieClip 1899 {
frame 1 {
_root.backLedak();
}
frame 28 {
removeMovieClip(_parent);
}
}
movieClip 1900 musuh4 {
frame 1 {
stop();
}
}
movieClip 1905 {
}
movieClip 1907 {
}
movieClip 1912 {
frame 3 {
_root.cekSerangMusuh(_parent);
}
}
movieClip 1915 {
frame 1 {
_root.backLedak();
}
frame 24 {
removeMovieClip(_parent);
}
}
movieClip 1916 musuh5 {
frame 1 {
stop();
}
}
movieClip 1921 {
}
movieClip 1923 {
}
movieClip 1932 {
frame 1 {
_root.backPanahLempar();
}
frame 7 {
_root.cekSerangWeapon(_parent);
}
}
movieClip 1939 {
frame 18 {
stop();
}
}
movieClip 1940 {
}
movieClip 1941 weapon1 {
frame 1 {
stop();
}
}
movieClip 1948 {
}
movieClip 1954 {
}
movieClip 1962 {
frame 1 {
_root.backBatuLempar();
}
frame 7 {
_root.cekSerangWeapon(_parent);
}
}
movieClip 1963 {
frame 20 {
stop();
}
}
movieClip 1964 weapon2 {
frame 1 {
stop();
}
}
movieClip 1968 {
}
movieClip 1980 {
frame 1 {
_root.backBolaLempar();
}
frame 7 {
_root.cekSerangWeapon(_parent);
}
}
movieClip 1981 {
}
movieClip 1982 weapon3 {
frame 1 {
stop();
}
}
movieClip 1984 benteng1 {
}
movieClip 1986 benteng2 {
}
movieClip 1993 {
frame 9 {
_root.keluarLabaLaba(_parent);
_root.backLaba();
}
frame 30 {
_parent.gotoAndStop(1);
}
}
movieClip 1994 benteng3 {
frame 1 {
stop();
}
}
movieClip 1996 {
frame 7 {
_root.cekSerangPanah(_parent);
_root.backPanah();
}
frame 40 {
_parent.gotoAndStop(1);
}
}
movieClip 1997 benteng4 {
frame 1 {
stop();
}
}
movieClip 2012 {
frame 4 {
_root.backZombie();
}
frame 22 {
_root.keluarZombie(_parent);
}
frame 60 {
_parent.gotoAndStop(1);
}
}
movieClip 2013 benteng5 {
frame 1 {
stop();
}
}
movieClip 2031 {
frame 1 {
_root.backPanah();
}
frame 3 {
_root.backPanah();
}
frame 5 {
_root.backPanah();
}
frame 7 {
_root.backPanah();
}
frame 9 {
_root.backMati2();
}
frame 20 {
removeMovieClip(_parent);
}
}
movieClip 2032 efek1 {
frame 1 {
stop();
}
}
movieClip 2045 {
frame 20 {
removeMovieClip(_parent);
}
}
movieClip 2046 efek2 {
frame 1 {
stop();
}
}
movieClip 2063 {
frame 7 {
_root.backAcid();
}
frame 20 {
removeMovieClip(_parent);
}
}
movieClip 2064 efek3 {
frame 1 {
stop();
}
}
movieClip 2076 {
frame 42 {
stop();
}
}
movieClip 2077 efek4 {
frame 50 {
stop();
}
}
movieClip 2083 {
}
movieClip 2084 efek5 {
}
movieClip 2087 {
}
movieClip 2088 efek6 {
}
movieClip 2094 {
}
movieClip 2095 efek7 {
}
movieClip 2109 {
}
movieClip 2110 efek8 {
}
movieClip 2113 lingkar_mc {
}
movieClip 2118 {
}
movieClip 2124 {
}
movieClip 2133 {
frame 5 {
_root.cekSerangMusuh(_parent);
_root.backSword();
}
}
movieClip 2145 {
frame 5 {
_root.backMati();
}
frame 29 {
removeMovieClip(_parent);
}
}
movieClip 2146 barbar1 {
frame 1 {
stop();
}
}
movieClip 2150 panah_mc {
frame 1 {
stop();
}
}
movieClip 2153 {
}
movieClip 2157 panahWeapon {
frame 1 {
stop();
}
}
movieClip 2161 panah_mc2 {
frame 1 {
stop();
}
}
movieClip 2164 batu_mc {
}
movieClip 2167 bolaApi_mc {
}
movieClip 2180 {
}
movieClip 2181 efekApi {
}
movieClip 2182 {
}
movieClip 2183 efekApi2 {
frame 9 {
removeMovieClip(this);
}
}
movieClip 2185 spellTarget {
}
movieClip 2186 {
frame 9 {
stop();
}
}
movieClip 2187 efekLedakan {
frame 1 {
_root.backLedak();
}
frame 9 {
removeMovieClip(this);
}
}
movieClip 2191 {
frame 15 {
stop();
}
}
movieClip 2192 bentengBarbar {
frame 1 {
stop();
}
}
movieClip 2193 efek4x {
frame 50 {
stop();
}
}
movieClip 2194 spellTarget2 {
}
movieClip 2198 laba_mc {
}
movieClip 2207 {
}
movieClip 2209 zombie_mc {
}
movieClip 2214 {
}
movieClip 2220 {
}
movieClip 2229 {
frame 11 {
_root.cekSerangMusuh(_parent);
_root.backPanah();
}
}
movieClip 2240 {
frame 5 {
_root.backMati();
}
frame 30 {
removeMovieClip(_parent);
}
}
movieClip 2241 barbar2 {
frame 1 {
stop();
}
}
movieClip 2245 panah_mc3 {
frame 1 {
stop();
}
}
movieClip 2250 {
frame 15 {
stop();
}
}
movieClip 2251 bentengJagoan {
frame 1 {
stop();
}
}
movieClip 2256 {
frame 15 {
stop();
}
}
movieClip 2257 bentengHuman {
frame 1 {
stop();
}
}
movieClip 2259 {
frame 1 {
_root.backBatuLempar();
}
frame 7 {
_root.cekSerangWeaponMusuh(_parent);
}
}
movieClip 2260 weaponMusuh2 {
frame 1 {
stop();
}
}
movieClip 2264 {
}
movieClip 2273 {
frame 9 {
_root.backPanahLempar();
}
frame 11 {
_root.cekSerangJagoan(_parent);
}
}
movieClip 2274 guard1 {
frame 1 {
stop();
}
}
movieClip 2278 {
}
movieClip 2286 {
frame 8 {
_root.cekSerangWeapon(_parent);
_root.backLempar();
}
}
movieClip 2287 guard2 {
frame 1 {
stop();
}
}
movieClip 2290 batu_mc2 {
}
movieClip 2295 {
}
movieClip 2296 panah_mc4 {
frame 1 {
stop();
}
}
movieClip 2298 msgBox_mc {
}
movieClip 2300 info_mc {
}
movieClip 2334 {
}
movieClip 2356 {
}
movieClip 2357 tutorial_mc {
frame 1 {
stop();
}
frame 12 {
if (_root.pilihSkenario == 1) {
xinformasi = 'Remember, Blacksmith need the mountain to produce, then you should put this building near the mountain, now move your mouse to the top of the game screen and look for the building\'s sign near the mountain, click it.';
} else {
xinformasi = 'Remember, Blacksmith need the mountain to produce, then you should put this building near the mountain, now move your mouse around the edges of the screen and look for the building\'s sign near the mountain, click it.';
}
}
frame 16 {
if (_root.pilihSkenario == 1) {
xinformasi = 'Remember, Sawmills need the tree to produce, then you should put this building near the trees, now move your mouse to the bottom of the game screen and look for the building\'s sign near the trees, click it.';
} else {
xinformasi = 'Remember, Sawmills need the tree to produce, then you should put this building near the trees, now move your mouse around the edges of the screen and look for the building\'s sign near the trees, click it.';
}
}
}
movieClip 2360 info_mc2 {
frame 1 {
stop();
}
}
movieClip 2362 {
}
movieClip 2364 {
}
movieClip 2367 latar_mc {
frame 1 {
stop();
}
}
movieClip 2370 pause_mc {
}
frame 20 {
stop();
play_btn.onRelease = function () {
_urlStart = _url.indexOf('://') + 3;
_urlEnd = _url.indexOf('/', _urlStart);
domain = _url.substring(_urlStart, _urlEnd);
LastDot = domain.lastIndexOf('.') - 1;
domEnd = domain.lastIndexOf('.', LastDot) + 1;
domain = domain.substring(domEnd, domain.length);
backBuilding2();
gotoAndStop(216);
};
}
frame 25 {
stop();
}
frame 31 {
play();
}
movieClip 2419 {
}
movieClip 2430 {
}
movieClip 2450 {
}
movieClip 2451 {
}
movieClip 2452 {
}
movieClip 2453 {
}
movieClip 2454 {
}
movieClip 2458 {
}
movieClip 2460 {
}
movieClip 2462 {
}
movieClip 2464 {
}
movieClip 2466 {
}
movieClip 2467 {
}
movieClip 2470 {
frame 186 {
_root.play();
}
}
movieClip 2472 {
frame 1 {
this.onRelease = function () {
getURL('http://www.maxgames.com', '_blank');
};
}
}
movieClip 2487 {
}
movieClip 2488 {
}
movieClip 2497 {
frame 30 {
stop();
}
}
movieClip 2510 {
frame 42 {
stop();
}
}
movieClip 2511 {
frame 50 {
stop();
}
}
frame 215 {
backBuilding2();
gotoAndStop(216);
}
frame 216 {
stop();
continue_mc._visible = false;
akanSerangKota = false;
play_btn.onRelease = function () {
if (sudahSimpan == undefined) {
initAwal();
gotoAndStop('skenario');
} else {
continue_mc._visible = true;
continue_mc.continue_btn.onRelease = function () {
loadData();
adaKotaMonster = 0;
i = 1;
while (i <= bykKota) {
if (_root['kotaMilik' + i] == 1) {
++adaKotaMonster;
}
++i;
}
if (adaKotaMonster >= 10) {
backBuilding2();
} else {
backBuilding();
}
gotoAndStop(737);
};
continue_mc.new_btn.onRelease = function () {
initAwal();
gotoAndStop('skenario');
};
}
};
credits_btn.onRelease = function () {
gotoAndStop('credits');
};
}
movieClip 2518 {
}
movieClip 2525 {
frame 1 {
this.onRelease = function () {
getURL('http://www.maxgames.com', '_blank');
};
}
}
frame 217 {
stop();
credits_mc.close_btn.onRelease = function () {
gotoAndStop('playings');
};
}
movieClip 2529 {
}
frame 218 {
stop();
skenario_mc.skenario1.onRelease = function () {
pilihSkenario = 1;
gotoAndStop(219);
};
skenario_mc.skenario2.onRelease = function () {
pilihSkenario = 2;
gotoAndStop(219);
};
skenario_mc.skenario3.onRelease = function () {
pilihSkenario = 3;
gotoAndStop(219);
};
skenario_mc.skenario4.onRelease = function () {
pilihSkenario = 4;
gotoAndStop(219);
};
skenario_mc.close_btn.onRelease = function () {
gotoAndStop('playings');
};
}
movieClip 2547 {
}
frame 219 {
stop();
back_btn.onRelease = function () {
gotoAndStop(216);
};
if (pilihSkenario == 1) {
keKota = 2;
_root.kotaMilik2 = 1;
_root.kotaMilik21 = 2;
} else {
if (pilihSkenario == 2) {
keKota = 22;
_root.kotaMilik22 = 1;
_root.kotaMilik1 = 2;
_root.kotaMilik2 = 2;
_root.kotaMilik3 = 2;
_root.kotaMilik20 = 2;
_root.kotaMilik21 = 2;
} else {
if (pilihSkenario == 3) {
keKota = 6;
_root.kotaMilik6 = 1;
_root.kotaMilik1 = 2;
_root.kotaMilik2 = 2;
_root.kotaMilik3 = 2;
_root.kotaMilik8 = 2;
_root.kotaMilik9 = 2;
_root.kotaMilik13 = 2;
_root.kotaMilik14 = 2;
_root.kotaMilik17 = 2;
_root.kotaMilik18 = 2;
_root.kotaMilik22 = 2;
_root.kotaMilik23 = 2;
_root.kotaMilik21 = 2;
_root.kotaMilik24 = 2;
} else {
if (pilihSkenario == 4) {
keKota = 12;
_root.kotaMilik12 = 1;
_root.kotaMilik2 = 2;
_root.kotaMilik8 = 2;
_root.kotaMilik14 = 2;
_root.kotaMilik17 = 2;
_root.kotaMilik22 = 2;
_root.kotaMilik21 = 2;
}
}
}
}
ability1.onRelease = function () {
pilihAbility = 1;
gotoAndStop('resource');
};
ability2.onRelease = function () {
pilihAbility = 2;
gotoAndStop('resource');
};
ability3.onRelease = function () {
pilihAbility = 3;
gotoAndStop('resource');
};
}
frame 220 {
function initResource() {
sisaResource = 50;
if (pilihAbility == 1) {
initialGold = 275;
initialIron = 200;
initialWood = 200;
initialTech = 5;
} else {
if (pilihAbility == 2) {
initialGold = 200;
initialIron = 125;
initialWood = 125;
initialTech = 15;
} else {
if (pilihAbility == 3) {
initialGold = 150;
initialIron = 75;
initialWood = 75;
initialTech = 250;
}
}
}
remaining = 'RESOURCES REMAINING: ' + sisaResource;
}
function cekResource() {
remaining = 'RESOURCES REMAINING: ' + sisaResource;
}
stop();
back_btn.onRelease = function () {
gotoAndStop('ability');
};
reset_btn.onRelease = function () {
initResource();
};
next_btn.onRelease = function () {
gotoAndStop('difficulty');
};
initResource();
plus1.onRelease = function () {
if (sisaResource >= 10) {
initialGold += 10;
sisaResource -= 10;
cekResource();
}
};
plus2.onRelease = function () {
if (sisaResource >= 10) {
initialIron += 10;
sisaResource -= 10;
cekResource();
}
};
plus3.onRelease = function () {
if (sisaResource >= 10) {
initialWood += 10;
sisaResource -= 10;
cekResource();
}
};
plus4.onRelease = function () {
if (sisaResource >= 10) {
initialTech += 10;
sisaResource -= 10;
cekResource();
}
};
minus1.onRelease = function () {
if (sisaResource <= 40) {
initialGold -= 10;
sisaResource += 10;
cekResource();
}
};
minus2.onRelease = function () {
if (sisaResource <= 40) {
initialIron -= 10;
sisaResource += 10;
cekResource();
}
};
minus3.onRelease = function () {
if (sisaResource <= 40) {
initialWood -= 10;
sisaResource += 10;
cekResource();
}
};
minus4.onRelease = function () {
if (sisaResource <= 40) {
initialTech -= 10;
sisaResource += 10;
cekResource();
}
};
}
frame 221 {
stop();
back_btn.onRelease = function () {
gotoAndStop(219);
};
if (pilihAbility == 2) {
i = 1;
while (i <= bykKota) {
_root['xbaremanPowerLow' + i] = 200;
_root['xswordmanPowerLow' + i] = 240;
_root['xarrowmanPowerLow' + i] = 270;
_root['xspearmanPowerLow' + i] = 300;
_root['xbaremanPower' + i] = 200;
_root['xswordmanPower' + i] = 240;
_root['xarrowmanPower' + i] = 270;
_root['xspearmanPower' + i] = 300;
_root['xbaremanPowerMax' + i] = 300;
_root['xswordmanPowerMax' + i] = 340;
_root['xarrowmanPowerMax' + i] = 370;
_root['xspearmanPowerMax' + i] = 400;
++i;
}
} else {
i = 1;
while (i <= bykKota) {
_root['xbaremanPowerLow' + i] = 100;
_root['xswordmanPowerLow' + i] = 120;
_root['xarrowmanPowerLow' + i] = 135;
_root['xspearmanPowerLow' + i] = 150;
_root['xbaremanPower' + i] = 100;
_root['xswordmanPower' + i] = 120;
_root['xarrowmanPower' + i] = 135;
_root['xspearmanPower' + i] = 150;
_root['xbaremanPowerMax' + i] = 150;
_root['xswordmanPowerMax' + i] = 170;
_root['xarrowmanPowerMax' + i] = 185;
_root['xspearmanPowerMax' + i] = 200;
++i;
}
}
sulit1.onRelease = function () {
tingkatSulit = 1;
initSerangan = 175;
penambahanSerangan = 175;
initSeranganHuman = 225;
penambahanSerangan2 = 225;
awalKaliMain = true;
gotoAndStop(222);
};
sulit2.onRelease = function () {
tingkatSulit = 2;
initSerangan = 150;
penambahanSerangan = 150;
initSeranganHuman = 200;
penambahanSerangan2 = 200;
awalKaliMain = true;
gotoAndStop(222);
};
sulit3.onRelease = function () {
tingkatSulit = 3;
initSerangan = 100;
penambahanSerangan = 100;
initSeranganHuman = 150;
penambahanSerangan2 = 150;
awalKaliMain = true;
gotoAndStop(222);
};
}
frame 222 {
play();
skip_btn.onRelease = function () {
backBuilding();
gotoAndStop(737);
};
}
// unknown tag 88 length 93
frame 736 {
backBuilding();
gotoAndStop(737);
}
frame 737 {
function buatTutorial() {
bisaUI(false);
akanSerangKota = true;
sedangTutorial = true;
mulaiBisaKlikBuilding = false;
ui_mc.remove_mc._visible = false;
ui_mc.gameQuest._visible = false;
tutorial = attachMovie('tutorial_mc', 'tutorial_mc', dalamTutorial);
tutorial.cacheAsBitmap = true;
tutorial._x = 400;
tutorial._y = 300;
tutorial.yes_btn.onRelease = function () {
if (tingkatSulit == 1) {
_root['xgold' + keKota] += 100;
_root['xiron' + keKota] += 75;
_root['xwood' + keKota] += 75;
} else {
if (tingkatSulit == 2) {
_root['xgold' + keKota] += 300;
_root['xiron' + keKota] += 225;
_root['xwood' + keKota] += 225;
} else {
if (tingkatSulit == 3) {
_root['xgold' + keKota] += 600;
_root['xiron' + keKota] += 450;
_root['xwood' + keKota] += 450;
}
}
}
cekTutorial(100);
};
tutorial.no_btn.onRelease = function () {
selesaiTutorial();
};
}
function cekRemovePanah() {
ui_mc.building_mc.enabled = false;
ui_mc.research_mc.enabled = false;
ui_mc.army_mc.enabled = false;
ui_mc.weaponary_mc.enabled = false;
i = 1;
while (i <= maxBangunan) {
j = keKota;
_root[j + 'bangunan' + i].panah_mc._visible = false;
++i;
}
}
function selesaiTutorial() {
sudahTutorial = true;
bisaUI(true);
akanSerangKota = false;
sedangTutorial = false;
mulaiBisaKlikBuilding = true;
i = 1;
while (i <= 12) {
box_mc.build_mc['bangunan' + i].enabled = true;
++i;
}
box_mc.prev_btn.enabled = true;
box_mc.close_btn.enabled = true;
box_mc.next_btn.enabled = true;
if (sideQuestKe == 0) {
sideQuestKe = 1;
}
removeMovieClip(tutorial_mc);
}
function cekTutorial(indi) {
cekRemovePanah();
if (indi == 100) {
awalTutorialSeratus = false;
sudahGeserKiri = false;
sudahGeserKanan = false;
sudahGeserAtas = false;
sudahGeserBawah = false;
} else {
if (indi == 101) {
ui_mc.remove_mc._visible = true;
} else {
if (indi == 2) {
sedangBuatKe = 1;
awalTutorialSeratus = true;
ui_mc.building_mc.enabled = true;
} else {
if (indi == 3) {
ui_mc.building_mc.gotoAndStop(1);
i = 1;
while (i <= 12) {
box_mc.build_mc['bangunan' + i].enabled = false;
++i;
}
box_mc.build_mc.bangunan1.enabled = true;
box_mc.prev_btn.enabled = false;
box_mc.close_btn.enabled = false;
box_mc.next_btn.enabled = false;
sedangBangunKe = 1;
} else {
if (indi == 4) {
} else {
if (indi == 5) {
akanSerangKota = false;
} else {
if (indi == 6) {
sedangBuatKe = 2;
akanSerangKota = true;
ui_mc.building_mc.enabled = true;
} else {
if (indi == 7) {
ui_mc.building_mc.gotoAndStop(1);
i = 1;
while (i <= 12) {
box_mc.build_mc['bangunan' + i].enabled = false;
++i;
}
box_mc.build_mc.bangunan2.enabled = true;
box_mc.prev_btn.enabled = false;
box_mc.close_btn.enabled = false;
box_mc.next_btn.enabled = false;
sedangBangunKe = 2;
} else {
if (indi == 8) {
} else {
if (indi == 9) {
akanSerangKota = false;
} else {
if (indi == 10) {
sedangBuatKe = 3;
akanSerangKota = true;
ui_mc.building_mc.enabled = true;
} else {
if (indi == 11) {
ui_mc.building_mc.gotoAndStop(1);
i = 1;
while (i <= 12) {
box_mc.build_mc['bangunan' + i].enabled = false;
++i;
}
box_mc.build_mc.bangunan3.enabled = true;
box_mc.prev_btn.enabled = false;
box_mc.close_btn.enabled = false;
box_mc.next_btn.enabled = false;
sedangBangunKe = 3;
} else {
if (indi == 12) {
} else {
if (indi == 13) {
akanSerangKota = false;
} else {
if (indi == 14) {
sedangBuatKe = 4;
akanSerangKota = true;
ui_mc.building_mc.enabled = true;
} else {
if (indi == 15) {
ui_mc.building_mc.gotoAndStop(1);
i = 1;
while (i <= 12) {
box_mc.build_mc['bangunan' + i].enabled = false;
++i;
}
box_mc.build_mc.bangunan4.enabled = true;
box_mc.prev_btn.enabled = false;
box_mc.close_btn.enabled = false;
box_mc.next_btn.enabled = false;
sedangBangunKe = 4;
} else {
if (indi == 16) {
} else {
if (indi == 17) {
akanSerangKota = false;
} else {
if (indi == 18) {
belumUpgradeBangunan = false;
mulaiBisaKlikBuilding = true;
i = 1;
while (i <= maxBangunan) {
j = keKota;
_root[j + 'bangunan' + i].panah_mc._visible = true;
++i;
}
} else {
if (indi == 19) {
belumUpgradeBangunan = true;
belumUpgradeBangunan2 = false;
i = 1;
while (i <= maxBangunan) {
j = keKota;
_root[j + 'bangunan' + i].panah_mc._visible = true;
++i;
}
} else {
if (indi == 20) {
mulaiBisaKlikBuilding = false;
belumUpgradeBangunan2 = true;
akanSerangKota = true;
sedangBuatKe = 5;
akanSerangKota = true;
ui_mc.building_mc.enabled = true;
} else {
if (indi == 21) {
if (tingkatSulit == 1) {
_root['xgold' + keKota] += 400;
_root['xiron' + keKota] += 300;
_root['xwood' + keKota] += 400;
} else {
if (tingkatSulit == 2) {
_root['xgold' + keKota] += 500;
_root['xiron' + keKota] += 300;
_root['xwood' + keKota] += 400;
} else {
if (tingkatSulit == 3) {
_root['xgold' + keKota] += 1300;
_root['xiron' + keKota] += 300;
_root['xwood' + keKota] += 400;
}
}
}
ui_mc.building_mc.gotoAndStop(1);
i = 1;
while (i <= 12) {
box_mc.build_mc['bangunan' + i].enabled = false;
++i;
}
box_mc.build_mc.bangunan5.enabled = true;
box_mc.prev_btn.enabled = false;
box_mc.close_btn.enabled = false;
box_mc.next_btn.enabled = false;
sedangBangunKe = 5;
} else {
if (indi == 22) {
} else {
if (indi == 23) {
akanSerangKota = false;
} else {
if (indi == 24) {
sedangBuatKe = 6;
akanSerangKota = true;
ui_mc.research_mc.enabled = true;
} else {
if (indi == 25) {
_root['xgold' + keKota] += 2000;
_root['xtech' + keKota] += 55;
ui_mc.research_mc.gotoAndStop(1);
i = 1;
while (i <= 18) {
box_mc.riset_mc['riset' + i].enabled = false;
++i;
}
box_mc.riset_mc.riset1.enabled = true;
box_mc.riset_mc.building_btn.enabled = false;
box_mc.riset_mc.military_btn.enabled = false;
box_mc.riset_mc.others_btn.enabled = false;
box_mc.riset_mc.build_btn.enabled = false;
box_mc.close_btn.enabled = false;
sedangBangunKe = 6;
} else {
if (indi == 26) {
sedangBuatKe = 6;
akanSerangKota = true;
ui_mc.building_mc.enabled = true;
} else {
if (indi == 27) {
ui_mc.building_mc.gotoAndStop(1);
i = 1;
while (i <= 12) {
box_mc.build_mc['bangunan' + i].enabled = false;
++i;
}
box_mc.prev_btn.enabled = false;
box_mc.close_btn.enabled = false;
box_mc.next_btn.enabled = true;
sedangBangunKe = 7;
} else {
if (indi == 28) {
if (tingkatSulit == 1) {
_root['xgold' + keKota] += 2500;
_root['xiron' + keKota] += 500;
_root['xwood' + keKota] += 700;
} else {
if (tingkatSulit == 2) {
_root['xgold' + keKota] += 5000;
_root['xiron' + keKota] += 500;
_root['xwood' + keKota] += 700;
} else {
if (tingkatSulit == 3) {
_root['xgold' + keKota] += 9000;
_root['xiron' + keKota] += 500;
_root['xwood' + keKota] += 700;
}
}
}
ui_mc.building_mc.gotoAndStop(1);
i = 1;
while (i <= 12) {
box_mc.build_mc['bangunan' + i].enabled = false;
++i;
}
box_mc.build_mc.bangunan7.enabled = true;
box_mc.prev_btn.enabled = false;
box_mc.close_btn.enabled = false;
box_mc.next_btn.enabled = false;
sedangBangunKe = 8;
} else {
if (indi == 29) {
} else {
if (indi == 30) {
speedGame = 4;
cekSpeed();
akanSerangKota = false;
} else {
if (indi == 31) {
speedGame = 1;
cekSpeed();
sedangBuatKe = 7;
akanSerangKota = true;
ui_mc.weaponary_mc.enabled = true;
} else {
if (indi == 32) {
ui_mc.weaponary_mc.gotoAndStop(1);
i = 1;
while (i <= 6) {
box_mc.weapon_mc['weapon' + i].enabled = false;
++i;
}
box_mc.weapon_mc.weapon1.enabled = true;
box_mc.weapon_mc.weapon2.enabled = true;
box_mc.weapon_mc.weapon3.enabled = true;
box_mc.weapon_mc.close_btn.enabled = false;
box_mc.weapon_mc.auto1.enabled = false;
box_mc.weapon_mc.auto2.enabled = false;
box_mc.weapon_mc.auto3.enabled = false;
sedangBangunKe = 9;
} else {
if (indi == 33) {
sedangBuatKe = 8;
akanSerangKota = true;
ui_mc.building_mc.enabled = true;
} else {
if (indi == 34) {
if (tingkatSulit == 1) {
_root['xgold' + keKota] += 5000;
_root['xiron' + keKota] += 400;
_root['xwood' + keKota] += 300;
} else {
if (tingkatSulit == 2) {
_root['xgold' + keKota] += 10000;
_root['xiron' + keKota] += 400;
_root['xwood' + keKota] += 300;
} else {
if (tingkatSulit == 3) {
_root['xgold' + keKota] += 15000;
_root['xiron' + keKota] += 400;
_root['xwood' + keKota] += 300;
}
}
}
ui_mc.building_mc.gotoAndStop(1);
i = 1;
while (i <= 12) {
box_mc.build_mc['bangunan' + i].enabled = false;
++i;
}
box_mc.build_mc.bangunan6.enabled = true;
box_mc.prev_btn.enabled = false;
box_mc.close_btn.enabled = false;
box_mc.next_btn.enabled = false;
sedangBangunKe = 10;
} else {
if (indi == 35) {
} else {
if (indi == 36) {
speedGame = 4;
cekSpeed();
akanSerangKota = false;
} else {
if (indi == 37) {
speedGame = 1;
cekSpeed();
sedangBuatKe = 9;
akanSerangKota = true;
ui_mc.army_mc.enabled = true;
} else {
if (indi == 38) {
ui_mc.army_mc.gotoAndStop(1);
box_mc.soldiers_mc.recruit1.enabled = false;
box_mc.soldiers_mc.train1.enabled = false;
box_mc.soldiers_mc.recruit2.enabled = false;
box_mc.soldiers_mc.train2.enabled = false;
box_mc.soldiers_mc.recruit3.enabled = false;
box_mc.soldiers_mc.train3.enabled = false;
box_mc.soldiers_mc.recruit4.enabled = false;
box_mc.soldiers_mc.train4.enabled = false;
box_mc.soldiers_mc.auto1.enabled = false;
box_mc.soldiers_mc.auto2.enabled = false;
box_mc.soldiers_mc.auto3.enabled = false;
box_mc.soldiers_mc.auto4.enabled = false;
box_mc.close_btn.enabled = false;
box_mc.soldiers_mc.recruit1.enabled = true;
box_mc.soldiers_mc.recruit2.enabled = true;
} else {
if (indi == 39) {
sedangBuatKe = 10;
akanSerangKota = true;
ui_mc.attack_mc.enabled = true;
_root['xbareman' + keKota] += 40;
_root['xswordman' + keKota] += 40;
} else {
if (indi == 40) {
} else {
if (indi == 41) {
} else {
if (indi == 42) {
} else {
if (indi == 43) {
} else {
if (indi == 44) {
} else {
if (indi == 45) {
} else {
if (indi == 46) {
} else {
if (indi == 47) {
bisaUI(false);
akanSerangKota = true;
sedangTutorial = true;
mulaiBisaKlikBuilding = false;
ui_mc.remove_mc._visible = false;
ui_mc.gameQuest._visible = false;
} else {
if (indi == 48) {
bisaUI(false);
akanSerangKota = true;
sedangTutorial = true;
mulaiBisaKlikBuilding = false;
ui_mc.remove_mc._visible = false;
ui_mc.gameQuest._visible = false;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
tutorial.gotoAndStop(indi);
tutorial.continue_btn.onRelease = function () {
cekTutorial(2);
};
tutorial.oke_btn.onRelease = function () {
cekTutorial(48);
};
tutorial.selesai_btn.onRelease = function () {
selesaiTutorial();
};
info_mc2._visible = false;
}
function buatMasking() {
masking = attachMovie('masking_mc', 'masking_mc', dalamMasking);
masking.cacheAsBitmap = true;
masking._x = 400;
masking._y = 300;
masking.gotoAndStop(latar_mc._currentframe);
masking.onEnterFrame = enterMasking;
}
function buatMsgBox() {
msgBox = attachMovie('msgBox_mc', 'msgBox_mc', dalamMsgBox);
msgBox.cacheAsBitmap = true;
msgBox._x = 400;
msgBox._y = 300;
msgBox._visible = false;
msgBox.onEnterFrame = enterMsgBox;
}
function buatInfo() {
info_mc = attachMovie('info_mc', 'info_mc', dalamInfo);
info_mc.cacheAsBitmap = true;
info_mc._x = 400;
info_mc._y = 300;
info_mc._visible = false;
info_mc.oke_btn.onRelease = function () {
info_mc._visible = false;
};
}
function buatInfo2() {
info_mc2 = attachMovie('info_mc2', 'info_mc2', dalamInfo2);
info_mc2.cacheAsBitmap = true;
info_mc2._x = 400;
info_mc2._y = 300;
info_mc2._visible = false;
info_mc2.gotoAndStop(1);
info_mc2.onEnterFrame = enterMsgBox2;
}
function cekInfo(indi) {
info_mc.xinfo = indi;
info_mc._visible = true;
}
function enterMsgBox() {
if (_root._xmouse >= 600) {
this._x = _root._xmouse - 100;
} else {
this._x = _root._xmouse;
}
if (_root._ymouse >= 400) {
this._y = _root._ymouse - 150;
} else {
this._y = _root._ymouse;
}
}
function enterMsgBox2() {
if (_root._xmouse >= 500) {
this._x = _root._xmouse - 350;
} else {
this._x = _root._xmouse;
}
if (_root._ymouse >= 500) {
this._y = _root._ymouse - 250;
} else {
this._y = _root._ymouse;
}
}
function enterMasking() {
this._x += geserKiri;
this._y += geserAtas;
}
function buatBackground() {
posBackground = new Array('', 3, 1, 2, 1, 3, 3, 1, 4, 3, 3, 4, 4, 4, 4, 2, 1, 2, 1, 2, 1, 2, 1, 2, 2, 2);
latar_mc.gotoAndStop(posBackground[keKota]);
obyek = attachMovie('obyekAtas' + keKota, 'obyek_mc', dalamObyek1);
obyek.cacheAsBitmap = true;
obyek._x = 400;
obyek._y = 300;
maxSlot = 30;
i = 1;
while (i <= maxSlot) {
obyek['slotGunung' + i]._visible = false;
obyek['slotHutan' + i]._visible = false;
obyek['slotKosong' + i]._visible = false;
++i;
}
cekHitBangunan();
obyek.gotoAndStop(keKota);
obyek.onEnterFrame = enterMasking;
obyek2 = attachMovie('obyekBawah' + keKota, 'obyek_mc2', dalamObyek2);
obyek2.cacheAsBitmap = true;
obyek2._x = 400;
obyek2._y = 300;
obyek2.gotoAndStop(keKota);
obyek2.onEnterFrame = enterMasking;
}
function initAwalGoods() {
_root['xgold' + keKota] = initialGold;
_root['xiron' + keKota] = initialIron;
_root['xwood' + keKota] = initialWood;
_root['xtech' + keKota] = initialTech;
}
function initCost() {
namaBuilding = new Array('', 'HOUSE', 'FARM', 'BLACKSMITH', 'SAWMILLS', 'LAB', 'BARRACK', 'ARMORY', 'FACTORY', 'PARK', 'TEMPLE', 'FORTRESS', 'LIBRARY');
costWorkerBuilding = new Array('', 0, 4, 6, 5, 10, 25, 30, 60, 50, 10, 25, 5);
if (tingkatSulit == 1) {
costGoldBuilding = new Array('', 10, 15, 30, 25, 200, 250, 1250, 1700, 300, 500, 750, 1500);
costIronBuilding = new Array('', 5, 10, 0, 15, 150, 200, 250, 600, 300, 350, 550, 250);
costWoodBuilding = new Array('', 10, 5, 15, 0, 200, 150, 350, 300, 500, 350, 300, 750);
} else {
if (tingkatSulit == 2) {
costGoldBuilding = new Array('', 25, 30, 60, 55, 450, 500, 2500, 3500, 750, 1000, 1500, 3000);
costIronBuilding = new Array('', 5, 10, 0, 15, 150, 200, 250, 600, 300, 350, 550, 250);
costWoodBuilding = new Array('', 10, 5, 15, 0, 200, 150, 350, 300, 500, 350, 300, 750);
} else {
if (tingkatSulit == 3) {
costGoldBuilding = new Array('', 35, 40, 70, 75, 650, 750, 4500, 5500, 100, 1250, 1750, 3500);
costIronBuilding = new Array('', 5, 10, 0, 15, 150, 200, 250, 600, 300, 350, 550, 250);
costWoodBuilding = new Array('', 10, 5, 15, 0, 200, 150, 350, 300, 500, 350, 300, 750);
}
}
}
if (pilihAbility == 2) {
costGoldWeapon = new Array('', 50, 75, 100, 500, 750, 750);
costIronWeapon = new Array('', 20, 15, 20, 60, 50, 100);
costWoodWeapon = new Array('', 10, 20, 25, 60, 150, 50);
} else {
costGoldWeapon = new Array('', 100, 150, 200, 1000, 1500, 1500);
costIronWeapon = new Array('', 40, 30, 40, 120, 75, 150);
costWoodWeapon = new Array('', 20, 40, 50, 120, 250, 100);
}
if (pilihAbility == 2) {
costGoldKendaraan = new Array('', 10000, 15000, 25000);
costIronKendaraan = new Array('', 3000, 3500, 15000);
costWoodKendaraan = new Array('', 2000, 4500, 10000);
costTambahanKendaraan = new Array('', 3, 3, 12);
costWorkerKendaraan = new Array('', 1, 1, 3);
} else {
costGoldKendaraan = new Array('', 20000, 25000, 50000);
costIronKendaraan = new Array('', 6000, 7000, 25000);
costWoodKendaraan = new Array('', 4000, 9000, 20000);
costTambahanKendaraan = new Array('', 5, 5, 25);
costWorkerKendaraan = new Array('', 2, 2, 6);
}
costGoldMagic = new Array('', 500, 1000, 1500, 2000, 2500, 3000, 3500, 4000);
costManaMagic = new Array('', 25, 50, 75, 100, 125, 150, 175, 200);
costGoldDefense = new Array('', 200, 300, 400, 500, 1000);
costIronDefense = new Array('', 100, 50, 150, 75, 400);
costWoodDefense = new Array('', 50, 100, 75, 150, 200);
lamaBuatBuilding = new Array('', 100, 150, 150, 200, 200, 750, 1500, 3500, 2000, 3000, 2500, 200);
lamaBuatBuilding2 = new Array('', 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50);
if (tingkatSulit == 1) {
if (pilihAbility == 1) {
productionBuilding = new Array('', 140, 120, 20, 20, 1.6, '', '', '', 0.2, 7, '', '');
} else {
if (pilihAbility == 3) {
productionBuilding = new Array('', 140, 80, 15, 15, 3.2, '', '', '', 0.2, 7, '', '');
} else {
productionBuilding = new Array('', 140, 80, 15, 15, 1.6, '', '', '', 0.2, 7, '', '');
}
}
} else {
if (tingkatSulit == 2) {
if (pilihAbility == 1) {
productionBuilding = new Array('', 120, 100, 16, 16, 1.2, '', '', '', 0.1, 5, '', '');
} else {
if (pilihAbility == 3) {
productionBuilding = new Array('', 120, 70, 12, 12, 2.4, '', '', '', 0.1, 5, '', '');
} else {
productionBuilding = new Array('', 120, 70, 12, 12, 1.2, '', '', '', 0.1, 5, '', '');
}
}
} else {
if (tingkatSulit == 3) {
if (pilihAbility == 1) {
productionBuilding = new Array('', 110, 90, 14, 14, 0.8, '', '', '', 0.05, 4, '', '');
} else {
if (pilihAbility == 3) {
productionBuilding = new Array('', 110, 60, 10, 10, 1.6, '', '', '', 0.05, 4, '', '');
} else {
productionBuilding = new Array('', 110, 60, 10, 10, 0.8, '', '', '', 0.05, 4, '', '');
}
}
}
}
}
productionBuilding2 = new Array('', '', 10, '', '', '', '', '', '', '', '', '', '');
costBuilding = new Array('', 0, 0, 3, 2, 10, 10, 15, 30, 35, 25, 20, 15);
costBuilding2 = new Array('', 2, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
costBuilding3 = new Array('', 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
butuhMoneyBuilding = new Array('', 1000, 1500, 2000, 3000, 3500, 4000, 500, 750, 1000, 2000, 2500, 3000, 1000, 5000, 10000, 1000, 2000, 2500);
if (pilihAbility == 3) {
butuhTechBuilding = new Array('', 20, 25, 25, 30, 30, 35, 15, 20, 20, 75, 100, 125, 35, 100, 125, 50, 60, 75);
} else {
butuhTechBuilding = new Array('', 35, 40, 45, 50, 50, 60, 25, 30, 40, 150, 200, 250, 75, 200, 250, 100, 125, 150);
}
costLibraryGold = new Array('', 150, 150, 150, 150, 200, 200, 0, 200);
costLibraryIron = new Array('', 25, 50, 25, 50, 75, 100, 10, 0);
costLibraryWood = new Array('', 50, 25, 50, 25, 100, 75, 10, 0);
costLibraryMana = new Array('', 3, 3, 3, 3, 5, 5, 10, 10);
butuhGoldArmy = new Array('', 200, 350, 400, 450);
butuhGoldTrain = new Array('', 500, 1000, 1500, 2000);
if (pilihAbility == 2) {
produksiArmy = 10;
} else {
produksiArmy = 5;
}
bangunanAktif = new Array();
i = 1;
while (i <= 12) {
bangunanAktif[i] = new Array();
j = 1;
while (j <= bykKota) {
bangunanAktif[i][j] = true;
++j;
}
++i;
}
delayWaktu = 0;
maxWaktu = 200;
geserKiri = 0;
geserAtas = 0;
dagangKali = true;
adaWarning1 = false;
adaWarning2 = false;
adaWarning3 = false;
dealKali = 0;
dalamMsgBox = 191000;
dalamInfo = 1920000;
dalamInfo2 = 1921000;
dalamTutorial = 1900000;
dalamMasking = 110000;
dalamObyek1 = 10000;
dalamObyek2 = 100000;
dalamDrag = 200000;
dalamBox = 170000;
dalamUI = 150000;
dalamRebel = 120000;
sedangDrag = false;
}
function initSemua() {
dalamBangunan = 100;
dalamBar = 140000;
titikAwalX = 0;
titikAwalY = 0;
geserKeKiri = false;
geserKeKanan = false;
geserKeAtas = false;
geserKeBawah = false;
}
function initBuilding(indi) {
i = 1;
while (i <= maxBangunan) {
if (xtipeBuilding[i][indi] >= 1) {
if (xsudahJadiBuilding[i][indi] == false) {
bar = attachMovie('bar_mc', 'bar' + i, dalamBar);
bar._x = xposXBuilding[i][indi];
bar._y = xposYBuilding[i][indi] + 75;
bar.onEnterFrame = enterBar;
++dalamBar;
if (dalamBar >= 141000) {
dalamBar = 140000;
}
}
pilihBangunanKe = xtipeBuilding[i][indi];
bangunan = attachMovie('bangunan_mc', indi + 'bangunan' + i, dalamBangunan);
bangunan.cacheAsBitmap = true;
bangunan.panah_mc._visible = false;
bangunan._x = xposXBuilding[i][indi];
bangunan._y = xposYBuilding[i][indi];
bangunan.gotoAndStop(pilihBangunanKe);
if (xsudahJadiBuilding[i][indi] == false) {
bangunan._alpha = 30;
bangunan.enabled = false;
} else {
bangunan._alpha = 100;
bangunan.enabled = true;
}
bangunan.sudahJadi = xsudahJadiBuilding[i][indi];
bangunan.jenisBangunan = pilihBangunanKe;
bangunan.keBangunan = i;
bangunan.aktif_mc._visible = false;
bangunan.delayBuat = xdelayBuatBuilding[i][indi];
bangunan.maxBuat = lamaBuatBuilding[pilihBangunanKe];
bangunan.levelKe = xlevelBuilding[i][indi];
bangunan.onEnterFrame = enterBangunan2;
bangunan.onRelease = klikBangunan2;
++dalamBangunan;
if (dalamBangunan >= 200) {
dalamBangunan = 100;
}
}
++i;
}
cekAdaTipeBangunan();
}
function cekAdaTipeBangunan() {
adaLab = false;
adaBarak = false;
adaArmory = false;
adaFactory = false;
adaTemple = false;
adaFortress = false;
adaLibrary = false;
adaLab2 = false;
adaBarak2 = false;
adaArmory2 = false;
adaFactory2 = false;
adaTemple2 = false;
adaFortress2 = false;
adaLibrary2 = false;
i = 1;
while (i <= maxBangunan) {
if (xsudahJadiBuilding[i][keKota] == true) {
if (xtipeBuilding[i][keKota] == 5) {
adaLab = true;
}
if (xtipeBuilding[i][keKota] == 6) {
adaBarak = true;
}
if (xtipeBuilding[i][keKota] == 7) {
adaArmory = true;
}
if (xtipeBuilding[i][keKota] == 8) {
adaFactory = true;
}
if (xtipeBuilding[i][keKota] == 10) {
adaTemple = true;
}
if (xtipeBuilding[i][keKota] == 11) {
adaFortress = true;
}
if (xtipeBuilding[i][keKota] == 12) {
adaLibrary = true;
}
} else {
if (xsudahJadiBuilding[i][keKota] == false) {
if (xtipeBuilding[i][keKota] == 5) {
adaLab2 = true;
}
if (xtipeBuilding[i][keKota] == 6) {
adaBarak2 = true;
}
if (xtipeBuilding[i][keKota] == 7) {
adaArmory2 = true;
}
if (xtipeBuilding[i][keKota] == 8) {
adaFactory2 = true;
}
if (xtipeBuilding[i][keKota] == 10) {
adaTemple2 = true;
}
if (xtipeBuilding[i][keKota] == 11) {
adaFortress2 = true;
}
if (xtipeBuilding[i][keKota] == 12) {
adaLibrary2 = true;
}
}
}
++i;
}
}
function cekSeranganMusuh() {
adaSeranganHariIni = false;
randSerangan = random(10) + 1;
if (xday >= initSerangan) {
initSerangan += penambahanSerangan + random(10) + 1;
penambahanSerangan -= 5;
if (tingkatSulit == 1) {
if (sudahSerangFinal == true) {
if (penambahanSerangan <= 100) {
penambahanSerangan = 100;
}
} else {
if (penambahanSerangan <= 200) {
penambahanSerangan = 200;
}
}
} else {
if (tingkatSulit == 2) {
if (sudahSerangFinal == true) {
if (penambahanSerangan <= 50) {
penambahanSerangan = 50;
}
} else {
if (penambahanSerangan <= 100) {
penambahanSerangan = 100;
}
}
} else {
if (tingkatSulit == 3) {
if (sudahSerangFinal == true) {
if (penambahanSerangan <= 25) {
penambahanSerangan = 25;
}
} else {
if (penambahanSerangan <= 50) {
penambahanSerangan = 50;
}
}
}
}
}
randSerangan = random(10) + 1;
beritaSerangan();
}
}
function beritaSerangan(xindi) {
if (xindi == 'human') {
pilihMasukKota = yangDiserang;
siapaYangNyerang = 2;
keMasuk = 1;
} else {
masukKota = new Array();
keMasuk = 0;
i = 1;
while (i <= bykKota) {
if (_root['kotaMilik' + i] == 1) {
adaBatasMusuh = false;
j = 1;
while (j <= maxKoneksi) {
if (_root['kotaMilik' + koneksiKota[i][j]] != undefined) {
if (_root['kotaMilik' + koneksiKota[i][j]] == 0) {
adaBatasMusuh = true;
}
}
++j;
}
if (adaBatasMusuh == true) {
masukKota[keMasuk] = i;
++keMasuk;
}
}
++i;
}
rand = random(keMasuk);
pilihMasukKota = masukKota[rand];
siapaYangNyerang = 0;
}
if (keMasuk != 0) {
jumlahPasukanMusuhSerang = 25;
if (xday <= 100) {
jumlahPasukanMusuhSerang = 20 + random(5);
} else {
if (xday <= 200) {
jumlahPasukanMusuhSerang = 25 + random(5);
} else {
if (xday <= 300) {
jumlahPasukanMusuhSerang = 30 + random(5);
} else {
if (xday <= 400) {
jumlahPasukanMusuhSerang = 35 + random(5);
} else {
if (xday <= 500) {
jumlahPasukanMusuhSerang = 40 + random(5);
} else {
if (xday <= 600) {
jumlahPasukanMusuhSerang = 45 + random(5);
} else {
if (xday <= 700) {
jumlahPasukanMusuhSerang = 50 + random(5);
} else {
if (xday <= 800) {
jumlahPasukanMusuhSerang = 55 + random(5);
} else {
jumlahPasukanMusuhSerang = 60 + random(5);
}
}
}
}
}
}
}
}
if (siapaYangNyerang == 0) {
ui_mc.berita_mc.namaKota = xnamaKota[pilihMasukKota] + ' is under attack by Barbarian';
} else {
if (siapaYangNyerang == 2) {
ui_mc.berita_mc.namaKota = xnamaKota[pilihMasukKota] + ' is under attack by Human';
}
}
sudahTolakBribe = false;
cekTombolBerita();
}
}
function cekTombolBerita() {
adaSeranganHariIni = true;
ui_mc.berita_mc._visible = true;
akanSerangKota = true;
bisaUI(false);
if (keKota == pilihMasukKota) {
adaSeranganMusuh = true;
ui_mc.berita_mc.go_btn.enabled = false;
ui_mc.berita_mc.go_btn._alpha = 50;
} else {
ui_mc.berita_mc.go_btn.enabled = true;
ui_mc.berita_mc.go_btn._alpha = 100;
}
ui_mc.berita_mc.go_btn.onRelease = function () {
adaSeranganMusuh = true;
this.enabled = false;
this._alpha = 50;
keKota = pilihMasukKota;
menujuKeKota(pilihMasukKota);
};
adaDefenseUnit = Number(_root['xwall' + pilihMasukKota]) + Number(_root['xspike' + pilihMasukKota]) + Number(_root['xspiderWeb' + pilihMasukKota]) + Number(_root['xtowerGuard' + pilihMasukKota]) + Number(_root['xzombieTrap' + pilihMasukKota]);
if (adaDefenseUnit == 0) {
ui_mc.berita_mc.field_btn.enabled = false;
ui_mc.berita_mc.field_btn._alpha = 50;
} else {
ui_mc.berita_mc.field_btn.enabled = true;
ui_mc.berita_mc.field_btn._alpha = 100;
}
ui_mc.berita_mc.field_btn.onRelease = function () {
keKota = pilihMasukKota;
adaSeranganMusuh = false;
clearSemua();
kondisiPreview = 'awal';
gotoAndStop(840);
};
ui_mc.berita_mc.castle_btn.onRelease = function () {
keKota = pilihMasukKota;
adaSeranganMusuh = false;
clearSemua();
kondisiPreview = 'tengah2';
gotoAndStop(840);
};
if (sudahTolakBribe == false) {
ui_mc.berita_mc.bribe_btn.enabled = true;
ui_mc.berita_mc.bribe_btn._alpha = 100;
} else {
ui_mc.berita_mc.bribe_btn.enabled = false;
ui_mc.berita_mc.bribe_btn._alpha = 50;
}
ui_mc.berita_mc.bribe_btn.onRelease = function () {
xrand = random(2);
if (xrand == 0) {
sudahTolakBribe = true;
ui_mc.berita_mc.gotoAndStop(2);
ui_mc.berita_mc.ok_btn.onRelease = function () {
ui_mc.berita_mc.gotoAndStop(1);
cekTombolBerita();
};
} else {
ui_mc.berita_mc.gotoAndStop(3);
ui_mc.berita_mc.ok_btn.onRelease = function () {
adaSeranganMusuh = false;
ui_mc.berita_mc._visible = false;
akanSerangKota = false;
bisaUI(true);
};
cekBribeMusuh();
}
};
ui_mc.berita_mc.surrender_btn.onRelease = function () {
if (pilihMasukKota == keKota) {
keKota = 0;
}
adaSeranganMusuh = false;
resetKota();
klikMap();
};
}
function cekBribeMusuh() {
_root['xwelfare' + pilihMasukKota] -= Math.ceil(_root['xwelfare' + pilihMasukKota] * 0.5);
_root['xgold' + pilihMasukKota] -= Math.ceil(_root['xgold' + pilihMasukKota] * 0.5);
_root['xiron' + pilihMasukKota] -= Math.ceil(_root['xiron' + pilihMasukKota] * 0.5);
_root['xwood' + pilihMasukKota] -= Math.ceil(_root['xwood' + pilihMasukKota] * 0.5);
_root['xfood' + pilihMasukKota] -= Math.ceil(_root['xfood' + pilihMasukKota] * 0.5);
_root['xbareman' + pilihMasukKota] -= Math.ceil(_root['xbareman' + pilihMasukKota] * 0.5);
_root['xswordman' + pilihMasukKota] -= Math.ceil(_root['xswordman' + pilihMasukKota] * 0.5);
_root['xarrowman' + pilihMasukKota] -= Math.ceil(_root['xarrowman' + pilihMasukKota] * 0.5);
_root['xspearman' + pilihMasukKota] -= Math.ceil(_root['xspearman' + pilihMasukKota] * 0.5);
_root['xsword' + pilihMasukKota] -= Math.ceil(_root['xsword' + pilihMasukKota] * 0.5);
_root['xarrow' + pilihMasukKota] -= Math.ceil(_root['xarrow' + pilihMasukKota] * 0.5);
_root['xspear' + pilihMasukKota] -= Math.ceil(_root['xspear' + pilihMasukKota] * 0.5);
_root['xarrowTrap' + pilihMasukKota] -= Math.ceil(_root['xarrowTrap' + pilihMasukKota] * 0.5);
_root['xcatapult' + pilihMasukKota] -= Math.ceil(_root['xcatapult' + pilihMasukKota] * 0.5);
_root['xfireTrap' + pilihMasukKota] -= Math.ceil(_root['xfireTrap' + pilihMasukKota] * 0.5);
_root['xarrowRain' + pilihMasukKota] -= Math.ceil(_root['xarrowRain' + pilihMasukKota] * 0.5);
_root['xmeteorid' + pilihMasukKota] -= Math.ceil(_root['xmeteorid' + pilihMasukKota] * 0.5);
_root['xacidRain' + pilihMasukKota] -= Math.ceil(_root['xacidRain' + pilihMasukKota] * 0.5);
_root['xearthquake' + pilihMasukKota] -= Math.ceil(_root['xearthquake' + pilihMasukKota] * 0.5);
_root['ximmune' + pilihMasukKota] -= Math.ceil(_root['ximmune' + pilihMasukKota] * 0.5);
_root['xinvisible' + pilihMasukKota] -= Math.ceil(_root['xinvisible' + pilihMasukKota] * 0.5);
_root['xspecialAttack' + pilihMasukKota] -= Math.ceil(_root['xspecialAttack' + pilihMasukKota] * 0.5);
_root['xduplicate' + pilihMasukKota] -= Math.ceil(_root['xduplicate' + pilihMasukKota] * 0.5);
_root['xwall' + pilihMasukKota] -= Math.ceil(_root['xwall' + pilihMasukKota] * 0.5);
_root['xspike' + pilihMasukKota] -= Math.ceil(_root['xspike' + pilihMasukKota] * 0.5);
_root['xspiderWeb' + pilihMasukKota] -= Math.ceil(_root['xspiderWeb' + pilihMasukKota] * 0.5);
_root['xtowerGuard' + pilihMasukKota] -= Math.ceil(_root['xtowerGuard' + pilihMasukKota] * 0.5);
_root['xzombieTrap' + pilihMasukKota] -= Math.ceil(_root['xzombieTrap' + pilihMasukKota] * 0.5);
}
function resetKota() {
_root['xgold' + pilihMasukKota] = 0;
_root['xiron' + pilihMasukKota] = 0;
_root['xwood' + pilihMasukKota] = 0;
_root['xworker' + pilihMasukKota] = 0;
_root['xbareman' + pilihMasukKota] = 0;
_root['xswordman' + pilihMasukKota] = 0;
_root['xarrowman' + pilihMasukKota] = 0;
_root['xspearman' + pilihMasukKota] = 0;
_root['xarrowTrap' + pilihMasukKota] = 0;
_root['xcatapult' + pilihMasukKota] = 0;
_root['xfireTrap' + pilihMasukKota] = 0;
_root['xtank' + pilihMasukKota] = 0;
_root['xcopter' + pilihMasukKota] = 0;
_root['xmonbot' + pilihMasukKota] = 0;
_root['xfood' + pilihMasukKota] = 0;
_root['xsword' + pilihMasukKota] = 0;
_root['xarrow' + pilihMasukKota] = 0;
_root['xspear' + pilihMasukKota] = 0;
_root['xarrowRain' + pilihMasukKota] = 0;
_root['xmeteorid' + pilihMasukKota] = 0;
_root['xacidRain' + pilihMasukKota] = 0;
_root['xearthquake' + pilihMasukKota] = 0;
_root['ximmune' + pilihMasukKota] = 0;
_root['xinvisible' + pilihMasukKota] = 0;
_root['xspecialAttack' + pilihMasukKota] = 0;
_root['xduplicate' + pilihMasukKota] = 0;
_root['xwall' + pilihMasukKota] = 0;
_root['xspike' + pilihMasukKota] = 0;
_root['xspiderWeb' + pilihMasukKota] = 0;
_root['xtowerGuard' + pilihMasukKota] = 0;
_root['xzombieTrap' + pilihMasukKota] = 0;
_root['risetArmory' + pilihMasukKota] = false;
_root['risetFactory' + pilihMasukKota] = false;
_root['risetPark' + pilihMasukKota] = false;
_root['risetTemple' + pilihMasukKota] = false;
_root['risetFortress' + pilihMasukKota] = false;
_root['risetLibrary' + pilihMasukKota] = false;
_root['risetCatapult' + pilihMasukKota] = false;
_root['risetFireTrap' + pilihMasukKota] = false;
_root['risetTank' + pilihMasukKota] = false;
_root['risetCopter' + pilihMasukKota] = false;
_root['risetMonbot' + pilihMasukKota] = false;
_root['risetInvisible' + pilihMasukKota] = false;
_root['risetSpecialAttack' + pilihMasukKota] = false;
_root['risetDuplicate' + pilihMasukKota] = false;
_root['risetZombie' + pilihMasukKota] = false;
_root['risetFastBuild' + pilihMasukKota] = false;
_root['risetRawPlus' + pilihMasukKota] = false;
_root['risetGoldPlus' + pilihMasukKota] = false;
_root['autoBareman' + pilihMasukKota] = false;
_root['autoSwordman' + pilihMasukKota] = false;
_root['autoArrowman' + pilihMasukKota] = false;
_root['autoSpearman' + pilihMasukKota] = false;
_root['autoSword' + pilihMasukKota] = false;
_root['autoArrow' + pilihMasukKota] = false;
_root['autoSpear' + pilihMasukKota] = false;
_root['autoTank' + pilihMasukKota] = false;
_root['autoCopter' + pilihMasukKota] = false;
_root['autoMonbot' + pilihMasukKota] = false;
_root['rangerAktif' + pilihMasukKota] = false;
_root['tirelessAktif' + pilihMasukKota] = false;
_root['armorPlusAktif' + pilihMasukKota] = false;
_root['speedPlusAktif' + pilihMasukKota] = false;
_root['entertainmentAktif' + pilihMasukKota] = false;
_root['fastBuildAktif' + pilihMasukKota] = false;
_root['rawPlusAktif' + pilihMasukKota] = false;
_root['goldPlusAktif' + pilihMasukKota] = false;
_root['xtech' + keKota] = 0;
_root['xwelfare' + keKota] = 15;
_root['kotaMilik' + pilihMasukKota] = siapaYangNyerang;
i = 1;
while (i <= maxBangunan) {
xtipeBuilding[i][pilihMasukKota] = 0;
xposXBuilding[i][pilihMasukKota] = 0;
xposYBuilding[i][pilihMasukKota] = 0;
xlevelBuilding[i][pilihMasukKota] = 0;
xsudahJadiBuilding[i][pilihMasukKota] = false;
xdelayBuatBuilding[i][pilihMasukKota] = 0;
++i;
}
}
function menujuKeKota(indi) {
ssi = 1;
while (ssi <= maxBangunan) {
ssj = 1;
while (ssj <= bykKota) {
removeMovieClip(_root[ssj + 'bangunan' + ssi]);
++ssj;
}
++ssi;
}
ssi = 1;
while (ssi <= maxBangunan) {
removeMovieClip(_root['bar' + ssi]);
++ssi;
}
ssi = 120000;
while (ssi <= 120200) {
removeMovieClip(_root['rebel_mc' + ssi]);
++ssi;
}
removeMovieClip(drag_mc);
removeMovieClip(masking_mc);
removeMovieClip(obyek_mc);
removeMovieClip(obyek_mc2);
latar_mc._x = 400;
latar_mc._y = 300;
keKota = indi;
initBuilding(keKota);
buatBackground();
buatMasking();
}
function adaRebel(indi) {
randRebel = random(2);
bykBangunanSini = 0;
i = 1;
while (i <= maxBangunan) {
if (xtipeBuilding[i][indi] >= 1) {
if (xsudahJadiBuilding[i][j] == true) {
++bykBangunanSini;
}
}
++i;
}
if (xday >= 100) {
if (randRebel == 0 && adaSeranganHariIni == false && bykBangunanSini > 0) {
cekRebel(indi);
}
}
}
function cekRebel(indi) {
akanSerangKota = true;
pilihKotaRebel = indi;
ui_mc.rebel_mc._visible = true;
ui_mc.rebel_mc.namaKota = 'Due the poor walfare, ' + xnamaKota[pilihKotaRebel] + ' is under attack by Rebel.';
bisaUI(false);
ui_mc.rebel_mc.go_btn.onRelease = function () {
adaSeranganMusuh = true;
ui_mc.rebel_mc._visible = false;
if (keKota == pilihKotaRebel) {
munculRebel(keKota);
} else {
keKota = pilihKotaRebel;
clearSemua();
keLoading = 'rebel';
gotoAndStop(739);
}
};
ui_mc.rebel_mc.bribe_btn.onRelease = function () {
randRebel = random(2);
if (randRebel == 0) {
cekBribeRebel();
ui_mc.rebel_mc.gotoAndStop(2);
ui_mc.rebel_mc.ok_btn.onRelease = function () {
bisaUI(true);
akanSerangKota = false;
adaSeranganMusuh = false;
ui_mc.rebel_mc._visible = false;
};
} else {
ui_mc.rebel_mc.gotoAndStop(3);
ui_mc.rebel_mc.go_btn.onRelease = function () {
adaSeranganMusuh = true;
ui_mc.rebel_mc._visible = false;
if (keKota == pilihKotaRebel) {
munculRebel(keKota);
} else {
keKota = pilihKotaRebel;
menujuKeKota(pilihKotaRebel);
munculRebel(keKota);
}
};
}
};
}
function cekBribeRebel() {
_root['xwelfare' + pilihKotaRebel] += 3;
_root['xgold' + pilihKotaRebel] -= Math.ceil(_root['xgold' + pilihKotaRebel] * 0.5);
_root['xiron' + pilihKotaRebel] -= Math.ceil(_root['xiron' + pilihKotaRebel] * 0.5);
_root['xwood' + pilihKotaRebel] -= Math.ceil(_root['xwood' + pilihKotaRebel] * 0.5);
_root['xfood' + pilihKotaRebel] -= Math.ceil(_root['xfood' + pilihKotaRebel] * 0.5);
_root['xbareman' + pilihKotaRebel] -= Math.ceil(_root['xbareman' + pilihKotaRebel] * 0.5);
_root['xswordman' + pilihKotaRebel] -= Math.ceil(_root['xswordman' + pilihKotaRebel] * 0.5);
_root['xarrowman' + pilihKotaRebel] -= Math.ceil(_root['xarrowman' + pilihKotaRebel] * 0.5);
_root['xspearman' + pilihKotaRebel] -= Math.ceil(_root['xspearman' + pilihKotaRebel] * 0.5);
_root['xsword' + pilihKotaRebel] -= Math.ceil(_root['xsword' + pilihKotaRebel] * 0.5);
_root['xarrow' + pilihKotaRebel] -= Math.ceil(_root['xarrow' + pilihKotaRebel] * 0.5);
_root['xspear' + pilihKotaRebel] -= Math.ceil(_root['xspear' + pilihKotaRebel] * 0.5);
_root['xarrowTrap' + pilihKotaRebel] -= Math.ceil(_root['xarrowTrap' + pilihKotaRebel] * 0.5);
_root['xcatapult' + pilihKotaRebel] -= Math.ceil(_root['xcatapult' + pilihKotaRebel] * 0.5);
_root['xfireTrap' + pilihKotaRebel] -= Math.ceil(_root['xfireTrap' + pilihKotaRebel] * 0.5);
_root['xarrowRain' + pilihKotaRebel] -= Math.ceil(_root['xarrowRain' + pilihKotaRebel] * 0.5);
_root['xmeteorid' + pilihKotaRebel] -= Math.ceil(_root['xmeteorid' + pilihKotaRebel] * 0.5);
_root['xacidRain' + pilihKotaRebel] -= Math.ceil(_root['xacidRain' + pilihKotaRebel] * 0.5);
_root['xearthquake' + pilihKotaRebel] -= Math.ceil(_root['xearthquake' + pilihKotaRebel] * 0.5);
_root['ximmune' + pilihKotaRebel] -= Math.ceil(_root['ximmune' + pilihKotaRebel] * 0.5);
_root['xinvisible' + pilihKotaRebel] -= Math.ceil(_root['xinvisible' + pilihKotaRebel] * 0.5);
_root['xspecialAttack' + pilihKotaRebel] -= Math.ceil(_root['xspecialAttack' + pilihKotaRebel] * 0.5);
_root['xduplicate' + pilihKotaRebel] -= Math.ceil(_root['xduplicate' + pilihKotaRebel] * 0.5);
_root['xwall' + pilihKotaRebel] -= Math.ceil(_root['xwall' + pilihKotaRebel] * 0.5);
_root['xspike' + pilihKotaRebel] -= Math.ceil(_root['xspike' + pilihKotaRebel] * 0.5);
_root['xspiderWeb' + pilihKotaRebel] -= Math.ceil(_root['xspiderWeb' + pilihKotaRebel] * 0.5);
_root['xtowerGuard' + pilihKotaRebel] -= Math.ceil(_root['xtowerGuard' + pilihKotaRebel] * 0.5);
_root['xzombieTrap' + pilihKotaRebel] -= Math.ceil(_root['xzombieTrap' + pilihKotaRebel] * 0.5);
}
function munculRebel(indi) {
bisaUI(false);
bykSerangBangunan = 1;
keSerangBangunan = new Array();
i = 1;
while (i <= maxBangunan) {
if (xtipeBuilding[i][indi] >= 1) {
if (tingkatSulit == 1) {
xrand = random(150);
} else {
if (tingkatSulit == 2) {
xrand = random(100);
} else {
if (tingkatSulit == 3) {
xrand = random(75);
}
}
}
if (xrand <= 50) {
keSerangBangunan[bykSerangBangunan] = i;
++bykSerangBangunan;
}
}
++i;
}
if (bykSerangBangunan <= 1) {
i = 1;
while (i <= maxBangunan) {
if (xtipeBuilding[i][indi] >= 1) {
keSerangBangunan[bykSerangBangunan] = i;
++bykSerangBangunan;
i = maxBangunan;
}
++i;
}
}
rebelKini = bykSerangBangunan;
i = 1;
while (i <= bykSerangBangunan - 1) {
bangunanDiSerang = keSerangBangunan[i];
randRebel = random(2) + 1;
rebel = attachMovie('soldier' + randRebel, 'rebel_mc' + dalamRebel, dalamRebel);
rebel._x = _root[indi + 'bangunan' + bangunanDiSerang]._x - 35 - random(25);
rebel._y = _root[indi + 'bangunan' + bangunanDiSerang]._y + 80;
rebel.xtarget = _root[indi + 'bangunan' + bangunanDiSerang];
rebel.serangKini = 0;
rebel.maxSerang = 100 + random(100);
rebel.onEnterFrame = enterRebel;
++dalamRebel;
if (dalamRebel >= 120200) {
dalamRebel = 120000;
}
++i;
}
_root['xwelfare' + keKota] += 3;
}
function enterRebel() {
this._x += geserKiri;
this._y += geserAtas;
this.gotoAndStop(3);
if (this.serangKini >= this.maxSerang) {
cekHancurBangunan(this.xtarget);
--rebelKini;
if (rebelKini <= 1) {
bisaUI(true);
akanSerangKota = false;
klikMap();
}
removeMovieClip(this);
} else {
++this.serangKini;
}
}
function cekHancurBangunan(indi2) {
if (indi2.jenisBangunan == 1) {
_root['xworker' + keKota] -= productionBuilding[_root[keKota + 'bangunan' + indi2.keBangunan].jenisBangunan] * indi2.levelKe;
} else {
if (indi2.jenisBangunan == 12) {
_root['rangerAktif' + keKota] = false;
_root['tirelessAktif' + keKota] = false;
_root['armorPlusAktif' + keKota] = false;
_root['speedPlusAktif' + keKota] = false;
_root['entertainmentAktif' + keKota] = false;
_root['fastBuildAktif' + keKota] = false;
_root['rawPlusAktif' + keKota] = false;
_root['goldPlusAktif' + keKota] = false;
}
}
_root['xworker' + keKota] += costWorkerBuilding[indi2.jenisBangunan];
xtipeBuilding[indi2.keBangunan][keKota] = 0;
box_mc._visible = false;
removeMovieClip(indi2);
cekAdaTipeBangunan();
}
function cekAI() {
adaSeranganHariIni = false;
randSerangan2 = random(5) + 1;
if (xday >= initSeranganHuman) {
initSeranganHuman += penambahanSerangan2 + randSerangan2;
penambahanSerangan2 -= 5;
if (tingkatSulit == 1) {
if (sudahSerangFinal == true) {
if (penambahanSerangan2 <= 100) {
penambahanSerangan2 = 100;
}
} else {
if (penambahanSerangan2 <= 200) {
penambahanSerangan2 = 200;
}
}
} else {
if (tingkatSulit == 2) {
if (sudahSerangFinal == true) {
if (penambahanSerangan2 <= 50) {
penambahanSerangan2 = 50;
}
} else {
if (penambahanSerangan2 <= 100) {
penambahanSerangan2 = 100;
}
}
} else {
if (tingkatSulit == 3) {
if (sudahSerangFinal == true) {
if (penambahanSerangan2 <= 25) {
penambahanSerangan2 = 25;
}
} else {
if (penambahanSerangan2 <= 50) {
penambahanSerangan2 = 50;
}
}
}
}
}
serangAI();
}
}
function serangAI() {
masukKotaMusuh = new Array();
keMasukMusuh = 0;
i = 1;
while (i <= bykKota) {
if (_root['kotaMilik' + i] == 2) {
adaBatasMusuh = false;
j = 1;
while (j <= maxKoneksi) {
if (_root['kotaMilik' + koneksiKota[i][j]] != undefined) {
if (_root['kotaMilik' + koneksiKota[i][j]] != 2) {
masukKotaMusuh[keMasukMusuh] = koneksiKota[i][j];
++keMasukMusuh;
}
}
++j;
}
}
++i;
}
adaBatasMusuh = false;
j = 1;
while (j <= maxKoneksi) {
if (_root['kotaMilik' + koneksiKota[i][j]] != undefined) {
if (_root['kotaMilik' + koneksiKota[i][j]] == 0) {
adaBatasMusuh = true;
}
}
++j;
}
if (adaBatasMusuh == true) {
masukKota[keMasuk] = i;
++keMasuk;
}
if (keMasukMusuh > 0) {
randMasukMusuh = random(keMasukMusuh);
yangDiserang = masukKotaMusuh[randMasukMusuh];
if (_root['kotaMilik' + yangDiserang] == 0) {
_root['kotaMilik' + yangDiserang] = 2;
penambahanSerangan2 += 5;
} else {
if (_root['kotaMilik' + yangDiserang] == 1) {
beritaSerangan('human');
}
}
}
}
function cekQuest() {
if (sideQuestKe >= 31) {
ui_mc.gameQuest._visible = true;
ui_mc.gameQuest.xnama = 'All Task Completed, Congratulations!';
} else {
if (sideQuestKe >= 1) {
ui_mc.gameQuest._visible = true;
ui_mc.gameQuest.xnama = 'Task ' + sideQuestKe + ': ' + xnamaQuest[sideQuestKe];
} else {
ui_mc.gameQuest._visible = false;
}
}
if (sideQuestKe == 1) {
xbykKotaKini = 0;
i = 1;
while (i <= maxBangunan) {
if (xtipeBuilding[i][keKota] == 1) {
if (xsudahJadiBuilding[i][keKota] == true) {
++xbykKotaKini;
}
}
++i;
}
if (xbykKotaKini >= 4) {
cekMenangQuest(sideQuestKe);
}
} else {
if (sideQuestKe == 2) {
} else {
if (sideQuestKe == 3) {
} else {
if (sideQuestKe == 4) {
} else {
if (sideQuestKe == 5) {
} else {
if (sideQuestKe == 6) {
} else {
if (sideQuestKe == 7) {
xadaKotaMonster = 0;
i = 1;
while (i <= bykKota) {
if (_root['kotaMilik' + i] == 1) {
++xadaKotaMonster;
}
++i;
}
if (xadaKotaMonster >= 3) {
cekMenangQuest(sideQuestKe);
}
} else {
if (sideQuestKe == 8) {
} else {
if (sideQuestKe == 9) {
} else {
if (sideQuestKe == 10) {
} else {
if (sideQuestKe == 11) {
if (_root['xmana' + keKota] >= 50) {
cekMenangQuest(sideQuestKe);
}
} else {
if (sideQuestKe == 12) {
if (killMusuh >= 100) {
cekMenangQuest(sideQuestKe);
}
} else {
if (sideQuestKe == 13) {
if (_root.kotaMilik13 == 1) {
cekMenangQuest(sideQuestKe);
}
} else {
if (sideQuestKe == 14) {
if (_root['xwelfare' + keKota] >= 50) {
cekMenangQuest(sideQuestKe);
}
} else {
if (sideQuestKe == 15) {
} else {
if (sideQuestKe == 16) {
xadaKotaMonster = 0;
i = 1;
while (i <= bykKota) {
if (_root['kotaMilik' + i] == 1) {
++xadaKotaMonster;
}
++i;
}
if (xadaKotaMonster >= 6) {
cekMenangQuest(sideQuestKe);
}
} else {
if (sideQuestKe == 17) {
if (_root.kotaMilik6 == 1) {
cekMenangQuest(sideQuestKe);
}
} else {
if (sideQuestKe == 18) {
if (_root['xtank' + keKota] >= 20) {
cekMenangQuest(sideQuestKe);
}
} else {
if (sideQuestKe == 19) {
xadaKotaMonster = 0;
i = 1;
while (i <= bykKota) {
if (_root['kotaMilik' + i] == 1) {
++xadaKotaMonster;
}
++i;
}
if (xadaKotaMonster >= 10) {
cekMenangQuest(sideQuestKe);
}
} else {
if (sideQuestKe == 20) {
if (_root['xcopter' + keKota] >= 20) {
cekMenangQuest(sideQuestKe);
}
} else {
if (sideQuestKe == 21) {
if (killMusuh >= 500) {
cekMenangQuest(sideQuestKe);
}
} else {
if (sideQuestKe == 22) {
if (_root['xmonbot' + keKota] >= 20) {
cekMenangQuest(sideQuestKe);
}
} else {
if (sideQuestKe == 23) {
xadaKotaMonster = 0;
i = 1;
while (i <= bykKota) {
if (_root['kotaMilik' + i] == 1) {
++xadaKotaMonster;
}
++i;
}
if (xadaKotaMonster >= 14) {
cekMenangQuest(sideQuestKe);
}
} else {
if (sideQuestKe == 24) {
if (killMusuh >= 1000) {
cekMenangQuest(sideQuestKe);
}
} else {
if (sideQuestKe == 25) {
if (_root['xmonbot' + keKota] >= 50) {
cekMenangQuest(sideQuestKe);
}
} else {
if (sideQuestKe == 26) {
xadaKotaMonster = 0;
i = 1;
while (i <= bykKota) {
if (_root['kotaMilik' + i] == 1) {
++xadaKotaMonster;
}
++i;
}
if (xadaKotaMonster >= 18) {
cekMenangQuest(sideQuestKe);
}
} else {
if (sideQuestKe == 27) {
cekSemuaResource();
if (gagalSemua == false) {
cekMenangQuest(sideQuestKe);
}
} else {
if (sideQuestKe == 28) {
if (killMusuh >= 1500) {
cekMenangQuest(sideQuestKe);
}
} else {
if (sideQuestKe == 29) {
if (tidakKalah >= 10) {
cekMenangQuest(sideQuestKe);
}
} else {
if (sideQuestKe == 30) {
xadaKotaMonster = 0;
i = 1;
while (i <= bykKota) {
if (_root['kotaMilik' + i] == 1) {
++xadaKotaMonster;
}
++i;
}
if (xadaKotaMonster >= 24) {
cekMenangQuest(sideQuestKe);
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
function cekMenangQuest(indi) {
akanSerangKota = true;
bisaUI(false);
ui_mc.quest_mc._visible = true;
ui_mc.quest_mc.xnama = xnamaQuest[sideQuestKe];
ui_mc.quest_mc.reward_mc.gotoAndStop(sideQuestKe);
if (sideQuestKe == 30) {
_root.dapatMedal31 = true;
}
if (sudahTerompet == undefined) {
sudahTerompet = true;
backTerompet();
}
ui_mc.quest_mc.oke_btn.onRelease = function () {
sudahTerompet = undefined;
if (sideQuestKe == 1) {
_root['xgold' + keKota] += 1000;
_root['xiron' + keKota] += 500;
_root['xwood' + keKota] += 500;
} else {
if (sideQuestKe == 2) {
_root['xsword' + keKota] += 30;
_root['xarrow' + keKota] += 30;
_root['xspear' + keKota] += 30;
} else {
if (sideQuestKe == 3) {
_root['xtech' + keKota] += 50;
} else {
if (sideQuestKe == 4) {
_root['xgold' + keKota] += 1500;
_root['xiron' + keKota] += 750;
_root['xwood' + keKota] += 750;
} else {
if (sideQuestKe == 5) {
_root['xfood' + keKota] += 1000;
} else {
if (sideQuestKe == 6) {
_root['xwelfare' + keKota] += 50;
} else {
if (sideQuestKe == 7) {
_root['xarrowTrap' + keKota] += 3;
_root['xcatapult' + keKota] += 3;
_root['xfireTrap' + keKota] += 3;
} else {
if (sideQuestKe == 8) {
_root['xwall' + keKota] += 5;
_root['xspike' + keKota] += 5;
_root['xspiderWeb' + keKota] += 5;
_root['xtowerGuard' + keKota] += 5;
} else {
if (sideQuestKe == 9) {
_root['xmana' + keKota] += 500;
} else {
if (sideQuestKe == 10) {
_root['xswordman' + keKota] += 100;
_root['xarrowman' + keKota] += 100;
_root['xspearman' + keKota] += 100;
} else {
if (sideQuestKe == 11) {
_root['xtech' + keKota] += 25;
_root['xwelfare' + keKota] += 25;
_root['xmana' + keKota] += 25;
} else {
if (sideQuestKe == 12) {
_root['xgold' + keKota] += 2500;
_root['xiron' + keKota] += 1000;
_root['xwood' + keKota] += 1000;
} else {
if (sideQuestKe == 13) {
_root['xtank' + keKota] += 2;
_root['xcopter' + keKota] += 2;
} else {
if (sideQuestKe == 14) {
i = 1;
while (i <= bykKota) {
if (_root['kotaMilik' + i] == 1) {
_root['xwelfare' + i] += 25;
}
++i;
}
} else {
if (sideQuestKe == 15) {
_root['xgold' + keKota] += 5000;
_root['xiron' + keKota] += 2500;
_root['xwood' + keKota] += 2500;
} else {
if (sideQuestKe == 16) {
_root['xswordman' + keKota] += 500;
_root['xarrowman' + keKota] += 500;
_root['xspearman' + keKota] += 500;
} else {
if (sideQuestKe == 17) {
_root['xmana' + keKota] += 2000;
} else {
if (sideQuestKe == 18) {
_root['xtank' + keKota] += 5;
} else {
if (sideQuestKe == 19) {
_root['xgold' + keKota] += 7500;
_root['xiron' + keKota] += 3500;
_root['xwood' + keKota] += 3500;
} else {
if (sideQuestKe == 20) {
_root['xcopter' + keKota] += 10;
} else {
if (sideQuestKe == 21) {
_root['xswordman' + keKota] += 1500;
_root['xarrowman' + keKota] += 1500;
_root['xspearman' + keKota] += 1500;
} else {
if (sideQuestKe == 22) {
_root['xmonbot' + keKota] += 10;
} else {
if (sideQuestKe == 23) {
_root['xarrowRain' + keKota] += 5;
_root['xmeteorid' + keKota] += 5;
_root['xacidRain' + keKota] += 5;
_root['xearthquake' + keKota] += 5;
_root['ximmune' + keKota] += 5;
_root['xinvisible' + keKota] += 5;
_root['xspecialAttack' + keKota] += 5;
_root['xduplicate' + keKota] += 5;
} else {
if (sideQuestKe == 24) {
_root['xgold' + keKota] += 10000;
_root['xiron' + keKota] += 5000;
_root['xwood' + keKota] += 5000;
} else {
if (sideQuestKe == 25) {
_root['xtank' + keKota] += 5;
_root['xcopter' + keKota] += 5;
_root['xmonbot' + keKota] += 5;
} else {
if (sideQuestKe == 26) {
_root['xgold' + keKota] += 50000;
_root['xiron' + keKota] += 20000;
_root['xwood' + keKota] += 20000;
} else {
if (sideQuestKe == 27) {
_root['xgold' + keKota] += 10;
_root['xiron' + keKota] += 10;
_root['xwood' + keKota] += 10;
_root['xworker' + keKota] += 10;
_root['xbareman' + keKota] += 10;
_root['xswordman' + keKota] += 10;
_root['xarrowman' + keKota] += 10;
_root['xspearman' + keKota] += 10;
_root['xwelfare' + keKota] += 10;
_root['xtech' + keKota] += 10;
_root['xmana' + keKota] += 10;
_root['xfood' + keKota] += 10;
_root['xtank' + keKota] += 10;
_root['xcopter' + keKota] += 10;
_root['xmonbot' + keKota] += 10;
_root['xsword' + keKota] += 10;
_root['xarrow' + keKota] += 10;
_root['xspear' + keKota] += 10;
_root['xarrowTrap' + keKota] += 10;
_root['xcatapult' + keKota] += 10;
_root['xfireTrap' + keKota] += 10;
_root['xarrowRain' + keKota] += 10;
_root['xmeteorid' + keKota] += 10;
_root['xacidRain' + keKota] += 10;
_root['xearthquake' + keKota] += 10;
_root['ximmune' + keKota] += 10;
_root['xinvisible' + keKota] += 10;
_root['xspecialAttack' + keKota] += 10;
_root['xduplicate' + keKota] += 10;
_root['xwall' + keKota] += 10;
_root['xspike' + keKota] += 10;
_root['xspiderWeb' + keKota] += 10;
_root['xtowerGuard' + keKota] += 10;
_root['xzombieTrap' + keKota] += 10;
} else {
if (sideQuestKe == 28) {
_root['xgold' + keKota] += 100000;
_root['xiron' + keKota] += 50000;
_root['xwood' + keKota] += 50000;
} else {
if (sideQuestKe == 29) {
i = 1;
while (i <= bykKota) {
_root['xgold' + i] *= 2;
_root['xiron' + i] *= 2;
_root['xwood' + i] *= 2;
_root['xworker' + i] *= 2;
_root['xbareman' + i] *= 2;
_root['xswordman' + i] *= 2;
_root['xarrowman' + i] *= 2;
_root['xspearman' + i] *= 2;
_root['xwelfare' + i] *= 2;
_root['xtech' + i] *= 2;
_root['xmana' + i] *= 2;
_root['xfood' + i] *= 2;
_root['xtank' + i] *= 2;
_root['xcopter' + i] *= 2;
_root['xmonbot' + i] *= 2;
_root['xsword' + i] *= 2;
_root['xarrow' + i] *= 2;
_root['xspear' + i] *= 2;
_root['xarrowTrap' + i] *= 2;
_root['xcatapult' + i] *= 2;
_root['xfireTrap' + i] *= 2;
_root['xarrowRain' + i] *= 2;
_root['xmeteorid' + i] *= 2;
_root['xacidRain' + i] *= 2;
_root['xearthquake' + i] *= 2;
_root['ximmune' + i] *= 2;
_root['xinvisible' + i] *= 2;
_root['xspecialAttack' + i] *= 2;
_root['xduplicate' + i] *= 2;
_root['xwall' + i] *= 2;
_root['xspike' + i] *= 2;
_root['xspiderWeb' + i] *= 2;
_root['xtowerGuard' + i] *= 2;
_root['xzombieTrap' + i] *= 2;
++i;
}
} else {
if (sideQuestKe == 30) {
dapatMedal31 = true;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
akanSerangKota = false;
bisaUI(true);
ui_mc.quest_mc._visible = false;
++sideQuestKe;
};
}
function buatBox() {
box_mc = attachMovie('box_mc', 'box_mc', dalamBox);
box_mc.cacheAsBitmap = true;
box_mc._x = 400;
box_mc._y = 315;
box_mc._visible = false;
}
function klikBangunan() {
if (this._currentframe == 1) {
myStr = new String(this);
if (isNaN(myStr.substr(myStr.length - 2, 2))) {
indi = myStr.substr(myStr.length - 1, 1);
} else {
indi = myStr.substr(myStr.length - 2, 2);
}
bisaBuat = true;
if (_root['xworker' + keKota] < costWorkerBuilding[indi]) {
if (indi == 1) {
bisaBuat = true;
} else {
bisaBuat = false;
}
}
if (_root['xgold' + keKota] < costGoldBuilding[indi]) {
bisaBuat = false;
}
if (_root['xwood' + keKota] < costWoodBuilding[indi]) {
bisaBuat = false;
}
if (_root['xiron' + keKota] < costIronBuilding[indi]) {
bisaBuat = false;
}
if (bisaBuat == true) {
drag = attachMovie('bangunan_mc', 'drag_mc', dalamDrag);
drag.gotoAndStop(indi);
drag.panah_mc._visible = false;
drag.aktif_mc._visible = false;
drag._x = _root._xmouse;
drag._y = _root._ymouse;
box_mc._visible = false;
pilihBangunanKe = indi;
startDrag(drag, true);
sedangDrag = true;
cekHitBangunan();
} else {
cekInfo('Can\'t build this building, need more resources in this town');
}
if (sedangTutorial == true) {
if (sedangBangunKe == 1) {
cekTutorial(4);
} else {
if (sedangBangunKe == 2) {
cekTutorial(8);
} else {
if (sedangBangunKe == 3) {
cekTutorial(12);
} else {
if (sedangBangunKe == 4) {
cekTutorial(16);
} else {
if (sedangBangunKe == 5) {
cekTutorial(22);
} else {
if (sedangBangunKe == 8) {
cekTutorial(29);
} else {
if (sedangBangunKe == 10) {
cekTutorial(35);
}
}
}
}
}
}
}
}
} else {
klikRiset();
}
}
function enterBar() {
this._x += geserKiri;
this._y += geserAtas;
}
function klikBangunan2() {
indi2 = this;
box_mc._visible = true;
if (this.levelKe == 3) {
box_mc.gotoAndStop(21);
} else {
box_mc.gotoAndStop(20);
}
box_mc.xlevel = namaBuilding[this.jenisBangunan] + ' LEVEL ' + this.levelKe;
box_mc.bangunan_mc.aktif_mc._visible = false;
box_mc.bangunan_mc.gotoAndStop(this.jenisBangunan);
box_mc.bangunan_mc.panah_mc._visible = false;
box_mc.bangunan_mc.bintang_mc.gotoAndStop(this.levelKe);
box_mc.info_mc.gotoAndStop(this.jenisBangunan);
box_mc.worker = costWorkerBuilding[this.jenisBangunan];
box_mc.gold = costGoldBuilding[this.jenisBangunan];
box_mc.wood = costWoodBuilding[this.jenisBangunan];
box_mc.iron = costIronBuilding[this.jenisBangunan];
box_mc.info_mc.produksi = productionBuilding[_root[keKota + 'bangunan' + indi2.keBangunan].jenisBangunan] * indi2.levelKe;
box_mc.info_mc.produksi2 = productionBuilding2[_root[keKota + 'bangunan' + indi2.keBangunan].jenisBangunan] * indi2.levelKe;
if (this.jenisBangunan == 2) {
box_mc.info_mc.biaya = costBuilding2[_root[keKota + 'bangunan' + indi2.keBangunan].jenisBangunan] * indi2.levelKe;
box_mc.info_mc.biaya2 = costBuilding3[_root[keKota + 'bangunan' + indi2.keBangunan].jenisBangunan] * indi2.levelKe;
} else {
box_mc.info_mc.biaya = costBuilding[_root[keKota + 'bangunan' + indi2.keBangunan].jenisBangunan] * indi2.levelKe;
box_mc.info_mc.biaya2 = costBuilding2[_root[keKota + 'bangunan' + indi2.keBangunan].jenisBangunan] * indi2.levelKe;
}
if (this.jenisBangunan == 5 || this.jenisBangunan == 6 || this.jenisBangunan == 7 || this.jenisBangunan == 8 || this.jenisBangunan == 10 || (this.jenisBangunan == 11 || this.jenisBangunan == 12)) {
box_mc.action_btn._visible = true;
} else {
box_mc.action_btn._visible = false;
}
if (this.levelKe >= 3) {
box_mc.upgrade_btn._visible = false;
} else {
box_mc.upgrade_btn._visible = true;
}
box_mc.action_btn.onRelease = function () {
if (indi2.jenisBangunan == 5) {
box_mc.gotoAndStop(2);
klikRiset();
} else {
if (indi2.jenisBangunan == 6) {
box_mc.gotoAndStop(3);
klikArmy();
} else {
if (indi2.jenisBangunan == 7) {
box_mc.gotoAndStop(4);
klikWeapon();
} else {
if (indi2.jenisBangunan == 8) {
box_mc.gotoAndStop(5);
klikVehicle();
} else {
if (indi2.jenisBangunan == 10) {
box_mc.gotoAndStop(6);
klikSpell();
} else {
if (indi2.jenisBangunan == 11) {
box_mc.gotoAndStop(7);
klikDefense();
} else {
if (indi2.jenisBangunan == 12) {
klikSkill();
}
}
}
}
}
}
}
};
box_mc.upgrade_btn.onRelease = function () {
bisaBuat = true;
if (_root['xworker' + keKota] < box_mc.worker) {
if (indi2.jenisBangunan == 1) {
bisaBuat = true;
} else {
bisaBuat = false;
}
}
if (_root['xgold' + keKota] < box_mc.gold) {
bisaBuat = false;
}
if (_root['xwood' + keKota] < box_mc.wood) {
bisaBuat = false;
}
if (_root['xiron' + keKota] < box_mc.iron) {
bisaBuat = false;
}
if (bisaBuat == true) {
backBangun2();
++indi2.levelKe;
_root['xworker' + keKota] -= box_mc.worker;
_root['xgold' + keKota] -= box_mc.gold;
_root['xwood' + keKota] -= box_mc.wood;
_root['xiron' + keKota] -= box_mc.iron;
if (indi2.jenisBangunan == 1) {
_root['xworker' + keKota] += productionBuilding[_root[keKota + 'bangunan' + indi2.keBangunan].jenisBangunan];
}
xlevelBuilding[indi2.keBangunan][keKota] = indi2.levelKe;
box_mc._visible = false;
} else {
cekInfo('Can\'t upgrade this building, need more resources in this town');
}
if (sedangTutorial == true) {
if (belumUpgradeBangunan == false) {
cekTutorial(19);
_root[keKota + 'bangunan' + indi2.keBangunan].panah_mc._visible = false;
} else {
if (belumUpgradeBangunan2 == false) {
sudahSemuaTiga = true;
i = 1;
while (i <= maxBangunan) {
j = keKota;
if (xtipeBuilding[i][j] >= 1) {
if (xsudahJadiBuilding[i][j] == true) {
if (xlevelBuilding[i][j] <= 1) {
sudahSemuaTiga = false;
}
}
}
++i;
}
_root[keKota + 'bangunan' + indi2.keBangunan].panah_mc._visible = false;
if (sudahSemuaTiga == true) {
cekTutorial(20);
}
}
}
}
};
if (sedangTutorial == true) {
box_mc.sell_btn._visible = false;
} else {
box_mc.sell_btn._visible = true;
}
box_mc.sell_btn.onRelease = function () {
backDeal();
if (indi2.jenisBangunan == 1) {
_root['xworker' + keKota] -= productionBuilding[_root[keKota + 'bangunan' + indi2.keBangunan].jenisBangunan] * indi2.levelKe;
} else {
if (indi2.jenisBangunan == 12) {
_root['rangerAktif' + keKota] = false;
_root['tirelessAktif' + keKota] = false;
_root['armorPlusAktif' + keKota] = false;
_root['speedPlusAktif' + keKota] = false;
_root['entertainmentAktif' + keKota] = false;
_root['fastBuildAktif' + keKota] = false;
_root['rawPlusAktif' + keKota] = false;
_root['goldPlusAktif' + keKota] = false;
}
}
_root['xworker' + keKota] += costWorkerBuilding[indi2.jenisBangunan];
_root['xgold' + keKota] += Math.ceil(costGoldBuilding[indi2.jenisBangunan] * 0.5);
_root['xwood' + keKota] += Math.ceil(costWoodBuilding[indi2.jenisBangunan] * 0.5);
_root['xiron' + keKota] += Math.ceil(costIronBuilding[indi2.jenisBangunan] * 0.5);
xtipeBuilding[indi2.keBangunan][keKota] = 0;
box_mc._visible = false;
removeMovieClip(indi2);
cekAdaTipeBangunan();
};
box_mc.close_btn2._visible = true;
box_mc.close_btn2.onRelease = function () {
box_mc._visible = false;
};
info_mc._visible = false;
cekHilangDrag();
}
function cekHitBangunan() {
j = 1;
while (j <= maxSlot) {
obyek['slotGunung' + j].bisaPakai = true;
obyek['slotHutan' + j].bisaPakai = true;
obyek['slotKosong' + j].bisaPakai = true;
++j;
}
i = 1;
while (i <= maxBangunan) {
j = 1;
while (j <= maxSlot) {
if (_root[keKota + 'bangunan' + i].hitTest(obyek['slotGunung' + j].indi)) {
obyek['slotGunung' + j].bisaPakai = false;
} else {
if (_root[keKota + 'bangunan' + i].hitTest(obyek['slotHutan' + j].indi)) {
obyek['slotHutan' + j].bisaPakai = false;
} else {
if (_root[keKota + 'bangunan' + i].hitTest(obyek['slotKosong' + j].indi)) {
obyek['slotKosong' + j].bisaPakai = false;
}
}
}
++j;
}
++i;
}
if (sedangDrag == true) {
i = 1;
while (i <= maxSlot) {
if (pilihBangunanKe == 3) {
obyek['slotGunung' + i]._visible = true;
obyek['slotHutan' + i]._visible = false;
obyek['slotKosong' + i]._visible = false;
} else {
if (pilihBangunanKe == 4) {
obyek['slotGunung' + i]._visible = false;
obyek['slotHutan' + i]._visible = true;
obyek['slotKosong' + i]._visible = false;
} else {
obyek['slotGunung' + i]._visible = true;
obyek['slotHutan' + i]._visible = true;
obyek['slotKosong' + i]._visible = true;
}
}
++i;
}
} else {
i = 1;
while (i <= maxSlot) {
obyek['slotGunung' + i]._visible = false;
obyek['slotHutan' + i]._visible = false;
obyek['slotKosong' + i]._visible = false;
++i;
}
}
i = 1;
while (i <= maxSlot) {
if (obyek['slotGunung' + i].bisaPakai == false) {
obyek['slotGunung' + i]._visible = false;
}
if (obyek['slotHutan' + i].bisaPakai == false) {
obyek['slotHutan' + i]._visible = false;
}
if (obyek['slotKosong' + i].bisaPakai == false) {
obyek['slotKosong' + i]._visible = false;
}
++i;
}
}
function enterBangunan2() {
this._x += geserKiri;
this._y += geserAtas;
if (this.sudahJadi == false) {
if (akanSerangKota != true) {
if (_root['fastBuildAktif' + keKota] == true) {
this.maxBuat = lamaBuatBuilding2[this.jenisBangunan];
} else {
this.maxBuat = lamaBuatBuilding[this.jenisBangunan];
}
this.delayBuat += speedGame;
_root['bar' + this.keBangunan].bar._xscale = (this.delayBuat / this.maxBuat) * 100;
xdelayBuatBuilding[this.keBangunan][keKota] = this.delayBuat;
if (this.delayBuat >= this.maxBuat) {
backBangun2();
_root['bar' + this.keBangunan].gotoAndPlay(2);
_root['bar' + this.keBangunan].bar._xscale = 100;
this._alpha = 100;
this.enabled = true;
this.delayBuat = 0;
this.sudahJadi = true;
xsudahJadiBuilding[this.keBangunan][keKota] = this.sudahJadi;
if (this.jenisBangunan == 1) {
_root['xworker' + keKota] += productionBuilding[this.jenisBangunan];
}
if (this.jenisBangunan == 9) {
if (sideQuestKe == 6) {
cekMenangQuest(sideQuestKe);
}
}
if (this.jenisBangunan == 10) {
if (sideQuestKe == 9) {
cekMenangQuest(sideQuestKe);
}
}
if (this.jenisBangunan == 1) {
if (sedangTutorial == true) {
cekTutorial(6);
}
} else {
if (this.jenisBangunan == 2) {
if (sedangTutorial == true) {
cekTutorial(10);
}
} else {
if (this.jenisBangunan == 3) {
if (sedangTutorial == true) {
cekTutorial(14);
}
} else {
if (this.jenisBangunan == 4) {
if (sedangTutorial == true) {
cekTutorial(18);
}
} else {
if (this.jenisBangunan == 5) {
if (sedangTutorial == true) {
cekTutorial(24);
}
} else {
if (this.jenisBangunan == 7) {
if (sedangTutorial == true) {
cekTutorial(31);
}
} else {
if (this.jenisBangunan == 6) {
if (sedangTutorial == true) {
cekTutorial(37);
}
}
}
}
}
}
}
}
}
}
} else {
if (sedangTutorial == true) {
if (mulaiBisaKlikBuilding == false) {
this.enabled = false;
} else {
this.enabled = true;
}
} else {
if (box_mc._visible == true || akanSerangKota == true) {
this.enabled = false;
} else {
this.enabled = true;
}
}
}
if (bangunanAktif[this.jenisBangunan][keKota] == true) {
this.aktif_mc._visible = false;
} else {
this.aktif_mc._visible = true;
}
this.bintang_mc.gotoAndStop(this.levelKe);
this.swapDepths(10000 + this._x + this._y * 100);
}
function klikBuilding(indi) {
cekAdaTipeBangunan();
box_mc._visible = true;
box_mc.gotoAndStop(1);
if (indi == 'dua') {
box_mc.build_mc.gotoAndStop(2);
} else {
box_mc.build_mc.gotoAndStop(1);
}
box_mc.close_btn._visible = true;
box_mc.close_btn.onRelease = function () {
box_mc._visible = false;
info_mc2._visible = false;
};
cekBangunan();
cekHilangDrag();
if (sedangTutorial == true) {
if (sedangBuatKe == 1) {
cekTutorial(3);
} else {
if (sedangBuatKe == 2) {
cekTutorial(7);
} else {
if (sedangBuatKe == 3) {
cekTutorial(11);
} else {
if (sedangBuatKe == 4) {
cekTutorial(15);
} else {
if (sedangBuatKe == 5) {
cekTutorial(21);
} else {
if (sedangBuatKe == 6) {
cekTutorial(27);
} else {
if (sedangBuatKe == 8) {
cekTutorial(34);
}
}
}
}
}
}
}
}
info_mc2._visible = false;
}
function cekBangunan() {
i = 1;
while (i <= 12) {
box_mc.build_mc['worker' + i] = costWorkerBuilding[i];
box_mc.build_mc['gold' + i] = costGoldBuilding[i];
box_mc.build_mc['wood' + i] = costWoodBuilding[i];
box_mc.build_mc['iron' + i] = costIronBuilding[i];
box_mc.build_mc['bangunan' + i].onRelease = klikBangunan;
box_mc.build_mc['bangunan' + i].onRollOver = overBangunan;
box_mc.build_mc['bangunan' + i].onRollOut = outBangunan;
++i;
}
if (_root['risetArmory' + keKota] == false) {
box_mc.build_mc.bangunan7.gotoAndStop(2);
} else {
box_mc.build_mc.bangunan7.gotoAndStop(1);
}
if (_root['risetFactory' + keKota] == false) {
box_mc.build_mc.bangunan8.gotoAndStop(2);
} else {
box_mc.build_mc.bangunan8.gotoAndStop(1);
}
if (_root['risetPark' + keKota] == false) {
box_mc.build_mc.bangunan9.gotoAndStop(2);
} else {
box_mc.build_mc.bangunan9.gotoAndStop(1);
}
if (_root['risetTemple' + keKota] == false) {
box_mc.build_mc.bangunan10.gotoAndStop(2);
} else {
box_mc.build_mc.bangunan10.gotoAndStop(1);
}
if (_root['risetFortress' + keKota] == false) {
box_mc.build_mc.bangunan11.gotoAndStop(2);
} else {
box_mc.build_mc.bangunan11.gotoAndStop(1);
}
if (_root['risetLibrary' + keKota] == false) {
box_mc.build_mc.bangunan12.gotoAndStop(2);
} else {
box_mc.build_mc.bangunan12.gotoAndStop(1);
}
box_mc.next_btn.onRelease = function () {
box_mc.build_mc.gotoAndStop(2);
cekBangunan();
if (sedangTutorial == true) {
if (sedangBangunKe == 7) {
cekTutorial(28);
}
}
};
box_mc.prev_btn.onRelease = function () {
box_mc.build_mc.gotoAndStop(1);
cekBangunan();
};
info_mc2._visible = false;
}
function overBangunan() {
info_mc2._visible = true;
myStr = new String(this);
if (isNaN(myStr.substr(myStr.length - 2, 2))) {
indi = myStr.substr(myStr.length - 1, 1);
} else {
indi = myStr.substr(myStr.length - 2, 2);
}
info_mc2.xinfo = xinfoBuilding[indi];
}
function outBangunan() {
info_mc2._visible = false;
}
function klikRiset(indi) {
cekAdaTipeBangunan();
box_mc._visible = true;
box_mc.gotoAndStop(2);
box_mc.close_btn._visible = true;
box_mc.close_btn.onRelease = function () {
box_mc._visible = false;
};
if (adaLab == true) {
if (indi == 'ketiga') {
box_mc.riset_mc.gotoAndStop(3);
} else {
if (indi == 'kedua') {
box_mc.riset_mc.gotoAndStop(2);
} else {
box_mc.riset_mc.gotoAndStop(1);
}
}
box_mc.study_mc._visible = true;
} else {
box_mc.riset_mc.gotoAndStop(10);
box_mc.study_mc._visible = false;
}
cekRiset();
cekHilangDrag();
if (sedangTutorial == true) {
if (sedangBuatKe == 6) {
cekTutorial(25);
}
}
info_mc2._visible = false;
}
function cekRiset() {
i = 1;
while (i <= 18) {
box_mc.riset_mc['gold' + i] = butuhMoneyBuilding[i];
box_mc.riset_mc['tech' + i] = butuhTechBuilding[i];
box_mc.riset_mc['riset' + i].onRelease = klikRisetBuilding;
if (i == 1) {
if (_root['risetArmory' + keKota] == true) {
box_mc.riset_mc['riset' + i].gotoAndStop(3);
box_mc.riset_mc['riset' + i].enabled = false;
} else {
box_mc.riset_mc['riset' + i].gotoAndStop(1);
box_mc.riset_mc['riset' + i].enabled = true;
}
} else {
if (i == 2) {
if (_root['risetFactory' + keKota] == true) {
box_mc.riset_mc['riset' + i].gotoAndStop(3);
box_mc.riset_mc['riset' + i].enabled = false;
} else {
box_mc.riset_mc['riset' + i].gotoAndStop(1);
box_mc.riset_mc['riset' + i].enabled = true;
}
} else {
if (i == 3) {
if (_root['risetPark' + keKota] == true) {
box_mc.riset_mc['riset' + i].gotoAndStop(3);
box_mc.riset_mc['riset' + i].enabled = false;
} else {
box_mc.riset_mc['riset' + i].gotoAndStop(1);
box_mc.riset_mc['riset' + i].enabled = true;
}
} else {
if (i == 4) {
if (_root['risetTemple' + keKota] == true) {
box_mc.riset_mc['riset' + i].gotoAndStop(3);
box_mc.riset_mc['riset' + i].enabled = false;
} else {
box_mc.riset_mc['riset' + i].gotoAndStop(1);
box_mc.riset_mc['riset' + i].enabled = true;
}
} else {
if (i == 5) {
if (_root['risetFortress' + keKota] == true) {
box_mc.riset_mc['riset' + i].gotoAndStop(3);
box_mc.riset_mc['riset' + i].enabled = false;
} else {
box_mc.riset_mc['riset' + i].gotoAndStop(1);
box_mc.riset_mc['riset' + i].enabled = true;
}
} else {
if (i == 6) {
if (_root['risetLibrary' + keKota] == true) {
box_mc.riset_mc['riset' + i].gotoAndStop(3);
box_mc.riset_mc['riset' + i].enabled = false;
} else {
box_mc.riset_mc['riset' + i].gotoAndStop(1);
box_mc.riset_mc['riset' + i].enabled = true;
}
} else {
if (i == 7) {
if (_root['risetZombie' + keKota] == true) {
box_mc.riset_mc['riset' + i].gotoAndStop(3);
box_mc.riset_mc['riset' + i].enabled = false;
} else {
box_mc.riset_mc['riset' + i].gotoAndStop(1);
box_mc.riset_mc['riset' + i].enabled = true;
}
} else {
if (i == 8) {
if (_root['risetCatapult' + keKota] == true) {
box_mc.riset_mc['riset' + i].gotoAndStop(3);
box_mc.riset_mc['riset' + i].enabled = false;
} else {
box_mc.riset_mc['riset' + i].gotoAndStop(1);
box_mc.riset_mc['riset' + i].enabled = true;
}
} else {
if (i == 9) {
if (_root['risetFireTrap' + keKota] == true) {
box_mc.riset_mc['riset' + i].gotoAndStop(3);
box_mc.riset_mc['riset' + i].enabled = false;
} else {
box_mc.riset_mc['riset' + i].gotoAndStop(1);
box_mc.riset_mc['riset' + i].enabled = true;
}
} else {
if (i == 10) {
if (_root['risetTank' + keKota] == true) {
box_mc.riset_mc['riset' + i].gotoAndStop(3);
box_mc.riset_mc['riset' + i].enabled = false;
} else {
box_mc.riset_mc['riset' + i].gotoAndStop(1);
box_mc.riset_mc['riset' + i].enabled = true;
}
} else {
if (i == 11) {
if (_root['risetCopter' + keKota] == true) {
box_mc.riset_mc['riset' + i].gotoAndStop(3);
box_mc.riset_mc['riset' + i].enabled = false;
} else {
box_mc.riset_mc['riset' + i].gotoAndStop(1);
box_mc.riset_mc['riset' + i].enabled = true;
}
} else {
if (i == 12) {
if (_root['risetMonbot' + keKota] == true) {
box_mc.riset_mc['riset' + i].gotoAndStop(3);
box_mc.riset_mc['riset' + i].enabled = false;
} else {
box_mc.riset_mc['riset' + i].gotoAndStop(1);
box_mc.riset_mc['riset' + i].enabled = true;
}
} else {
if (i == 13) {
if (_root['risetFastBuild' + keKota] == true) {
box_mc.riset_mc['riset' + i].gotoAndStop(3);
box_mc.riset_mc['riset' + i].enabled = false;
} else {
box_mc.riset_mc['riset' + i].gotoAndStop(1);
box_mc.riset_mc['riset' + i].enabled = true;
}
} else {
if (i == 14) {
if (_root['risetRawPlus' + keKota] == true) {
box_mc.riset_mc['riset' + i].gotoAndStop(3);
box_mc.riset_mc['riset' + i].enabled = false;
} else {
box_mc.riset_mc['riset' + i].gotoAndStop(1);
box_mc.riset_mc['riset' + i].enabled = true;
}
} else {
if (i == 15) {
if (_root['risetGoldPlus' + keKota] == true) {
box_mc.riset_mc['riset' + i].gotoAndStop(3);
box_mc.riset_mc['riset' + i].enabled = false;
} else {
box_mc.riset_mc['riset' + i].gotoAndStop(1);
box_mc.riset_mc['riset' + i].enabled = true;
}
} else {
if (i == 16) {
if (_root['risetInvisible' + keKota] == true) {
box_mc.riset_mc['riset' + i].gotoAndStop(3);
box_mc.riset_mc['riset' + i].enabled = false;
} else {
box_mc.riset_mc['riset' + i].gotoAndStop(1);
box_mc.riset_mc['riset' + i].enabled = true;
}
} else {
if (i == 17) {
if (_root['risetSpecialAttack' + keKota] == true) {
box_mc.riset_mc['riset' + i].gotoAndStop(3);
box_mc.riset_mc['riset' + i].enabled = false;
} else {
box_mc.riset_mc['riset' + i].gotoAndStop(1);
box_mc.riset_mc['riset' + i].enabled = true;
}
} else {
if (i == 18) {
if (_root['risetDuplicate' + keKota] == true) {
box_mc.riset_mc['riset' + i].gotoAndStop(3);
box_mc.riset_mc['riset' + i].enabled = false;
} else {
box_mc.riset_mc['riset' + i].gotoAndStop(1);
box_mc.riset_mc['riset' + i].enabled = true;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
++i;
}
box_mc.riset_mc.building_btn.onRelease = function () {
box_mc.riset_mc.gotoAndStop(1);
cekRiset();
};
box_mc.riset_mc.military_btn.onRelease = function () {
box_mc.riset_mc.gotoAndStop(2);
cekRiset();
};
box_mc.riset_mc.others_btn.onRelease = function () {
box_mc.riset_mc.gotoAndStop(3);
cekRiset();
};
box_mc.riset_mc.build_btn.onRelease = function () {
klikBuilding();
};
info_mc2._visible = false;
}
function klikRisetBuilding() {
myStr = new String(this);
if (isNaN(myStr.substr(myStr.length - 2, 2))) {
indi = myStr.substr(myStr.length - 1, 1);
} else {
indi = myStr.substr(myStr.length - 2, 2);
}
bisaRiset = true;
if (_root['xgold' + keKota] < butuhMoneyBuilding[indi]) {
bisaRiset = false;
}
if (_root['xtech' + keKota] < butuhTechBuilding[indi]) {
bisaRiset = false;
}
if (bisaRiset == true) {
backMoney();
_root['xgold' + keKota] -= butuhMoneyBuilding[indi];
_root['xtech' + keKota] -= butuhTechBuilding[indi];
if (indi == 1) {
_root['risetArmory' + keKota] = true;
} else {
if (indi == 2) {
if (sideQuestKe == 3) {
cekMenangQuest(sideQuestKe);
}
_root['risetFactory' + keKota] = true;
} else {
if (indi == 3) {
_root['risetPark' + keKota] = true;
} else {
if (indi == 4) {
_root['risetTemple' + keKota] = true;
} else {
if (indi == 5) {
_root['risetFortress' + keKota] = true;
} else {
if (indi == 6) {
_root['risetLibrary' + keKota] = true;
} else {
if (indi == 7) {
_root['risetZombie' + keKota] = true;
} else {
if (indi == 8) {
_root['risetCatapult' + keKota] = true;
} else {
if (indi == 9) {
_root['risetFireTrap' + keKota] = true;
} else {
if (indi == 10) {
_root['risetTank' + keKota] = true;
} else {
if (indi == 11) {
_root['risetCopter' + keKota] = true;
} else {
if (indi == 12) {
_root['risetMonbot' + keKota] = true;
} else {
if (indi == 13) {
_root['risetFastBuild' + keKota] = true;
} else {
if (indi == 14) {
_root['risetRawPlus' + keKota] = true;
} else {
if (indi == 15) {
_root['risetGoldPlus' + keKota] = true;
} else {
if (indi == 16) {
_root['risetInvisible' + keKota] = true;
} else {
if (indi == 17) {
_root['risetSpecialAttack' + keKota] = true;
} else {
if (indi == 18) {
_root['risetDuplicate' + keKota] = true;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
box_mc._visible = false;
if (sedangTutorial == true) {
if (sedangBangunKe == 6) {
cekTutorial(26);
}
}
} else {
cekInfo('Can\'t research this, need more resources in this town');
}
info_mc2._visible = false;
}
function klikArmy() {
cekAdaTipeBangunan();
box_mc._visible = true;
box_mc.gotoAndStop(3);
box_mc.close_btn._visible = true;
box_mc.close_btn.onRelease = function () {
box_mc._visible = false;
};
box_mc.soldiers_mc.worker1 = produksiArmy;
box_mc.soldiers_mc.worker2 = produksiArmy;
box_mc.soldiers_mc.worker3 = produksiArmy;
box_mc.soldiers_mc.worker4 = produksiArmy;
box_mc.soldiers_mc.lima1.xangka = produksiArmy;
box_mc.soldiers_mc.lima2.xangka = produksiArmy;
box_mc.soldiers_mc.lima3.xangka = produksiArmy;
box_mc.soldiers_mc.lima4.xangka = produksiArmy;
box_mc.soldiers_mc.limapuluh1.xangka = produksiArmy * 10;
box_mc.soldiers_mc.limapuluh2.xangka = produksiArmy * 10;
box_mc.soldiers_mc.limapuluh3.xangka = produksiArmy * 10;
box_mc.soldiers_mc.limapuluh4.xangka = produksiArmy * 10;
box_mc.soldiers_mc.lima1.gotoAndStop(2);
box_mc.soldiers_mc.lima2.gotoAndStop(2);
box_mc.soldiers_mc.lima3.gotoAndStop(2);
box_mc.soldiers_mc.lima4.gotoAndStop(2);
box_mc.soldiers_mc.limapuluh1.gotoAndStop(1);
box_mc.soldiers_mc.limapuluh2.gotoAndStop(1);
box_mc.soldiers_mc.limapuluh3.gotoAndStop(1);
box_mc.soldiers_mc.limapuluh4.gotoAndStop(1);
produksi1 = produksiArmy;
box_mc.soldiers_mc.lima1.gotoAndStop(2);
box_mc.soldiers_mc.limapuluh1.gotoAndStop(1);
box_mc.soldiers_mc.worker1 = produksi1;
box_mc.soldiers_mc.lima1.xangka = produksiArmy;
box_mc.soldiers_mc.gold1 = butuhGoldArmy[1];
produksi2 = produksiArmy;
box_mc.soldiers_mc.lima2.gotoAndStop(2);
box_mc.soldiers_mc.limapuluh2.gotoAndStop(1);
box_mc.soldiers_mc.worker2 = produksi2;
box_mc.soldiers_mc.lima2.xangka = produksiArmy;
box_mc.soldiers_mc.xsword = produksiArmy;
box_mc.soldiers_mc.gold2 = butuhGoldArmy[2];
produksi3 = produksiArmy;
box_mc.soldiers_mc.lima3.gotoAndStop(2);
box_mc.soldiers_mc.limapuluh3.gotoAndStop(1);
box_mc.soldiers_mc.worker3 = produksi3;
box_mc.soldiers_mc.lima3.xangka = produksiArmy;
box_mc.soldiers_mc.xarrow = produksiArmy;
box_mc.soldiers_mc.gold3 = butuhGoldArmy[3];
produksi4 = produksiArmy;
box_mc.soldiers_mc.lima4.gotoAndStop(2);
box_mc.soldiers_mc.limapuluh4.gotoAndStop(1);
box_mc.soldiers_mc.worker4 = produksi4;
box_mc.soldiers_mc.lima4.xangka = produksiArmy;
box_mc.soldiers_mc.xspear = produksiArmy;
box_mc.soldiers_mc.gold4 = butuhGoldArmy[4];
box_mc.soldiers_mc.gold1 = butuhGoldArmy[1];
box_mc.soldiers_mc.gold2 = butuhGoldArmy[2];
box_mc.soldiers_mc.gold3 = butuhGoldArmy[3];
box_mc.soldiers_mc.gold4 = butuhGoldArmy[4];
if (adaBarak == true) {
box_mc.soldiers_mc.gotoAndStop(1);
cekArmy();
} else {
box_mc.soldiers_mc.gotoAndStop(10);
box_mc.soldiers_mc.xlevel = '';
box_mc.soldiers_mc.build_btn.onRelease = function () {
klikBuilding();
};
}
cekHilangDrag();
if (sedangTutorial == true) {
if (sedangBuatKe == 9) {
cekTutorial(38);
}
}
info_mc2._visible = false;
}
function cekArmy() {
i = 1;
while (i <= maxBangunan) {
if (xtipeBuilding[i][keKota] == 6) {
pilihanBangunanKe = i;
i = maxBangunan;
}
++i;
}
levelBarrackIni = xlevelBuilding[pilihanBangunanKe][keKota];
box_mc.soldiers_mc.xlevel = 'BARRACK LEVEL ' + levelBarrackIni;
box_mc.soldiers_mc.pasukan1 = _root['xbareman' + keKota];
box_mc.soldiers_mc.pasukan2 = _root['xswordman' + keKota];
box_mc.soldiers_mc.pasukan3 = _root['xarrowman' + keKota];
box_mc.soldiers_mc.pasukan4 = _root['xspearman' + keKota];
if (box_mc.soldiers_mc.pasukan1 > 0) {
box_mc.soldiers_mc.power1 = _root['xbaremanPower' + keKota];
} else {
box_mc.soldiers_mc.power1 = 0;
}
if (box_mc.soldiers_mc.pasukan2 > 0) {
box_mc.soldiers_mc.power2 = _root['xswordmanPower' + keKota];
} else {
box_mc.soldiers_mc.power2 = 0;
}
if (box_mc.soldiers_mc.pasukan3 > 0) {
box_mc.soldiers_mc.power3 = _root['xarrowmanPower' + keKota];
} else {
box_mc.soldiers_mc.power3 = 0;
}
if (box_mc.soldiers_mc.pasukan4 > 0) {
box_mc.soldiers_mc.power4 = _root['xspearmanPower' + keKota];
} else {
box_mc.soldiers_mc.power4 = 0;
}
box_mc.soldiers_mc.xsword = produksiArmy;
box_mc.soldiers_mc.xarrow = produksiArmy;
box_mc.soldiers_mc.xspear = produksiArmy;
box_mc.soldiers_mc.goldTrain1 = butuhGoldTrain[1];
box_mc.soldiers_mc.goldTrain2 = butuhGoldTrain[2];
box_mc.soldiers_mc.goldTrain3 = butuhGoldTrain[3];
box_mc.soldiers_mc.goldTrain4 = butuhGoldTrain[4];
if (levelBarrackIni <= 1) {
box_mc.soldiers_mc.recruit1.enabled = true;
box_mc.soldiers_mc.train1.enabled = true;
box_mc.soldiers_mc.recruit2.enabled = true;
box_mc.soldiers_mc.train2.enabled = true;
box_mc.soldiers_mc.recruit3.enabled = false;
box_mc.soldiers_mc.train3.enabled = false;
box_mc.soldiers_mc.recruit4.enabled = false;
box_mc.soldiers_mc.train4.enabled = false;
box_mc.soldiers_mc.jenisTentara1.gotoAndStop(1);
box_mc.soldiers_mc.jenisTentara2.gotoAndStop(1);
box_mc.soldiers_mc.jenisTentara3.gotoAndStop(2);
box_mc.soldiers_mc.jenisTentara4.gotoAndStop(2);
box_mc.soldiers_mc.auto1.enabled = true;
box_mc.soldiers_mc.auto2.enabled = true;
box_mc.soldiers_mc.auto3.enabled = false;
box_mc.soldiers_mc.auto4.enabled = false;
} else {
if (levelBarrackIni <= 2) {
box_mc.soldiers_mc.recruit1.enabled = true;
box_mc.soldiers_mc.train1.enabled = true;
box_mc.soldiers_mc.recruit2.enabled = true;
box_mc.soldiers_mc.train2.enabled = true;
box_mc.soldiers_mc.recruit3.enabled = true;
box_mc.soldiers_mc.train3.enabled = true;
box_mc.soldiers_mc.recruit4.enabled = false;
box_mc.soldiers_mc.train4.enabled = false;
box_mc.soldiers_mc.jenisTentara1.gotoAndStop(1);
box_mc.soldiers_mc.jenisTentara2.gotoAndStop(1);
box_mc.soldiers_mc.jenisTentara3.gotoAndStop(1);
box_mc.soldiers_mc.jenisTentara4.gotoAndStop(2);
box_mc.soldiers_mc.auto1.enabled = true;
box_mc.soldiers_mc.auto2.enabled = true;
box_mc.soldiers_mc.auto3.enabled = true;
box_mc.soldiers_mc.auto4.enabled = false;
} else {
if (levelBarrackIni <= 3) {
box_mc.soldiers_mc.recruit1.enabled = true;
box_mc.soldiers_mc.train1.enabled = true;
box_mc.soldiers_mc.recruit2.enabled = true;
box_mc.soldiers_mc.train2.enabled = true;
box_mc.soldiers_mc.recruit3.enabled = true;
box_mc.soldiers_mc.train3.enabled = true;
box_mc.soldiers_mc.recruit4.enabled = true;
box_mc.soldiers_mc.train4.enabled = true;
box_mc.soldiers_mc.jenisTentara1.gotoAndStop(1);
box_mc.soldiers_mc.jenisTentara2.gotoAndStop(1);
box_mc.soldiers_mc.jenisTentara3.gotoAndStop(1);
box_mc.soldiers_mc.jenisTentara4.gotoAndStop(1);
box_mc.soldiers_mc.auto1.enabled = true;
box_mc.soldiers_mc.auto2.enabled = true;
box_mc.soldiers_mc.auto3.enabled = true;
box_mc.soldiers_mc.auto4.enabled = true;
}
}
}
if (_root['autoBareman' + keKota] == true) {
box_mc.soldiers_mc.auto1.gotoAndStop(1);
box_mc.soldiers_mc.recruit1.enabled = false;
} else {
box_mc.soldiers_mc.auto1.gotoAndStop(2);
if (box_mc.soldiers_mc.recruit1.enabled == true) {
box_mc.soldiers_mc.recruit1.enabled = true;
}
}
if (_root['autoSwordman' + keKota] == true) {
box_mc.soldiers_mc.auto2.gotoAndStop(1);
box_mc.soldiers_mc.recruit2.enabled = false;
} else {
box_mc.soldiers_mc.auto2.gotoAndStop(2);
if (box_mc.soldiers_mc.recruit2.enabled == true) {
box_mc.soldiers_mc.recruit2.enabled = true;
}
}
if (_root['autoArrowman' + keKota] == true) {
box_mc.soldiers_mc.auto3.gotoAndStop(1);
box_mc.soldiers_mc.recruit3.enabled = false;
} else {
box_mc.soldiers_mc.auto3.gotoAndStop(2);
if (box_mc.soldiers_mc.recruit3.enabled == true) {
box_mc.soldiers_mc.recruit3.enabled = true;
}
}
if (_root['autoSpearman' + keKota] == true) {
box_mc.soldiers_mc.auto4.gotoAndStop(1);
box_mc.soldiers_mc.recruit4.enabled = false;
} else {
box_mc.soldiers_mc.auto4.gotoAndStop(2);
if (box_mc.soldiers_mc.recruit4.enabled == true) {
box_mc.soldiers_mc.recruit4.enabled = true;
}
}
box_mc.soldiers_mc.auto1.onRelease = function () {
if (_root['autoBareman' + keKota] == true) {
_root['autoBareman' + keKota] = false;
box_mc.soldiers_mc.auto1.gotoAndStop(2);
} else {
_root['autoBareman' + keKota] = true;
box_mc.soldiers_mc.auto1.gotoAndStop(1);
}
cekArmy();
};
box_mc.soldiers_mc.auto2.onRelease = function () {
if (_root['autoSwordman' + keKota] == true) {
_root['autoSwordman' + keKota] = false;
box_mc.soldiers_mc.auto2.gotoAndStop(2);
} else {
_root['autoSwordman' + keKota] = true;
box_mc.soldiers_mc.auto2.gotoAndStop(1);
}
cekArmy();
};
box_mc.soldiers_mc.auto3.onRelease = function () {
if (_root['autoArrowman' + keKota] == true) {
_root['autoArrowman' + keKota] = false;
box_mc.soldiers_mc.auto3.gotoAndStop(2);
} else {
_root['autoArrowman' + keKota] = true;
box_mc.soldiers_mc.auto3.gotoAndStop(1);
}
cekArmy();
};
box_mc.soldiers_mc.auto4.onRelease = function () {
if (_root['autoSpearman' + keKota] == true) {
_root['autoSpearman' + keKota] = false;
box_mc.soldiers_mc.auto4.gotoAndStop(2);
} else {
_root['autoSpearman' + keKota] = true;
box_mc.soldiers_mc.auto4.gotoAndStop(1);
}
cekArmy();
};
if (sedangTutorial == true) {
box_mc.soldiers_mc.lima1.enabled = false;
box_mc.soldiers_mc.lima2.enabled = false;
box_mc.soldiers_mc.lima3.enabled = false;
box_mc.soldiers_mc.lima4.enabled = false;
box_mc.soldiers_mc.limapuluh1.enabled = false;
box_mc.soldiers_mc.limapuluh2.enabled = false;
box_mc.soldiers_mc.limapuluh3.enabled = false;
box_mc.soldiers_mc.limapuluh4.enabled = false;
}
box_mc.soldiers_mc.lima1.onRelease = function () {
produksi1 = produksiArmy;
box_mc.soldiers_mc.lima1.gotoAndStop(2);
box_mc.soldiers_mc.limapuluh1.gotoAndStop(1);
box_mc.soldiers_mc.worker1 = produksi1;
box_mc.soldiers_mc.lima1.xangka = produksiArmy;
box_mc.soldiers_mc.gold1 = butuhGoldArmy[1];
};
box_mc.soldiers_mc.lima2.onRelease = function () {
produksi2 = produksiArmy;
box_mc.soldiers_mc.lima2.gotoAndStop(2);
box_mc.soldiers_mc.limapuluh2.gotoAndStop(1);
box_mc.soldiers_mc.worker2 = produksi2;
box_mc.soldiers_mc.lima2.xangka = produksiArmy;
box_mc.soldiers_mc.xsword = produksiArmy;
box_mc.soldiers_mc.gold2 = butuhGoldArmy[2];
};
box_mc.soldiers_mc.lima3.onRelease = function () {
produksi3 = produksiArmy;
box_mc.soldiers_mc.lima3.gotoAndStop(2);
box_mc.soldiers_mc.limapuluh3.gotoAndStop(1);
box_mc.soldiers_mc.worker3 = produksi3;
box_mc.soldiers_mc.lima3.xangka = produksiArmy;
box_mc.soldiers_mc.xarrow = produksiArmy;
box_mc.soldiers_mc.gold3 = butuhGoldArmy[3];
};
box_mc.soldiers_mc.lima4.onRelease = function () {
produksi4 = produksiArmy;
box_mc.soldiers_mc.lima4.gotoAndStop(2);
box_mc.soldiers_mc.limapuluh4.gotoAndStop(1);
box_mc.soldiers_mc.worker4 = produksi4;
box_mc.soldiers_mc.lima4.xangka = produksiArmy;
box_mc.soldiers_mc.xspear = produksiArmy;
box_mc.soldiers_mc.gold4 = butuhGoldArmy[4];
};
box_mc.soldiers_mc.limapuluh1.onRelease = function () {
produksi1 = produksiArmy * 10;
box_mc.soldiers_mc.lima1.gotoAndStop(1);
box_mc.soldiers_mc.limapuluh1.gotoAndStop(2);
box_mc.soldiers_mc.worker1 = produksi1;
box_mc.soldiers_mc.limapuluh1.xangka = produksiArmy * 10;
box_mc.soldiers_mc.gold1 = butuhGoldArmy[1] * 10;
};
box_mc.soldiers_mc.limapuluh2.onRelease = function () {
produksi2 = produksiArmy * 10;
box_mc.soldiers_mc.lima2.gotoAndStop(1);
box_mc.soldiers_mc.limapuluh2.gotoAndStop(2);
box_mc.soldiers_mc.worker2 = produksi2;
box_mc.soldiers_mc.limapuluh2.xangka = produksiArmy * 10;
box_mc.soldiers_mc.xsword = produksiArmy * 10;
box_mc.soldiers_mc.gold2 = butuhGoldArmy[2] * 10;
};
box_mc.soldiers_mc.limapuluh3.onRelease = function () {
produksi3 = produksiArmy * 10;
box_mc.soldiers_mc.lima3.gotoAndStop(1);
box_mc.soldiers_mc.limapuluh3.gotoAndStop(2);
box_mc.soldiers_mc.worker3 = produksi3;
box_mc.soldiers_mc.limapuluh3.xangka = produksiArmy * 10;
box_mc.soldiers_mc.xarrow = produksiArmy * 10;
box_mc.soldiers_mc.gold3 = butuhGoldArmy[3] * 10;
};
box_mc.soldiers_mc.limapuluh4.onRelease = function () {
produksi4 = produksiArmy * 10;
box_mc.soldiers_mc.lima4.gotoAndStop(1);
box_mc.soldiers_mc.limapuluh4.gotoAndStop(2);
box_mc.soldiers_mc.worker4 = produksi4;
box_mc.soldiers_mc.limapuluh4.xangka = produksiArmy * 10;
box_mc.soldiers_mc.xspear = produksiArmy * 10;
box_mc.soldiers_mc.gold4 = butuhGoldArmy[4] * 10;
};
box_mc.soldiers_mc.recruit1.onRollOver = function () {
info_mc2._visible = true;
info_mc2.xinfo = xinfoTroops[1];
};
box_mc.soldiers_mc.recruit1.onRollOut = function () {
info_mc2._visible = false;
};
box_mc.soldiers_mc.recruit1.onRelease = function () {
bisaRecruit = true;
if (_root['xworker' + keKota] < box_mc.soldiers_mc.worker1) {
bisaRecruit = false;
}
if (_root['xgold' + keKota] < box_mc.soldiers_mc.gold1) {
bisaRecruit = false;
}
if (bisaRecruit == true) {
backMoney();
_root['xworker' + keKota] -= box_mc.soldiers_mc.worker1;
_root['xgold' + keKota] -= box_mc.soldiers_mc.gold1;
if (sedangTutorial == true) {
_root['xbareman' + keKota] += box_mc.soldiers_mc.worker1 * 5;
} else {
_root['xbareman' + keKota] += box_mc.soldiers_mc.worker1;
}
_root['xbaremanPower' + keKota] -= 5;
if (_root['xbaremanPower' + keKota] <= _root['xbaremanPowerLow' + keKota]) {
_root['xbaremanPower' + keKota] = _root['xbaremanPowerLow' + keKota];
}
if (sedangTutorial == true) {
tutorial_mc.panah1._visible = false;
box_mc.soldiers_mc.recruit1.enabled = false;
if (_root['xbareman' + keKota] > 0 && _root['xswordman' + keKota] > 0) {
box_mc._visible = false;
cekTutorial(39);
}
} else {
cekArmy();
}
info_mc2._visible = false;
} else {
cekInfo('Can\'t recruit this soldiers, need more resources in this town');
}
};
box_mc.soldiers_mc.recruit2.onRollOver = function () {
info_mc2._visible = true;
info_mc2.xinfo = xinfoTroops[2];
};
box_mc.soldiers_mc.recruit2.onRollOut = function () {
info_mc2._visible = false;
};
box_mc.soldiers_mc.recruit2.onRelease = function () {
bisaRecruit = true;
if (_root['xworker' + keKota] < box_mc.soldiers_mc.worker2) {
bisaRecruit = false;
}
if (_root['xgold' + keKota] < box_mc.soldiers_mc.gold2) {
bisaRecruit = false;
}
if (_root['xsword' + keKota] < box_mc.soldiers_mc.xsword) {
bisaRecruit = false;
}
if (bisaRecruit == true) {
backMoney();
_root['xworker' + keKota] -= box_mc.soldiers_mc.worker2;
_root['xgold' + keKota] -= box_mc.soldiers_mc.gold2;
if (sedangTutorial == true) {
_root['xsword' + keKota] -= box_mc.soldiers_mc.xsword * 3;
_root['xswordman' + keKota] += box_mc.soldiers_mc.worker2 * 3;
} else {
_root['xsword' + keKota] -= box_mc.soldiers_mc.xsword;
_root['xswordman' + keKota] += box_mc.soldiers_mc.worker2;
}
_root['xswordmanPower' + keKota] -= 5;
if (_root['xswordmanPower' + keKota] <= _root['xswordmanPowerLow' + keKota]) {
_root['xswordmanPower' + keKota] = _root['xswordmanPowerLow' + keKota];
}
if (sedangTutorial == true) {
tutorial_mc.panah2._visible = false;
box_mc.soldiers_mc.recruit2.enabled = false;
if (_root['xbareman' + keKota] > 0 && _root['xswordman' + keKota] > 0) {
box_mc._visible = false;
cekTutorial(39);
}
} else {
cekArmy();
}
info_mc2._visible = false;
} else {
cekInfo('Can\'t recruit this soldiers, need more resources in this town');
}
};
box_mc.soldiers_mc.recruit3.onRollOver = function () {
info_mc2._visible = true;
info_mc2.xinfo = xinfoTroops[3];
};
box_mc.soldiers_mc.recruit3.onRollOut = function () {
info_mc2._visible = false;
};
box_mc.soldiers_mc.recruit3.onRelease = function () {
bisaRecruit = true;
if (_root['xworker' + keKota] < box_mc.soldiers_mc.worker3) {
bisaRecruit = false;
}
if (_root['xgold' + keKota] < box_mc.soldiers_mc.gold3) {
bisaRecruit = false;
}
if (_root['xarrow' + keKota] < box_mc.soldiers_mc.xarrow) {
bisaRecruit = false;
}
if (bisaRecruit == true) {
backMoney();
_root['xworker' + keKota] -= box_mc.soldiers_mc.worker3;
_root['xgold' + keKota] -= box_mc.soldiers_mc.gold3;
_root['xarrow' + keKota] -= box_mc.soldiers_mc.xarrow;
_root['xarrowman' + keKota] += box_mc.soldiers_mc.worker3;
_root['xarrowmanPower' + keKota] -= 5;
if (_root['xarrowmanPower' + keKota] <= _root['xarrowmanPowerLow' + keKota]) {
_root['xarrowmanPower' + keKota] = _root['xarrowmanPowerLow' + keKota];
}
cekArmy();
info_mc2._visible = false;
} else {
cekInfo('Can\'t recruit this soldiers, need more resources in this town');
}
};
box_mc.soldiers_mc.recruit4.onRollOver = function () {
info_mc2._visible = true;
info_mc2.xinfo = xinfoTroops[4];
};
box_mc.soldiers_mc.recruit4.onRollOut = function () {
info_mc2._visible = false;
};
box_mc.soldiers_mc.recruit4.onRelease = function () {
bisaRecruit = true;
if (_root['xworker' + keKota] < box_mc.soldiers_mc.worker4) {
bisaRecruit = false;
}
if (_root['xgold' + keKota] < box_mc.soldiers_mc.gold4) {
bisaRecruit = false;
}
if (_root['xspear' + keKota] < box_mc.soldiers_mc.xspear) {
bisaRecruit = false;
}
if (bisaRecruit == true) {
backMoney();
_root['xworker' + keKota] -= box_mc.soldiers_mc.worker4;
_root['xgold' + keKota] -= box_mc.soldiers_mc.gold4;
_root['xspear' + keKota] -= box_mc.soldiers_mc.xspear;
_root['xspearman' + keKota] += box_mc.soldiers_mc.worker4;
_root['xspearmanPower' + keKota] -= 5;
if (_root['xspearmanPower' + keKota] <= _root['xspearmanPowerLow' + keKota]) {
_root['xspearmanPower' + keKota] = _root['xspearmanPowerLow' + keKota];
}
cekArmy();
info_mc2._visible = false;
} else {
cekInfo('Can\'t recruit this soldiers, need more resources in this town');
}
};
box_mc.soldiers_mc.train1.onRelease = function () {
bisaRecruit = true;
if (_root['xgold' + keKota] < box_mc.soldiers_mc.goldTrain1) {
bisaRecruit = false;
}
if (bisaRecruit == true) {
if (_root['xbaremanPower' + keKota] < _root['xbaremanPowerMax' + keKota]) {
if (_root['xbareman' + keKota] > 0) {
backTrain();
_root['xgold' + keKota] -= box_mc.soldiers_mc.goldTrain1;
_root['xbaremanPower' + keKota] += 10;
if (_root['xbaremanPower' + keKota] >= _root['xbaremanPowerMax' + keKota]) {
_root['xbaremanPower' + keKota] = _root['xbaremanPowerMax' + keKota];
}
if (sideQuestKe == 2) {
cekMenangQuest(sideQuestKe);
}
cekArmy();
info_mc2._visible = false;
} else {
cekInfo('There\'s no bareman in this town, can\'t train');
}
} else {
cekInfo('Can\'t train this soldiers anymore, the powers are maximum');
}
} else {
cekInfo('Can\'t train this soldiers, need more resources in this town');
}
};
box_mc.soldiers_mc.train2.onRelease = function () {
bisaRecruit = true;
if (_root['xgold' + keKota] < box_mc.soldiers_mc.goldTrain2) {
bisaRecruit = false;
}
if (bisaRecruit == true) {
if (_root['xswordmanPower' + keKota] < _root['xswordmanPowerMax' + keKota]) {
if (_root['xswordman' + keKota] > 0) {
backTrain();
_root['xgold' + keKota] -= box_mc.soldiers_mc.goldTrain2;
_root['xswordmanPower' + keKota] += 10;
if (_root['xswordmanPower' + keKota] >= _root['xswordmanPowerMax' + keKota]) {
_root['xswordmanPower' + keKota] = _root['xswordmanPowerMax' + keKota];
}
if (sideQuestKe == 2) {
cekMenangQuest(sideQuestKe);
}
cekArmy();
info_mc2._visible = false;
} else {
cekInfo('There\'s no swordman in this town, can\'t train');
}
} else {
cekInfo('Can\'t train this soldiers anymore, the powers are maximum');
}
} else {
cekInfo('Can\'t train this soldiers, need more resources in this town');
}
};
box_mc.soldiers_mc.train3.onRelease = function () {
bisaRecruit = true;
if (_root['xgold' + keKota] < box_mc.soldiers_mc.goldTrain3) {
bisaRecruit = false;
}
if (bisaRecruit == true) {
if (_root['xarrowmanPower' + keKota] < _root['xarrowmanPowerMax' + keKota]) {
if (_root['xarrowman' + keKota] > 0) {
backTrain();
_root['xgold' + keKota] -= box_mc.soldiers_mc.goldTrain3;
_root['xarrowmanPower' + keKota] += 10;
if (_root['xarrowmanPower' + keKota] >= _root['xarrowmanPowerMax' + keKota]) {
_root['xarrowmanPower' + keKota] = _root['xarrowmanPowerMax' + keKota];
}
if (sideQuestKe == 2) {
cekMenangQuest(sideQuestKe);
}
cekArmy();
info_mc2._visible = false;
} else {
cekInfo('There\'s no arrowman in this town, can\'t train');
}
} else {
cekInfo('Can\'t train this soldiers anymore, the powers are maximum');
}
} else {
cekInfo('Can\'t train this soldiers, need more resources in this town');
}
};
box_mc.soldiers_mc.train4.onRelease = function () {
bisaRecruit = true;
if (_root['xgold' + keKota] < box_mc.soldiers_mc.goldTrain4) {
bisaRecruit = false;
}
if (bisaRecruit == true) {
if (_root['xspearmanPower' + keKota] < _root['xspearmanPowerMax' + keKota]) {
if (_root['xspearman' + keKota] > 0) {
backTrain();
_root['xgold' + keKota] -= box_mc.soldiers_mc.goldTrain4;
_root['xspearmanPower' + keKota] += 10;
if (_root['xspearmanPower' + keKota] >= _root['xspearmanPowerMax' + keKota]) {
_root['xspearmanPower' + keKota] = _root['xspearmanPowerMax' + keKota];
}
if (sideQuestKe == 2) {
cekMenangQuest(sideQuestKe);
}
cekArmy();
info_mc2._visible = false;
} else {
cekInfo('There\'s no spearman in this town, can\'t train');
}
} else {
cekInfo('Can\'t train this soldiers anymore, the powers are maximum');
}
} else {
cekInfo('Can\'t train this soldiers, need more resources in this town');
}
};
box_mc.soldiers_mc.bareAmount.onRollOver = overMenuUI;
box_mc.soldiers_mc.swordAmount.onRollOver = overMenuUI;
box_mc.soldiers_mc.arrowAmount.onRollOver = overMenuUI;
box_mc.soldiers_mc.spearAmount.onRollOver = overMenuUI;
box_mc.soldiers_mc.barePower.onRollOver = overMenuUI;
box_mc.soldiers_mc.swordPower.onRollOver = overMenuUI;
box_mc.soldiers_mc.arrowPower.onRollOver = overMenuUI;
box_mc.soldiers_mc.spearPower.onRollOver = overMenuUI;
box_mc.soldiers_mc.bareGold.onRollOver = overMenuUI;
box_mc.soldiers_mc.swordGold.onRollOver = overMenuUI;
box_mc.soldiers_mc.arrowGold.onRollOver = overMenuUI;
box_mc.soldiers_mc.spearGold.onRollOver = overMenuUI;
box_mc.soldiers_mc.bareAmount.onRollOut = outMenuUI;
box_mc.soldiers_mc.swordAmount.onRollOut = outMenuUI;
box_mc.soldiers_mc.arrowAmount.onRollOut = outMenuUI;
box_mc.soldiers_mc.spearAmount.onRollOut = outMenuUI;
box_mc.soldiers_mc.barePower.onRollOut = outMenuUI;
box_mc.soldiers_mc.swordPower.onRollOut = outMenuUI;
box_mc.soldiers_mc.arrowPower.onRollOut = outMenuUI;
box_mc.soldiers_mc.spearPower.onRollOut = outMenuUI;
box_mc.soldiers_mc.bareGold.onRollOut = outMenuUI;
box_mc.soldiers_mc.swordGold.onRollOut = outMenuUI;
box_mc.soldiers_mc.arrowGold.onRollOut = outMenuUI;
box_mc.soldiers_mc.spearGold.onRollOut = outMenuUI;
info_mc2._visible = false;
}
function klikWeapon() {
cekAdaTipeBangunan();
box_mc._visible = true;
box_mc.gotoAndStop(4);
box_mc.weapon_mc.close_btn.onRelease = function () {
box_mc._visible = false;
info_mc2._visible = false;
};
box_mc.close_btn.onRelease = function () {
box_mc._visible = false;
info_mc2._visible = false;
};
if (adaArmory == true) {
box_mc.weapon_mc.gotoAndStop(1);
box_mc.close_btn._visible = false;
} else {
box_mc.weapon_mc.gotoAndStop(10);
box_mc.close_btn._visible = true;
}
cekWeapon();
cekHilangDrag();
if (sedangTutorial == true) {
if (sedangBuatKe == 7) {
cekTutorial(32);
}
}
info_mc2._visible = false;
}
function cekWeapon() {
i = 1;
while (i <= maxBangunan) {
if (xtipeBuilding[i][keKota] == 7) {
pilihanBangunanKe = i;
i = maxBangunan;
}
++i;
}
levelArmoryKini = xlevelBuilding[pilihanBangunanKe][keKota];
box_mc.weapon_mc.xlevel = 'ARMORY\n\nLEVEL\n\n' + levelArmoryKini;
box_mc.weapon_mc.jumlah1 = produksiArmy * levelArmoryKini + ' SWORDS';
box_mc.weapon_mc.jumlah2 = produksiArmy * levelArmoryKini + ' ARROWS';
box_mc.weapon_mc.jumlah3 = produksiArmy * levelArmoryKini + ' SPEARS';
if (levelArmoryKini == 1) {
box_mc.weapon_mc.jumlah4 = 1 * levelArmoryKini + ' BOW TRAP';
box_mc.weapon_mc.jumlah5 = 1 * levelArmoryKini + ' CATAPULT';
box_mc.weapon_mc.jumlah6 = 1 * levelArmoryKini + ' FIRE TRAP';
} else {
box_mc.weapon_mc.jumlah4 = 1 * levelArmoryKini + ' BOW TRAPS';
box_mc.weapon_mc.jumlah5 = 1 * levelArmoryKini + ' CATAPULTS';
box_mc.weapon_mc.jumlah6 = 1 * levelArmoryKini + ' FIRE TRAPS';
}
i = 1;
while (i <= 6) {
if (i <= 3) {
box_mc.weapon_mc['gold' + i] = costGoldWeapon[i] * levelArmoryKini;
box_mc.weapon_mc['iron' + i] = costIronWeapon[i] * levelArmoryKini;
box_mc.weapon_mc['wood' + i] = costWoodWeapon[i] * levelArmoryKini;
} else {
box_mc.weapon_mc['gold' + i] = costGoldWeapon[i];
box_mc.weapon_mc['iron' + i] = costIronWeapon[i];
box_mc.weapon_mc['wood' + i] = costWoodWeapon[i];
}
box_mc.weapon_mc['weapon' + i].onRelease = klikWeaponBuild;
box_mc.weapon_mc['weapon' + i].onRollOver = overWeaponBuild;
box_mc.weapon_mc['weapon' + i].onRollOut = outWeaponBuild;
++i;
}
if (_root['autoSword' + keKota] == true) {
box_mc.weapon_mc.auto1.gotoAndStop(1);
box_mc.weapon_mc.weapon1.enabled = false;
} else {
box_mc.weapon_mc.auto1.gotoAndStop(2);
box_mc.weapon_mc.weapon1.enabled = true;
}
if (_root['autoArrow' + keKota] == true) {
box_mc.weapon_mc.auto2.gotoAndStop(1);
box_mc.weapon_mc.weapon2.enabled = false;
} else {
box_mc.weapon_mc.auto2.gotoAndStop(2);
box_mc.weapon_mc.weapon2.enabled = true;
}
if (_root['autoSpear' + keKota] == true) {
box_mc.weapon_mc.auto3.gotoAndStop(1);
box_mc.weapon_mc.weapon3.enabled = false;
} else {
box_mc.weapon_mc.auto3.gotoAndStop(2);
box_mc.weapon_mc.weapon3.enabled = true;
}
box_mc.weapon_mc.auto1.onRelease = function () {
if (_root['autoSword' + keKota] == true) {
_root['autoSword' + keKota] = false;
box_mc.weapon_mc.auto1.gotoAndStop(2);
} else {
_root['autoSword' + keKota] = true;
box_mc.weapon_mc.auto1.gotoAndStop(1);
}
cekWeapon();
};
box_mc.weapon_mc.auto2.onRelease = function () {
if (_root['autoArrow' + keKota] == true) {
_root['autoArrow' + keKota] = false;
box_mc.weapon_mc.auto2.gotoAndStop(2);
} else {
_root['autoArrow' + keKota] = true;
box_mc.weapon_mc.auto2.gotoAndStop(1);
}
cekWeapon();
};
box_mc.weapon_mc.auto3.onRelease = function () {
if (_root['autoSpear' + keKota] == true) {
_root['autoSpear' + keKota] = false;
box_mc.weapon_mc.auto3.gotoAndStop(2);
} else {
_root['autoSpear' + keKota] = true;
box_mc.weapon_mc.auto3.gotoAndStop(1);
}
cekWeapon();
};
if (_root['risetCatapult' + keKota] == true) {
box_mc.weapon_mc.weapon5.gotoAndStop(1);
} else {
box_mc.weapon_mc.weapon5.gotoAndStop(2);
}
if (_root['risetFireTrap' + keKota] == true) {
box_mc.weapon_mc.weapon6.gotoAndStop(1);
} else {
box_mc.weapon_mc.weapon6.gotoAndStop(2);
}
box_mc.weapon_mc.build_btn.onRelease = function () {
klikBuilding('dua');
};
info_mc2._visible = false;
}
function overWeaponBuild() {
info_mc2._visible = true;
myStr = new String(this);
if (isNaN(myStr.substr(myStr.length - 2, 2))) {
indi = myStr.substr(myStr.length - 1, 1);
} else {
indi = myStr.substr(myStr.length - 2, 2);
}
info_mc2.xinfo = xinfoArmory[indi];
}
function outWeaponBuild() {
info_mc2._visible = false;
}
function klikWeaponBuild() {
if (this._currentframe == 2) {
klikRiset('kedua');
} else {
myStr = new String(this);
indi = myStr.substr(myStr.length - 1, 1);
if (indi <= 3) {
box_mc.weapon_mc['gold' + indi] = costGoldWeapon[indi] * levelArmoryKini;
box_mc.weapon_mc['iron' + indi] = costIronWeapon[indi] * levelArmoryKini;
box_mc.weapon_mc['wood' + indi] = costWoodWeapon[indi] * levelArmoryKini;
} else {
box_mc.weapon_mc['gold' + indi] = costGoldWeapon[indi];
box_mc.weapon_mc['iron' + indi] = costIronWeapon[indi];
box_mc.weapon_mc['wood' + indi] = costWoodWeapon[indi];
}
bisaBuat = true;
if (_root['xgold' + keKota] < box_mc.weapon_mc['gold' + indi]) {
bisaBuat = false;
}
if (_root['xiron' + keKota] < box_mc.weapon_mc['iron' + indi]) {
bisaBuat = false;
}
if (_root['xwood' + keKota] < box_mc.weapon_mc['wood' + indi]) {
bisaBuat = false;
}
if (bisaBuat == true) {
backCreate();
if (sedangTutorial == true) {
if (indi == 1) {
_root['xsword' + keKota] += 15 * levelArmoryKini;
} else {
if (indi == 2) {
_root['xarrow' + keKota] += 15 * levelArmoryKini;
} else {
if (indi == 3) {
_root['xspear' + keKota] += 15 * levelArmoryKini;
} else {
if (indi == 4) {
_root['xarrowTrap' + keKota] += 1 * levelArmoryKini;
} else {
if (indi == 5) {
_root['xcatapult' + keKota] += 1 * levelArmoryKini;
} else {
if (indi == 6) {
_root['xfireTrap' + keKota] += 1 * levelArmoryKini;
}
}
}
}
}
}
} else {
if (indi == 1) {
_root['xsword' + keKota] += produksiArmy * levelArmoryKini;
} else {
if (indi == 2) {
_root['xarrow' + keKota] += produksiArmy * levelArmoryKini;
} else {
if (indi == 3) {
_root['xspear' + keKota] += produksiArmy * levelArmoryKini;
} else {
if (indi == 4) {
_root['xarrowTrap' + keKota] += 1 * levelArmoryKini;
} else {
if (indi == 5) {
_root['xcatapult' + keKota] += 1 * levelArmoryKini;
} else {
if (indi == 6) {
_root['xfireTrap' + keKota] += 1 * levelArmoryKini;
}
}
}
}
}
}
}
_root['xgold' + keKota] -= box_mc.weapon_mc['gold' + indi];
_root['xiron' + keKota] -= box_mc.weapon_mc['iron' + indi];
_root['xwood' + keKota] -= box_mc.weapon_mc['wood' + indi];
if (sedangTutorial == true) {
this.gotoAndStop(2);
this.enabled = false;
tutorial_mc['panah' + indi]._visible = false;
if (_root['xsword' + keKota] >= 1 && _root['xarrow' + keKota] >= 1 && _root['xspear' + keKota] >= 1) {
box_mc._visible = false;
cekTutorial(33);
}
} else {
cekWeapon();
}
} else {
cekInfo('Can\'t create this weapon, need more resources in this town');
}
}
info_mc2._visible = false;
}
function klikVehicle() {
cekAdaTipeBangunan();
box_mc._visible = true;
box_mc.gotoAndStop(5);
box_mc.factory_mc.close_btn.onRelease = function () {
box_mc._visible = false;
info_mc2._visible = false;
};
box_mc.close_btn.onRelease = function () {
box_mc._visible = false;
info_mc2._visible = false;
};
if (adaFactory == true) {
box_mc.factory_mc.gotoAndStop(1);
box_mc.close_btn._visible = false;
} else {
box_mc.factory_mc.gotoAndStop(10);
box_mc.close_btn._visible = true;
}
cekVehicle();
cekHilangDrag();
info_mc2._visible = false;
}
function cekVehicle() {
i = 1;
while (i <= maxBangunan) {
if (xtipeBuilding[i][keKota] == 8) {
pilihanBangunanKe = i;
i = maxBangunan;
}
++i;
}
levelFactoryKini = xlevelBuilding[pilihanBangunanKe][keKota];
box_mc.factory_mc.xlevel = 'FACTORY LEVEL ' + levelFactoryKini;
i = 1;
while (i <= 3) {
box_mc.factory_mc['gold' + i] = costGoldKendaraan[i];
box_mc.factory_mc['iron' + i] = costIronKendaraan[i];
box_mc.factory_mc['wood' + i] = costWoodKendaraan[i];
box_mc.factory_mc['worker' + i] = costWorkerKendaraan[i];
box_mc.factory_mc['tambahan' + i] = costTambahanKendaraan[i];
box_mc.factory_mc['pabrik' + i].onRelease = klikFactoryBuild;
box_mc.factory_mc['pabrik' + i].onRollOver = overFactoryBuild;
box_mc.factory_mc['pabrik' + i].onRollOut = outFactoryBuild;
++i;
}
box_mc.factory_mc.auto1.onRelease = function () {
if (_root['autoTank' + keKota] == true) {
_root['autoTank' + keKota] = false;
box_mc.factory_mc.auto1.gotoAndStop(2);
} else {
_root['autoTank' + keKota] = true;
box_mc.factory_mc.auto1.gotoAndStop(1);
}
cekVehicle();
};
box_mc.factory_mc.auto2.onRelease = function () {
if (_root['autoCopter' + keKota] == true) {
_root['autoCopter' + keKota] = false;
box_mc.factory_mc.auto2.gotoAndStop(2);
} else {
_root['autoCopter' + keKota] = true;
box_mc.factory_mc.auto2.gotoAndStop(1);
}
cekVehicle();
};
box_mc.factory_mc.auto3.onRelease = function () {
if (_root['autoMonbot' + keKota] == true) {
_root['autoMonbot' + keKota] = false;
box_mc.factory_mc.auto3.gotoAndStop(2);
} else {
_root['autoMonbot' + keKota] = true;
box_mc.factory_mc.auto3.gotoAndStop(1);
}
cekVehicle();
};
if (_root['risetTank' + keKota] == true) {
if (levelFactoryKini >= 1) {
box_mc.factory_mc.auto1._visible = true;
if (_root['autoTank' + keKota] == true) {
box_mc.factory_mc.auto1.gotoAndStop(1);
box_mc.factory_mc.pabrik1.enabled = false;
} else {
box_mc.factory_mc.auto1.gotoAndStop(2);
box_mc.factory_mc.pabrik1.enabled = true;
}
} else {
box_mc.factory_mc.auto1._visible = false;
box_mc.factory_mc.pabrik1.gotoAndStop(4);
box_mc.factory_mc.pabrik1.enabled = false;
}
} else {
box_mc.factory_mc.auto1._visible = false;
box_mc.factory_mc.pabrik1.gotoAndStop(2);
box_mc.factory_mc.pabrik1.enabled = true;
}
if (_root['risetCopter' + keKota] == true) {
if (levelFactoryKini >= 2) {
box_mc.factory_mc.auto2._visible = true;
if (_root['autoCopter' + keKota] == true) {
box_mc.factory_mc.auto2.gotoAndStop(1);
box_mc.factory_mc.pabrik2.enabled = false;
} else {
box_mc.factory_mc.auto2.gotoAndStop(2);
box_mc.factory_mc.pabrik2.enabled = true;
}
} else {
box_mc.factory_mc.auto2._visible = false;
box_mc.factory_mc.pabrik2.gotoAndStop(4);
box_mc.factory_mc.pabrik2.enabled = false;
}
} else {
box_mc.factory_mc.auto2._visible = false;
box_mc.factory_mc.pabrik2.gotoAndStop(2);
box_mc.factory_mc.pabrik2.enabled = true;
}
if (_root['risetMonbot' + keKota] == true) {
if (levelFactoryKini >= 3) {
box_mc.factory_mc.auto3._visible = true;
if (_root['autoMonbot' + keKota] == true) {
box_mc.factory_mc.auto3.gotoAndStop(1);
box_mc.factory_mc.pabrik3.enabled = false;
} else {
box_mc.factory_mc.auto3.gotoAndStop(2);
box_mc.factory_mc.pabrik3.enabled = true;
}
} else {
box_mc.factory_mc.auto3._visible = false;
box_mc.factory_mc.pabrik3.gotoAndStop(4);
box_mc.factory_mc.pabrik3.enabled = false;
}
} else {
box_mc.factory_mc.auto3._visible = false;
box_mc.factory_mc.pabrik3.gotoAndStop(2);
box_mc.factory_mc.pabrik3.enabled = true;
}
box_mc.factory_mc.build_btn.onRelease = function () {
klikBuilding('dua');
};
if (keKota == 8 || keKota == 14 || keKota == 17 || keKota == 22) {
} else {
box_mc.factory_mc.auto3.enabled = false;
box_mc.factory_mc.pabrik3.enabled = false;
box_mc.factory_mc.pabrik3.gotoAndStop(5);
}
info_mc2._visible = false;
}
function overFactoryBuild() {
info_mc2._visible = true;
myStr = new String(this);
if (isNaN(myStr.substr(myStr.length - 2, 2))) {
indi = myStr.substr(myStr.length - 1, 1);
} else {
indi = myStr.substr(myStr.length - 2, 2);
}
info_mc2.xinfo = xinfoFactory[indi];
}
function outFactoryBuild() {
info_mc2._visible = false;
}
function klikFactoryBuild() {
if (this._currentframe == 2) {
klikRiset('kedua');
} else {
myStr = new String(this);
indi = myStr.substr(myStr.length - 1, 1);
box_mc.factory_mc['gold' + indi] = costGoldKendaraan[indi];
box_mc.factory_mc['iron' + indi] = costIronKendaraan[indi];
box_mc.factory_mc['wood' + indi] = costWoodKendaraan[indi];
box_mc.factory_mc['worker' + indi] = costWorkerKendaraan[indi];
box_mc.factory_mc['tambahan' + indi] = costTambahanKendaraan[indi];
bisaBuat = true;
if (_root['xgold' + keKota] < box_mc.factory_mc['gold' + indi]) {
bisaBuat = false;
}
if (_root['xiron' + keKota] < box_mc.factory_mc['iron' + indi]) {
bisaBuat = false;
}
if (_root['xwood' + keKota] < box_mc.factory_mc['wood' + indi]) {
bisaBuat = false;
}
if (_root['xworker' + keKota] < box_mc.factory_mc['worker' + indi]) {
bisaBuat = false;
}
if (indi <= 2) {
if (_root['xfireTrap' + keKota] < box_mc.factory_mc['tambahan' + indi]) {
bisaBuat = false;
}
} else {
if (indi == 3) {
if (_root['xmana' + keKota] < box_mc.factory_mc['tambahan' + indi]) {
bisaBuat = false;
}
}
}
if (bisaBuat == true) {
backCreate();
if (indi == 1) {
_root['xtank' + keKota] += 1;
} else {
if (indi == 2) {
_root['xcopter' + keKota] += 1;
} else {
if (indi == 3) {
if (sideQuestKe == 15) {
cekMenangQuest(sideQuestKe);
}
_root['xmonbot' + keKota] += 1;
}
}
}
_root['xgold' + keKota] -= box_mc.factory_mc['gold' + indi];
_root['xiron' + keKota] -= box_mc.factory_mc['iron' + indi];
_root['xwood' + keKota] -= box_mc.factory_mc['wood' + indi];
_root['xworker' + keKota] -= box_mc.factory_mc['worker' + indi];
if (indi <= 2) {
_root['xfireTrap' + keKota] -= box_mc.factory_mc['tambahan' + indi];
} else {
if (indi == 3) {
_root['xmana' + keKota] -= box_mc.factory_mc['tambahan' + indi];
}
}
cekWeapon();
} else {
cekInfo('Can\'t create this vehicle, need more resources in this town');
}
}
info_mc2._visible = false;
}
function klikSpell(indi) {
cekAdaTipeBangunan();
box_mc._visible = true;
box_mc.gotoAndStop(6);
box_mc.magic_mc.gotoAndStop(1);
box_mc.close_btn._visible = true;
box_mc.close_btn.onRelease = function () {
box_mc._visible = false;
info_mc2._visible = false;
};
if (adaTemple == true) {
box_mc.magic_mc.gotoAndStop(1);
box_mc.close_btn2._visible = false;
box_mc.close_btn._visible = true;
box_mc.prev_btn._visible = true;
box_mc.next_btn._visible = true;
} else {
box_mc.magic_mc.gotoAndStop(10);
box_mc.close_btn2._visible = true;
box_mc.close_btn._visible = false;
box_mc.prev_btn._visible = false;
box_mc.next_btn._visible = false;
}
box_mc.close_btn2.onRelease = function () {
box_mc._visible = false;
info_mc2._visible = false;
};
cekSpell();
cekHilangDrag();
info_mc2._visible = false;
}
function cekSpell() {
i = 1;
while (i <= maxBangunan) {
if (xtipeBuilding[i][keKota] == 10) {
pilihanBangunanKe = i;
i = maxBangunan;
}
++i;
}
levelTempleKini = xlevelBuilding[pilihanBangunanKe][keKota];
box_mc.magic_mc.xlevel = 'TEMPLE\n\nLEVEL\n\n' + levelTempleKini;
i = 1;
while (i <= 8) {
box_mc.magic_mc['gold' + i] = costGoldMagic[i];
box_mc.magic_mc['mana' + i] = costManaMagic[i];
box_mc.magic_mc['magic' + i].onRelease = klikMagicMana;
box_mc.magic_mc['magic' + i].onRollOver = overMagicMana;
box_mc.magic_mc['magic' + i].onRollOut = outMagicMana;
++i;
}
if (_root['risetInvisible' + keKota] == true) {
box_mc.magic_mc.magic6.gotoAndStop(1);
} else {
box_mc.magic_mc.magic6.gotoAndStop(2);
}
if (_root['risetSpecialAttack' + keKota] == true) {
box_mc.magic_mc.magic7.gotoAndStop(1);
} else {
box_mc.magic_mc.magic7.gotoAndStop(2);
}
if (_root['risetDuplicate' + keKota] == true) {
box_mc.magic_mc.magic8.gotoAndStop(1);
} else {
box_mc.magic_mc.magic8.gotoAndStop(2);
}
box_mc.next_btn.onRelease = function () {
box_mc.magic_mc.gotoAndStop(2);
cekSpell();
};
box_mc.prev_btn.onRelease = function () {
box_mc.magic_mc.gotoAndStop(1);
cekSpell();
};
box_mc.magic_mc.build_btn.onRelease = function () {
klikBuilding('dua');
};
info_mc2._visible = false;
}
function overMagicMana() {
info_mc2._visible = true;
myStr = new String(this);
if (isNaN(myStr.substr(myStr.length - 2, 2))) {
indi = myStr.substr(myStr.length - 1, 1);
} else {
indi = myStr.substr(myStr.length - 2, 2);
}
info_mc2.xinfo = xinfoSpell[indi];
}
function outMagicMana() {
info_mc2._visible = false;
}
function klikMagicMana() {
if (this._currentframe == 2) {
klikRiset('ketiga');
} else {
myStr = new String(this);
indi = myStr.substr(myStr.length - 1, 1);
box_mc.magic_mc['gold' + indi] = costGoldMagic[indi];
box_mc.magic_mc['mana' + indi] = costManaMagic[indi];
bisaBuat = true;
if (_root['xgold' + keKota] < box_mc.magic_mc['gold' + indi]) {
bisaBuat = false;
}
if (_root['xmana' + keKota] < box_mc.magic_mc['mana' + indi]) {
bisaBuat = false;
}
if (bisaBuat == true) {
backSpell3();
if (indi == 1) {
_root['xarrowRain' + keKota] += 1;
} else {
if (indi == 2) {
_root['xmeteorid' + keKota] += 1;
} else {
if (indi == 3) {
_root['xacidRain' + keKota] += 1;
} else {
if (indi == 4) {
_root['xearthquake' + keKota] += 1;
} else {
if (indi == 5) {
_root['ximmune' + keKota] += 1;
} else {
if (indi == 6) {
_root['xinvisible' + keKota] += 1;
} else {
if (indi == 7) {
_root['xspecialAttack' + keKota] += 1;
} else {
if (indi == 8) {
_root['xduplicate' + keKota] += 1;
}
}
}
}
}
}
}
}
_root['xgold' + keKota] -= box_mc.magic_mc['gold' + indi];
_root['xmana' + keKota] -= box_mc.magic_mc['mana' + indi];
cekSpell();
} else {
cekInfo('Can\'t produce this spell, need more resources in this town');
}
}
info_mc2._visible = false;
}
function klikDefense() {
cekAdaTipeBangunan();
box_mc._visible = true;
box_mc.gotoAndStop(7);
box_mc.pertahanan_mc.close_btn.onRelease = function () {
box_mc._visible = false;
info_mc2._visible = false;
};
box_mc.close_btn.onRelease = function () {
box_mc._visible = false;
info_mc2._visible = false;
};
if (adaFortress == true) {
box_mc.pertahanan_mc.gotoAndStop(1);
box_mc.close_btn._visible = false;
box_mc.pertahanan_mc.close_btn._visible = true;
} else {
box_mc.pertahanan_mc.gotoAndStop(10);
box_mc.close_btn._visible = true;
box_mc.pertahanan_mc.close_btn._visible = false;
}
cekDefense();
cekHilangDrag();
info_mc2._visible = false;
}
function cekDefense() {
i = 1;
while (i <= maxBangunan) {
if (xtipeBuilding[i][keKota] == 11) {
pilihanBangunanKe = i;
i = maxBangunan;
}
++i;
}
levelFortressKini = xlevelBuilding[pilihanBangunanKe][keKota];
box_mc.pertahanan_mc.xlevel = 'FORTRESS\n\nLEVEL\n\n' + levelFortressKini;
i = 1;
while (i <= 5) {
box_mc.pertahanan_mc['gold' + i] = costGoldDefense[i];
box_mc.pertahanan_mc['iron' + i] = costIronDefense[i];
box_mc.pertahanan_mc['wood' + i] = costWoodDefense[i];
box_mc.pertahanan_mc['defense' + i].onRelease = klikPertahananDefense;
box_mc.pertahanan_mc['defense' + i].onRollOver = overPertahananDefense;
box_mc.pertahanan_mc['defense' + i].onRollOut = outPertahananDefense;
++i;
}
if (levelFortressKini <= 1) {
box_mc.pertahanan_mc.defense1.enabled = true;
box_mc.pertahanan_mc.defense2.enabled = false;
box_mc.pertahanan_mc.defense3.enabled = false;
box_mc.pertahanan_mc.defense4.enabled = false;
box_mc.pertahanan_mc.defense5.enabled = false;
box_mc.pertahanan_mc.defense1.gotoAndStop(1);
box_mc.pertahanan_mc.defense2.gotoAndStop(2);
box_mc.pertahanan_mc.defense3.gotoAndStop(2);
box_mc.pertahanan_mc.defense4.gotoAndStop(2);
box_mc.pertahanan_mc.defense5.gotoAndStop(2);
} else {
if (levelFortressKini <= 2) {
box_mc.pertahanan_mc.defense1.enabled = true;
box_mc.pertahanan_mc.defense2.enabled = true;
box_mc.pertahanan_mc.defense3.enabled = true;
box_mc.pertahanan_mc.defense4.enabled = false;
box_mc.pertahanan_mc.defense5.enabled = false;
box_mc.pertahanan_mc.defense1.gotoAndStop(1);
box_mc.pertahanan_mc.defense2.gotoAndStop(1);
box_mc.pertahanan_mc.defense3.gotoAndStop(1);
box_mc.pertahanan_mc.defense4.gotoAndStop(2);
box_mc.pertahanan_mc.defense5.gotoAndStop(2);
} else {
if (levelFortressKini <= 3) {
box_mc.pertahanan_mc.defense1.enabled = true;
box_mc.pertahanan_mc.defense2.enabled = true;
box_mc.pertahanan_mc.defense3.enabled = true;
box_mc.pertahanan_mc.defense4.enabled = true;
box_mc.pertahanan_mc.defense5.enabled = true;
box_mc.pertahanan_mc.defense1.gotoAndStop(1);
box_mc.pertahanan_mc.defense2.gotoAndStop(1);
box_mc.pertahanan_mc.defense3.gotoAndStop(1);
box_mc.pertahanan_mc.defense4.gotoAndStop(1);
box_mc.pertahanan_mc.defense5.gotoAndStop(1);
}
}
}
if (_root['risetZombie' + keKota] == true) {
if (levelFortressKini >= 3) {
box_mc.pertahanan_mc.defense5.gotoAndStop(1);
box_mc.pertahanan_mc.defense5.enabled = true;
} else {
box_mc.pertahanan_mc.defense5.gotoAndStop(4);
box_mc.pertahanan_mc.defense5.enabled = false;
}
} else {
box_mc.pertahanan_mc.defense5.gotoAndStop(2);
box_mc.pertahanan_mc.defense5.enabled = true;
}
box_mc.pertahanan_mc.build_btn.onRelease = function () {
klikBuilding('dua');
};
info_mc2._visible = false;
}
function overPertahananDefense() {
info_mc2._visible = true;
myStr = new String(this);
if (isNaN(myStr.substr(myStr.length - 2, 2))) {
indi = myStr.substr(myStr.length - 1, 1);
} else {
indi = myStr.substr(myStr.length - 2, 2);
}
info_mc2.xinfo = xinfoDefense[indi];
}
function outPertahananDefense() {
info_mc2._visible = false;
}
function klikPertahananDefense() {
if (this._currentframe == 2) {
klikRiset('kedua');
} else {
myStr = new String(this);
indi = myStr.substr(myStr.length - 1, 1);
box_mc.pertahanan_mc['gold' + indi] = costGoldDefense[indi];
box_mc.pertahanan_mc['iron' + indi] = costIronDefense[indi];
box_mc.pertahanan_mc['wood' + indi] = costWoodDefense[indi];
bisaBuat = true;
if (_root['xgold' + keKota] < box_mc.pertahanan_mc['gold' + indi]) {
bisaBuat = false;
}
if (_root['xiron' + keKota] < box_mc.pertahanan_mc['iron' + indi]) {
bisaBuat = false;
}
if (_root['xwood' + keKota] < box_mc.pertahanan_mc['wood' + indi]) {
bisaBuat = false;
}
if (bisaBuat == true) {
if (indi == 1) {
_root['xwall' + keKota] += 1;
} else {
if (indi == 2) {
_root['xspike' + keKota] += 1;
} else {
if (indi == 3) {
_root['xspiderWeb' + keKota] += 1;
} else {
if (indi == 4) {
_root['xtowerGuard' + keKota] += 1;
} else {
if (indi == 5) {
_root['xzombieTrap' + keKota] += 1;
if (sideQuestKe == 8) {
cekMenangQuest(sideQuestKe);
}
}
}
}
}
}
_root['xgold' + keKota] -= box_mc.pertahanan_mc['gold' + indi];
_root['xiron' + keKota] -= box_mc.pertahanan_mc['iron' + indi];
_root['xwood' + keKota] -= box_mc.pertahanan_mc['wood' + indi];
cekDefense();
} else {
cekInfo('Can\'t create this defense equipment, need more resources in this town');
}
}
info_mc2._visible = false;
}
function klikSkill(indi) {
cekAdaTipeBangunan();
box_mc._visible = true;
box_mc.gotoAndStop(8);
box_mc.knowledge_mc.gotoAndStop(1);
box_mc.close_btn._visible = true;
box_mc.close_btn.onRelease = function () {
box_mc._visible = false;
info_mc2._visible = false;
};
if (adaLibrary == true) {
box_mc.knowledge_mc.gotoAndStop(1);
box_mc.close_btn2._visible = false;
box_mc.close_btn._visible = true;
box_mc.prev_btn._visible = true;
box_mc.next_btn._visible = true;
} else {
box_mc.knowledge_mc.gotoAndStop(10);
box_mc.close_btn2._visible = true;
box_mc.close_btn._visible = false;
box_mc.prev_btn._visible = false;
box_mc.next_btn._visible = false;
}
box_mc.close_btn2.onRelease = function () {
box_mc._visible = false;
info_mc2._visible = false;
};
cekSkill();
cekHilangDrag();
info_mc2._visible = false;
}
function cekSkill() {
i = 1;
while (i <= maxBangunan) {
if (xtipeBuilding[i][keKota] == 12) {
pilihanBangunanKe = i;
i = maxBangunan;
}
++i;
}
levelLibraryKini = xlevelBuilding[pilihanBangunanKe][keKota];
box_mc.knowledge_mc.xlevel = 'LIBRARY\n\nLEVEL\n\n' + levelLibraryKini;
if (_root['rangerAktif' + keKota] == true) {
box_mc.knowledge_mc.aktif1.gotoAndStop(1);
} else {
if (_root['rangerAktif' + keKota] == false) {
box_mc.knowledge_mc.aktif1.gotoAndStop(2);
}
}
if (_root['tirelessAktif' + keKota] == true) {
box_mc.knowledge_mc.aktif2.gotoAndStop(1);
} else {
if (_root['tirelessAktif' + keKota] == false) {
box_mc.knowledge_mc.aktif2.gotoAndStop(2);
}
}
if (_root['armorPlusAktif' + keKota] == true) {
box_mc.knowledge_mc.aktif3.gotoAndStop(1);
} else {
if (_root['armorPlusAktif' + keKota] == false) {
box_mc.knowledge_mc.aktif3.gotoAndStop(2);
}
}
if (_root['speedPlusAktif' + keKota] == true) {
box_mc.knowledge_mc.aktif4.gotoAndStop(1);
} else {
if (_root['speedPlusAktif' + keKota] == false) {
box_mc.knowledge_mc.aktif4.gotoAndStop(2);
}
}
if (_root['entertainmentAktif' + keKota] == true) {
box_mc.knowledge_mc.aktif5.gotoAndStop(1);
} else {
if (_root['entertainmentAktif' + keKota] == false) {
box_mc.knowledge_mc.aktif5.gotoAndStop(2);
}
}
if (_root['fastBuildAktif' + keKota] == true) {
box_mc.knowledge_mc.aktif6.gotoAndStop(1);
} else {
if (_root['fastBuildAktif' + keKota] == false) {
box_mc.knowledge_mc.aktif6.gotoAndStop(2);
}
}
if (_root['rawPlusAktif' + keKota] == true) {
box_mc.knowledge_mc.aktif7.gotoAndStop(1);
} else {
if (_root['rawPlusAktif' + keKota] == false) {
box_mc.knowledge_mc.aktif7.gotoAndStop(2);
}
}
if (_root['goldPlusAktif' + keKota] == true) {
box_mc.knowledge_mc.aktif8.gotoAndStop(1);
} else {
if (_root['goldPlusAktif' + keKota] == false) {
box_mc.knowledge_mc.aktif8.gotoAndStop(2);
}
}
i = 1;
while (i <= 8) {
box_mc.knowledge_mc['gold' + i] = costLibraryGold[i];
box_mc.knowledge_mc['iron' + i] = costLibraryIron[i];
box_mc.knowledge_mc['wood' + i] = costLibraryWood[i];
box_mc.knowledge_mc['mana' + i] = costLibraryMana[i];
box_mc.knowledge_mc['skill' + i].onRelease = klikLibrarySkill;
box_mc.knowledge_mc['skill' + i].onRollOver = overLibrarySkill;
box_mc.knowledge_mc['skill' + i].onRollOut = outLibrarySkill;
++i;
}
if (levelLibraryKini <= 1) {
box_mc.knowledge_mc.skill1.enabled = true;
box_mc.knowledge_mc.skill2.enabled = true;
box_mc.knowledge_mc.skill3.enabled = true;
box_mc.knowledge_mc.skill4.enabled = false;
box_mc.knowledge_mc.skill5.enabled = false;
box_mc.knowledge_mc.skill6.enabled = false;
box_mc.knowledge_mc.skill7.enabled = false;
box_mc.knowledge_mc.skill8.enabled = false;
box_mc.knowledge_mc.skill1.gotoAndStop(1);
box_mc.knowledge_mc.skill2.gotoAndStop(1);
box_mc.knowledge_mc.skill3.gotoAndStop(1);
box_mc.knowledge_mc.skill4.gotoAndStop(2);
box_mc.knowledge_mc.skill5.gotoAndStop(2);
box_mc.knowledge_mc.skill6.gotoAndStop(2);
box_mc.knowledge_mc.skill7.gotoAndStop(2);
box_mc.knowledge_mc.skill8.gotoAndStop(2);
box_mc.knowledge_mc.aktif1._visible = true;
box_mc.knowledge_mc.aktif2._visible = true;
box_mc.knowledge_mc.aktif3._visible = true;
box_mc.knowledge_mc.aktif4._visible = false;
box_mc.knowledge_mc.aktif5._visible = false;
box_mc.knowledge_mc.aktif6._visible = false;
box_mc.knowledge_mc.aktif7._visible = false;
box_mc.knowledge_mc.aktif8._visible = false;
} else {
if (levelLibraryKini <= 2) {
box_mc.knowledge_mc.skill1.enabled = true;
box_mc.knowledge_mc.skill2.enabled = true;
box_mc.knowledge_mc.skill3.enabled = true;
box_mc.knowledge_mc.skill4.enabled = true;
box_mc.knowledge_mc.skill5.enabled = true;
box_mc.knowledge_mc.skill6.enabled = true;
box_mc.knowledge_mc.skill7.enabled = false;
box_mc.knowledge_mc.skill8.enabled = false;
box_mc.knowledge_mc.skill1.gotoAndStop(1);
box_mc.knowledge_mc.skill2.gotoAndStop(1);
box_mc.knowledge_mc.skill3.gotoAndStop(1);
box_mc.knowledge_mc.skill4.gotoAndStop(1);
box_mc.knowledge_mc.skill5.gotoAndStop(1);
box_mc.knowledge_mc.skill6.gotoAndStop(1);
box_mc.knowledge_mc.skill7.gotoAndStop(2);
box_mc.knowledge_mc.skill8.gotoAndStop(2);
box_mc.knowledge_mc.aktif1._visible = true;
box_mc.knowledge_mc.aktif2._visible = true;
box_mc.knowledge_mc.aktif3._visible = true;
box_mc.knowledge_mc.aktif4._visible = true;
box_mc.knowledge_mc.aktif5._visible = true;
box_mc.knowledge_mc.aktif6._visible = true;
box_mc.knowledge_mc.aktif7._visible = false;
box_mc.knowledge_mc.aktif8._visible = false;
} else {
if (levelLibraryKini <= 3) {
box_mc.knowledge_mc.skill1.enabled = true;
box_mc.knowledge_mc.skill2.enabled = true;
box_mc.knowledge_mc.skill3.enabled = true;
box_mc.knowledge_mc.skill4.enabled = true;
box_mc.knowledge_mc.skill5.enabled = true;
box_mc.knowledge_mc.skill6.enabled = true;
box_mc.knowledge_mc.skill7.enabled = true;
box_mc.knowledge_mc.skill8.enabled = true;
box_mc.knowledge_mc.skill1.gotoAndStop(1);
box_mc.knowledge_mc.skill2.gotoAndStop(1);
box_mc.knowledge_mc.skill3.gotoAndStop(1);
box_mc.knowledge_mc.skill4.gotoAndStop(1);
box_mc.knowledge_mc.skill5.gotoAndStop(1);
box_mc.knowledge_mc.skill6.gotoAndStop(1);
box_mc.knowledge_mc.skill7.gotoAndStop(1);
box_mc.knowledge_mc.skill8.gotoAndStop(1);
box_mc.knowledge_mc.aktif1._visible = true;
box_mc.knowledge_mc.aktif2._visible = true;
box_mc.knowledge_mc.aktif3._visible = true;
box_mc.knowledge_mc.aktif4._visible = true;
box_mc.knowledge_mc.aktif5._visible = true;
box_mc.knowledge_mc.aktif6._visible = true;
box_mc.knowledge_mc.aktif7._visible = true;
box_mc.knowledge_mc.aktif8._visible = true;
}
}
}
if (_root['risetFastBuild' + keKota] == true) {
if (levelLibraryKini >= 2) {
box_mc.knowledge_mc.skill6.gotoAndStop(1);
box_mc.knowledge_mc.skill6.enabled = true;
box_mc.knowledge_mc.aktif6._visible = true;
} else {
box_mc.knowledge_mc.skill6.gotoAndStop(5);
box_mc.knowledge_mc.skill6.enabled = false;
box_mc.knowledge_mc.aktif6._visible = false;
}
} else {
box_mc.knowledge_mc.skill6.gotoAndStop(2);
box_mc.knowledge_mc.skill6.enabled = true;
box_mc.knowledge_mc.aktif6._visible = false;
}
if (_root['risetRawPlus' + keKota] == true) {
if (levelLibraryKini >= 3) {
box_mc.knowledge_mc.skill7.gotoAndStop(1);
box_mc.knowledge_mc.skill7.enabled = true;
box_mc.knowledge_mc.aktif7._visible = true;
} else {
box_mc.knowledge_mc.skill7.gotoAndStop(5);
box_mc.knowledge_mc.skill7.enabled = false;
box_mc.knowledge_mc.aktif7._visible = false;
}
} else {
box_mc.knowledge_mc.skill7.gotoAndStop(2);
box_mc.knowledge_mc.skill7.enabled = true;
box_mc.knowledge_mc.aktif7._visible = false;
}
if (_root['risetGoldPlus' + keKota] == true) {
if (levelLibraryKini >= 3) {
box_mc.knowledge_mc.skill8.gotoAndStop(1);
box_mc.knowledge_mc.skill8.enabled = true;
box_mc.knowledge_mc.aktif8._visible = true;
} else {
box_mc.knowledge_mc.skill8.gotoAndStop(5);
box_mc.knowledge_mc.skill8.enabled = false;
box_mc.knowledge_mc.aktif8._visible = false;
}
} else {
box_mc.knowledge_mc.skill8.gotoAndStop(2);
box_mc.knowledge_mc.skill8.enabled = true;
box_mc.knowledge_mc.aktif8._visible = false;
}
box_mc.next_btn.onRelease = function () {
box_mc.knowledge_mc.gotoAndStop(2);
cekSkill();
};
box_mc.prev_btn.onRelease = function () {
box_mc.knowledge_mc.gotoAndStop(1);
cekSkill();
};
box_mc.knowledge_mc.build_btn.onRelease = function () {
klikBuilding('dua');
};
info_mc2._visible = false;
}
function overLibrarySkill() {
info_mc2._visible = true;
myStr = new String(this);
if (isNaN(myStr.substr(myStr.length - 2, 2))) {
indi = myStr.substr(myStr.length - 1, 1);
} else {
indi = myStr.substr(myStr.length - 2, 2);
}
info_mc2.xinfo = xinfoSkill[indi];
}
function outLibrarySkill() {
info_mc2._visible = false;
}
function klikLibrarySkill() {
if (this._currentframe == 2) {
klikRiset('ketiga');
} else {
myStr = new String(this);
indi = myStr.substr(myStr.length - 1, 1);
box_mc.knowledge_mc['gold' + indi] = costLibraryGold[indi];
box_mc.knowledge_mc['iron' + indi] = costLibraryIron[indi];
box_mc.knowledge_mc['wood' + indi] = costLibraryWood[indi];
box_mc.knowledge_mc['mana' + indi] = costLibraryMana[indi];
bisaBuat = true;
if (_root['xgold' + keKota] < box_mc.knowledge_mc['gold' + indi]) {
bisaBuat = false;
}
if (_root['xiron' + keKota] < box_mc.knowledge_mc['iron' + indi]) {
bisaBuat = false;
}
if (_root['xwood' + keKota] < box_mc.knowledge_mc['wood' + indi]) {
bisaBuat = false;
}
if (_root['xmana' + keKota] < box_mc.knowledge_mc['mana' + indi]) {
bisaBuat = false;
}
if (indi == 1) {
if (bisaBuat == true) {
if (_root['rangerAktif' + keKota] == true) {
_root['rangerAktif' + keKota] = false;
} else {
backMoney();
if (sideQuestKe == 10) {
cekMenangQuest(sideQuestKe);
}
_root['rangerAktif' + keKota] = true;
}
} else {
_root['rangerAktif' + keKota] = false;
}
} else {
if (indi == 2) {
if (bisaBuat == true) {
if (_root['tirelessAktif' + keKota] == true) {
_root['tirelessAktif' + keKota] = false;
} else {
backMoney();
_root['tirelessAktif' + keKota] = true;
}
} else {
_root['tirelessAktif' + keKota] = false;
}
} else {
if (indi == 3) {
if (bisaBuat == true) {
if (_root['armorPlusAktif' + keKota] == true) {
_root['armorPlusAktif' + keKota] = false;
} else {
backMoney();
_root['armorPlusAktif' + keKota] = true;
}
} else {
_root['armorPlusAktif' + keKota] = false;
}
} else {
if (indi == 4) {
if (bisaBuat == true) {
if (_root['speedPlusAktif' + keKota] == true) {
_root['speedPlusAktif' + keKota] = false;
} else {
backMoney();
_root['speedPlusAktif' + keKota] = true;
}
} else {
_root['speedPlusAktif' + keKota] = false;
}
} else {
if (indi == 5) {
if (bisaBuat == true) {
if (_root['entertainmentAktif' + keKota] == true) {
_root['entertainmentAktif' + keKota] = false;
} else {
backMoney();
_root['entertainmentAktif' + keKota] = true;
}
} else {
_root['entertainmentAktif' + keKota] = false;
}
} else {
if (indi == 6) {
if (bisaBuat == true) {
if (_root['fastBuildAktif' + keKota] == true) {
_root['fastBuildAktif' + keKota] = false;
} else {
backMoney();
_root['fastBuildAktif' + keKota] = true;
}
} else {
_root['fastBuildAktif' + keKota] = false;
}
} else {
if (indi == 7) {
if (bisaBuat == true) {
if (_root['rawPlusAktif' + keKota] == true) {
_root['rawPlusAktif' + keKota] = false;
} else {
backMoney();
_root['rawPlusAktif' + keKota] = true;
}
} else {
_root['rawPlusAktif' + keKota] = false;
}
} else {
if (indi == 8) {
if (bisaBuat == true) {
if (_root['goldPlusAktif' + keKota] == true) {
_root['goldPlusAktif' + keKota] = false;
} else {
backMoney();
_root['goldPlusAktif' + keKota] = true;
}
} else {
_root['goldPlusAktif' + keKota] = false;
}
}
}
}
}
}
}
}
}
cekSkill();
}
info_mc2._visible = false;
}
function cekSpeed() {
if (speedGame == 1) {
ui_mc.speed_mc.gotoAndStop(1);
} else {
if (speedGame == 2) {
ui_mc.speed_mc.gotoAndStop(2);
} else {
if (speedGame == 4) {
ui_mc.speed_mc.gotoAndStop(3);
}
}
}
}
function buatUI() {
ui_mc = attachMovie('ui_mc', 'ui_mc', dalamUI);
ui_mc.cacheAsBitmap = true;
ui_mc._x = 12.6;
ui_mc._y = 14.9;
ui_mc.rename_mc._visible = false;
ui_mc.option_mc._visible = false;
ui_mc.remove_mc._visible = false;
ui_mc.serang_mc._visible = false;
ui_mc.pindah_mc._visible = false;
ui_mc.berita_mc._visible = false;
ui_mc.rebel_mc._visible = false;
ui_mc.medal_mc._visible = false;
ui_mc.dagang_mc._visible = false;
ui_mc.more_mc._visible = false;
ui_mc.quest_mc._visible = false;
if (akanSerangKota == true) {
bisaUI(false);
if (aksiMap == 'serang') {
ui_mc.serang_mc._visible = true;
cekSerangInfo();
} else {
if (aksiMap == 'move') {
ui_mc.pindah_mc._visible = true;
cekMoveInfo();
}
}
} else {
bisaUI(true);
ui_mc.serang_mc._visible = false;
ui_mc.pindah_mc._visible = false;
}
ui_mc.klikNama_btn.onRelease = function () {
ui_mc.rename_mc._visible = true;
ui_mc.rename_mc.namaKota = xnamaKota[keKota];
ui_mc.rename_mc.xnamaKota.text = '';
Selection.setFocus(ui_mc.rename_mc.xnamaKota);
ui_mc.rename_mc.cancel_btn.onRelease = function () {
ui_mc.rename_mc._visible = false;
};
ui_mc.rename_mc.apply_btn.onRelease = function () {
if (ui_mc.rename_mc.xnamaKota.text == '' || ui_mc.rename_mc.xnamaKota.text == ' ' || ui_mc.rename_mc.xnamaKota.text == ' ' || ui_mc.rename_mc.xnamaKota.text == ' ' || ui_mc.rename_mc.xnamaKota.text == ' ' || ui_mc.rename_mc.xnamaKota.text == ' ' || ui_mc.rename_mc.xnamaKota.text == ' ' || ui_mc.rename_mc.xnamaKota.text == ' ' || ui_mc.rename_mc.xnamaKota.text == ' ' || ui_mc.rename_mc.xnamaKota.text == ' ' || ui_mc.rename_mc.xnamaKota.text == ' ' || ui_mc.rename_mc.xnamaKota.text == 'Input Here') {
} else {
xnamaKota[keKota] = ui_mc.rename_mc.xnamaKota.text;
}
ui_mc.rename_mc._visible = false;
};
};
ui_mc.attack_mc.onRelease = function () {
cekSerang();
};
ui_mc.move_mc.onRelease = function () {
cekMove();
};
cekSpeed();
ui_mc.speed_mc.namaSpeed._visible = false;
ui_mc.speed_mc.onRollOver = function () {
ui_mc.speed_mc.namaSpeed._visible = true;
};
ui_mc.speed_mc.onRollOut = function () {
ui_mc.speed_mc.namaSpeed._visible = false;
};
ui_mc.speed_mc.onRelease = function () {
if (speedGame == 1) {
speedGame = 2;
} else {
if (speedGame == 2) {
speedGame = 4;
} else {
if (speedGame == 4) {
speedGame = 1;
}
}
}
cekSpeed();
};
cekUI();
if (pilihAbility == 1) {
ui_mc.option_mc.namaAbility = 'Town Ability: Resource';
} else {
if (pilihAbility == 2) {
ui_mc.option_mc.namaAbility = 'Town Ability: Military';
} else {
if (pilihAbility == 3) {
ui_mc.option_mc.namaAbility = 'Town Ability: Technology';
}
}
}
if (tingkatSulit == 1) {
ui_mc.option_mc.namaSulit = 'Difficulty: Easy';
} else {
if (tingkatSulit == 2) {
ui_mc.option_mc.namaSulit = 'Difficulty: Normal';
} else {
if (tingkatSulit == 3) {
ui_mc.option_mc.namaSulit = 'Difficulty: Hard';
}
}
}
if (pilihSkenario == 1) {
ui_mc.option_mc.namaSkenario = 'Scenario: Monster Glory';
} else {
if (pilihSkenario == 2) {
ui_mc.option_mc.namaSkenario = 'Scenario: Two Ways';
} else {
if (pilihSkenario == 3) {
ui_mc.option_mc.namaSkenario = 'Scenario: Massive Enemy';
} else {
if (pilihSkenario == 4) {
ui_mc.option_mc.namaSkenario = 'Scenario: No Resources?';
}
}
}
}
}
function cekMove() {
clearSemua();
aksiMap = 'move';
gotoAndStop(769);
}
function cekMoveInfo() {
ui_mc.pindah_mc.cityName = 'Move Goods From ' + xnamaKota[keKota] + ' To ' + xnamaKota[kotaMove];
cekDataPindah();
ui_mc.pindah_mc.move_btn.onRelease = cekPindahSemua;
ui_mc.pindah_mc.cancel_btn.onRelease = function () {
akanSerangKota = false;
ui_mc.pindah_mc._visible = false;
bisaUI(true);
};
ui_mc.pindah_mc.maxResource.onRelease = function () {
updateResource2();
ui_mc.pindah_mc.ygold.text = Math.ceil(_root['xgold' + keKota] / 1);
ui_mc.pindah_mc.yiron.text = Math.ceil(_root['xiron' + keKota] / 1);
ui_mc.pindah_mc.ywood.text = Math.ceil(_root['xwood' + keKota] / 1);
ui_mc.pindah_mc.yworker.text = Math.ceil(_root['xworker' + keKota] / 1);
ui_mc.pindah_mc.yfood.text = Math.ceil(_root['xfood' + keKota] / 1);
};
ui_mc.pindah_mc.halfResource.onRelease = function () {
updateResource2();
ui_mc.pindah_mc.ygold.text = Math.ceil(_root['xgold' + keKota] / 2);
ui_mc.pindah_mc.yiron.text = Math.ceil(_root['xiron' + keKota] / 2);
ui_mc.pindah_mc.ywood.text = Math.ceil(_root['xwood' + keKota] / 2);
ui_mc.pindah_mc.yworker.text = Math.ceil(_root['xworker' + keKota] / 2);
ui_mc.pindah_mc.yfood.text = Math.ceil(_root['xfood' + keKota] / 2);
};
ui_mc.pindah_mc.quarterResource.onRelease = function () {
updateResource2();
ui_mc.pindah_mc.ygold.text = Math.ceil(_root['xgold' + keKota] / 4);
ui_mc.pindah_mc.yiron.text = Math.ceil(_root['xiron' + keKota] / 4);
ui_mc.pindah_mc.ywood.text = Math.ceil(_root['xwood' + keKota] / 4);
ui_mc.pindah_mc.yworker.text = Math.ceil(_root['xworker' + keKota] / 4);
ui_mc.pindah_mc.yfood.text = Math.ceil(_root['xfood' + keKota] / 4);
};
ui_mc.pindah_mc.maxArmy.onRelease = function () {
updateResource2();
ui_mc.pindah_mc.ybareman.text = Math.ceil(_root['xbareman' + keKota] / 1);
ui_mc.pindah_mc.yswordman.text = Math.ceil(_root['xswordman' + keKota] / 1);
ui_mc.pindah_mc.yarrowman.text = Math.ceil(_root['xarrowman' + keKota] / 1);
ui_mc.pindah_mc.yspearman.text = Math.ceil(_root['xspearman' + keKota] / 1);
ui_mc.pindah_mc.ytank.text = Math.ceil(_root['xtank' + keKota] / 1);
ui_mc.pindah_mc.ycopter.text = Math.ceil(_root['xcopter' + keKota] / 1);
ui_mc.pindah_mc.ymonbot.text = Math.ceil(_root['xmonbot' + keKota] / 1);
};
ui_mc.pindah_mc.halfArmy.onRelease = function () {
updateResource2();
ui_mc.pindah_mc.ybareman.text = Math.ceil(_root['xbareman' + keKota] / 2);
ui_mc.pindah_mc.yswordman.text = Math.ceil(_root['xswordman' + keKota] / 2);
ui_mc.pindah_mc.yarrowman.text = Math.ceil(_root['xarrowman' + keKota] / 2);
ui_mc.pindah_mc.yspearman.text = Math.ceil(_root['xspearman' + keKota] / 2);
ui_mc.pindah_mc.ytank.text = Math.ceil(_root['xtank' + keKota] / 2);
ui_mc.pindah_mc.ycopter.text = Math.ceil(_root['xcopter' + keKota] / 2);
ui_mc.pindah_mc.ymonbot.text = Math.ceil(_root['xmonbot' + keKota] / 2);
};
ui_mc.pindah_mc.quarterArmy.onRelease = function () {
updateResource2();
ui_mc.pindah_mc.ybareman.text = Math.ceil(_root['xbareman' + keKota] / 4);
ui_mc.pindah_mc.yswordman.text = Math.ceil(_root['xswordman' + keKota] / 4);
ui_mc.pindah_mc.yarrowman.text = Math.ceil(_root['xarrowman' + keKota] / 4);
ui_mc.pindah_mc.yspearman.text = Math.ceil(_root['xspearman' + keKota] / 4);
ui_mc.pindah_mc.ytank.text = Math.ceil(_root['xtank' + keKota] / 4);
ui_mc.pindah_mc.ycopter.text = Math.ceil(_root['xcopter' + keKota] / 4);
ui_mc.pindah_mc.ymonbot.text = Math.ceil(_root['xmonbot' + keKota] / 4);
};
ui_mc.pindah_mc.maxWeapon.onRelease = function () {
updateResource2();
ui_mc.pindah_mc.ysword.text = Math.ceil(_root['xsword' + keKota] / 1);
ui_mc.pindah_mc.yarrow.text = Math.ceil(_root['xarrow' + keKota] / 1);
ui_mc.pindah_mc.yspear.text = Math.ceil(_root['xspear' + keKota] / 1);
ui_mc.pindah_mc.yarrowTrap.text = Math.ceil(_root['xarrowTrap' + keKota] / 1);
ui_mc.pindah_mc.ycatapult.text = Math.ceil(_root['xcatapult' + keKota] / 1);
ui_mc.pindah_mc.yfireTrap.text = Math.ceil(_root['xfireTrap' + keKota] / 1);
};
ui_mc.pindah_mc.halfWeapon.onRelease = function () {
updateResource2();
ui_mc.pindah_mc.ysword.text = Math.ceil(_root['xsword' + keKota] / 2);
ui_mc.pindah_mc.yarrow.text = Math.ceil(_root['xarrow' + keKota] / 2);
ui_mc.pindah_mc.yspear.text = Math.ceil(_root['xspear' + keKota] / 2);
ui_mc.pindah_mc.yarrowTrap.text = Math.ceil(_root['xarrowTrap' + keKota] / 2);
ui_mc.pindah_mc.ycatapult.text = Math.ceil(_root['xcatapult' + keKota] / 2);
ui_mc.pindah_mc.yfireTrap.text = Math.ceil(_root['xfireTrap' + keKota] / 2);
};
ui_mc.pindah_mc.quarterWeapon.onRelease = function () {
updateResource2();
ui_mc.pindah_mc.ysword.text = Math.ceil(_root['xsword' + keKota] / 4);
ui_mc.pindah_mc.yarrow.text = Math.ceil(_root['xarrow' + keKota] / 4);
ui_mc.pindah_mc.yspear.text = Math.ceil(_root['xspear' + keKota] / 4);
ui_mc.pindah_mc.yarrowTrap.text = Math.ceil(_root['xarrowTrap' + keKota] / 4);
ui_mc.pindah_mc.ycatapult.text = Math.ceil(_root['xcatapult' + keKota] / 4);
ui_mc.pindah_mc.yfireTrap.text = Math.ceil(_root['xfireTrap' + keKota] / 4);
};
ui_mc.pindah_mc.maxSpell.onRelease = function () {
updateResource2();
ui_mc.pindah_mc.yarrowRain.text = Math.ceil(_root['xarrowRain' + keKota] / 1);
ui_mc.pindah_mc.ymeteorid.text = Math.ceil(_root['xmeteorid' + keKota] / 1);
ui_mc.pindah_mc.yacidRain.text = Math.ceil(_root['xacidRain' + keKota] / 1);
ui_mc.pindah_mc.yearthquake.text = Math.ceil(_root['xearthquake' + keKota] / 1);
ui_mc.pindah_mc.yimmune.text = Math.ceil(_root['ximmune' + keKota] / 1);
ui_mc.pindah_mc.yinvisible.text = Math.ceil(_root['xinvisible' + keKota] / 1);
ui_mc.pindah_mc.yspecialAttack.text = Math.ceil(_root['xspecialAttack' + keKota] / 1);
ui_mc.pindah_mc.yduplicate.text = Math.ceil(_root['xduplicate' + keKota] / 1);
};
ui_mc.pindah_mc.halfSpell.onRelease = function () {
updateResource2();
ui_mc.pindah_mc.yarrowRain.text = Math.ceil(_root['xarrowRain' + keKota] / 2);
ui_mc.pindah_mc.ymeteorid.text = Math.ceil(_root['xmeteorid' + keKota] / 2);
ui_mc.pindah_mc.yacidRain.text = Math.ceil(_root['xacidRain' + keKota] / 2);
ui_mc.pindah_mc.yearthquake.text = Math.ceil(_root['xearthquake' + keKota] / 2);
ui_mc.pindah_mc.yimmune.text = Math.ceil(_root['ximmune' + keKota] / 2);
ui_mc.pindah_mc.yinvisible.text = Math.ceil(_root['xinvisible' + keKota] / 2);
ui_mc.pindah_mc.yspecialAttack.text = Math.ceil(_root['xspecialAttack' + keKota] / 2);
ui_mc.pindah_mc.yduplicate.text = Math.ceil(_root['xduplicate' + keKota] / 2);
};
ui_mc.pindah_mc.quarterSpell.onRelease = function () {
updateResource2();
ui_mc.pindah_mc.yarrowRain.text = Math.ceil(_root['xarrowRain' + keKota] / 4);
ui_mc.pindah_mc.ymeteorid.text = Math.ceil(_root['xmeteorid' + keKota] / 4);
ui_mc.pindah_mc.yacidRain.text = Math.ceil(_root['xacidRain' + keKota] / 4);
ui_mc.pindah_mc.yearthquake.text = Math.ceil(_root['xearthquake' + keKota] / 4);
ui_mc.pindah_mc.yimmune.text = Math.ceil(_root['ximmune' + keKota] / 4);
ui_mc.pindah_mc.yinvisible.text = Math.ceil(_root['xinvisible' + keKota] / 4);
ui_mc.pindah_mc.yspecialAttack.text = Math.ceil(_root['xspecialAttack' + keKota] / 4);
ui_mc.pindah_mc.yduplicate.text = Math.ceil(_root['xduplicate' + keKota] / 4);
};
ui_mc.pindah_mc.maxDefense.onRelease = function () {
updateResource2();
ui_mc.pindah_mc.ywall.text = Math.ceil(_root['xwall' + keKota] / 1);
ui_mc.pindah_mc.yspike.text = Math.ceil(_root['xspike' + keKota] / 1);
ui_mc.pindah_mc.yspiderWeb.text = Math.ceil(_root['xspiderWeb' + keKota] / 1);
ui_mc.pindah_mc.ytowerGuard.text = Math.ceil(_root['xtowerGuard' + keKota] / 1);
ui_mc.pindah_mc.yzombieTrap.text = Math.ceil(_root['xzombieTrap' + keKota] / 1);
};
ui_mc.pindah_mc.halfDefense.onRelease = function () {
updateResource2();
ui_mc.pindah_mc.ywall.text = Math.ceil(_root['xwall' + keKota] / 2);
ui_mc.pindah_mc.yspike.text = Math.ceil(_root['xspike' + keKota] / 2);
ui_mc.pindah_mc.yspiderWeb.text = Math.ceil(_root['xspiderWeb' + keKota] / 2);
ui_mc.pindah_mc.ytowerGuard.text = Math.ceil(_root['xtowerGuard' + keKota] / 2);
ui_mc.pindah_mc.yzombieTrap.text = Math.ceil(_root['xzombieTrap' + keKota] / 2);
};
ui_mc.pindah_mc.quarterDefense.onRelease = function () {
updateResource2();
ui_mc.pindah_mc.ywall.text = Math.ceil(_root['xwall' + keKota] / 4);
ui_mc.pindah_mc.yspike.text = Math.ceil(_root['xspike' + keKota] / 4);
ui_mc.pindah_mc.yspiderWeb.text = Math.ceil(_root['xspiderWeb' + keKota] / 4);
ui_mc.pindah_mc.ytowerGuard.text = Math.ceil(_root['xtowerGuard' + keKota] / 4);
ui_mc.pindah_mc.yzombieTrap.text = Math.ceil(_root['xzombieTrap' + keKota] / 4);
};
ui_mc.pindah_mc.max_btn.onRelease = function () {
updateResource2();
ui_mc.pindah_mc.ygold.text = Math.ceil(_root['xgold' + keKota] / 1);
ui_mc.pindah_mc.yiron.text = Math.ceil(_root['xiron' + keKota] / 1);
ui_mc.pindah_mc.ywood.text = Math.ceil(_root['xwood' + keKota] / 1);
ui_mc.pindah_mc.yworker.text = Math.ceil(_root['xworker' + keKota] / 1);
ui_mc.pindah_mc.ybareman.text = Math.ceil(_root['xbareman' + keKota] / 1);
ui_mc.pindah_mc.yswordman.text = Math.ceil(_root['xswordman' + keKota] / 1);
ui_mc.pindah_mc.yarrowman.text = Math.ceil(_root['xarrowman' + keKota] / 1);
ui_mc.pindah_mc.yspearman.text = Math.ceil(_root['xspearman' + keKota] / 1);
ui_mc.pindah_mc.ytech.text = Math.ceil(_root['xtech' + keKota] / 1);
ui_mc.pindah_mc.ymana.text = Math.ceil(_root['xmana' + keKota] / 1);
ui_mc.pindah_mc.yfood.text = Math.ceil(_root['xfood' + keKota] / 1);
ui_mc.pindah_mc.ytank.text = Math.ceil(_root['xtank' + keKota] / 1);
ui_mc.pindah_mc.ycopter.text = Math.ceil(_root['xcopter' + keKota] / 1);
ui_mc.pindah_mc.ymonbot.text = Math.ceil(_root['xmonbot' + keKota] / 1);
ui_mc.pindah_mc.ysword.text = Math.ceil(_root['xsword' + keKota] / 1);
ui_mc.pindah_mc.yarrow.text = Math.ceil(_root['xarrow' + keKota] / 1);
ui_mc.pindah_mc.yspear.text = Math.ceil(_root['xspear' + keKota] / 1);
ui_mc.pindah_mc.yarrowTrap.text = Math.ceil(_root['xarrowTrap' + keKota] / 1);
ui_mc.pindah_mc.ycatapult.text = Math.ceil(_root['xcatapult' + keKota] / 1);
ui_mc.pindah_mc.yfireTrap.text = Math.ceil(_root['xfireTrap' + keKota] / 1);
ui_mc.pindah_mc.yarrowRain.text = Math.ceil(_root['xarrowRain' + keKota] / 1);
ui_mc.pindah_mc.ymeteorid.text = Math.ceil(_root['xmeteorid' + keKota] / 1);
ui_mc.pindah_mc.yacidRain.text = Math.ceil(_root['xacidRain' + keKota] / 1);
ui_mc.pindah_mc.yearthquake.text = Math.ceil(_root['xearthquake' + keKota] / 1);
ui_mc.pindah_mc.yimmune.text = Math.ceil(_root['ximmune' + keKota] / 1);
ui_mc.pindah_mc.yinvisible.text = Math.ceil(_root['xinvisible' + keKota] / 1);
ui_mc.pindah_mc.yspecialAttack.text = Math.ceil(_root['xspecialAttack' + keKota] / 1);
ui_mc.pindah_mc.yduplicate.text = Math.ceil(_root['xduplicate' + keKota] / 1);
ui_mc.pindah_mc.ywall.text = Math.ceil(_root['xwall' + keKota] / 1);
ui_mc.pindah_mc.yspike.text = Math.ceil(_root['xspike' + keKota] / 1);
ui_mc.pindah_mc.yspiderWeb.text = Math.ceil(_root['xspiderWeb' + keKota] / 1);
ui_mc.pindah_mc.ytowerGuard.text = Math.ceil(_root['xtowerGuard' + keKota] / 1);
ui_mc.pindah_mc.yzombieTrap.text = Math.ceil(_root['xzombieTrap' + keKota] / 1);
};
ui_mc.pindah_mc.half_btn.onRelease = function () {
updateResource2();
ui_mc.pindah_mc.ygold.text = Math.ceil(_root['xgold' + keKota] / 2);
ui_mc.pindah_mc.yiron.text = Math.ceil(_root['xiron' + keKota] / 2);
ui_mc.pindah_mc.ywood.text = Math.ceil(_root['xwood' + keKota] / 2);
ui_mc.pindah_mc.yworker.text = Math.ceil(_root['xworker' + keKota] / 2);
ui_mc.pindah_mc.ybareman.text = Math.ceil(_root['xbareman' + keKota] / 2);
ui_mc.pindah_mc.yswordman.text = Math.ceil(_root['xswordman' + keKota] / 2);
ui_mc.pindah_mc.yarrowman.text = Math.ceil(_root['xarrowman' + keKota] / 2);
ui_mc.pindah_mc.yspearman.text = Math.ceil(_root['xspearman' + keKota] / 2);
ui_mc.pindah_mc.ytech.text = Math.ceil(_root['xtech' + keKota] / 2);
ui_mc.pindah_mc.ymana.text = Math.ceil(_root['xmana' + keKota] / 2);
ui_mc.pindah_mc.yfood.text = Math.ceil(_root['xfood' + keKota] / 2);
ui_mc.pindah_mc.ytank.text = Math.ceil(_root['xtank' + keKota] / 2);
ui_mc.pindah_mc.ycopter.text = Math.ceil(_root['xcopter' + keKota] / 2);
ui_mc.pindah_mc.ymonbot.text = Math.ceil(_root['xmonbot' + keKota] / 2);
ui_mc.pindah_mc.ysword.text = Math.ceil(_root['xsword' + keKota] / 2);
ui_mc.pindah_mc.yarrow.text = Math.ceil(_root['xarrow' + keKota] / 2);
ui_mc.pindah_mc.yspear.text = Math.ceil(_root['xspear' + keKota] / 2);
ui_mc.pindah_mc.yarrowTrap.text = Math.ceil(_root['xarrowTrap' + keKota] / 2);
ui_mc.pindah_mc.ycatapult.text = Math.ceil(_root['xcatapult' + keKota] / 2);
ui_mc.pindah_mc.yfireTrap.text = Math.ceil(_root['xfireTrap' + keKota] / 2);
ui_mc.pindah_mc.yarrowRain.text = Math.ceil(_root['xarrowRain' + keKota] / 2);
ui_mc.pindah_mc.ymeteorid.text = Math.ceil(_root['xmeteorid' + keKota] / 2);
ui_mc.pindah_mc.yacidRain.text = Math.ceil(_root['xacidRain' + keKota] / 2);
ui_mc.pindah_mc.yearthquake.text = Math.ceil(_root['xearthquake' + keKota] / 2);
ui_mc.pindah_mc.yimmune.text = Math.ceil(_root['ximmune' + keKota] / 2);
ui_mc.pindah_mc.yinvisible.text = Math.ceil(_root['xinvisible' + keKota] / 2);
ui_mc.pindah_mc.yspecialAttack.text = Math.ceil(_root['xspecialAttack' + keKota] / 2);
ui_mc.pindah_mc.yduplicate.text = Math.ceil(_root['xduplicate' + keKota] / 2);
ui_mc.pindah_mc.ywall.text = Math.ceil(_root['xwall' + keKota] / 2);
ui_mc.pindah_mc.yspike.text = Math.ceil(_root['xspike' + keKota] / 2);
ui_mc.pindah_mc.yspiderWeb.text = Math.ceil(_root['xspiderWeb' + keKota] / 2);
ui_mc.pindah_mc.ytowerGuard.text = Math.ceil(_root['xtowerGuard' + keKota] / 2);
ui_mc.pindah_mc.yzombieTrap.text = Math.ceil(_root['xzombieTrap' + keKota] / 2);
};
ui_mc.pindah_mc.quarter_btn.onRelease = function () {
updateResource2();
ui_mc.pindah_mc.ygold.text = Math.ceil(_root['xgold' + keKota] / 4);
ui_mc.pindah_mc.yiron.text = Math.ceil(_root['xiron' + keKota] / 4);
ui_mc.pindah_mc.ywood.text = Math.ceil(_root['xwood' + keKota] / 4);
ui_mc.pindah_mc.yworker.text = Math.ceil(_root['xworker' + keKota] / 4);
ui_mc.pindah_mc.ybareman.text = Math.ceil(_root['xbareman' + keKota] / 4);
ui_mc.pindah_mc.yswordman.text = Math.ceil(_root['xswordman' + keKota] / 4);
ui_mc.pindah_mc.yarrowman.text = Math.ceil(_root['xarrowman' + keKota] / 4);
ui_mc.pindah_mc.yspearman.text = Math.ceil(_root['xspearman' + keKota] / 4);
ui_mc.pindah_mc.ytech.text = Math.ceil(_root['xtech' + keKota] / 4);
ui_mc.pindah_mc.ymana.text = Math.ceil(_root['xmana' + keKota] / 4);
ui_mc.pindah_mc.yfood.text = Math.ceil(_root['xfood' + keKota] / 4);
ui_mc.pindah_mc.ytank.text = Math.ceil(_root['xtank' + keKota] / 4);
ui_mc.pindah_mc.ycopter.text = Math.ceil(_root['xcopter' + keKota] / 4);
ui_mc.pindah_mc.ymonbot.text = Math.ceil(_root['xmonbot' + keKota] / 4);
ui_mc.pindah_mc.ysword.text = Math.ceil(_root['xsword' + keKota] / 4);
ui_mc.pindah_mc.yarrow.text = Math.ceil(_root['xarrow' + keKota] / 4);
ui_mc.pindah_mc.yspear.text = Math.ceil(_root['xspear' + keKota] / 4);
ui_mc.pindah_mc.yarrowTrap.text = Math.ceil(_root['xarrowTrap' + keKota] / 4);
ui_mc.pindah_mc.ycatapult.text = Math.ceil(_root['xcatapult' + keKota] / 4);
ui_mc.pindah_mc.yfireTrap.text = Math.ceil(_root['xfireTrap' + keKota] / 4);
ui_mc.pindah_mc.yarrowRain.text = Math.ceil(_root['xarrowRain' + keKota] / 4);
ui_mc.pindah_mc.ymeteorid.text = Math.ceil(_root['xmeteorid' + keKota] / 4);
ui_mc.pindah_mc.yacidRain.text = Math.ceil(_root['xacidRain' + keKota] / 4);
ui_mc.pindah_mc.yearthquake.text = Math.ceil(_root['xearthquake' + keKota] / 4);
ui_mc.pindah_mc.yimmune.text = Math.ceil(_root['ximmune' + keKota] / 4);
ui_mc.pindah_mc.yinvisible.text = Math.ceil(_root['xinvisible' + keKota] / 4);
ui_mc.pindah_mc.yspecialAttack.text = Math.ceil(_root['xspecialAttack' + keKota] / 4);
ui_mc.pindah_mc.yduplicate.text = Math.ceil(_root['xduplicate' + keKota] / 4);
ui_mc.pindah_mc.ywall.text = Math.ceil(_root['xwall' + keKota] / 4);
ui_mc.pindah_mc.yspike.text = Math.ceil(_root['xspike' + keKota] / 4);
ui_mc.pindah_mc.yspiderWeb.text = Math.ceil(_root['xspiderWeb' + keKota] / 4);
ui_mc.pindah_mc.ytowerGuard.text = Math.ceil(_root['xtowerGuard' + keKota] / 4);
ui_mc.pindah_mc.yzombieTrap.text = Math.ceil(_root['xzombieTrap' + keKota] / 4);
};
ui_mc.pindah_mc.reset_btn.onRelease = function () {
updateResource2();
ui_mc.pindah_mc.ygold.text = 0;
ui_mc.pindah_mc.yiron.text = 0;
ui_mc.pindah_mc.ywood.text = 0;
ui_mc.pindah_mc.yworker.text = 0;
ui_mc.pindah_mc.ybareman.text = 0;
ui_mc.pindah_mc.yswordman.text = 0;
ui_mc.pindah_mc.yarrowman.text = 0;
ui_mc.pindah_mc.yspearman.text = 0;
ui_mc.pindah_mc.ytech.text = 0;
ui_mc.pindah_mc.ymana.text = 0;
ui_mc.pindah_mc.yfood.text = 0;
ui_mc.pindah_mc.ytank.text = 0;
ui_mc.pindah_mc.ycopter.text = 0;
ui_mc.pindah_mc.ymonbot.text = 0;
ui_mc.pindah_mc.ysword.text = 0;
ui_mc.pindah_mc.yarrow.text = 0;
ui_mc.pindah_mc.yspear.text = 0;
ui_mc.pindah_mc.yarrowTrap.text = 0;
ui_mc.pindah_mc.ycatapult.text = 0;
ui_mc.pindah_mc.yfireTrap.text = 0;
ui_mc.pindah_mc.yarrowRain.text = 0;
ui_mc.pindah_mc.ymeteorid.text = 0;
ui_mc.pindah_mc.yacidRain.text = 0;
ui_mc.pindah_mc.yearthquake.text = 0;
ui_mc.pindah_mc.yimmune.text = 0;
ui_mc.pindah_mc.yinvisible.text = 0;
ui_mc.pindah_mc.yspecialAttack.text = 0;
ui_mc.pindah_mc.yduplicate.text = 0;
ui_mc.pindah_mc.ywall.text = 0;
ui_mc.pindah_mc.yspike.text = 0;
ui_mc.pindah_mc.yspiderWeb.text = 0;
ui_mc.pindah_mc.ytowerGuard.text = 0;
ui_mc.pindah_mc.yzombieTrap.text = 0;
};
}
function cekDataPindah() {
ui_mc.pindah_mc.xgold = _root['xgold' + keKota];
ui_mc.pindah_mc.xiron = _root['xiron' + keKota];
ui_mc.pindah_mc.xwood = _root['xwood' + keKota];
ui_mc.pindah_mc.xworker = _root['xworker' + keKota];
ui_mc.pindah_mc.xbareman = _root['xbareman' + keKota];
ui_mc.pindah_mc.xswordman = _root['xswordman' + keKota];
ui_mc.pindah_mc.xarrowman = _root['xarrowman' + keKota];
ui_mc.pindah_mc.xspearman = _root['xspearman' + keKota];
ui_mc.pindah_mc.xtech = _root['xtech' + keKota];
ui_mc.pindah_mc.xmana = _root['xmana' + keKota];
ui_mc.pindah_mc.xfood = _root['xfood' + keKota];
ui_mc.pindah_mc.xtank = _root['xtank' + keKota];
ui_mc.pindah_mc.xcopter = _root['xcopter' + keKota];
ui_mc.pindah_mc.xmonbot = _root['xmonbot' + keKota];
ui_mc.pindah_mc.xsword = _root['xsword' + keKota];
ui_mc.pindah_mc.xarrow = _root['xarrow' + keKota];
ui_mc.pindah_mc.xspear = _root['xspear' + keKota];
ui_mc.pindah_mc.xarrowTrap = _root['xarrowTrap' + keKota];
ui_mc.pindah_mc.xcatapult = _root['xcatapult' + keKota];
ui_mc.pindah_mc.xfireTrap = _root['xfireTrap' + keKota];
ui_mc.pindah_mc.xarrowRain = _root['xarrowRain' + keKota];
ui_mc.pindah_mc.xmeteorid = _root['xmeteorid' + keKota];
ui_mc.pindah_mc.xacidRain = _root['xacidRain' + keKota];
ui_mc.pindah_mc.xearthquake = _root['xearthquake' + keKota];
ui_mc.pindah_mc.ximmune = _root['ximmune' + keKota];
ui_mc.pindah_mc.xinvisible = _root['xinvisible' + keKota];
ui_mc.pindah_mc.xspecialAttack = _root['xspecialAttack' + keKota];
ui_mc.pindah_mc.xduplicate = _root['xduplicate' + keKota];
ui_mc.pindah_mc.xwall = _root['xwall' + keKota];
ui_mc.pindah_mc.xspike = _root['xspike' + keKota];
ui_mc.pindah_mc.xspiderWeb = _root['xspiderWeb' + keKota];
ui_mc.pindah_mc.xtowerGuard = _root['xtowerGuard' + keKota];
ui_mc.pindah_mc.xzombieTrap = _root['xzombieTrap' + keKota];
ui_mc.pindah_mc.ygold.text = 0;
ui_mc.pindah_mc.yiron.text = 0;
ui_mc.pindah_mc.ywood.text = 0;
ui_mc.pindah_mc.yworker.text = 0;
ui_mc.pindah_mc.ybareman.text = 0;
ui_mc.pindah_mc.yswordman.text = 0;
ui_mc.pindah_mc.yarrowman.text = 0;
ui_mc.pindah_mc.yspearman.text = 0;
ui_mc.pindah_mc.ytech.text = 0;
ui_mc.pindah_mc.ymana.text = 0;
ui_mc.pindah_mc.yfood.text = 0;
ui_mc.pindah_mc.ytank.text = 0;
ui_mc.pindah_mc.ycopter.text = 0;
ui_mc.pindah_mc.ymonbot.text = 0;
ui_mc.pindah_mc.ysword.text = 0;
ui_mc.pindah_mc.yarrow.text = 0;
ui_mc.pindah_mc.yspear.text = 0;
ui_mc.pindah_mc.yarrowTrap.text = 0;
ui_mc.pindah_mc.ycatapult.text = 0;
ui_mc.pindah_mc.yfireTrap.text = 0;
ui_mc.pindah_mc.yarrowRain.text = 0;
ui_mc.pindah_mc.ymeteorid.text = 0;
ui_mc.pindah_mc.yacidRain.text = 0;
ui_mc.pindah_mc.yearthquake.text = 0;
ui_mc.pindah_mc.yimmune.text = 0;
ui_mc.pindah_mc.yinvisible.text = 0;
ui_mc.pindah_mc.yspecialAttack.text = 0;
ui_mc.pindah_mc.yduplicate.text = 0;
ui_mc.pindah_mc.ywall.text = 0;
ui_mc.pindah_mc.yspike.text = 0;
ui_mc.pindah_mc.yspiderWeb.text = 0;
ui_mc.pindah_mc.ytowerGuard.text = 0;
ui_mc.pindah_mc.yzombieTrap.text = 0;
}
function cekPindahan() {
pindahGold = ui_mc.pindah_mc.ygold.text;
pindahIron = ui_mc.pindah_mc.yiron.text;
pindahWood = ui_mc.pindah_mc.ywood.text;
pindahWorker = ui_mc.pindah_mc.yworker.text;
pindahBareman = ui_mc.pindah_mc.ybareman.text;
pindahSwordman = ui_mc.pindah_mc.yswordman.text;
pindahArrowman = ui_mc.pindah_mc.yarrowman.text;
pindahSpearman = ui_mc.pindah_mc.yspearman.text;
pindahTech = ui_mc.pindah_mc.ytech.text;
pindahMana = ui_mc.pindah_mc.ymana.text;
pindahFood = ui_mc.pindah_mc.yfood.text;
pindahTank = ui_mc.pindah_mc.ytank.text;
pindahCopter = ui_mc.pindah_mc.ycopter.text;
pindahMonbot = ui_mc.pindah_mc.ymonbot.text;
pindahSword = ui_mc.pindah_mc.ysword.text;
pindahArrow = ui_mc.pindah_mc.yarrow.text;
pindahSpear = ui_mc.pindah_mc.yspear.text;
pindahArrowTrap = ui_mc.pindah_mc.yarrowTrap.text;
pindahCatapult = ui_mc.pindah_mc.ycatapult.text;
pindahFireTrap = ui_mc.pindah_mc.yfireTrap.text;
pindahArrowRain = ui_mc.pindah_mc.yarrowRain.text;
pindahMeteorid = ui_mc.pindah_mc.ymeteorid.text;
pindahAcidRain = ui_mc.pindah_mc.yacidRain.text;
pindahEarthquake = ui_mc.pindah_mc.yearthquake.text;
pindahImmune = ui_mc.pindah_mc.yimmune.text;
pindahInvisible = ui_mc.pindah_mc.yinvisible.text;
pindahSpecialAttack = ui_mc.pindah_mc.yspecialAttack.text;
pindahDuplicate = ui_mc.pindah_mc.yduplicate.text;
pindahWall = ui_mc.pindah_mc.ywall.text;
pindahSpike = ui_mc.pindah_mc.yspike.text;
pindahSpiderWeb = ui_mc.pindah_mc.yspiderWeb.text;
pindahTowerGuard = ui_mc.pindah_mc.ytowerGuard.text;
pindahZombieTrap = ui_mc.pindah_mc.yzombieTrap.text;
if (isNaN(pindahGold)) {
pindahGold = 0;
} else {
if (pindahGold >= _root['xgold' + keKota]) {
pindahGold = _root['xgold' + keKota];
}
}
if (isNaN(pindahIron)) {
pindahIron = 0;
} else {
if (pindahIron >= _root['xiron' + keKota]) {
pindahIron = _root['xiron' + keKota];
}
}
if (isNaN(pindahWood)) {
pindahWood = 0;
} else {
if (pindahWood >= _root['xwood' + keKota]) {
pindahWood = _root['xwood' + keKota];
}
}
if (isNaN(pindahWorker)) {
pindahWorker = 0;
} else {
if (pindahWorker >= _root['xworker' + keKota]) {
pindahWorker = _root['xworker' + keKota];
}
}
pindahWorker = 0;
if (isNaN(pindahBareman)) {
pindahBareman = 0;
} else {
if (pindahBareman >= _root['xbareman' + keKota]) {
pindahBareman = _root['xbareman' + keKota];
}
}
if (isNaN(pindahSwordman)) {
pindahSwordman = 0;
} else {
if (pindahSwordman >= _root['xswordman' + keKota]) {
pindahSwordman = _root['xswordman' + keKota];
}
}
if (isNaN(pindahArrowman)) {
pindahArrowman = 0;
} else {
if (pindahArrowman >= _root['xarrowman' + keKota]) {
pindahArrowman = _root['xarrowman' + keKota];
}
}
if (isNaN(pindahSpearman)) {
pindahSpearman = 0;
} else {
if (pindahSpearman >= _root['xspearman' + keKota]) {
pindahSpearman = _root['xspearman' + keKota];
}
}
if (isNaN(pindahTech)) {
pindahTech = 0;
} else {
if (pindahTech >= _root['xtech' + keKota]) {
pindahTech = _root['xtech' + keKota];
}
}
if (isNaN(pindahMana)) {
pindahMana = 0;
} else {
if (pindahMana >= _root['xmana' + keKota]) {
pindahMana = _root['xmana' + keKota];
}
}
if (isNaN(pindahFood)) {
pindahFood = 0;
} else {
if (pindahFood >= _root['xfood' + keKota]) {
pindahFood = _root['xfood' + keKota];
}
}
if (isNaN(pindahTank)) {
pindahTank = 0;
} else {
if (pindahTank >= _root['xtank' + keKota]) {
pindahTank = _root['xtank' + keKota];
}
}
if (isNaN(pindahCopter)) {
pindahCopter = 0;
} else {
if (pindahCopter >= _root['xcopter' + keKota]) {
pindahCopter = _root['xcopter' + keKota];
}
}
if (isNaN(pindahMonbot)) {
pindahMonbot = 0;
} else {
if (pindahMonbot >= _root['xmonbot' + keKota]) {
pindahMonbot = _root['xmonbot' + keKota];
}
}
if (isNaN(pindahSword)) {
pindahSword = 0;
} else {
if (pindahSword >= _root['xsword' + keKota]) {
pindahSword = _root['xsword' + keKota];
}
}
if (isNaN(pindahArrow)) {
pindahArrow = 0;
} else {
if (pindahSword >= _root['xarrow' + keKota]) {
pindahArrow = _root['xarrow' + keKota];
}
}
if (isNaN(pindahSpear)) {
pindahSpear = 0;
} else {
if (pindahSpear >= _root['xspear' + keKota]) {
pindahSpear = _root['xspear' + keKota];
}
}
if (isNaN(pindahArrowTrap)) {
pindahArrowTrap = 0;
} else {
if (pindahArrowTrap >= _root['xarrowTrap' + keKota]) {
pindahArrowTrap = _root['xarrowTrap' + keKota];
}
}
if (isNaN(pindahCatapult)) {
pindahCatapult = 0;
} else {
if (pindahCatapult >= _root['xcatapult' + keKota]) {
pindahCatapult = _root['xcatapult' + keKota];
}
}
if (isNaN(pindahFireTrap)) {
pindahFireTrap = 0;
} else {
if (pindahFireTrap >= _root['xfireTrap' + keKota]) {
pindahFireTrap = _root['xfireTrap' + keKota];
}
}
if (isNaN(pindahArrowRain)) {
pindahArrowRain = 0;
} else {
if (pindahArrowRain >= _root['xarrowRain' + keKota]) {
pindahArrowRain = _root['xarrowRain' + keKota];
}
}
if (isNaN(pindahMeteorid)) {
pindahMeteorid = 0;
} else {
if (pindahMeteorid >= _root['xarrowRain' + keKota]) {
pindahMeteorid = _root['xarrowRain' + keKota];
}
}
if (isNaN(pindahAcidRain)) {
pindahAcidRain = 0;
} else {
if (pindahAcidRain >= _root['xacidRain' + keKota]) {
pindahAcidRain = _root['xacidRain' + keKota];
}
}
if (isNaN(pindahEarthquake)) {
pindahEarthquake = 0;
} else {
if (pindahEarthquake >= _root['xearthquake' + keKota]) {
pindahEarthquake = _root['xearthquake' + keKota];
}
}
if (isNaN(pindahImmune)) {
pindahImmune = 0;
} else {
if (pindahImmune >= _root['ximmune' + keKota]) {
pindahImmune = _root['ximmune' + keKota];
}
}
if (isNaN(pindahInvisible)) {
pindahInvisible = 0;
} else {
if (pindahInvisible >= _root['xinvisible' + keKota]) {
pindahInvisible = _root['xinvisible' + keKota];
}
}
if (isNaN(pindahSpecialAttack)) {
pindahSpecialAttack = 0;
} else {
if (pindahSpecialAttack >= _root['xspecialAttack' + keKota]) {
pindahSpecialAttack = _root['xspecialAttack' + keKota];
}
}
if (isNaN(pindahDuplicate)) {
pindahDuplicate = 0;
} else {
if (pindahDuplicate >= _root['xduplicate' + keKota]) {
pindahDuplicate = _root['xduplicate' + keKota];
}
}
if (isNaN(pindahWall)) {
pindahWall = 0;
} else {
if (pindahWall >= _root['xwall' + keKota]) {
pindahWall = _root['xwall' + keKota];
}
}
if (isNaN(pindahSpike)) {
pindahSpike = 0;
} else {
if (pindahSpike >= _root['xspike' + keKota]) {
pindahSpike = _root['xspike' + keKota];
}
}
if (isNaN(pindahSpiderWeb)) {
pindahSpiderWeb = 0;
} else {
if (pindahSpiderWeb >= _root['xspiderWeb' + keKota]) {
pindahSpiderWeb = _root['xspiderWeb' + keKota];
}
}
if (isNaN(pindahTowerGuard)) {
pindahTowerGuard = 0;
} else {
if (pindahTowerGuard >= _root['xtowerGuard' + keKota]) {
pindahTowerGuard = _root['xtowerGuard' + keKota];
}
}
if (isNaN(pindahZombieTrap)) {
pindahZombieTrap = 0;
} else {
if (pindahZombieTrap >= _root['xzombieTrap' + keKota]) {
pindahZombieTrap = _root['xzombieTrap' + keKota];
}
}
_root['xgold' + kotaMove] += Number(pindahGold);
_root['xiron' + kotaMove] += Number(pindahIron);
_root['xwood' + kotaMove] += Number(pindahWood);
_root['xbareman' + kotaMove] += Number(pindahBareman);
_root['xswordman' + kotaMove] += Number(pindahSwordman);
_root['xarrowman' + kotaMove] += Number(pindahArrowman);
_root['xspearman' + kotaMove] += Number(pindahSpearman);
_root['xfood' + kotaMove] += Number(pindahFood);
_root['xtank' + kotaMove] += Number(pindahTank);
_root['xcopter' + kotaMove] += Number(pindahCopter);
_root['xmonbot' + kotaMove] += Number(pindahMonbot);
_root['xsword' + kotaMove] += Number(pindahSword);
_root['xarrow' + kotaMove] += Number(pindahArrow);
_root['xspear' + kotaMove] += Number(pindahSpear);
_root['xarrowTrap' + kotaMove] += Number(pindahArrowTrap);
_root['xcatapult' + kotaMove] += Number(pindahCatapult);
_root['xfireTrap' + kotaMove] += Number(pindahFireTrap);
_root['xarrowRain' + kotaMove] += Number(pindahArrowRain);
_root['xmeteorid' + kotaMove] += Number(pindahMeteorid);
_root['xacidRain' + kotaMove] += Number(pindahAcidRain);
_root['xearthquake' + kotaMove] += Number(pindahEarthquake);
_root['ximmune' + kotaMove] += Number(pindahImmune);
_root['xinvisible' + kotaMove] += Number(pindahInvisible);
_root['xspecialAttack' + kotaMove] += Number(pindahSpecialAttack);
_root['xduplicate' + kotaMove] += Number(pindahDuplicate);
_root['xwall' + kotaMove] += Number(pindahWall);
_root['xspike' + kotaMove] += Number(pindahSpike);
_root['xspiderWeb' + kotaMove] += Number(pindahSpiderWeb);
_root['xtowerGuard' + kotaMove] += Number(pindahTowerGuard);
_root['xzombieTrap' + kotaMove] += Number(pindahZombieTrap);
_root['xgold' + keKota] -= Number(pindahGold);
_root['xiron' + keKota] -= Number(pindahIron);
_root['xwood' + keKota] -= Number(pindahWood);
_root['xbareman' + keKota] -= Number(pindahBareman);
_root['xswordman' + keKota] -= Number(pindahSwordman);
_root['xarrowman' + keKota] -= Number(pindahArrowman);
_root['xspearman' + keKota] -= Number(pindahSpearman);
_root['xfood' + keKota] -= Number(pindahFood);
_root['xtank' + keKota] -= Number(pindahTank);
_root['xcopter' + keKota] -= Number(pindahCopter);
_root['xmonbot' + keKota] -= Number(pindahMonbot);
_root['xsword' + keKota] -= Number(pindahSword);
_root['xarrow' + keKota] -= Number(pindahArrow);
_root['xspear' + keKota] -= Number(pindahSpear);
_root['xarrowTrap' + keKota] -= Number(pindahArrowTrap);
_root['xcatapult' + keKota] -= Number(pindahCatapult);
_root['xfireTrap' + keKota] -= Number(pindahFireTrap);
_root['xarrowRain' + keKota] -= Number(pindahArrowRain);
_root['xmeteorid' + keKota] -= Number(pindahMeteorid);
_root['xacidRain' + keKota] -= Number(pindahAcidRain);
_root['xearthquake' + keKota] -= Number(pindahEarthquake);
_root['ximmune' + keKota] -= Number(pindahImmune);
_root['xinvisible' + keKota] -= Number(pindahInvisible);
_root['xspecialAttack' + keKota] -= Number(pindahSpecialAttack);
_root['xduplicate' + keKota] -= Number(pindahDuplicate);
_root['xwall' + keKota] -= Number(pindahWall);
_root['xspike' + keKota] -= Number(pindahSpike);
_root['xspiderWeb' + keKota] -= Number(pindahSpiderWeb);
_root['xtowerGuard' + keKota] -= Number(pindahTowerGuard);
_root['xzombieTrap' + keKota] -= Number(pindahZombieTrap);
_root['xworker' + keKota] += Number(pindahBareman);
_root['xworker' + keKota] += Number(pindahSwordman);
_root['xworker' + keKota] += Number(pindahArrowman);
_root['xworker' + keKota] += Number(pindahSpearman);
_root['xworker' + keKota] += Number(pindahTank) * costWorkerKendaraan[1];
_root['xworker' + keKota] += Number(pindahCopter) * costWorkerKendaraan[2];
_root['xworker' + keKota] += Number(pindahMonbot) * costWorkerKendaraan[3];
}
function cekPindahSemua() {
cekPindahan();
ui_mc.pindah_mc.gotoAndStop(2);
if (sideQuestKe == 5) {
cekMenangQuest(sideQuestKe);
}
ui_mc.pindah_mc.go_btn.onRelease = function () {
clearSemua();
keLoading = 'city';
gotoAndStop(739);
};
ui_mc.pindah_mc.close_btn.onRelease = function () {
akanSerangKota = false;
ui_mc.pindah_mc._visible = false;
bisaUI(true);
};
}
function cekSerangInfo() {
ui_mc.serang_mc.cityName = 'Attack ' + xnamaKota[kotaSerang] + ' From ' + xnamaKota[keKota];
cekDataSerang();
ui_mc.serang_mc.attack_btn.onRelease = cekSerangan;
if (sedangTutorial == true) {
ui_mc.serang_mc.cancel_btn.enabled = false;
}
ui_mc.serang_mc.cancel_btn.onRelease = function () {
akanSerangKota = false;
ui_mc.serang_mc._visible = false;
bisaUI(true);
};
ui_mc.serang_mc.maxResource.onRelease = function () {
updateResource();
ui_mc.serang_mc.ygold.text = Math.ceil(_root['xgold' + keKota] / 1);
ui_mc.serang_mc.yiron.text = Math.ceil(_root['xiron' + keKota] / 1);
ui_mc.serang_mc.ywood.text = Math.ceil(_root['xwood' + keKota] / 1);
ui_mc.serang_mc.yworker.text = Math.ceil(_root['xworker' + keKota] / 1);
ui_mc.serang_mc.yfood.text = Math.ceil(_root['xfood' + keKota] / 1);
};
ui_mc.serang_mc.halfResource.onRelease = function () {
updateResource();
ui_mc.serang_mc.ygold.text = Math.ceil(_root['xgold' + keKota] / 2);
ui_mc.serang_mc.yiron.text = Math.ceil(_root['xiron' + keKota] / 2);
ui_mc.serang_mc.ywood.text = Math.ceil(_root['xwood' + keKota] / 2);
ui_mc.serang_mc.yworker.text = Math.ceil(_root['xworker' + keKota] / 2);
ui_mc.serang_mc.yfood.text = Math.ceil(_root['xfood' + keKota] / 2);
};
ui_mc.serang_mc.quarterResource.onRelease = function () {
updateResource();
ui_mc.serang_mc.ygold.text = Math.ceil(_root['xgold' + keKota] / 4);
ui_mc.serang_mc.yiron.text = Math.ceil(_root['xiron' + keKota] / 4);
ui_mc.serang_mc.ywood.text = Math.ceil(_root['xwood' + keKota] / 4);
ui_mc.serang_mc.yworker.text = Math.ceil(_root['xworker' + keKota] / 4);
ui_mc.serang_mc.yfood.text = Math.ceil(_root['xfood' + keKota] / 4);
};
ui_mc.serang_mc.maxArmy.onRelease = function () {
updateResource();
ui_mc.serang_mc.ybareman.text = Math.ceil(_root['xbareman' + keKota] / 1);
ui_mc.serang_mc.yswordman.text = Math.ceil(_root['xswordman' + keKota] / 1);
ui_mc.serang_mc.yarrowman.text = Math.ceil(_root['xarrowman' + keKota] / 1);
ui_mc.serang_mc.yspearman.text = Math.ceil(_root['xspearman' + keKota] / 1);
ui_mc.serang_mc.ytank.text = Math.ceil(_root['xtank' + keKota] / 1);
ui_mc.serang_mc.ycopter.text = Math.ceil(_root['xcopter' + keKota] / 1);
ui_mc.serang_mc.ymonbot.text = Math.ceil(_root['xmonbot' + keKota] / 1);
};
ui_mc.serang_mc.halfArmy.onRelease = function () {
updateResource();
ui_mc.serang_mc.ybareman.text = Math.ceil(_root['xbareman' + keKota] / 2);
ui_mc.serang_mc.yswordman.text = Math.ceil(_root['xswordman' + keKota] / 2);
ui_mc.serang_mc.yarrowman.text = Math.ceil(_root['xarrowman' + keKota] / 2);
ui_mc.serang_mc.yspearman.text = Math.ceil(_root['xspearman' + keKota] / 2);
ui_mc.serang_mc.ytank.text = Math.ceil(_root['xtank' + keKota] / 2);
ui_mc.serang_mc.ycopter.text = Math.ceil(_root['xcopter' + keKota] / 2);
ui_mc.serang_mc.ymonbot.text = Math.ceil(_root['xmonbot' + keKota] / 2);
};
ui_mc.serang_mc.quarterArmy.onRelease = function () {
updateResource();
ui_mc.serang_mc.ybareman.text = Math.ceil(_root['xbareman' + keKota] / 4);
ui_mc.serang_mc.yswordman.text = Math.ceil(_root['xswordman' + keKota] / 4);
ui_mc.serang_mc.yarrowman.text = Math.ceil(_root['xarrowman' + keKota] / 4);
ui_mc.serang_mc.yspearman.text = Math.ceil(_root['xspearman' + keKota] / 4);
ui_mc.serang_mc.ytank.text = Math.ceil(_root['xtank' + keKota] / 4);
ui_mc.serang_mc.ycopter.text = Math.ceil(_root['xcopter' + keKota] / 4);
ui_mc.serang_mc.ymonbot.text = Math.ceil(_root['xmonbot' + keKota] / 4);
};
ui_mc.serang_mc.maxWeapon.onRelease = function () {
updateResource();
ui_mc.serang_mc.ysword.text = Math.ceil(_root['xsword' + keKota] / 1);
ui_mc.serang_mc.yarrow.text = Math.ceil(_root['xarrow' + keKota] / 1);
ui_mc.serang_mc.yspear.text = Math.ceil(_root['xspear' + keKota] / 1);
ui_mc.serang_mc.yarrowTrap.text = Math.ceil(_root['xarrowTrap' + keKota] / 1);
ui_mc.serang_mc.ycatapult.text = Math.ceil(_root['xcatapult' + keKota] / 1);
ui_mc.serang_mc.yfireTrap.text = Math.ceil(_root['xfireTrap' + keKota] / 1);
};
ui_mc.serang_mc.halfWeapon.onRelease = function () {
updateResource();
ui_mc.serang_mc.ysword.text = Math.ceil(_root['xsword' + keKota] / 2);
ui_mc.serang_mc.yarrow.text = Math.ceil(_root['xarrow' + keKota] / 2);
ui_mc.serang_mc.yspear.text = Math.ceil(_root['xspear' + keKota] / 2);
ui_mc.serang_mc.yarrowTrap.text = Math.ceil(_root['xarrowTrap' + keKota] / 2);
ui_mc.serang_mc.ycatapult.text = Math.ceil(_root['xcatapult' + keKota] / 2);
ui_mc.serang_mc.yfireTrap.text = Math.ceil(_root['xfireTrap' + keKota] / 2);
};
ui_mc.serang_mc.quarterWeapon.onRelease = function () {
updateResource();
ui_mc.serang_mc.ysword.text = Math.ceil(_root['xsword' + keKota] / 4);
ui_mc.serang_mc.yarrow.text = Math.ceil(_root['xarrow' + keKota] / 4);
ui_mc.serang_mc.yspear.text = Math.ceil(_root['xspear' + keKota] / 4);
ui_mc.serang_mc.yarrowTrap.text = Math.ceil(_root['xarrowTrap' + keKota] / 4);
ui_mc.serang_mc.ycatapult.text = Math.ceil(_root['xcatapult' + keKota] / 4);
ui_mc.serang_mc.yfireTrap.text = Math.ceil(_root['xfireTrap' + keKota] / 4);
};
ui_mc.serang_mc.maxSpell.onRelease = function () {
updateResource();
ui_mc.serang_mc.yarrowRain.text = Math.ceil(_root['xarrowRain' + keKota] / 1);
ui_mc.serang_mc.ymeteorid.text = Math.ceil(_root['xmeteorid' + keKota] / 1);
ui_mc.serang_mc.yacidRain.text = Math.ceil(_root['xacidRain' + keKota] / 1);
ui_mc.serang_mc.yearthquake.text = Math.ceil(_root['xearthquake' + keKota] / 1);
ui_mc.serang_mc.yimmune.text = Math.ceil(_root['ximmune' + keKota] / 1);
ui_mc.serang_mc.yinvisible.text = Math.ceil(_root['xinvisible' + keKota] / 1);
ui_mc.serang_mc.yspecialAttack.text = Math.ceil(_root['xspecialAttack' + keKota] / 1);
ui_mc.serang_mc.yduplicate.text = Math.ceil(_root['xduplicate' + keKota] / 1);
};
ui_mc.serang_mc.halfSpell.onRelease = function () {
updateResource();
ui_mc.serang_mc.yarrowRain.text = Math.ceil(_root['xarrowRain' + keKota] / 2);
ui_mc.serang_mc.ymeteorid.text = Math.ceil(_root['xmeteorid' + keKota] / 2);
ui_mc.serang_mc.yacidRain.text = Math.ceil(_root['xacidRain' + keKota] / 2);
ui_mc.serang_mc.yearthquake.text = Math.ceil(_root['xearthquake' + keKota] / 2);
ui_mc.serang_mc.yimmune.text = Math.ceil(_root['ximmune' + keKota] / 2);
ui_mc.serang_mc.yinvisible.text = Math.ceil(_root['xinvisible' + keKota] / 2);
ui_mc.serang_mc.yspecialAttack.text = Math.ceil(_root['xspecialAttack' + keKota] / 2);
ui_mc.serang_mc.yduplicate.text = Math.ceil(_root['xduplicate' + keKota] / 2);
};
ui_mc.serang_mc.quarterSpell.onRelease = function () {
updateResource();
ui_mc.serang_mc.yarrowRain.text = Math.ceil(_root['xarrowRain' + keKota] / 4);
ui_mc.serang_mc.ymeteorid.text = Math.ceil(_root['xmeteorid' + keKota] / 4);
ui_mc.serang_mc.yacidRain.text = Math.ceil(_root['xacidRain' + keKota] / 4);
ui_mc.serang_mc.yearthquake.text = Math.ceil(_root['xearthquake' + keKota] / 4);
ui_mc.serang_mc.yimmune.text = Math.ceil(_root['ximmune' + keKota] / 4);
ui_mc.serang_mc.yinvisible.text = Math.ceil(_root['xinvisible' + keKota] / 4);
ui_mc.serang_mc.yspecialAttack.text = Math.ceil(_root['xspecialAttack' + keKota] / 4);
ui_mc.serang_mc.yduplicate.text = Math.ceil(_root['xduplicate' + keKota] / 4);
};
ui_mc.serang_mc.max_btn.onRelease = function () {
updateResource();
ui_mc.serang_mc.ygold.text = Math.ceil(_root['xgold' + keKota] / 1);
ui_mc.serang_mc.yiron.text = Math.ceil(_root['xiron' + keKota] / 1);
ui_mc.serang_mc.ywood.text = Math.ceil(_root['xwood' + keKota] / 1);
ui_mc.serang_mc.yworker.text = Math.ceil(_root['xworker' + keKota] / 1);
ui_mc.serang_mc.ybareman.text = Math.ceil(_root['xbareman' + keKota] / 1);
ui_mc.serang_mc.yswordman.text = Math.ceil(_root['xswordman' + keKota] / 1);
ui_mc.serang_mc.yarrowman.text = Math.ceil(_root['xarrowman' + keKota] / 1);
ui_mc.serang_mc.yspearman.text = Math.ceil(_root['xspearman' + keKota] / 1);
ui_mc.serang_mc.ytech.text = Math.ceil(_root['xtech' + keKota] / 1);
ui_mc.serang_mc.ymana.text = Math.ceil(_root['xmana' + keKota] / 1);
ui_mc.serang_mc.yfood.text = Math.ceil(_root['xfood' + keKota] / 1);
ui_mc.serang_mc.ytank.text = Math.ceil(_root['xtank' + keKota] / 1);
ui_mc.serang_mc.ycopter.text = Math.ceil(_root['xcopter' + keKota] / 1);
ui_mc.serang_mc.ymonbot.text = Math.ceil(_root['xmonbot' + keKota] / 1);
ui_mc.serang_mc.ysword.text = Math.ceil(_root['xsword' + keKota] / 1);
ui_mc.serang_mc.yarrow.text = Math.ceil(_root['xarrow' + keKota] / 1);
ui_mc.serang_mc.yspear.text = Math.ceil(_root['xspear' + keKota] / 1);
ui_mc.serang_mc.yarrowTrap.text = Math.ceil(_root['xarrowTrap' + keKota] / 1);
ui_mc.serang_mc.ycatapult.text = Math.ceil(_root['xcatapult' + keKota] / 1);
ui_mc.serang_mc.yfireTrap.text = Math.ceil(_root['xfireTrap' + keKota] / 1);
ui_mc.serang_mc.yarrowRain.text = Math.ceil(_root['xarrowRain' + keKota] / 1);
ui_mc.serang_mc.ymeteorid.text = Math.ceil(_root['xmeteorid' + keKota] / 1);
ui_mc.serang_mc.yacidRain.text = Math.ceil(_root['xacidRain' + keKota] / 1);
ui_mc.serang_mc.yearthquake.text = Math.ceil(_root['xearthquake' + keKota] / 1);
ui_mc.serang_mc.yimmune.text = Math.ceil(_root['ximmune' + keKota] / 1);
ui_mc.serang_mc.yinvisible.text = Math.ceil(_root['xinvisible' + keKota] / 1);
ui_mc.serang_mc.yspecialAttack.text = Math.ceil(_root['xspecialAttack' + keKota] / 1);
ui_mc.serang_mc.yduplicate.text = Math.ceil(_root['xduplicate' + keKota] / 1);
};
ui_mc.serang_mc.half_btn.onRelease = function () {
updateResource();
ui_mc.serang_mc.ygold.text = Math.ceil(_root['xgold' + keKota] / 2);
ui_mc.serang_mc.yiron.text = Math.ceil(_root['xiron' + keKota] / 2);
ui_mc.serang_mc.ywood.text = Math.ceil(_root['xwood' + keKota] / 2);
ui_mc.serang_mc.yworker.text = Math.ceil(_root['xworker' + keKota] / 2);
ui_mc.serang_mc.ybareman.text = Math.ceil(_root['xbareman' + keKota] / 2);
ui_mc.serang_mc.yswordman.text = Math.ceil(_root['xswordman' + keKota] / 2);
ui_mc.serang_mc.yarrowman.text = Math.ceil(_root['xarrowman' + keKota] / 2);
ui_mc.serang_mc.yspearman.text = Math.ceil(_root['xspearman' + keKota] / 2);
ui_mc.serang_mc.ytech.text = Math.ceil(_root['xtech' + keKota] / 2);
ui_mc.serang_mc.ymana.text = Math.ceil(_root['xmana' + keKota] / 2);
ui_mc.serang_mc.yfood.text = Math.ceil(_root['xfood' + keKota] / 2);
ui_mc.serang_mc.ytank.text = Math.ceil(_root['xtank' + keKota] / 2);
ui_mc.serang_mc.ycopter.text = Math.ceil(_root['xcopter' + keKota] / 2);
ui_mc.serang_mc.ymonbot.text = Math.ceil(_root['xmonbot' + keKota] / 2);
ui_mc.serang_mc.ysword.text = Math.ceil(_root['xsword' + keKota] / 2);
ui_mc.serang_mc.yarrow.text = Math.ceil(_root['xarrow' + keKota] / 2);
ui_mc.serang_mc.yspear.text = Math.ceil(_root['xspear' + keKota] / 2);
ui_mc.serang_mc.yarrowTrap.text = Math.ceil(_root['xarrowTrap' + keKota] / 2);
ui_mc.serang_mc.ycatapult.text = Math.ceil(_root['xcatapult' + keKota] / 2);
ui_mc.serang_mc.yfireTrap.text = Math.ceil(_root['xfireTrap' + keKota] / 2);
ui_mc.serang_mc.yarrowRain.text = Math.ceil(_root['xarrowRain' + keKota] / 2);
ui_mc.serang_mc.ymeteorid.text = Math.ceil(_root['xmeteorid' + keKota] / 2);
ui_mc.serang_mc.yacidRain.text = Math.ceil(_root['xacidRain' + keKota] / 2);
ui_mc.serang_mc.yearthquake.text = Math.ceil(_root['xearthquake' + keKota] / 2);
ui_mc.serang_mc.yimmune.text = Math.ceil(_root['ximmune' + keKota] / 2);
ui_mc.serang_mc.yinvisible.text = Math.ceil(_root['xinvisible' + keKota] / 2);
ui_mc.serang_mc.yspecialAttack.text = Math.ceil(_root['xspecialAttack' + keKota] / 2);
ui_mc.serang_mc.yduplicate.text = Math.ceil(_root['xduplicate' + keKota] / 2);
};
ui_mc.serang_mc.quarter_btn.onRelease = function () {
updateResource();
ui_mc.serang_mc.ygold.text = Math.ceil(_root['xgold' + keKota] / 4);
ui_mc.serang_mc.yiron.text = Math.ceil(_root['xiron' + keKota] / 4);
ui_mc.serang_mc.ywood.text = Math.ceil(_root['xwood' + keKota] / 4);
ui_mc.serang_mc.yworker.text = Math.ceil(_root['xworker' + keKota] / 4);
ui_mc.serang_mc.ybareman.text = Math.ceil(_root['xbareman' + keKota] / 4);
ui_mc.serang_mc.yswordman.text = Math.ceil(_root['xswordman' + keKota] / 4);
ui_mc.serang_mc.yarrowman.text = Math.ceil(_root['xarrowman' + keKota] / 4);
ui_mc.serang_mc.yspearman.text = Math.ceil(_root['xspearman' + keKota] / 4);
ui_mc.serang_mc.ytech.text = Math.ceil(_root['xtech' + keKota] / 4);
ui_mc.serang_mc.ymana.text = Math.ceil(_root['xmana' + keKota] / 4);
ui_mc.serang_mc.yfood.text = Math.ceil(_root['xfood' + keKota] / 4);
ui_mc.serang_mc.ytank.text = Math.ceil(_root['xtank' + keKota] / 4);
ui_mc.serang_mc.ycopter.text = Math.ceil(_root['xcopter' + keKota] / 4);
ui_mc.serang_mc.ymonbot.text = Math.ceil(_root['xmonbot' + keKota] / 4);
ui_mc.serang_mc.ysword.text = Math.ceil(_root['xsword' + keKota] / 4);
ui_mc.serang_mc.yarrow.text = Math.ceil(_root['xarrow' + keKota] / 4);
ui_mc.serang_mc.yspear.text = Math.ceil(_root['xspear' + keKota] / 4);
ui_mc.serang_mc.yarrowTrap.text = Math.ceil(_root['xarrowTrap' + keKota] / 4);
ui_mc.serang_mc.ycatapult.text = Math.ceil(_root['xcatapult' + keKota] / 4);
ui_mc.serang_mc.yfireTrap.text = Math.ceil(_root['xfireTrap' + keKota] / 4);
ui_mc.serang_mc.yarrowRain.text = Math.ceil(_root['xarrowRain' + keKota] / 4);
ui_mc.serang_mc.ymeteorid.text = Math.ceil(_root['xmeteorid' + keKota] / 4);
ui_mc.serang_mc.yacidRain.text = Math.ceil(_root['xacidRain' + keKota] / 4);
ui_mc.serang_mc.yearthquake.text = Math.ceil(_root['xearthquake' + keKota] / 4);
ui_mc.serang_mc.yimmune.text = Math.ceil(_root['ximmune' + keKota] / 4);
ui_mc.serang_mc.yinvisible.text = Math.ceil(_root['xinvisible' + keKota] / 4);
ui_mc.serang_mc.yspecialAttack.text = Math.ceil(_root['xspecialAttack' + keKota] / 4);
ui_mc.serang_mc.yduplicate.text = Math.ceil(_root['xduplicate' + keKota] / 4);
};
ui_mc.serang_mc.reset_btn.onRelease = function () {
updateResource();
ui_mc.serang_mc.ygold.text = 0;
ui_mc.serang_mc.yiron.text = 0;
ui_mc.serang_mc.ywood.text = 0;
ui_mc.serang_mc.yworker.text = 0;
ui_mc.serang_mc.ybareman.text = 0;
ui_mc.serang_mc.yswordman.text = 0;
ui_mc.serang_mc.yarrowman.text = 0;
ui_mc.serang_mc.yspearman.text = 0;
ui_mc.serang_mc.ytech.text = 0;
ui_mc.serang_mc.ymana.text = 0;
ui_mc.serang_mc.yfood.text = 0;
ui_mc.serang_mc.ytank.text = 0;
ui_mc.serang_mc.ycopter.text = 0;
ui_mc.serang_mc.ymonbot.text = 0;
ui_mc.serang_mc.ysword.text = 0;
ui_mc.serang_mc.yarrow.text = 0;
ui_mc.serang_mc.yspear.text = 0;
ui_mc.serang_mc.yarrowTrap.text = 0;
ui_mc.serang_mc.ycatapult.text = 0;
ui_mc.serang_mc.yfireTrap.text = 0;
ui_mc.serang_mc.yarrowRain.text = 0;
ui_mc.serang_mc.ymeteorid.text = 0;
ui_mc.serang_mc.yacidRain.text = 0;
ui_mc.serang_mc.yearthquake.text = 0;
ui_mc.serang_mc.yimmune.text = 0;
ui_mc.serang_mc.yinvisible.text = 0;
ui_mc.serang_mc.yspecialAttack.text = 0;
ui_mc.serang_mc.yduplicate.text = 0;
};
}
function updateResource() {
ui_mc.serang_mc.xgold = _root['xgold' + keKota];
ui_mc.serang_mc.xiron = _root['xiron' + keKota];
ui_mc.serang_mc.xwood = _root['xwood' + keKota];
ui_mc.serang_mc.xworker = _root['xworker' + keKota];
ui_mc.serang_mc.xbareman = _root['xbareman' + keKota];
ui_mc.serang_mc.xswordman = _root['xswordman' + keKota];
ui_mc.serang_mc.xarrowman = _root['xarrowman' + keKota];
ui_mc.serang_mc.xspearman = _root['xspearman' + keKota];
ui_mc.serang_mc.xtech = _root['xtech' + keKota];
ui_mc.serang_mc.xmana = _root['xmana' + keKota];
ui_mc.serang_mc.xfood = _root['xfood' + keKota];
ui_mc.serang_mc.xtank = _root['xtank' + keKota];
ui_mc.serang_mc.xcopter = _root['xcopter' + keKota];
ui_mc.serang_mc.xmonbot = _root['xmonbot' + keKota];
ui_mc.serang_mc.xsword = _root['xsword' + keKota];
ui_mc.serang_mc.xarrow = _root['xarrow' + keKota];
ui_mc.serang_mc.xspear = _root['xspear' + keKota];
ui_mc.serang_mc.xarrowTrap = _root['xarrowTrap' + keKota];
ui_mc.serang_mc.xcatapult = _root['xcatapult' + keKota];
ui_mc.serang_mc.xfireTrap = _root['xfireTrap' + keKota];
ui_mc.serang_mc.xarrowRain = _root['xarrowRain' + keKota];
ui_mc.serang_mc.xmeteorid = _root['xmeteorid' + keKota];
ui_mc.serang_mc.xacidRain = _root['xacidRain' + keKota];
ui_mc.serang_mc.xearthquake = _root['xearthquake' + keKota];
ui_mc.serang_mc.ximmune = _root['ximmune' + keKota];
ui_mc.serang_mc.xinvisible = _root['xinvisible' + keKota];
ui_mc.serang_mc.xspecialAttack = _root['xspecialAttack' + keKota];
ui_mc.serang_mc.xduplicate = _root['xduplicate' + keKota];
}
function updateResource2() {
ui_mc.pindah_mc.xgold = _root['xgold' + keKota];
ui_mc.pindah_mc.xiron = _root['xiron' + keKota];
ui_mc.pindah_mc.xwood = _root['xwood' + keKota];
ui_mc.pindah_mc.xworker = _root['xworker' + keKota];
ui_mc.pindah_mc.xbareman = _root['xbareman' + keKota];
ui_mc.pindah_mc.xswordman = _root['xswordman' + keKota];
ui_mc.pindah_mc.xarrowman = _root['xarrowman' + keKota];
ui_mc.pindah_mc.xspearman = _root['xspearman' + keKota];
ui_mc.pindah_mc.xtech = _root['xtech' + keKota];
ui_mc.pindah_mc.xmana = _root['xmana' + keKota];
ui_mc.pindah_mc.xfood = _root['xfood' + keKota];
ui_mc.pindah_mc.xtank = _root['xtank' + keKota];
ui_mc.pindah_mc.xcopter = _root['xcopter' + keKota];
ui_mc.pindah_mc.xmonbot = _root['xmonbot' + keKota];
ui_mc.pindah_mc.xsword = _root['xsword' + keKota];
ui_mc.pindah_mc.xarrow = _root['xarrow' + keKota];
ui_mc.pindah_mc.xspear = _root['xspear' + keKota];
ui_mc.pindah_mc.xarrowTrap = _root['xarrowTrap' + keKota];
ui_mc.pindah_mc.xcatapult = _root['xcatapult' + keKota];
ui_mc.pindah_mc.xfireTrap = _root['xfireTrap' + keKota];
ui_mc.pindah_mc.xarrowRain = _root['xarrowRain' + keKota];
ui_mc.pindah_mc.xmeteorid = _root['xmeteorid' + keKota];
ui_mc.pindah_mc.xacidRain = _root['xacidRain' + keKota];
ui_mc.pindah_mc.xearthquake = _root['xearthquake' + keKota];
ui_mc.pindah_mc.ximmune = _root['ximmune' + keKota];
ui_mc.pindah_mc.xinvisible = _root['xinvisible' + keKota];
ui_mc.pindah_mc.xspecialAttack = _root['xspecialAttack' + keKota];
ui_mc.pindah_mc.xduplicate = _root['xduplicate' + keKota];
ui_mc.pindah_mc.xwall = _root['xwall' + keKota];
ui_mc.pindah_mc.xspike = _root['xspike' + keKota];
ui_mc.pindah_mc.xspiderWeb = _root['xspiderWeb' + keKota];
ui_mc.pindah_mc.xtowerGuard = _root['xtowerGuard' + keKota];
ui_mc.pindah_mc.xzombieTrap = _root['xzombieTrap' + keKota];
}
function cekDataSerang() {
ui_mc.serang_mc.xgold = _root['xgold' + keKota];
ui_mc.serang_mc.xiron = _root['xiron' + keKota];
ui_mc.serang_mc.xwood = _root['xwood' + keKota];
ui_mc.serang_mc.xworker = _root['xworker' + keKota];
ui_mc.serang_mc.xbareman = _root['xbareman' + keKota];
ui_mc.serang_mc.xswordman = _root['xswordman' + keKota];
ui_mc.serang_mc.xarrowman = _root['xarrowman' + keKota];
ui_mc.serang_mc.xspearman = _root['xspearman' + keKota];
ui_mc.serang_mc.xtech = _root['xtech' + keKota];
ui_mc.serang_mc.xmana = _root['xmana' + keKota];
ui_mc.serang_mc.xfood = _root['xfood' + keKota];
ui_mc.serang_mc.xtank = _root['xtank' + keKota];
ui_mc.serang_mc.xcopter = _root['xcopter' + keKota];
ui_mc.serang_mc.xmonbot = _root['xmonbot' + keKota];
ui_mc.serang_mc.xsword = _root['xsword' + keKota];
ui_mc.serang_mc.xarrow = _root['xarrow' + keKota];
ui_mc.serang_mc.xspear = _root['xspear' + keKota];
ui_mc.serang_mc.xarrowTrap = _root['xarrowTrap' + keKota];
ui_mc.serang_mc.xcatapult = _root['xcatapult' + keKota];
ui_mc.serang_mc.xfireTrap = _root['xfireTrap' + keKota];
ui_mc.serang_mc.xarrowRain = _root['xarrowRain' + keKota];
ui_mc.serang_mc.xmeteorid = _root['xmeteorid' + keKota];
ui_mc.serang_mc.xacidRain = _root['xacidRain' + keKota];
ui_mc.serang_mc.xearthquake = _root['xearthquake' + keKota];
ui_mc.serang_mc.ximmune = _root['ximmune' + keKota];
ui_mc.serang_mc.xinvisible = _root['xinvisible' + keKota];
ui_mc.serang_mc.xspecialAttack = _root['xspecialAttack' + keKota];
ui_mc.serang_mc.xduplicate = _root['xduplicate' + keKota];
ui_mc.serang_mc.ygold.text = 0;
ui_mc.serang_mc.yiron.text = 0;
ui_mc.serang_mc.ywood.text = 0;
ui_mc.serang_mc.yworker.text = 0;
ui_mc.serang_mc.ybareman.text = 0;
ui_mc.serang_mc.yswordman.text = 0;
ui_mc.serang_mc.yarrowman.text = 0;
ui_mc.serang_mc.yspearman.text = 0;
ui_mc.serang_mc.ytech.text = 0;
ui_mc.serang_mc.ymana.text = 0;
ui_mc.serang_mc.yfood.text = 0;
ui_mc.serang_mc.ytank.text = 0;
ui_mc.serang_mc.ycopter.text = 0;
ui_mc.serang_mc.ymonbot.text = 0;
ui_mc.serang_mc.ysword.text = 0;
ui_mc.serang_mc.yarrow.text = 0;
ui_mc.serang_mc.yspear.text = 0;
ui_mc.serang_mc.yarrowTrap.text = 0;
ui_mc.serang_mc.ycatapult.text = 0;
ui_mc.serang_mc.yfireTrap.text = 0;
ui_mc.serang_mc.yarrowRain.text = 0;
ui_mc.serang_mc.ymeteorid.text = 0;
ui_mc.serang_mc.yacidRain.text = 0;
ui_mc.serang_mc.yearthquake.text = 0;
ui_mc.serang_mc.yimmune.text = 0;
ui_mc.serang_mc.yinvisible.text = 0;
ui_mc.serang_mc.yspecialAttack.text = 0;
ui_mc.serang_mc.yduplicate.text = 0;
}
function cekSerangan() {
pindahGold = ui_mc.serang_mc.ygold.text;
pindahIron = ui_mc.serang_mc.yiron.text;
pindahWood = ui_mc.serang_mc.ywood.text;
pindahWorker = ui_mc.serang_mc.yworker.text;
pindahBareman = ui_mc.serang_mc.ybareman.text;
pindahSwordman = ui_mc.serang_mc.yswordman.text;
pindahArrowman = ui_mc.serang_mc.yarrowman.text;
pindahSpearman = ui_mc.serang_mc.yspearman.text;
pindahTech = ui_mc.serang_mc.ytech.text;
pindahMana = ui_mc.serang_mc.ymana.text;
pindahFood = ui_mc.serang_mc.yfood.text;
pindahTank = ui_mc.serang_mc.ytank.text;
pindahCopter = ui_mc.serang_mc.ycopter.text;
pindahMonbot = ui_mc.serang_mc.ymonbot.text;
pindahSword = ui_mc.serang_mc.ysword.text;
pindahArrow = ui_mc.serang_mc.yarrow.text;
pindahSpear = ui_mc.serang_mc.yspear.text;
pindahArrowTrap = ui_mc.serang_mc.yarrowTrap.text;
pindahCatapult = ui_mc.serang_mc.ycatapult.text;
pindahFireTrap = ui_mc.serang_mc.yfireTrap.text;
pindahArrowRain = ui_mc.serang_mc.yarrowRain.text;
pindahMeteorid = ui_mc.serang_mc.ymeteorid.text;
pindahAcidRain = ui_mc.serang_mc.yacidRain.text;
pindahEarthquake = ui_mc.serang_mc.yearthquake.text;
pindahImmune = ui_mc.serang_mc.yimmune.text;
pindahInvisible = ui_mc.serang_mc.yinvisible.text;
pindahSpecialAttack = ui_mc.serang_mc.yspecialAttack.text;
pindahDuplicate = ui_mc.serang_mc.yduplicate.text;
pindahWall = ui_mc.serang_mc.ywall.text;
pindahSpike = ui_mc.serang_mc.yspike.text;
pindahSpiderWeb = ui_mc.serang_mc.yspiderWeb.text;
pindahTowerGuard = ui_mc.serang_mc.ytowerGuard.text;
pindahZombieTrap = ui_mc.serang_mc.yzombieTrap.text;
if (isNaN(pindahGold)) {
pindahGold = 0;
} else {
if (pindahGold >= _root['xgold' + keKota]) {
pindahGold = _root['xgold' + keKota];
}
}
if (isNaN(pindahIron)) {
pindahIron = 0;
} else {
if (pindahIron >= _root['xiron' + keKota]) {
pindahIron = _root['xiron' + keKota];
}
}
if (isNaN(pindahWood)) {
pindahWood = 0;
} else {
if (pindahWood >= _root['xwood' + keKota]) {
pindahWood = _root['xwood' + keKota];
}
}
if (isNaN(pindahWorker)) {
pindahWorker = 0;
} else {
if (pindahWorker >= _root['xworker' + keKota]) {
pindahWorker = _root['xworker' + keKota];
}
}
pindahWorker = 0;
if (isNaN(pindahBareman)) {
pindahBareman = 0;
} else {
if (pindahBareman >= _root['xbareman' + keKota]) {
pindahBareman = _root['xbareman' + keKota];
}
}
if (isNaN(pindahSwordman)) {
pindahSwordman = 0;
} else {
if (pindahSwordman >= _root['xswordman' + keKota]) {
pindahSwordman = _root['xswordman' + keKota];
}
}
if (isNaN(pindahArrowman)) {
pindahArrowman = 0;
} else {
if (pindahArrowman >= _root['xarrowman' + keKota]) {
pindahArrowman = _root['xarrowman' + keKota];
}
}
if (isNaN(pindahSpearman)) {
pindahSpearman = 0;
} else {
if (pindahSpearman >= _root['xspearman' + keKota]) {
pindahSpearman = _root['xspearman' + keKota];
}
}
if (isNaN(pindahTech)) {
pindahTech = 0;
} else {
if (pindahTech >= _root['xtech' + keKota]) {
pindahTech = _root['xtech' + keKota];
}
}
if (isNaN(pindahMana)) {
pindahMana = 0;
} else {
if (pindahMana >= _root['xmana' + keKota]) {
pindahMana = _root['xmana' + keKota];
}
}
if (isNaN(pindahFood)) {
pindahFood = 0;
} else {
if (pindahFood >= _root['xfood' + keKota]) {
pindahFood = _root['xfood' + keKota];
}
}
if (isNaN(pindahTank)) {
pindahTank = 0;
} else {
if (pindahTank >= _root['xtank' + keKota]) {
pindahTank = _root['xtank' + keKota];
}
}
if (isNaN(pindahCopter)) {
pindahCopter = 0;
} else {
if (pindahCopter >= _root['xcopter' + keKota]) {
pindahCopter = _root['xcopter' + keKota];
}
}
if (isNaN(pindahMonbot)) {
pindahMonbot = 0;
} else {
if (pindahMonbot >= _root['xmonbot' + keKota]) {
pindahMonbot = _root['xmonbot' + keKota];
}
}
if (isNaN(pindahSword)) {
pindahSword = 0;
} else {
if (pindahSword >= _root['xsword' + keKota]) {
pindahSword = _root['xsword' + keKota];
}
}
if (isNaN(pindahArrow)) {
pindahArrow = 0;
} else {
if (pindahArrow >= _root['xarrow' + keKota]) {
pindahArrow = _root['xarrow' + keKota];
}
}
if (isNaN(pindahSpear)) {
pindahSpear = 0;
} else {
if (pindahSpear >= _root['xspear' + keKota]) {
pindahSpear = _root['xspear' + keKota];
}
}
if (isNaN(pindahArrowTrap)) {
pindahArrowTrap = 0;
} else {
if (pindahArrowTrap >= _root['xarrowTrap' + keKota]) {
pindahArrowTrap = _root['xarrowTrap' + keKota];
}
}
if (isNaN(pindahCatapult)) {
pindahCatapult = 0;
} else {
if (pindahCatapult >= _root['xcatapult' + keKota]) {
pindahCatapult = _root['xcatapult' + keKota];
}
}
if (isNaN(pindahFireTrap)) {
pindahFireTrap = 0;
} else {
if (pindahFireTrap >= _root['xfireTrap' + keKota]) {
pindahFireTrap = _root['xfireTrap' + keKota];
}
}
if (isNaN(pindahArrowRain)) {
pindahArrowRain = 0;
} else {
if (pindahArrowRain >= _root['xarrowRain' + keKota]) {
pindahArrowRain = _root['xarrowRain' + keKota];
}
}
if (isNaN(pindahMeteorid)) {
pindahMeteorid = 0;
} else {
if (pindahMeteorid >= _root['xarrowRain' + keKota]) {
pindahMeteorid = _root['xarrowRain' + keKota];
}
}
if (isNaN(pindahAcidRain)) {
pindahAcidRain = 0;
} else {
if (pindahAcidRain >= _root['xacidRain' + keKota]) {
pindahAcidRain = _root['xacidRain' + keKota];
}
}
if (isNaN(pindahEarthquake)) {
pindahEarthquake = 0;
} else {
if (pindahEarthquake >= _root['xearthquake' + keKota]) {
pindahEarthquake = _root['xearthquake' + keKota];
}
}
if (isNaN(pindahImmune)) {
pindahImmune = 0;
} else {
if (pindahImmune >= _root['ximmune' + keKota]) {
pindahImmune = _root['ximmune' + keKota];
}
}
if (isNaN(pindahInvisible)) {
pindahInvisible = 0;
} else {
if (pindahInvisible >= _root['xinvisible' + keKota]) {
pindahInvisible = _root['xinvisible' + keKota];
}
}
if (isNaN(pindahSpecialAttack)) {
pindahSpecialAttack = 0;
} else {
if (pindahSpecialAttack >= _root['xspecialAttack' + keKota]) {
pindahSpecialAttack = _root['xspecialAttack' + keKota];
}
}
if (isNaN(pindahDuplicate)) {
pindahDuplicate = 0;
} else {
if (pindahDuplicate >= _root['xduplicate' + keKota]) {
pindahDuplicate = _root['xduplicate' + keKota];
}
}
adaPasukan1 = true;
adaPasukan2 = true;
adaPasukan3 = true;
adaPasukan4 = true;
adaPasukan5 = true;
adaPasukan6 = true;
adaPasukan7 = true;
if (pindahBareman == 0) {
adaPasukan1 = false;
}
if (pindahSwordman == 0) {
adaPasukan2 = false;
}
if (pindahArrowman == 0) {
adaPasukan3 = false;
}
if (pindahSpearman == 0) {
adaPasukan4 = false;
}
if (pindahTank == 0) {
adaPasukan5 = false;
}
if (pindahCopter == 0) {
adaPasukan6 = false;
}
if (pindahMonbot == 0) {
adaPasukan7 = false;
}
if (adaPasukan1 == false && adaPasukan2 == false && adaPasukan3 == false && adaPasukan4 == false && adaPasukan5 == false && adaPasukan6 == false && adaPasukan7 == false) {
bisaSerangKini = false;
} else {
bisaSerangKini = true;
}
if (bisaSerangKini == true) {
if (_root['kotaMilik' + kotaSerang] == 0) {
siapaYangNyerang = 0;
clearSemua();
cekSerangGate();
if (serangGateLangsung == true) {
kondisiPreview = 'tengah2';
} else {
kondisiPreview = 'awal';
}
if (sedangTutorial == true) {
kondisiPreview = 'awal';
}
gotoAndStop(770);
} else {
if (_root['kotaMilik' + kotaSerang] == 2) {
if (kotaSerang == 21) {
sudahSerangAlvetia = true;
siapaYangNyerang = 2;
clearSemua();
kondisiPreview = 'gate1';
gotoAndStop(770);
} else {
siapaYangNyerang = 2;
clearSemua();
cekSerangGate();
if (serangGateLangsung == true) {
kondisiPreview = 'tengah2';
} else {
kondisiPreview = 'awal';
}
gotoAndStop(770);
}
}
}
} else {
cekInfo('Can\'t attack right now, there\'s no army units brought into the battle, input it first');
}
}
function cekSerangGate() {
if (awalKaliSerang == true) {
awalKaliSerang = false;
serangGateLangsung = false;
} else {
if (siapaYangNyerang == 0) {
rand = random(2);
} else {
rand = random(3);
}
if (rand == 0) {
serangGateLangsung = true;
} else {
serangGateLangsung = false;
}
}
}
function cekSerang() {
cekTutorial(40);
clearSemua();
aksiMap = 'serang';
gotoAndStop(769);
}
function bisaUI(indi) {
ui_mc.building_mc.enabled = indi;
ui_mc.research_mc.enabled = indi;
ui_mc.army_mc.enabled = indi;
ui_mc.weaponary_mc.enabled = indi;
ui_mc.vehicle_mc.enabled = indi;
ui_mc.skill_mc.enabled = indi;
ui_mc.spell_mc.enabled = indi;
ui_mc.defense_mc.enabled = indi;
ui_mc.map_mc.enabled = indi;
ui_mc.trade_mc.enabled = indi;
ui_mc.move_mc.enabled = indi;
ui_mc.attack_mc.enabled = indi;
ui_mc.klikNama_btn.enabled = indi;
ui_mc.speed_mc.enabled = indi;
ui_mc.achievement_mc.enabled = indi;
}
function cekUI() {
ui_mc.building_mc.onRelease = klikBuilding;
ui_mc.research_mc.onRelease = klikRiset;
ui_mc.army_mc.onRelease = klikArmy;
ui_mc.weaponary_mc.onRelease = klikWeapon;
ui_mc.vehicle_mc.onRelease = klikVehicle;
ui_mc.spell_mc.onRelease = klikSpell;
ui_mc.defense_mc.onRelease = klikDefense;
ui_mc.skill_mc.onRelease = klikSkill;
ui_mc.remove_mc.onRelease = cekHilangDrag2;
ui_mc.map_mc.onRelease = klikMap;
ui_mc.menu_mc.onRelease = klikOption;
ui_mc.sound_mc.onRelease = klikSound;
ui_mc.achievement_mc.onRelease = klikMedal;
ui_mc.trade_mc.onRelease = klikDagang;
ui_mc.more_btn.onRelease = klikMore;
ui_mc.building_mc.onRollOver = overMenuUI;
ui_mc.research_mc.onRollOver = overMenuUI;
ui_mc.army_mc.onRollOver = overMenuUI;
ui_mc.weaponary_mc.onRollOver = overMenuUI;
ui_mc.vehicle_mc.onRollOver = overMenuUI;
ui_mc.skill_mc.onRollOver = overMenuUI;
ui_mc.spell_mc.onRollOver = overMenuUI;
ui_mc.defense_mc.onRollOver = overMenuUI;
ui_mc.gold_mc.onRollOver = overMenuUI;
ui_mc.iron_mc.onRollOver = overMenuUI;
ui_mc.wood_mc.onRollOver = overMenuUI;
ui_mc.worker_mc.onRollOver = overMenuUI;
ui_mc.tech_mc.onRollOver = overMenuUI;
ui_mc.welfare_mc.onRollOver = overMenuUI;
ui_mc.soldier_mc.onRollOver = overMenuUI;
ui_mc.bareman_mc.onRollOver = overMenuUI;
ui_mc.swordman_mc.onRollOver = overMenuUI;
ui_mc.arrowman_mc.onRollOver = overMenuUI;
ui_mc.spearman_mc.onRollOver = overMenuUI;
ui_mc.tank_mc.onRollOver = overMenuUI;
ui_mc.copter_mc.onRollOver = overMenuUI;
ui_mc.sword_mc.onRollOver = overMenuUI;
ui_mc.arrow_mc.onRollOver = overMenuUI;
ui_mc.spear_mc.onRollOver = overMenuUI;
ui_mc.monbot_mc.onRollOver = overMenuUI;
ui_mc.bowTrap_mc.onRollOver = overMenuUI;
ui_mc.catapult_mc.onRollOver = overMenuUI;
ui_mc.fireTrap_mc.onRollOver = overMenuUI;
ui_mc.mana_mc.onRollOver = overMenuUI;
ui_mc.food_mc.onRollOver = overMenuUI;
ui_mc.arrowRain_mc.onRollOver = overMenuUI;
ui_mc.meteorid_mc.onRollOver = overMenuUI;
ui_mc.acidRain_mc.onRollOver = overMenuUI;
ui_mc.earthquake_mc.onRollOver = overMenuUI;
ui_mc.immune_mc.onRollOver = overMenuUI;
ui_mc.invisible_mc.onRollOver = overMenuUI;
ui_mc.specialAttack_mc.onRollOver = overMenuUI;
ui_mc.duplicate_mc.onRollOver = overMenuUI;
ui_mc.wall_mc.onRollOver = overMenuUI;
ui_mc.spike_mc.onRollOver = overMenuUI;
ui_mc.spiderWeb_mc.onRollOver = overMenuUI;
ui_mc.towerGuard_mc.onRollOver = overMenuUI;
ui_mc.zombieTrap_mc.onRollOver = overMenuUI;
ui_mc.map_mc.onRollOver = overMenuUI;
ui_mc.trade_mc.onRollOver = overMenuUI;
ui_mc.move_mc.onRollOver = overMenuUI;
ui_mc.attack_mc.onRollOver = overMenuUI;
ui_mc.menu_mc.onRollOver = overMenuUI;
ui_mc.sound_mc.onRollOver = overSound;
ui_mc.achievement_mc.onRollOver = overMenuUI;
ui_mc.building_mc.onRollOut = outMenuUI;
ui_mc.research_mc.onRollOut = outMenuUI;
ui_mc.army_mc.onRollOut = outMenuUI;
ui_mc.weaponary_mc.onRollOut = outMenuUI;
ui_mc.vehicle_mc.onRollOut = outMenuUI;
ui_mc.skill_mc.onRollOut = outMenuUI;
ui_mc.spell_mc.onRollOut = outMenuUI;
ui_mc.defense_mc.onRollOut = outMenuUI;
ui_mc.gold_mc.onRollOut = outMenuUI;
ui_mc.iron_mc.onRollOut = outMenuUI;
ui_mc.wood_mc.onRollOut = outMenuUI;
ui_mc.worker_mc.onRollOut = outMenuUI;
ui_mc.tech_mc.onRollOut = outMenuUI;
ui_mc.welfare_mc.onRollOut = outMenuUI;
ui_mc.soldier_mc.onRollOut = outMenuUI;
ui_mc.bareman_mc.onRollOut = outMenuUI;
ui_mc.swordman_mc.onRollOut = outMenuUI;
ui_mc.arrowman_mc.onRollOut = outMenuUI;
ui_mc.spearman_mc.onRollOut = outMenuUI;
ui_mc.tank_mc.onRollOut = outMenuUI;
ui_mc.copter_mc.onRollOut = outMenuUI;
ui_mc.sword_mc.onRollOut = outMenuUI;
ui_mc.arrow_mc.onRollOut = outMenuUI;
ui_mc.spear_mc.onRollOut = outMenuUI;
ui_mc.monbot_mc.onRollOut = outMenuUI;
ui_mc.bowTrap_mc.onRollOut = outMenuUI;
ui_mc.catapult_mc.onRollOut = outMenuUI;
ui_mc.fireTrap_mc.onRollOut = outMenuUI;
ui_mc.mana_mc.onRollOut = outMenuUI;
ui_mc.food_mc.onRollOut = outMenuUI;
ui_mc.arrowRain_mc.onRollOut = outMenuUI;
ui_mc.meteorid_mc.onRollOut = outMenuUI;
ui_mc.acidRain_mc.onRollOut = outMenuUI;
ui_mc.earthquake_mc.onRollOut = outMenuUI;
ui_mc.immune_mc.onRollOut = outMenuUI;
ui_mc.invisible_mc.onRollOut = outMenuUI;
ui_mc.specialAttack_mc.onRollOut = outMenuUI;
ui_mc.duplicate_mc.onRollOut = outMenuUI;
ui_mc.wall_mc.onRollOut = outMenuUI;
ui_mc.spike_mc.onRollOut = outMenuUI;
ui_mc.spiderWeb_mc.onRollOut = outMenuUI;
ui_mc.towerGuard_mc.onRollOut = outMenuUI;
ui_mc.zombieTrap_mc.onRollOut = outMenuUI;
ui_mc.map_mc.onRollOut = outMenuUI;
ui_mc.trade_mc.onRollOut = outMenuUI;
ui_mc.move_mc.onRollOut = outMenuUI;
ui_mc.attack_mc.onRollOut = outMenuUI;
ui_mc.menu_mc.onRollOut = outMenuUI;
ui_mc.sound_mc.onRollOut = outSound;
ui_mc.achievement_mc.onRollOut = outMenuUI;
}
function klikMore() {
ui_mc.more_mc._visible = true;
ui_mc.more_mc.close_btn.onRelease = function () {
ui_mc.more_mc._visible = false;
};
}
function klikDagang() {
if (dagangKali == true) {
if (dealKali >= 5) {
ui_mc.dagang_mc.gotoAndStop(3);
ui_mc.dagang_mc.oke_btn.onRelease = function () {
ui_mc.dagang_mc._visible = false;
};
} else {
dagangKali = false;
ui_mc.dagang_mc.gotoAndStop(1);
}
} else {
ui_mc.dagang_mc.gotoAndStop(2);
ui_mc.dagang_mc.oke_btn.onRelease = function () {
ui_mc.dagang_mc._visible = false;
};
}
ui_mc.dagang_mc._visible = true;
randDay = 1 + Math.ceil(xday / 10);
randGold = 200 * (randDay * (random(3) + 1));
randIron = 25 * (randDay * (random(3) + 1));
randWood = 25 * (randDay * (random(3) + 1));
ui_mc.dagang_mc.dapat1 = randGold + random(10);
ui_mc.dagang_mc.kasih1 = randIron + random(10);
ui_mc.dagang_mc.kasih12 = randWood + random(10);
ui_mc.dagang_mc.dapat2 = randIron + random(10);
ui_mc.dagang_mc.dapat22 = randWood + random(10);
ui_mc.dagang_mc.kasih2 = randGold + random(10);
ui_mc.dagang_mc.dapat3 = 75 * (random(randDay) + 1) + random(10);
ui_mc.dagang_mc.kasih3 = 100 * (random(randDay) + 1) + random(10);
ui_mc.dagang_mc.kasih32 = 15 * (random(randDay) + 1) + random(10);
ui_mc.dagang_mc.dapat4 = 75 * (random(randDay) + 1) + random(10);
ui_mc.dagang_mc.kasih4 = 50 * (random(randDay) + 1) + random(10);
ui_mc.dagang_mc.kasih42 = 15 * (random(randDay) + 1) + random(10);
randFood = 100 * (randDay * (random(3) + 1));
randGold = 100 * (randDay * (random(3) + 1));
ui_mc.dagang_mc.dapat5 = randFood + random(10);
ui_mc.dagang_mc.kasih5 = randGold + random(10);
ui_mc.dagang_mc.dapat6 = randGold + random(10);
ui_mc.dagang_mc.kasih6 = randFood + random(10);
if (_root['xgold' + j] <= 0) {
_root['xgold' + j] = 0;
}
if (_root['xiron' + j] <= 0) {
_root['xiron' + j] = 0;
}
if (_root['xwood' + j] <= 0) {
_root['xwood' + j] = 0;
}
ui_mc.dagang_mc.deal1.onRelease = function () {
if (_root['xiron' + keKota] >= ui_mc.dagang_mc.kasih1) {
if (_root['xwood' + keKota] >= ui_mc.dagang_mc.kasih12) {
backDeal();
++dealKali;
if (sideQuestKe == 4) {
cekMenangQuest(sideQuestKe);
}
_root['xiron' + keKota] -= ui_mc.dagang_mc.kasih1;
_root['xwood' + keKota] -= ui_mc.dagang_mc.kasih12;
_root['xgold' + keKota] += ui_mc.dagang_mc.dapat1;
if (dealKali >= 5) {
ui_mc.dagang_mc.gotoAndStop(3);
ui_mc.dagang_mc.oke_btn.onRelease = function () {
ui_mc.dagang_mc._visible = false;
};
}
}
}
};
ui_mc.dagang_mc.deal2.onRelease = function () {
if (_root['xgold' + keKota] >= ui_mc.dagang_mc.kasih2) {
backDeal();
++dealKali;
if (sideQuestKe == 4) {
cekMenangQuest(sideQuestKe);
}
_root['xgold' + keKota] -= ui_mc.dagang_mc.kasih2;
_root['xiron' + keKota] += ui_mc.dagang_mc.dapat2;
_root['xwood' + keKota] += ui_mc.dagang_mc.dapat22;
if (dealKali >= 5) {
ui_mc.dagang_mc.gotoAndStop(3);
ui_mc.dagang_mc.oke_btn.onRelease = function () {
ui_mc.dagang_mc._visible = false;
};
}
}
};
ui_mc.dagang_mc.deal3.onRelease = function () {
if (_root['xgold' + keKota] >= ui_mc.dagang_mc.kasih3) {
if (_root['xwood' + keKota] >= ui_mc.dagang_mc.kasih32) {
backDeal();
++dealKali;
if (sideQuestKe == 4) {
cekMenangQuest(sideQuestKe);
}
_root['xgold' + keKota] -= ui_mc.dagang_mc.kasih3;
_root['xwood' + keKota] -= ui_mc.dagang_mc.kasih32;
_root['xiron' + keKota] += ui_mc.dagang_mc.dapat3;
if (dealKali >= 5) {
ui_mc.dagang_mc.gotoAndStop(3);
ui_mc.dagang_mc.oke_btn.onRelease = function () {
ui_mc.dagang_mc._visible = false;
};
}
}
}
};
ui_mc.dagang_mc.deal4.onRelease = function () {
if (_root['xgold' + keKota] >= ui_mc.dagang_mc.kasih4) {
if (_root['xiron' + keKota] >= ui_mc.dagang_mc.kasih42) {
backDeal();
++dealKali;
if (sideQuestKe == 4) {
cekMenangQuest(sideQuestKe);
}
_root['xgold' + keKota] -= ui_mc.dagang_mc.kasih4;
_root['xiron' + keKota] -= ui_mc.dagang_mc.kasih42;
_root['xwood' + keKota] += ui_mc.dagang_mc.dapat4;
if (dealKali >= 5) {
ui_mc.dagang_mc.gotoAndStop(3);
ui_mc.dagang_mc.oke_btn.onRelease = function () {
ui_mc.dagang_mc._visible = false;
};
}
}
}
};
ui_mc.dagang_mc.deal5.onRelease = function () {
if (_root['xgold' + keKota] >= ui_mc.dagang_mc.kasih5) {
backDeal();
++dealKali;
if (sideQuestKe == 4) {
cekMenangQuest(sideQuestKe);
}
_root['xgold' + keKota] -= ui_mc.dagang_mc.kasih5;
_root['xfood' + keKota] += ui_mc.dagang_mc.dapat5;
if (dealKali >= 5) {
ui_mc.dagang_mc.gotoAndStop(3);
ui_mc.dagang_mc.oke_btn.onRelease = function () {
ui_mc.dagang_mc._visible = false;
};
}
}
};
ui_mc.dagang_mc.deal6.onRelease = function () {
if (_root['xfood' + keKota] >= ui_mc.dagang_mc.kasih6) {
backDeal();
++dealKali;
if (sideQuestKe == 4) {
cekMenangQuest(sideQuestKe);
}
_root['xfood' + keKota] -= ui_mc.dagang_mc.kasih6;
_root['xgold' + keKota] += ui_mc.dagang_mc.dapat6;
if (dealKali >= 5) {
ui_mc.dagang_mc.gotoAndStop(3);
ui_mc.dagang_mc.oke_btn.onRelease = function () {
ui_mc.dagang_mc._visible = false;
};
}
}
};
ui_mc.dagang_mc.close_btn.onRelease = function () {
ui_mc.dagang_mc._visible = false;
};
}
function klikMap() {
clearSemua();
aksiMap = 'lihat';
gotoAndStop(769);
}
function cekAutoSave() {
if (autoSave == false) {
ui_mc.option_mc.autosave_mc.gotoAndStop(1);
} else {
ui_mc.option_mc.autosave_mc.gotoAndStop(2);
}
}
function klikOption() {
ui_mc.option_mc.gotoAndStop(1);
ui_mc.option_mc._visible = true;
if (sudahSimpan == undefined) {
ui_mc.option_mc.load_btn.enabled = false;
ui_mc.option_mc.saved_mc._visible = true;
ui_mc.option_mc.load_btn._alpha = 50;
} else {
ui_mc.option_mc.load_btn.enabled = true;
ui_mc.option_mc.saved_mc._visible = false;
ui_mc.option_mc.load_btn._alpha = 100;
}
cekAutoSave();
ui_mc.option_mc.autosave_mc.onRelease = function () {
if (autoSave == false) {
autoSave = true;
} else {
autoSave = false;
}
cekAutoSave();
};
ui_mc.option_mc.save_btn.onRelease = function () {
sudahSimpan = true;
simpanData();
ui_mc.option_mc.gotoAndStop(2);
ui_mc.option_mc.close_btn.onRelease = function () {
ui_mc.option_mc._visible = false;
if (sudahTutorial == false) {
tutorial_mc._visible = true;
} else {
if (ui_mc.berita_mc._visible == true) {
} else {
if (ui_mc.rebel_mc._visible == true) {
} else {
akanSerangKota = false;
bisaUI(true);
}
}
}
};
};
ui_mc.option_mc.load_btn.onRelease = function () {
selesaiTutorial();
clearSemua();
keLoading = 'loading';
gotoAndStop(739);
akanSerangKota = false;
bisaUI(true);
};
ui_mc.option_mc.quit_btn.onRelease = function () {
ui_mc.option_mc.gotoAndStop(3);
ui_mc.option_mc.yes_btn.onRelease = function () {
selesaiTutorial();
clearSemua();
backMenu();
backBuilding2();
gotoAndStop(216);
akanSerangKota = false;
bisaUI(true);
};
ui_mc.option_mc.no_btn.onRelease = function () {
ui_mc.option_mc._visible = false;
if (sudahTutorial == false) {
tutorial_mc._visible = true;
} else {
if (ui_mc.berita_mc._visible == true) {
} else {
if (ui_mc.rebel_mc._visible == true) {
} else {
akanSerangKota = false;
bisaUI(true);
}
}
}
};
};
ui_mc.option_mc.close_btn.onRelease = function () {
ui_mc.option_mc._visible = false;
if (sudahTutorial == false) {
tutorial_mc._visible = true;
} else {
if (ui_mc.berita_mc._visible == true) {
} else {
if (ui_mc.rebel_mc._visible == true) {
} else {
akanSerangKota = false;
bisaUI(true);
}
}
}
};
if (sudahTutorial == false) {
tutorial_mc._visible = false;
} else {
akanSerangKota = true;
bisaUI(false);
}
}
function klikMedal() {
ui_mc.medal_mc._visible = true;
ui_mc.achievement_mc.gotoAndStop(1);
cekMedal();
ui_mc.medal_mc.prev_btn.onRelease = function () {
ui_mc.medal_mc.gotoAndStop(1);
cekMedal();
};
ui_mc.medal_mc.next_btn.onRelease = function () {
ui_mc.medal_mc.gotoAndStop(2);
cekMedal();
};
ui_mc.medal_mc.close_btn.onRelease = function () {
ui_mc.medal_mc._visible = false;
akanSerangKota = false;
bisaUI(true);
};
akanSerangKota = true;
bisaUI(false);
}
function cekMedal() {
i = 1;
while (i <= 31) {
if (_root['dapatMedal' + i] == false) {
ui_mc.medal_mc['medal' + i].gotoAndStop(2);
} else {
ui_mc.medal_mc['medal' + i].gotoAndStop(1);
}
ui_mc.medal_mc['medal' + i].onRollOver = overMedal;
ui_mc.medal_mc['medal' + i].onRollOut = outMedal;
++i;
}
}
function cekDapatMedal() {
if (_root['xgold' + keKota] >= 5000) {
_root.dapatMedal1 = true;
}
if (_root['xgold' + keKota] >= 50000) {
_root.dapatMedal16 = true;
}
if (_root['xiron' + keKota] >= 2000) {
_root.dapatMedal2 = true;
}
if (_root['xiron' + keKota] >= 20000) {
_root.dapatMedal17 = true;
}
if (_root['xwood' + keKota] >= 2000) {
_root.dapatMedal3 = true;
}
if (_root['xwood' + keKota] >= 20000) {
_root.dapatMedal18 = true;
}
bykBangunanTotal = 0;
i = 1;
while (i <= maxBangunan) {
j = 1;
while (j <= bykKota) {
if (xtipeBuilding[i][j] >= 1) {
++bykBangunanTotal;
}
++j;
}
++i;
}
if (bykBangunanTotal >= 50) {
_root.dapatMedal4 = true;
}
if (bykBangunanTotal >= 300) {
_root.dapatMedal19 = true;
}
if (killMusuh >= 50) {
_root.dapatMedal5 = true;
}
if (killMusuh >= 500) {
_root.dapatMedal20 = true;
}
if (_root['xtech' + keKota] >= 100) {
_root.dapatMedal6 = true;
}
if (_root['xtech' + keKota] >= 500) {
_root.dapatMedal21 = true;
}
if (_root['xmana' + keKota] >= 100) {
_root.dapatMedal7 = true;
}
if (_root['xmana' + keKota] >= 500) {
_root.dapatMedal22 = true;
}
if (_root['xwelfare' + keKota] >= 100) {
_root.dapatMedal8 = true;
}
if (_root['xwelfare' + keKota] >= 500) {
_root.dapatMedal23 = true;
}
if (winBattle >= 10) {
_root.dapatMedal9 = true;
}
if (winBattle >= 100) {
_root.dapatMedal24 = true;
}
if (tidakKalah >= 5) {
_root.dapatMedal10 = true;
}
if (tidakKalah >= 25) {
_root.dapatMedal25 = true;
}
totalSoldierKota = _root['xbareman' + keKota] + _root['xswordman' + keKota] + _root['xarrowman' + keKota] + _root['xspearman' + keKota];
if (totalSoldierKota >= 500) {
_root.dapatMedal11 = true;
}
if (totalSoldierKota >= 4000) {
_root.dapatMedal26 = true;
}
if (_root['xtank' + keKota] >= 5) {
_root.dapatMedal12 = true;
}
if (_root['xtank' + keKota] >= 20) {
_root.dapatMedal27 = true;
}
if (_root['xcopter' + keKota] >= 5) {
_root.dapatMedal13 = true;
}
if (_root['xcopter' + keKota] >= 20) {
_root.dapatMedal28 = true;
}
if (_root['xmonbot' + keKota] >= 5) {
_root.dapatMedal14 = true;
}
if (_root['xmonbot' + keKota] >= 20) {
_root.dapatMedal29 = true;
}
simpanMedal();
}
function overMedal() {
msgBox._visible = true;
myStr = new String(this);
if (isNaN(myStr.substr(myStr.length - 2, 2))) {
indi = myStr.substr(myStr.length - 1, 1);
} else {
indi = myStr.substr(myStr.length - 2, 2);
}
msgBox.xinfo = xnamaMedal[indi];
}
function outMedal() {
msgBox._visible = false;
}
function overMenuUI() {
this.gotoAndStop(2);
}
function outMenuUI() {
this.gotoAndStop(1);
}
function cekHilangDrag() {
sedangDrag = false;
cekHitBangunan();
removeMovieClip(drag_mc);
}
function cekHilangDrag2() {
if (sedangTutorial == true) {
sudahTutorial = true;
cekRemovePanah();
selesaiTutorial();
} else {
sedangDrag = false;
cekHitBangunan();
removeMovieClip(drag_mc);
}
}
function clearSemua() {
stopDrag();
sedangDrag = false;
akanSerangKota = false;
cekHitBangunan();
delete myListener.onKeyDown;
delete myListener.onKeyUp;
Key.removeListener(myListener);
removeMovieClip(drag_mc);
i = 1;
while (i <= maxBangunan) {
j = 1;
while (j <= bykKota) {
removeMovieClip(_root[j + 'bangunan' + i]);
++j;
}
++i;
}
i = 1;
while (i <= maxBangunan) {
removeMovieClip(_root['bar' + i]);
++i;
}
i = 120000;
while (i <= 120200) {
removeMovieClip(_root['rebel_mc' + i]);
++i;
}
delete _root.onEnterFrame;
removeMovieClip(ui_mc);
removeMovieClip(box_mc);
removeMovieClip(masking_mc);
removeMovieClip(obyek_mc);
removeMovieClip(obyek_mc2);
if (sedangTutorial == true) {
} else {
removeMovieClip(tutorial_mc);
}
removeMovieClip(msgBox_mc);
removeMovieClip(latar_mc);
}
function klikSound() {
if (suaraNyala == true) {
suaraNyala = false;
} else {
suaraNyala = true;
}
cekSuara();
}
function cekSuara() {
ui_mc.sound_mc.infoSound_mc._visible = false;
if (suaraNyala == true) {
volume1 = 100;
volume2 = 30;
ui_mc.sound_mc.gotoAndStop(1);
} else {
volume1 = 0;
volume2 = 0;
ui_mc.sound_mc.gotoAndStop(2);
}
myMusic.setVolume(volume1);
}
function overSound() {
ui_mc.sound_mc.infoSound_mc._visible = true;
if (suaraNyala == true) {
ui_mc.sound_mc.infoSound_mc.gotoAndStop(1);
} else {
ui_mc.sound_mc.infoSound_mc.gotoAndStop(2);
}
}
function outSound() {
ui_mc.sound_mc.infoSound_mc._visible = false;
}
stop();
latar_mc = attachMovie('latar_mc', 'latar_mc', 9);
latar_mc._x = 400;
latar_mc._y = 300;
latar_mc.cacheAsBitmap = true;
initSemua();
initCost();
if (awalKaliMain == true) {
awalKaliMain = false;
initAwalGoods();
} else {
initBuilding(keKota);
}
buatBox();
buatUI();
buatBackground();
buatMasking();
buatMsgBox();
buatInfo();
buatInfo2();
cekDapatMedal();
xnamaQuest = new Array('', 'Have 4 houses in a town', 'Train your soldiers', 'Research for factory', 'Deal with the trader', 'Move resources to Monster Town', 'Build a park', 'Conquer at least 3 towns', 'Buy a zombie trap', 'Build a temple', 'Activate ranger', 'Have at least 50 mana\'s in a town', 'Kill 100 enemies', 'Conquer the ' + xnamaKota[13] + ' Town', 'Have at least 50 welfares in a town', 'Build a monbot', 'Conquer at least 6 towns', 'Conquer the ' + xnamaKota[6] + ' Town', 'Have at least 20 tanks', 'Conquer at least 10 towns', 'Have at least 20 copters', 'Kill 500 enemies', 'Have at least 20 monbots', 'Conquer at least 14 towns', 'Kill 1000 enemies', 'Have at least 50 monbots', 'Conquer at least 18 towns', 'Has all the resources in a town', 'Kill 1500 enemies', 'Unbeatable in battle 10 times in a row', 'Conquer at least 24 towns');
xinfoBuilding = new Array('', 'House is where the monsters live, it can increase the worker, the worker can be used for many things in this game.', 'Farm will produce food and money at the same time, useful for sustainable food town, while the money can be used to develop the town', 'Blacksmith is a place for producing iron, which will be used to make many things, this building can only be placed near the mountain.', 'Sawmill is a place for producing wood, which will be used to make many things, this building can only be placed near the tree.', 'Lab is a building to do some research, you can do a lot of research to produce a more modern buildings, the better troops and many other things.', 'Barack is a place for recruiting and training forces to be stronger, in this place you can generate infantry forces such as barehands, swordsman, arrowman and Spearman.', 'Armory is a place to produce a weapon, which is the main weapon for the infantry: swords, arrows and spears, as well as weapons such as Fire Thrower to build Tank and Copter.', 'Factory is a place for the manufacture of heavy vehicles such as Tanks, Helicopters and Monbots, all of which are heavy combat vehicles are expensive and very powerful.', 'Park is a place of entertainment for the monsters, this place will make people entertained and increase the welfere of town. The building is to be sufficiently important to avoid rebel.', 'Temple is a place of worship and to increases Mana, which could create spells and Monbot that can be used to support the battle.', 'Fortress can produce defense equipment. It\'s very useful to reduce the enemy in the field defend, use these tools to reduce their troops before they met you.', 'Library is a source of knowledge, here you can activate a number of special features that can increases the production value or the ability of your troops.');
xinfoTroops = new Array('', 'Barehands tends most basic troops, he doesn\'t use weapons, this is a melee type unit which is only requires the barrack, but the power is the weakest compared to the others', 'Swordman need a sword to fight, this is the type of melee unit, medium strength and have a decent speed.', 'Arrowman need arrows for war, this is the type of range unit, which can attack from a distance, has a slow speed but good enough damage.', 'Spearman need a spear to fight, this is the type of melee unit, more powerful than swordsman, has considerable speed and fairly good damage.');
xinfoArmory = new Array('', 'Sword is a swordman\'s main weapon, to train swordman you should create this weapon.', 'Arrow is a arrowman\'s main weapon, to train arrowman you should create this weapon.', 'Spear is a spearman\'s main weapon, to train spearman you should create this weapon.', 'Bow Launcher is a low defense weapons to reduce enemies.', 'Stone Thrower is a medium-defense weapons to reduce enemies.', 'Fire Thrower is a high defensive weapons to reduce enemies and one of material to build Tank and Copter.');
xinfoFactory = new Array('', 'Tank is a very powerful vehicle, which has a slow speed but high damage, can result in an explosion tank weapon that can kill a group of enemies, Tank is s range type unit.', 'Copter is a aerial vehicle that is very powerful, it can be shot anything with explosion weapon without being able to reach by melee troops, Copter is a range type unit.', 'Monbot is a monster robot, can only build in a certain places, monbot is the ultimate vehicle, can create an earthquake to reduce all enemies at once, Monbot is a melee type unit.');
xinfoSpell = new Array('', 'Bring rain arrows from the air, is used to attack enemies.', 'Bring a small meteor of the air, is used to attack enemies.', 'Bring acid rain from the air, is used to attack enemies.', 'Creating a powerful earthquake, is used to attack enemies.', 'Making monsters can not attack for a while, used to monsters.', 'Making monsters can not be seen for a while, used to monsters.', 'Making monsters brutally attacked for a while, used to monsters.', 'Making a double monster stats for a long time, used to monsters.');
xinfoDefense = new Array('', 'Wall is the standard used to delay the enemy moves, can\'t strike back and have the most greatest resistance than others.', 'Spike is useful to reduce the opponent\'s life when they touch it, but can not delay the enemy movement, ake sure that your opponent is slow enough for maximum results.', 'Spider Web can produce a small army of spiders that can attack enemies continuously, the damage is probably small, but in large amounts it is very useful.', 'Tower Guard is the guardian monsters on the tower that have arrow weapon, this is a defensive unit that has the most far range, it\'s very suitable if put in the back.', 'Zombie Trap is the most powerful defensive unit, if the trap is touched, it will triggers zombies to come out of his grave.');
xinfoSkill = new Array('', 'Activate Ranger to increase all the troop\'s range in this town.', 'Activate Tireless to increase all troop\'s damage in this town.', 'Activate Armor Plus to improve the all the troop\'s defense in this town.', 'Activate Speed Plus to increase all the troop\'s speed in this town.', 'Activate Entertainment to increase the production of welfare in this town.', 'Activate Fast Build to make the accelerate build time in this town.', 'Activate Raw Plus to increase production of iron and wood in this town.', 'Activate Gold Plus to increase gold production in this town.');
if (sedangTutorial == true) {
} else {
if (sudahTutorial == false) {
cekRemovePanah();
buatTutorial();
} else {
sudahTutorial = true;
cekRemovePanah();
selesaiTutorial();
}
if (menujuRebel == true) {
menujuRebel = undefined;
bisaUI(false);
akanSerangKota = true;
munculRebel(keKota);
}
}
if (pilihSkenario == 4) {
sudahTutorial = true;
cekRemovePanah();
selesaiTutorial();
}
_root.onMouseDown = function () {
bisaClick = true;
if (_root._xmouse <= 50 || _root._xmouse >= 750 || _root._ymouse <= 50) {
bisaClick = false;
}
if (sedangDrag == true && bisaClick == true) {
bisaPasang = true;
bisaPasang2 = false;
if (bisaPasang == true) {
i = 1;
while (i <= maxBangunan) {
if (_root[keKota + 'bangunan' + i]._x == undefined) {
bangunanPilih = i;
bisaPasang2 = true;
i = maxBangunan;
}
++i;
}
}
bisaPasang3 = true;
if (pilihBangunanKe == 5) {
if (adaLab2 == true) {
bisaPasang3 = false;
}
if (adaLab == true) {
bisaPasang3 = false;
}
} else {
if (pilihBangunanKe == 6) {
if (adaBarak2 == true) {
bisaPasang3 = false;
}
if (adaBarak == true) {
bisaPasang3 = false;
}
} else {
if (pilihBangunanKe == 7) {
if (adaArmory2 == true) {
bisaPasang3 = false;
}
if (adaArmory == true) {
bisaPasang3 = false;
}
} else {
if (pilihBangunanKe == 8) {
if (adaFactory2 == true) {
bisaPasang3 = false;
}
if (adaFactory == true) {
bisaPasang3 = false;
}
} else {
if (pilihBangunanKe == 11) {
if (adaFortress2 == true) {
bisaPasang3 = false;
}
if (adaFortress == true) {
bisaPasang3 = false;
}
} else {
if (pilihBangunanKe == 12) {
if (adaLibrary2 == true) {
bisaPasang3 = false;
}
if (adaLibrary == true) {
bisaPasang3 = false;
}
}
}
}
}
}
}
if (bisaPasang2 == true) {
if (bisaPasang3 == true) {
bisaPasang4 = false;
i = 1;
while (i <= maxSlot) {
if (_root.drag_mc.hitTest(obyek['slotHutan' + i].indi)) {
if (obyek['slotHutan' + i]._visible == true) {
posBangunanX = obyek['slotHutan' + i]._x + obyek._x;
posBangunanY = obyek['slotHutan' + i]._y + obyek._y;
bisaPasang4 = true;
i = maxSlot;
}
} else {
if (_root.drag_mc.hitTest(obyek['slotGunung' + i].indi)) {
if (obyek['slotGunung' + i]._visible == true) {
posBangunanX = obyek['slotGunung' + i]._x + obyek._x;
posBangunanY = obyek['slotGunung' + i]._y + obyek._y;
bisaPasang4 = true;
i = maxSlot;
}
} else {
if (_root.drag_mc.hitTest(obyek['slotKosong' + i].indi)) {
if (obyek['slotKosong' + i]._visible == true) {
posBangunanX = obyek['slotKosong' + i]._x + obyek._x;
posBangunanY = obyek['slotKosong' + i]._y + obyek._y;
bisaPasang4 = true;
i = maxSlot;
}
}
}
}
++i;
}
if (bisaPasang4 == true) {
if (sedangTutorial == true) {
if (sedangBangunKe <= 7) {
cekTutorial(5);
} else {
if (sedangBangunKe >= 8) {
cekTutorial(30);
}
}
}
bar = attachMovie('bar_mc', 'bar' + bangunanPilih, dalamBar);
bar._x = posBangunanX;
bar._y = posBangunanY + 75;
bar.onEnterFrame = enterBar;
++dalamBar;
if (dalamBar >= 141000) {
dalamBar = 140000;
}
backBangun();
bangunan = attachMovie('bangunan_mc', keKota + 'bangunan' + bangunanPilih, dalamBangunan);
bangunan._x = posBangunanX;
bangunan._y = posBangunanY;
bangunan.panah_mc._visible = false;
bangunan.gotoAndStop(pilihBangunanKe);
bangunan._alpha = 30;
bangunan.enabled = false;
bangunan.sudahJadi = false;
bangunan.aktif_mc._visible = false;
bangunan.jenisBangunan = pilihBangunanKe;
bangunan.keBangunan = bangunanPilih;
bangunan.delayBuat = 0;
bangunan.maxBuat = lamaBuatBuilding[pilihBangunanKe];
bangunan.levelKe = 1;
xtipeBuilding[bangunanPilih][keKota] = pilihBangunanKe;
xposXBuilding[bangunanPilih][keKota] = bangunan._x - titikAwalX;
xposYBuilding[bangunanPilih][keKota] = bangunan._y - titikAwalY;
xlevelBuilding[bangunanPilih][keKota] = bangunan.levelKe;
xsudahJadiBuilding[bangunanPilih][keKota] = bangunan.sudahJadi;
xdelayBuatBuilding[bangunanPilih][keKota] = bangunan.delayBuat;
bangunan.onEnterFrame = enterBangunan2;
bangunan.onRelease = klikBangunan2;
++dalamBangunan;
if (dalamBangunan >= 200) {
dalamBangunan = 100;
}
stopDrag();
sedangDrag = false;
cekHitBangunan();
removeMovieClip(drag_mc);
_root['xworker' + keKota] -= costWorkerBuilding[pilihBangunanKe];
_root['xgold' + keKota] -= costGoldBuilding[pilihBangunanKe];
_root['xwood' + keKota] -= costWoodBuilding[pilihBangunanKe];
_root['xiron' + keKota] -= costIronBuilding[pilihBangunanKe];
cekAdaTipeBangunan();
} else {
if (pilihBangunanKe == 3) {
cekInfo('Can\'t build Blacksmith on this place, place it near the mountain');
} else {
if (pilihBangunanKe == 4) {
cekInfo('Can\'t build Sawmills on this place, place it near the tree');
} else {
cekInfo('Can\'t build on this place, place it on the right sign');
}
}
}
} else {
cekInfo('Can\'t build this building again, this is already exist in this town');
}
} else {
if (pilihBangunanKe == 3) {
cekInfo('Can\'t build Blacksmith on this place, place it near the mountain');
} else {
if (pilihBangunanKe == 4) {
cekInfo('Can\'t build Sawmills on this place, place it near the tree');
} else {
cekInfo('Can\'t build on this place, place it on the right sign');
}
}
}
}
};
cekSuara();
delete myListener.onKeyDown;
delete myListener.onKeyUp;
Key.removeListener(myListener);
myListener = new Object();
myListener.onKeyDown = function () {
if (Key.getCode() == 65 || Key.getCode() == 37) {
geserKeKiri = true;
}
if (Key.getCode() == 68 || Key.getCode() == 39) {
geserKeKanan = true;
}
if (Key.getCode() == 87 || Key.getCode() == 38) {
geserKeAtas = true;
}
if (Key.getCode() == 83 || Key.getCode() == 40) {
geserKeBawah = true;
}
};
myListener.onKeyUp = function () {
if (Key.getCode() == 65 || Key.getCode() == 37) {
geserKeKiri = false;
}
if (Key.getCode() == 68 || Key.getCode() == 39) {
geserKeKanan = false;
}
if (Key.getCode() == 87 || Key.getCode() == 38) {
geserKeAtas = false;
}
if (Key.getCode() == 83 || Key.getCode() == 40) {
geserKeBawah = false;
}
};
Key.addListener(myListener);
}
frame 737 {
function cekSemuaResource() {
gagalSemua = false;
if (_root['xgold' + keKota] == 0) {
gagalSemua = true;
}
if (_root['xiron' + keKota] == 0) {
gagalSemua = true;
}
if (_root['xwood' + keKota] == 0) {
gagalSemua = true;
}
if (_root['xworker' + keKota] == 0) {
gagalSemua = true;
}
if (_root['xbareman' + keKota] == 0) {
gagalSemua = true;
}
if (_root['xswordman' + keKota] == 0) {
gagalSemua = true;
}
if (_root['xarrowman' + keKota] == 0) {
gagalSemua = true;
}
if (_root['xspearman' + keKota] == 0) {
gagalSemua = true;
}
if (_root['xwelfare' + keKota] == 0) {
gagalSemua = true;
}
if (_root['xtech' + keKota] == 0) {
gagalSemua = true;
}
if (_root['xmana' + keKota] == 0) {
gagalSemua = true;
}
if (_root['xfood' + keKota] == 0) {
gagalSemua = true;
}
if (_root['xtank' + keKota] == 0) {
gagalSemua = true;
}
if (_root['xcopter' + keKota] == 0) {
gagalSemua = true;
}
if (_root['xmonbot' + keKota] == 0) {
gagalSemua = true;
}
if (_root['xsword' + keKota] == 0) {
gagalSemua = true;
}
if (_root['xarrow' + keKota] == 0) {
gagalSemua = true;
}
if (_root['xspear' + keKota] == 0) {
gagalSemua = true;
}
if (_root['xarrowTrap' + keKota] == 0) {
gagalSemua = true;
}
if (_root['xcatapult' + keKota] == 0) {
gagalSemua = true;
}
if (_root['xfireTrap' + keKota] == 0) {
gagalSemua = true;
}
if (_root['xarrowRain' + keKota] == 0) {
gagalSemua = true;
}
if (_root['xmeteorid' + keKota] == 0) {
gagalSemua = true;
}
if (_root['xacidRain' + keKota] == 0) {
gagalSemua = true;
}
if (_root['xearthquake' + keKota] == 0) {
gagalSemua = true;
}
if (_root['ximmune' + keKota] == 0) {
gagalSemua = true;
}
if (_root['xinvisible' + keKota] == 0) {
gagalSemua = true;
}
if (_root['xspecialAttack' + keKota] == 0) {
gagalSemua = true;
}
if (_root['xduplicate' + keKota] == 0) {
gagalSemua = true;
}
if (_root['xwall' + keKota] == 0) {
gagalSemua = true;
}
if (_root['xspike' + keKota] == 0) {
gagalSemua = true;
}
if (_root['xspiderWeb' + keKota] == 0) {
gagalSemua = true;
}
if (_root['xtowerGuard' + keKota] == 0) {
gagalSemua = true;
}
if (_root['xzombieTrap' + keKota] == 0) {
gagalSemua = true;
}
}
stop();
_root.onEnterFrame = function () {
if (_root._xmouse <= 10 || geserKeKiri == true) {
if (latar_mc._x <= 845) {
geserKiri = 10 * speedGame;
} else {
geserKiri = 0;
}
} else {
if (_root._xmouse >= 790 || geserKeKanan == true) {
if (latar_mc._x >= -45) {
geserKiri = -10 * speedGame;
} else {
geserKiri = 0;
}
} else {
geserKiri = 0;
}
}
if (_root._ymouse <= 5 || geserKeAtas == true) {
if (latar_mc._y <= 645) {
geserAtas = 10 * speedGame;
} else {
geserAtas = 0;
}
} else {
if (_root._ymouse >= 585 || geserKeBawah == true) {
if (latar_mc._y >= -45) {
geserAtas = -10 * speedGame;
} else {
geserAtas = 0;
}
} else {
geserAtas = 0;
}
}
if (sudahTutorial == false) {
if (awalTutorialSeratus == false) {
if (geserKiri >= 10) {
tutorial_mc.kiri._visible = false;
sudahGeserKiri = true;
}
if (geserKiri <= -10) {
tutorial_mc.kanan._visible = false;
sudahGeserKanan = true;
}
if (geserAtas >= 10) {
tutorial_mc.atas._visible = false;
sudahGeserAtas = true;
}
if (geserAtas <= -10) {
tutorial_mc.bawah._visible = false;
sudahGeserBawah = true;
}
if (sudahGeserKiri == true && sudahGeserKanan == true && sudahGeserAtas == true && sudahGeserBawah == true) {
cekTutorial(101);
}
}
} else {
if (box_mc._visible == true) {
geserKiri = 0;
geserAtas = 0;
} else {
if (akanSerangKota == true) {
if (adaSeranganMusuh != true) {
geserKiri = 0;
geserAtas = 0;
}
}
}
}
latar_mc._x += geserKiri;
latar_mc._y += geserAtas;
titikAwalX += geserKiri;
titikAwalY += geserAtas;
if (delayWaktu >= maxWaktu && akanSerangKota != true) {
delayWaktu = 0;
dagangKali = true;
dealKali = 0;
++xday;
cekSeranganMusuh();
if (adaSeranganHariIni == false) {
cekAI();
}
if (adaSeranganHariIni == false) {
j = 1;
while (j <= bykKota) {
if (_root['kotaMilik' + j] == 1) {
if (_root['xworker' + j] > 0) {
if (_root['xwelfare' + j] <= 0) {
_root['xwelfare' + j] = 0;
adaRebel(j);
} else {
_root['xwelfare' + j] -= 0.05;
}
}
}
++j;
}
}
awalGold = _root['xgold' + keKota];
awalIron = _root['xiron' + keKota];
awalWood = _root['xwood' + keKota];
awalWorker = _root['xworker' + keKota];
awalTech = _root['xtech' + keKota];
awalWelfare = _root['xwelfare' + keKota];
awalFood = _root['xfood' + keKota];
awalMana = _root['xmana' + keKota];
if (_root['xworker' + keKota] < 0) {
if (adaWarning1 == false) {
adaWarning1 = true;
cekInfo('Warning! There\'s no worker in this town, all town activity has been stopped!');
}
} else {
if (_root['xfood' + keKota] <= 0) {
if (adaWarning2 == false) {
adaWarning2 = true;
cekInfo('Warning! There\'s no food in this town, all town activity has been stopped!');
}
}
}
i = 1;
while (i <= maxBangunan) {
j = 1;
while (j <= bykKota) {
if (xtipeBuilding[i][j] >= 1) {
if (j != keKota) {
if (_root['xworker' + j] >= 0) {
if (_root['xfood' + j] > 0) {
if (xsudahJadiBuilding[i][j] == false) {
xdelayBuatBuilding[i][j] += maxWaktu;
if (_root['fastBuildAktif' + j] == true) {
xmaxBuat = lamaBuatBuilding2[xtipeBuilding[i][j]];
} else {
xmaxBuat = lamaBuatBuilding[xtipeBuilding[i][j]];
}
if (xdelayBuatBuilding[i][j] >= xmaxBuat) {
xsudahJadiBuilding[i][j] = true;
if (xtipeBuilding[i][j] == 1) {
_root['xworker' + j] += productionBuilding[xtipeBuilding[i][j]];
}
}
}
}
}
}
if (xsudahJadiBuilding[i][j] == true) {
if (_root['xworker' + j] >= 0) {
if (_root['xfood' + j] > 0) {
if (xtipeBuilding[i][j] == 1) {
bangunanAktif[xtipeBuilding[i][j]][j] = false;
if (_root['xfood' + j] >= costBuilding2[xtipeBuilding[i][j]] * xlevelBuilding[i][j]) {
_root['xfood' + j] -= costBuilding2[xtipeBuilding[i][j]] * xlevelBuilding[i][j];
bangunanAktif[xtipeBuilding[i][j]][j] = true;
} else {
_root['xworker' + keKota] -= productionBuilding[xtipeBuilding[i][j]] * xlevelBuilding[i][j];
xtipeBuilding[i][j] = 0;
box_mc._visible = false;
removeMovieClip(_root[j + 'bangunan' + i]);
cekAdaTipeBangunan();
}
} else {
if (xtipeBuilding[i][j] == 2) {
bangunanAktif[xtipeBuilding[i][j]][j] = false;
if (_root['xiron' + j] >= costBuilding2[xtipeBuilding[i][j]] * xlevelBuilding[i][j] && _root['xwood' + j] >= costBuilding3[xtipeBuilding[i][j]] * xlevelBuilding[i][j]) {
if (_root['goldPlusAktif' + j] == true) {
if (tingkatSulit == 1) {
_root['xgold' + j] += 10 * productionBuilding[xtipeBuilding[i][j]] * xlevelBuilding[i][j];
} else {
if (tingkatSulit == 2) {
_root['xgold' + j] += 8 * productionBuilding[xtipeBuilding[i][j]] * xlevelBuilding[i][j];
} else {
if (tingkatSulit == 3) {
_root['xgold' + j] += 6 * productionBuilding[xtipeBuilding[i][j]] * xlevelBuilding[i][j];
}
}
}
} else {
_root['xgold' + j] += productionBuilding[xtipeBuilding[i][j]] * xlevelBuilding[i][j];
}
_root['xfood' + j] += productionBuilding2[xtipeBuilding[i][j]] * xlevelBuilding[i][j];
_root['xiron' + j] -= costBuilding2[xtipeBuilding[i][j]] * xlevelBuilding[i][j];
_root['xwood' + j] -= costBuilding3[xtipeBuilding[i][j]] * xlevelBuilding[i][j];
bangunanAktif[xtipeBuilding[i][j]][j] = true;
}
} else {
if (xtipeBuilding[i][j] == 3) {
bangunanAktif[xtipeBuilding[i][j]][j] = false;
if (_root['xgold' + j] >= costBuilding[xtipeBuilding[i][j]] * xlevelBuilding[i][j]) {
if (_root['rawPlusAktif' + j] == true) {
if (tingkatSulit == 1) {
_root['xiron' + j] += 10 * productionBuilding[xtipeBuilding[i][j]] * xlevelBuilding[i][j];
} else {
if (tingkatSulit == 2) {
_root['xiron' + j] += 8 * productionBuilding[xtipeBuilding[i][j]] * xlevelBuilding[i][j];
} else {
if (tingkatSulit == 3) {
_root['xiron' + j] += 6 * productionBuilding[xtipeBuilding[i][j]] * xlevelBuilding[i][j];
}
}
}
} else {
_root['xiron' + j] += productionBuilding[xtipeBuilding[i][j]] * xlevelBuilding[i][j];
}
_root['xgold' + j] -= costBuilding[xtipeBuilding[i][j]] * xlevelBuilding[i][j];
bangunanAktif[xtipeBuilding[i][j]][j] = true;
}
} else {
if (xtipeBuilding[i][j] == 4) {
bangunanAktif[xtipeBuilding[i][j]][j] = false;
if (_root['xgold' + j] >= costBuilding[xtipeBuilding[i][j]] * xlevelBuilding[i][j]) {
if (_root['rawPlusAktif' + j] == true) {
if (tingkatSulit == 1) {
_root['xwood' + j] += 10 * productionBuilding[xtipeBuilding[i][j]] * xlevelBuilding[i][j];
} else {
if (tingkatSulit == 2) {
_root['xwood' + j] += 8 * productionBuilding[xtipeBuilding[i][j]] * xlevelBuilding[i][j];
} else {
if (tingkatSulit == 3) {
_root['xwood' + j] += 6 * productionBuilding[xtipeBuilding[i][j]] * xlevelBuilding[i][j];
}
}
}
} else {
_root['xwood' + j] += productionBuilding[xtipeBuilding[i][j]] * xlevelBuilding[i][j];
}
_root['xgold' + j] -= costBuilding[xtipeBuilding[i][j]] * xlevelBuilding[i][j];
bangunanAktif[xtipeBuilding[i][j]][j] = true;
}
} else {
if (xtipeBuilding[i][j] == 5) {
bangunanAktif[xtipeBuilding[i][j]][j] = false;
if (_root['xgold' + j] >= costBuilding[xtipeBuilding[i][j]] * xlevelBuilding[i][j]) {
_root['xtech' + j] += productionBuilding[xtipeBuilding[i][j]] * xlevelBuilding[i][j];
_root['xgold' + j] -= costBuilding[xtipeBuilding[i][j]] * xlevelBuilding[i][j];
bangunanAktif[xtipeBuilding[i][j]][j] = true;
}
} else {
if (xtipeBuilding[i][j] == 6) {
bangunanAktif[xtipeBuilding[i][j]][j] = false;
if (_root['xgold' + j] >= costBuilding[xtipeBuilding[i][j]] * xlevelBuilding[i][j]) {
_root['xgold' + j] -= costBuilding[xtipeBuilding[i][j]] * xlevelBuilding[i][j];
bangunanAktif[xtipeBuilding[i][j]][j] = true;
}
if (bangunanAktif[xtipeBuilding[i][j]][j] == true) {
bisaGagalArmy = false;
if (_root['autoBareman' + j] == true) {
if (_root['xgold' + j] >= butuhGoldArmy[1]) {
if (_root['xworker' + j] >= produksiArmy) {
_root['xgold' + j] -= butuhGoldArmy[1];
_root['xworker' + j] -= produksiArmy;
_root['xbareman' + j] += produksiArmy;
} else {
bisaGagalArmy = true;
}
} else {
bisaGagalArmy = true;
}
}
if (_root['autoSwordman' + j] == true) {
if (_root['xgold' + j] >= butuhGoldArmy[2]) {
if (_root['xworker' + j] >= produksiArmy) {
if (_root['xsword' + j] >= produksiArmy) {
_root['xgold' + j] -= butuhGoldArmy[2];
_root['xworker' + j] -= produksiArmy;
_root['xsword' + j] -= produksiArmy;
_root['xswordman' + j] += produksiArmy;
} else {
bisaGagalArmy = true;
}
} else {
bisaGagalArmy = true;
}
} else {
bisaGagalArmy = true;
}
}
if (_root['autoArrowman' + j] == true) {
if (_root['xgold' + j] >= butuhGoldArmy[3]) {
if (_root['xworker' + j] >= produksiArmy) {
if (_root['xarrow' + j] >= produksiArmy) {
_root['xgold' + j] -= butuhGoldArmy[3];
_root['xworker' + j] -= produksiArmy;
_root['xarrow' + j] -= produksiArmy;
_root['xarrowman' + j] += produksiArmy;
} else {
bisaGagalArmy = true;
}
} else {
bisaGagalArmy = true;
}
} else {
bisaGagalArmy = true;
}
}
if (_root['autoSpearman' + j] == true) {
if (_root['xgold' + j] >= butuhGoldArmy[4]) {
if (_root['xworker' + j] >= produksiArmy) {
if (_root['xspear' + j] >= produksiArmy) {
_root['xgold' + j] -= butuhGoldArmy[4];
_root['xworker' + j] -= produksiArmy;
_root['xspear' + j] -= produksiArmy;
_root['xspearman' + j] += produksiArmy;
} else {
bisaGagalArmy = true;
}
} else {
bisaGagalArmy = true;
}
} else {
bisaGagalArmy = true;
}
}
if (bisaGagalArmy == true) {
bangunanAktif[xtipeBuilding[i][j]][j] = false;
}
}
} else {
if (xtipeBuilding[i][j] == 7) {
bangunanAktif[xtipeBuilding[i][j]][j] = false;
if (_root['xgold' + j] >= costBuilding[xtipeBuilding[i][j]] * xlevelBuilding[i][j]) {
_root['xgold' + j] -= costBuilding[xtipeBuilding[i][j]] * xlevelBuilding[i][j];
bangunanAktif[xtipeBuilding[i][j]][j] = true;
}
if (bangunanAktif[xtipeBuilding[i][j]][j] == true) {
bisaGagalArmory = false;
if (_root['autoSword' + j] == true) {
if (_root['xgold' + j] >= costGoldWeapon[1] * xlevelBuilding[i][j]) {
if (_root['xiron' + j] >= costIronWeapon[1] * xlevelBuilding[i][j]) {
if (_root['xwood' + j] >= costWoodWeapon[1] * xlevelBuilding[i][j]) {
_root['xgold' + j] -= costGoldWeapon[1] * xlevelBuilding[i][j];
_root['xiron' + j] -= costIronWeapon[1] * xlevelBuilding[i][j];
_root['xwood' + j] -= costWoodWeapon[1] * xlevelBuilding[i][j];
_root['xsword' + j] += 5 * xlevelBuilding[i][j];
} else {
bisaGagalArmory = true;
}
} else {
bisaGagalArmory = true;
}
} else {
bisaGagalArmory = true;
}
}
if (_root['autoArrow' + j] == true) {
if (_root['xgold' + j] >= costGoldWeapon[2] * xlevelBuilding[i][j]) {
if (_root['xiron' + j] >= costIronWeapon[2] * xlevelBuilding[i][j]) {
if (_root['xwood' + j] >= costWoodWeapon[2] * xlevelBuilding[i][j]) {
_root['xgold' + j] -= costGoldWeapon[2] * xlevelBuilding[i][j];
_root['xiron' + j] -= costIronWeapon[2] * xlevelBuilding[i][j];
_root['xwood' + j] -= costWoodWeapon[2] * xlevelBuilding[i][j];
_root['xarrow' + j] += 5 * xlevelBuilding[i][j];
} else {
bisaGagalArmory = true;
}
} else {
bisaGagalArmory = true;
}
} else {
bisaGagalArmory = true;
}
}
if (_root['autoSpear' + j] == true) {
if (_root['xgold' + j] >= costGoldWeapon[3] * xlevelBuilding[i][j]) {
if (_root['xiron' + j] >= costIronWeapon[3] * xlevelBuilding[i][j]) {
if (_root['xwood' + j] >= costWoodWeapon[3] * xlevelBuilding[i][j]) {
_root['xgold' + j] -= costGoldWeapon[3] * xlevelBuilding[i][j];
_root['xiron' + j] -= costIronWeapon[3] * xlevelBuilding[i][j];
_root['xwood' + j] -= costWoodWeapon[3] * xlevelBuilding[i][j];
_root['xspear' + j] += 5 * xlevelBuilding[i][j];
} else {
bisaGagalArmory = true;
}
} else {
bisaGagalArmory = true;
}
} else {
bisaGagalArmory = true;
}
}
if (bisaGagalArmory == true) {
bangunanAktif[xtipeBuilding[i][j]][j] = false;
}
}
} else {
if (xtipeBuilding[i][j] == 8) {
bangunanAktif[xtipeBuilding[i][j]][j] = false;
if (_root['xgold' + j] >= costBuilding[xtipeBuilding[i][j]] * xlevelBuilding[i][j]) {
_root['xgold' + j] -= costBuilding[xtipeBuilding[i][j]] * xlevelBuilding[i][j];
bangunanAktif[xtipeBuilding[i][j]][j] = true;
}
if (bangunanAktif[xtipeBuilding[i][j]][j] == true) {
bisaGagalFactory = false;
if (_root['autoTank' + j] == true) {
if (_root['xgold' + j] >= costGoldKendaraan[1]) {
if (_root['xiron' + j] >= costIronKendaraan[1]) {
if (_root['xwood' + j] >= costWoodKendaraan[1]) {
if (_root['xworker' + j] >= costWorkerKendaraan[1]) {
if (_root['xfireTrap' + j] >= costTambahanKendaraan[1]) {
_root['xgold' + j] -= costGoldKendaraan[1];
_root['xiron' + j] -= costIronKendaraan[1];
_root['xwood' + j] -= costWoodKendaraan[1];
_root['xworker' + j] -= costWorkerKendaraan[1];
_root['xfireTrap' + j] -= costTambahanKendaraan[1];
_root['xtank' + j] += 1;
}
} else {
bisaGagalFactory = true;
}
} else {
bisaGagalFactory = true;
}
} else {
bisaGagalFactory = true;
}
} else {
bisaGagalFactory = true;
}
}
if (_root['autoCopter' + j] == true) {
if (_root['xgold' + j] >= costGoldKendaraan[2]) {
if (_root['xiron' + j] >= costIronKendaraan[2]) {
if (_root['xwood' + j] >= costWoodKendaraan[2]) {
if (_root['xworker' + j] >= costWorkerKendaraan[2]) {
if (_root['xfireTrap' + j] >= costTambahanKendaraan[2]) {
_root['xgold' + j] -= costGoldKendaraan[2];
_root['xiron' + j] -= costIronKendaraan[2];
_root['xwood' + j] -= costWoodKendaraan[2];
_root['xworker' + j] -= costWorkerKendaraan[2];
_root['xfireTrap' + j] -= costTambahanKendaraan[2];
_root['xcopter' + j] += 1;
}
} else {
bisaGagalFactory = true;
}
} else {
bisaGagalFactory = true;
}
} else {
bisaGagalFactory = true;
}
} else {
bisaGagalFactory = true;
}
}
if (_root['autoMonbot' + j] == true) {
if (_root['xgold' + j] >= costGoldKendaraan[3]) {
if (_root['xiron' + j] >= costIronKendaraan[3]) {
if (_root['xwood' + j] >= costWoodKendaraan[3]) {
if (_root['xworker' + j] >= costWorkerKendaraan[3]) {
if (_root['xmana' + j] >= costTambahanKendaraan[3]) {
_root['xgold' + j] -= costGoldKendaraan[3];
_root['xiron' + j] -= costIronKendaraan[3];
_root['xwood' + j] -= costWoodKendaraan[3];
_root['xworker' + j] -= costWorkerKendaraan[3];
_root['xmana' + j] -= costTambahanKendaraan[3];
_root['xmonbot' + j] += 1;
}
} else {
bisaGagalFactory = true;
}
} else {
bisaGagalFactory = true;
}
} else {
bisaGagalFactory = true;
}
} else {
bisaGagalFactory = true;
}
}
if (bisaGagalFactory == true) {
bangunanAktif[xtipeBuilding[i][j]][j] = false;
}
}
} else {
if (xtipeBuilding[i][j] == 9) {
bangunanAktif[xtipeBuilding[i][j]][j] = false;
if (_root['xgold' + j] >= costBuilding[xtipeBuilding[i][j]] * xlevelBuilding[i][j]) {
if (_root['entertainmentAktif' + j] == true) {
_root['xwelfare' + j] += 5 * productionBuilding[xtipeBuilding[i][j]] * xlevelBuilding[i][j];
} else {
_root['xwelfare' + j] += productionBuilding[xtipeBuilding[i][j]] * xlevelBuilding[i][j];
}
_root['xgold' + j] -= costBuilding[xtipeBuilding[i][j]] * xlevelBuilding[i][j];
bangunanAktif[xtipeBuilding[i][j]][j] = true;
}
} else {
if (xtipeBuilding[i][j] == 10) {
bangunanAktif[xtipeBuilding[i][j]][j] = false;
if (_root['xgold' + j] >= costBuilding[xtipeBuilding[i][j]] * xlevelBuilding[i][j]) {
_root['xmana' + j] += productionBuilding[xtipeBuilding[i][j]] * xlevelBuilding[i][j];
_root['xgold' + j] -= costBuilding[xtipeBuilding[i][j]] * xlevelBuilding[i][j];
bangunanAktif[xtipeBuilding[i][j]][j] = true;
}
} else {
if (xtipeBuilding[i][j] == 11) {
bangunanAktif[xtipeBuilding[i][j]][j] = false;
if (_root['xgold' + j] >= costBuilding[xtipeBuilding[i][j]] * xlevelBuilding[i][j]) {
_root['xgold' + j] -= costBuilding[xtipeBuilding[i][j]] * xlevelBuilding[i][j];
bangunanAktif[xtipeBuilding[i][j]][j] = true;
}
} else {
if (xtipeBuilding[i][j] == 12) {
bangunanAktif[xtipeBuilding[i][j]][j] = true;
k = 1;
while (k <= 8) {
jalanPasang = false;
if (k == 1 && _root['rangerAktif' + j] == true) {
jalanPasang = true;
} else {
if (k == 2 && _root['tirelessAktif' + j] == true) {
jalanPasang = true;
} else {
if (k == 3 && _root['armorPlusAktif' + j] == true) {
jalanPasang = true;
} else {
if (k == 4 && _root['speedPlusAktif' + j] == true) {
jalanPasang = true;
} else {
if (k == 5 && _root['entertainmentAktif' + j] == true) {
jalanPasang = true;
} else {
if (k == 6 && _root['fastBuildAktif' + j] == true) {
jalanPasang = true;
} else {
if (k == 7 && _root['rawPlusAktif' + j] == true) {
jalanPasang = true;
} else {
if (k == 8 && _root['goldPlusAktif' + j] == true) {
jalanPasang = true;
}
}
}
}
}
}
}
}
if (jalanPasang == true) {
bisaKahPasang = false;
if (_root['xgold' + j] >= costLibraryGold[k]) {
if (_root['xiron' + j] >= costLibraryIron[k]) {
if (_root['xwood' + j] >= costLibraryWood[k]) {
if (_root['xmana' + j] >= costLibraryMana[k]) {
_root['xgold' + j] -= costLibraryGold[k];
_root['xiron' + j] -= costLibraryIron[k];
_root['xwood' + j] -= costLibraryWood[k];
_root['xmana' + j] -= costLibraryMana[k];
bisaKahPasang = true;
}
}
}
}
if (bisaKahPasang == false) {
if (k == 1) {
_root['rangerAktif' + j] = false;
} else {
if (k == 2) {
_root['tirelessAktif' + j] = false;
} else {
if (k == 3) {
_root['armorPlusAktif' + j] = false;
} else {
if (k == 4) {
_root['speedPlusAktif' + j] = false;
} else {
if (k == 5) {
_root['entertainmentAktif' + j] = false;
} else {
if (k == 6) {
_root['fastBuildAktif' + j] = false;
} else {
if (k == 7) {
_root['rawPlusAktif' + j] = false;
} else {
if (k == 8) {
_root['goldPlusAktif' + j] = false;
}
}
}
}
}
}
}
}
bangunanAktif[xtipeBuilding[i][j]][j] = false;
if (adaWarning3 == false) {
adaWarning3 = true;
cekInfo('One or more library skills are inactive, need more resources');
}
}
}
++k;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
if (_root['xgold' + j] <= 0) {
_root['xgold' + j] = 0;
}
if (_root['xiron' + j] <= 0) {
_root['xiron' + j] = 0;
}
if (_root['xwood' + j] <= 0) {
_root['xwood' + j] = 0;
}
}
}
++j;
}
++i;
}
cekDapatMedal();
i = 1;
while (i <= 8) {
ui_mc['box_mc' + i].gotoAndStop(1);
++i;
}
akhirGold = _root['xgold' + keKota];
akhirIron = _root['xiron' + keKota];
akhirWood = _root['xwood' + keKota];
akhirWorker = _root['xworker' + keKota];
akhirTech = _root['xtech' + keKota];
akhirWelfare = _root['xwelfare' + keKota];
akhirFood = _root['xfood' + keKota];
akhirMana = _root['xmana' + keKota];
if (awalGold < akhirGold) {
ui_mc.box_mc1.gotoAndStop(3);
jedaGold = akhirGold - awalGold;
ui_mc.gold_mc.infoTambah = 'GOLD\nINC ' + jedaGold;
} else {
if (awalGold > akhirGold) {
ui_mc.box_mc1.gotoAndStop(2);
jedaGold = awalGold - akhirGold;
ui_mc.gold_mc.infoTambah = 'GOLD\nDEC ' + jedaGold;
} else {
ui_mc.box_mc1.gotoAndStop(1);
ui_mc.gold_mc.infoTambah = 'GOLD';
}
}
if (awalIron < akhirIron) {
ui_mc.box_mc2.gotoAndStop(3);
jedaIron = akhirIron - awalIron;
ui_mc.iron_mc.infoTambah = 'IRON\nINC ' + jedaIron;
} else {
if (awalIron > akhirIron) {
ui_mc.box_mc2.gotoAndStop(2);
jedaIron = awalIron - akhirIron;
ui_mc.iron_mc.infoTambah = 'IRON\nDEC ' + jedaIron;
} else {
ui_mc.box_mc2.gotoAndStop(1);
ui_mc.iron_mc.infoTambah = 'IRON';
}
}
if (awalWood < akhirWood) {
ui_mc.box_mc3.gotoAndStop(3);
jedaWood = akhirWood - awalWood;
ui_mc.wood_mc.infoTambah = 'WOOD\nINC ' + jedaWood;
} else {
if (awalWood > akhirWood) {
ui_mc.box_mc3.gotoAndStop(2);
jedaWood = awalWood - akhirWood;
ui_mc.wood_mc.infoTambah = 'WOOD\nDEC ' + jedaWood;
} else {
ui_mc.box_mc3.gotoAndStop(1);
ui_mc.wood_mc.infoTambah = 'WOOD';
}
}
if (awalWorker < akhirWorker) {
ui_mc.box_mc4.gotoAndStop(3);
jedaWorker = akhirWorker - awalWorker;
ui_mc.worker_mc.infoTambah = 'AVAILABLE WORKER\nINC ' + jedaWorker;
} else {
if (awalWorker > akhirWorker) {
ui_mc.box_mc4.gotoAndStop(2);
jedaWorker = awalWorker - akhirWorker;
ui_mc.worker_mc.infoTambah = 'AVAILABLE WORKER\nDEC ' + jedaWorker;
} else {
ui_mc.box_mc4.gotoAndStop(1);
ui_mc.worker_mc.infoTambah = 'AVAILABLE WORKER';
}
}
if (awalTech < akhirTech) {
ui_mc.box_mc5.gotoAndStop(3);
jedaTech = akhirTech - awalTech;
myStr = new String(jedaTech);
xjedaTech = myStr.substr(0, 4);
ui_mc.tech_mc.infoTambah = 'TECH POINT\nINC ' + xjedaTech;
} else {
if (awalTech > akhirTech) {
ui_mc.box_mc5.gotoAndStop(2);
jedaTech = awalTech - akhirTech;
ui_mc.tech_mc.infoTambah = 'TECH POINT\nDEC ' + jedaTech;
} else {
ui_mc.box_mc5.gotoAndStop(1);
ui_mc.tech_mc.infoTambah = 'TECH POINT';
}
}
if (awalWelfare < akhirWelfare) {
ui_mc.box_mc6.gotoAndStop(3);
jedaWelfare = akhirWelfare - awalWelfare;
myStr = new String(jedaWelfare);
xjedaWelfare = myStr.substr(0, 4);
ui_mc.welfare_mc.infoTambah = 'WELFARE\nINC ' + xjedaWelfare;
} else {
if (awalWelfare > akhirWelfare) {
ui_mc.box_mc6.gotoAndStop(2);
jedaWelfare = awalWelfare - akhirWelfare;
myStr = new String(jedaWelfare);
xjedaWelfare = myStr.substr(0, 4);
ui_mc.welfare_mc.infoTambah = 'WELFARE\nDEC ' + xjedaWelfare;
} else {
ui_mc.box_mc6.gotoAndStop(1);
ui_mc.welfare_mc.infoTambah = 'WELFARE';
}
}
if (awalMana < akhirMana) {
ui_mc.box_mc8.gotoAndStop(3);
jedaMana = akhirMana - awalMana;
ui_mc.mana_mc.infoTambah = 'MANA\nINC ' + jedaMana;
} else {
if (awalMana > akhirMana) {
ui_mc.box_mc8.gotoAndStop(2);
jedaMana = awalMana - akhirMana;
ui_mc.mana_mc.infoTambah = 'MANA\nDEC ' + jedaMana;
} else {
ui_mc.box_mc8.gotoAndStop(1);
ui_mc.mana_mc.infoTambah = 'MANA';
}
}
if (awalFood < akhirFood) {
ui_mc.box_mc9.gotoAndStop(3);
jedaFood = akhirFood - awalFood;
ui_mc.food_mc.infoTambah = 'FOOD\nINC ' + jedaFood;
} else {
if (awalFood > akhirFood) {
ui_mc.box_mc9.gotoAndStop(2);
jedaFood = awalFood - akhirFood;
ui_mc.food_mc.infoTambah = 'FOOD\nDEC ' + jedaFood;
} else {
ui_mc.box_mc9.gotoAndStop(1);
ui_mc.food_mc.infoTambah = 'FOOD';
}
}
if (autoSave == true) {
kelipatan = 100;
pembagi = xday / kelipatan;
myStr3 = new String(pembagi);
bisaSimpanGame = true;
zz = 0;
while (zz <= myStr3.length) {
if (myStr3.substr(zz, 1) == '.') {
bisaSimpanGame = false;
}
++zz;
}
if (bisaSimpanGame == true) {
sudahSimpan = true;
simpanData();
ui_mc.option_mc._visible = true;
ui_mc.option_mc.gotoAndStop(2);
sedangDrag = false;
cekHitBangunan();
removeMovieClip(drag_mc);
ui_mc.option_mc.close_btn.onRelease = function () {
ui_mc.option_mc._visible = false;
if (sudahTutorial == false) {
tutorial_mc._visible = true;
} else {
akanSerangKota = false;
bisaUI(true);
}
};
}
}
} else {
delayWaktu += speedGame;
}
ui_mc.xday = 'DAY ' + xday;
ui_mc.frameKota.namaKota = xnamaKota[keKota];
ui_mc.xgold = _root['xgold' + keKota];
ui_mc.xiron = _root['xiron' + keKota];
ui_mc.xwood = _root['xwood' + keKota];
if (_root['xworker' + keKota] <= 0) {
_root['xworker' + keKota] = 0;
}
ui_mc.xworker = _root['xworker' + keKota];
techBulat = Math.floor(_root['xtech' + keKota]);
ui_mc.xtech = techBulat;
welfareBulat = Math.ceil(_root['xwelfare' + keKota]);
ui_mc.xwelfare = welfareBulat;
ui_mc.xmana = _root['xmana' + keKota];
ui_mc.xfood = _root['xfood' + keKota];
ui_mc.xsoldier = _root['xbareman' + keKota] + _root['xswordman' + keKota] + _root['xarrowman' + keKota] + _root['xspearman' + keKota];
ui_mc.xbareman = _root['xbareman' + keKota];
ui_mc.xswordman = _root['xswordman' + keKota];
ui_mc.xarrowman = _root['xarrowman' + keKota];
ui_mc.xspearman = _root['xspearman' + keKota];
ui_mc.xsword = _root['xsword' + keKota];
ui_mc.xarrow = _root['xarrow' + keKota];
ui_mc.xspear = _root['xspear' + keKota];
ui_mc.xtank = _root['xtank' + keKota];
ui_mc.xcopter = _root['xcopter' + keKota];
ui_mc.xmonbot = _root['xmonbot' + keKota];
ui_mc.xarrowTrap = _root['xarrowTrap' + keKota];
ui_mc.xcatapult = _root['xcatapult' + keKota];
ui_mc.xfireTrap = _root['xfireTrap' + keKota];
ui_mc.xarrowRain = _root['xarrowRain' + keKota];
ui_mc.xmeteorid = _root['xmeteorid' + keKota];
ui_mc.xacidRain = _root['xacidRain' + keKota];
ui_mc.xearthquake = _root['xearthquake' + keKota];
ui_mc.ximmune = _root['ximmune' + keKota];
ui_mc.xinvisible = _root['xinvisible' + keKota];
ui_mc.xspecialAttack = _root['xspecialAttack' + keKota];
ui_mc.xduplicate = _root['xduplicate' + keKota];
ui_mc.xwall = _root['xwall' + keKota];
ui_mc.xspike = _root['xspike' + keKota];
ui_mc.xspiderWeb = _root['xspiderWeb' + keKota];
ui_mc.xtowerGuard = _root['xtowerGuard' + keKota];
ui_mc.xzombieTrap = _root['xzombieTrap' + keKota];
if (box_mc._currentframe == 7 && box_mc._visible == true) {
ui_mc.gotoAndStop(6);
cekUI();
} else {
if (box_mc._currentframe == 6 && box_mc._visible == true) {
ui_mc.gotoAndStop(5);
cekUI();
} else {
if (box_mc._currentframe == 5 && box_mc._visible == true) {
ui_mc.gotoAndStop(4);
cekUI();
} else {
if (box_mc._currentframe == 4 && box_mc._visible == true) {
ui_mc.gotoAndStop(3);
cekUI();
} else {
if (box_mc._currentframe == 3 && box_mc._visible == true) {
ui_mc.gotoAndStop(2);
cekUI();
} else {
ui_mc.gotoAndStop(1);
cekUI();
}
}
}
}
}
if (sedangTutorial == true) {
} else {
if (sedangDrag == true) {
ui_mc.remove_mc._visible = true;
} else {
ui_mc.remove_mc._visible = false;
}
}
if (tingkatSulit == 1) {
ui_mc.gameLevel.gameLevel = 'Easy';
} else {
if (tingkatSulit == 2) {
ui_mc.gameLevel.gameLevel = 'Normal';
} else {
if (tingkatSulit == 3) {
ui_mc.gameLevel.gameLevel = 'Hard';
}
}
}
if (_root['xmonbot' + keKota] <= 0) {
_root['xmonbot' + keKota] = 0;
}
if (_root['xcopter' + keKota] <= 0) {
_root['xcopter' + keKota] = 0;
}
if (_root['xtank' + keKota] <= 0) {
_root['xtank' + keKota] = 0;
}
if (_root['xsword' + keKota] <= 0) {
_root['xsword' + keKota] = 0;
}
if (_root['xarrow' + keKota] <= 0) {
_root['xarrow' + keKota] = 0;
}
if (_root['xspear' + keKota] <= 0) {
_root['xspear' + keKota] = 0;
}
if (_root['xswordman' + keKota] <= 0) {
_root['xswordman' + keKota] = 0;
}
if (_root['xarrowman' + keKota] <= 0) {
_root['xarrowman' + keKota] = 0;
}
if (_root['xspearman' + keKota] <= 0) {
_root['xspearman' + keKota] = 0;
}
if (_root['xarrowTrap' + keKota] <= 0) {
_root['xarrowTrap' + keKota] = 0;
}
if (_root['xcatapult' + keKota] <= 0) {
_root['xcatapult' + keKota] = 0;
}
if (_root['xfireTrap' + keKota] <= 0) {
_root['xfireTrap' + keKota] = 0;
}
if (_root['xarrowRain' + keKota] <= 0) {
_root['xarrowRain' + keKota] = 0;
}
if (_root['xmeteorid' + keKota] <= 0) {
_root['xmeteorid' + keKota] = 0;
}
if (_root['xacidRain' + keKota] <= 0) {
_root['xacidRain' + keKota] = 0;
}
if (_root['xearthquake' + keKota] <= 0) {
_root['xearthquake' + keKota] = 0;
}
if (_root['ximmune' + keKota] <= 0) {
_root['ximmune' + keKota] = 0;
}
if (_root['xinvisible' + keKota] <= 0) {
_root['xinvisible' + keKota] = 0;
}
if (_root['xspecialAttack' + keKota] <= 0) {
_root['xspecialAttack' + keKota] = 0;
}
if (_root['xduplicate' + keKota] <= 0) {
_root['xduplicate' + keKota] = 0;
}
if (_root['xwall' + keKota] <= 0) {
_root['xwall' + keKota] = 0;
}
if (_root['xspike' + keKota] <= 0) {
_root['xspike' + keKota] = 0;
}
if (_root['xspiderWeb' + keKota] <= 0) {
_root['xspiderWeb' + keKota] = 0;
}
if (_root['xtowerGuard' + keKota] <= 0) {
_root['xtowerGuard' + keKota] = 0;
}
if (_root['xzombieTrap' + keKota] <= 0) {
_root['xzombieTrap' + keKota] = 0;
}
ui_mc.more_mc.cityName = xnamaKota[keKota] + ' All Resources and Goods';
ui_mc.more_mc.xgold = _root['xgold' + keKota];
ui_mc.more_mc.xiron = _root['xiron' + keKota];
ui_mc.more_mc.xwood = _root['xwood' + keKota];
ui_mc.more_mc.xworker = _root['xworker' + keKota];
ui_mc.more_mc.xbareman = _root['xbareman' + keKota];
ui_mc.more_mc.xswordman = _root['xswordman' + keKota];
ui_mc.more_mc.xarrowman = _root['xarrowman' + keKota];
ui_mc.more_mc.xspearman = _root['xspearman' + keKota];
ui_mc.more_mc.xwelfare = Math.ceil(_root['xwelfare' + keKota]);
ui_mc.more_mc.xtech = Math.ceil(_root['xtech' + keKota]);
ui_mc.more_mc.xmana = Math.ceil(_root['xmana' + keKota]);
ui_mc.more_mc.xfood = _root['xfood' + keKota];
ui_mc.more_mc.xtank = _root['xtank' + keKota];
ui_mc.more_mc.xcopter = _root['xcopter' + keKota];
ui_mc.more_mc.xmonbot = _root['xmonbot' + keKota];
ui_mc.more_mc.xsword = _root['xsword' + keKota];
ui_mc.more_mc.xarrow = _root['xarrow' + keKota];
ui_mc.more_mc.xspear = _root['xspear' + keKota];
ui_mc.more_mc.xarrowTrap = _root['xarrowTrap' + keKota];
ui_mc.more_mc.xcatapult = _root['xcatapult' + keKota];
ui_mc.more_mc.xfireTrap = _root['xfireTrap' + keKota];
ui_mc.more_mc.xarrowRain = _root['xarrowRain' + keKota];
ui_mc.more_mc.xmeteorid = _root['xmeteorid' + keKota];
ui_mc.more_mc.xacidRain = _root['xacidRain' + keKota];
ui_mc.more_mc.xearthquake = _root['xearthquake' + keKota];
ui_mc.more_mc.ximmune = _root['ximmune' + keKota];
ui_mc.more_mc.xinvisible = _root['xinvisible' + keKota];
ui_mc.more_mc.xspecialAttack = _root['xspecialAttack' + keKota];
ui_mc.more_mc.xduplicate = _root['xduplicate' + keKota];
ui_mc.more_mc.xwall = _root['xwall' + keKota];
ui_mc.more_mc.xspike = _root['xspike' + keKota];
ui_mc.more_mc.xspiderWeb = _root['xspiderWeb' + keKota];
ui_mc.more_mc.xtowerGuard = _root['xtowerGuard' + keKota];
ui_mc.more_mc.xzombieTrap = _root['xzombieTrap' + keKota];
cekQuest();
};
}
frame 739 {
play();
}
frame 768 {
stop();
if (keLoading == 'city') {
keKota = kotaMove;
gotoAndStop(737);
} else {
if (keLoading == 'rebel') {
menujuRebel = true;
gotoAndStop(737);
} else {
loadData();
gotoAndStop(737);
}
}
}
frame 769 {
function initMap() {
frame_mc3._visible = false;
i = 1;
while (i <= bykKota) {
_root['kota' + i].cacheAsBitmap = true;
_root['kota' + i].onRollOver = overKota;
_root['kota' + i].onRollOut = outKota;
_root['kota' + i].onRelease = klikKota;
_root['kota' + i].onEnterFrame = enterKota;
_root['kota' + i].enabled = true;
if (_root['kotaMilik' + i] == 0) {
_root['kota' + i].gotoAndStop(3);
} else {
if (_root['kotaMilik' + i] == 1) {
_root['kota' + i].gotoAndStop(1);
} else {
if (_root['kotaMilik' + i] == 2) {
_root['kota' + i].gotoAndStop(2);
}
}
}
_root['kota' + i].position_mc._visible = false;
_root['kota' + i].kedip_mc._visible = false;
++i;
}
if (aksiMap == 'lihat') {
perintah = 'click monster town to go to the town';
_root['kota' + keKota].position_mc._visible = true;
} else {
if (aksiMap == 'serang') {
perintah = 'click blinking town to attack the town';
_root['kota' + keKota].position_mc._visible = true;
i = 1;
while (i <= bykKota) {
_root['kota' + i].enabled = false;
_root['kota' + i].kedip_mc._visible = false;
++i;
}
i = 1;
while (i <= maxKoneksi) {
if (_root['kota' + koneksiKota[keKota][i]] != undefined) {
if (_root['kotaMilik' + koneksiKota[keKota][i]] != 1) {
_root['kota' + koneksiKota[keKota][i]].enabled = true;
_root['kota' + koneksiKota[keKota][i]].kedip_mc._visible = true;
}
}
++i;
}
} else {
if (aksiMap == 'move') {
perintah = 'click blinking monster town to move';
_root['kota' + keKota].position_mc._visible = true;
i = 1;
while (i <= bykKota) {
_root['kota' + i].enabled = false;
_root['kota' + i].kedip_mc._visible = false;
++i;
}
i = 1;
while (i <= maxKoneksi) {
if (_root['kota' + koneksiKota[keKota][i]] != undefined) {
if (_root['kotaMilik' + koneksiKota[keKota][i]] == 1) {
_root['kota' + koneksiKota[keKota][i]].enabled = true;
_root['kota' + koneksiKota[keKota][i]].kedip_mc._visible = true;
}
}
++i;
}
}
}
}
}
function overKota() {
frame_mc3._visible = true;
myStr = new String(this);
if (isNaN(myStr.substr(myStr.length - 2, 2))) {
indi = myStr.substr(myStr.length - 1, 1);
} else {
indi = myStr.substr(myStr.length - 2, 2);
}
frame_mc3.namaKota = xnamaKota[indi];
}
function outKota() {
frame_mc3._visible = false;
}
function enterKota() {
if (_root._xmouse >= 650) {
frame_mc3._x = _root._xmouse - 50;
} else {
frame_mc3._x = _root._xmouse + 50;
}
if (_root._ymouse >= 500) {
frame_mc3._y = _root._ymouse - 50;
} else {
frame_mc3._y = _root._ymouse + 50;
}
}
function klikKota() {
myStr = new String(this);
if (isNaN(myStr.substr(myStr.length - 2, 2))) {
indi = Number(myStr.substr(myStr.length - 1, 1));
} else {
indi = Number(myStr.substr(myStr.length - 2, 2));
}
if (aksiMap == 'lihat') {
if (_root['kotaMilik' + indi] == 1) {
keKota = indi;
if (sedangTutorial == true) {
cekTutorial(47);
}
gotoAndStop(737);
} else {
cekInfo('This is not a monster town, click a monster town to go to that town');
}
} else {
if (aksiMap == 'serang') {
if (_root['kotaMilik' + indi] != 1) {
kotaSerang = indi;
akanSerangKota = true;
if (sedangTutorial == true) {
cekTutorial(41);
}
gotoAndStop(737);
} else {
cekInfo('This is a monster town, click barbarian or human town to attack it');
}
} else {
if (aksiMap == 'move') {
if (_root['kotaMilik' + indi] == 1) {
kotaMove = indi;
akanSerangKota = true;
gotoAndStop(737);
} else {
cekInfo('This is not a monster town, click a monster town to move to that town');
}
}
}
}
}
stop();
delete _root.onEnterFrame;
removeMovieClip(latar_mc);
if (pilihSkenario == 1) {
kontur_mc.gotoAndStop(1);
} else {
if (pilihSkenario == 2) {
kontur_mc.gotoAndStop(2);
} else {
if (pilihSkenario == 3) {
kontur_mc.gotoAndStop(3);
} else {
if (pilihSkenario == 4) {
kontur_mc.gotoAndStop(4);
}
}
}
}
back_btn.onRelease = function () {
gotoAndStop(737);
};
if (keKota == 0) {
back_btn._visible = false;
} else {
back_btn._visible = true;
}
adaKotaMonster = 0;
i = 1;
while (i <= bykKota) {
if (_root['kotaMilik' + i] == 1) {
++adaKotaMonster;
}
++i;
}
if (adaKotaMonster == 0) {
gotoAndStop(904);
} else {
if (adaKotaMonster == bykKota) {
gotoAndStop(905);
}
}
akanSerangKota = false;
initMap();
if (sedangTutorial == true) {
if (sudahTutorial46 == false) {
sudahTutorial46 = true;
_root.kota2.enabled = false;
_root.kota2.position_mc._visible = false;
_root.kota2.kedip_mc._visible = false;
back_btn._visible = false;
} else {
back_btn._visible = false;
}
}
}
movieClip 2638 {
frame 1 {
stop();
}
}
movieClip 2647 {
}
movieClip 2648 {
}
movieClip 2650 {
frame 1 {
stop();
}
}
frame 770 {
play();
delete myListener.onKeyDown;
delete myListener.onKeyUp;
Key.removeListener(myListener);
removeMovieClip(latar_mc);
info_mc2._visible = false;
if (sedangTutorial == true) {
cekTutorial(90);
}
if (kondisiPreview == 'gate1') {
infox = 'ATTACKING ENEMY AT THE 1ST FRONT GATE';
} else {
if (kondisiPreview == 'gate2') {
infox = 'ATTACKING ENEMY AT THE 2ND FRONT GATE';
} else {
if (kondisiPreview == 'gate3') {
infox = 'ATTACKING ENEMY AT THE 3RD FRONT GATE';
} else {
if (kondisiPreview == 'gate4') {
infox = 'ATTACKING ENEMY AT THE MAIN FRONT GATE';
} else {
if (kondisiPreview == 'awal') {
infox = 'ATTACKING ENEMY AT THE FIELD';
gotoAndPlay(779);
} else {
if (kondisiPreview == 'tengah') {
infox = 'ATTACKING ENEMY AT THE FRONT GATE';
gotoAndPlay(779);
} else {
if (kondisiPreview == 'tengah2') {
infox = 'ATTACKING ENEMY AT THE FRONT GATE';
gotoAndPlay(779);
} else {
if (kondisiPreview == 'akhir') {
infox = 'WAITING FOR THE BATTLE RESULT';
gotoAndPlay(794);
}
}
}
}
}
}
}
}
}
frame 839 {
function cekInitBattle() {
xpindahGold = 0;
xpindahIron = 0;
xpindahWood = 0;
xpindahWorker = 0;
xpindahBareman = 0;
xpindahSwordman = 0;
xpindahArrowman = 0;
xpindahSpearman = 0;
xpindahFood = 0;
xpindahTank = 0;
xpindahCopter = 0;
xpindahMonbot = 0;
xpindahSword = 0;
xpindahArrow = 0;
xpindahSpear = 0;
xpindahArrowTrap = 0;
xpindahCatapult = 0;
xpindahFireTrap = 0;
xpindahArrowRain = 0;
xpindahMeteorid = 0;
xpindahAcidRain = 0;
xpindahEarthquake = 0;
xpindahImmune = 0;
xpindahInvisible = 0;
xpindahSpecialAttack = 0;
xpindahDuplicate = 0;
gotoAndStop(900);
}
function cekInitBattle2() {
xpindahGold = 0;
xpindahIron = 0;
xpindahWood = 0;
xpindahWorker = 0;
xpindahBareman = 0;
xpindahSwordman = 0;
xpindahArrowman = 0;
xpindahSpearman = 0;
xpindahFood = 0;
xpindahTank = 0;
xpindahCopter = 0;
xpindahMonbot = 0;
xpindahSword = 0;
xpindahArrow = 0;
xpindahSpear = 0;
xpindahArrowTrap = 0;
xpindahCatapult = 0;
xpindahFireTrap = 0;
xpindahArrowRain = 0;
xpindahMeteorid = 0;
xpindahAcidRain = 0;
xpindahEarthquake = 0;
xpindahImmune = 0;
xpindahInvisible = 0;
xpindahSpecialAttack = 0;
xpindahDuplicate = 0;
gotoAndStop(901);
}
function cekHasilBattle() {
if (menangBattle == true) {
backTerompet();
_root['kotaMilik' + kotaSerang] = 1;
result_mc.informasi = xnamaKota[kotaSerang] + ' already conquerd, victory!';
} else {
result_mc.informasi = xnamaKota[kotaSerang] + ' can\'t be conquerd, defeated!';
}
if (menangBattle == true) {
xpindahGold = Math.ceil(Number(pindahGold) * Math.random() * 0.25);
xpindahIron = Math.ceil(Number(pindahIron) * Math.random() * 0.25);
xpindahWood = Math.ceil(Number(pindahWood) * Math.random() * 0.25);
xpindahWorker = pindahWorker;
xpindahFood = Math.ceil(Number(pindahFood) * Math.random() * 0.25);
} else {
xpindahGold = pindahGold;
xpindahIron = pindahIron;
xpindahWood = pindahWood;
xpindahWorker = pindahWorker;
xpindahBareman = xpindahBareman;
xpindahSwordman = xpindahSwordman;
xpindahArrowman = xpindahArrowman;
xpindahSpearman = xpindahSpearman;
xpindahTank = xpindahTank;
xpindahCopter = xpindahCopter;
xpindahMonbot = xpindahMonbot;
xpindahArrowTrap = xpindahArrowTrap;
xpindahCatapult = xpindahCatapult;
xpindahFireTrap = xpindahFireTrap;
xpindahArrowRain = pindahArrowRain;
xpindahMeteorid = pindahMeteorid;
xpindahAcidRain = pindahAcidRain;
xpindahEarthquake = pindahEarthquake;
xpindahImmune = pindahImmune;
xpindahInvisible = pindahInvisible;
xpindahSpecialAttack = pindahSpecialAttack;
xpindahDuplicate = pindahDuplicate;
xpindahFood = pindahFood;
xpindahSword = pindahSword;
xpindahArrow = pindahArrow;
xpindahSpear = pindahSpear;
}
}
function cekResult() {
result_mc.xgold = Number(pindahGold);
result_mc.xiron = Number(pindahIron);
result_mc.xwood = Number(pindahWood);
result_mc.xworker = Number(pindahWorker);
result_mc.xbareman = Number(pindahBareman);
result_mc.xswordman = Number(pindahSwordman);
result_mc.xarrowman = Number(pindahArrowman);
result_mc.xspearman = Number(pindahSpearman);
result_mc.xfood = Number(pindahFood);
result_mc.xtank = Number(pindahTank);
result_mc.xcopter = Number(pindahCopter);
result_mc.xmonbot = Number(pindahMonbot);
result_mc.xsword = Number(pindahSword);
result_mc.xarrow = Number(pindahArrow);
result_mc.xspear = Number(pindahSpear);
result_mc.xarrowTrap = Number(pindahArrowTrap);
result_mc.xcatapult = Number(pindahCatapult);
result_mc.xfireTrap = Number(pindahFireTrap);
result_mc.xarrowRain = Number(pindahArrowRain);
result_mc.xmeteorid = Number(pindahMeteorid);
result_mc.xacidRain = Number(pindahAcidRain);
result_mc.xearthquake = Number(pindahEarthquake);
result_mc.ximmune = Number(pindahImmune);
result_mc.xinvisible = Number(pindahInvisible);
result_mc.xspecialAttack = Number(pindahSpecialAttack);
result_mc.xduplicate = Number(pindahDuplicate);
result_mc.ygold.text = xpindahGold;
result_mc.yiron.text = xpindahIron;
result_mc.ywood.text = xpindahWood;
result_mc.yworker.text = xpindahWorker;
result_mc.ybareman.text = xpindahBareman;
result_mc.yswordman.text = xpindahSwordman;
result_mc.yarrowman.text = xpindahArrowman;
result_mc.yspearman.text = xpindahSpearman;
result_mc.yfood.text = xpindahFood;
result_mc.ytank.text = xpindahTank;
result_mc.ycopter.text = xpindahCopter;
result_mc.ymonbot.text = xpindahMonbot;
result_mc.ysword.text = xpindahSword;
result_mc.yarrow.text = xpindahArrow;
result_mc.yspear.text = xpindahSpear;
result_mc.yarrowTrap.text = xpindahArrowTrap;
result_mc.ycatapult.text = xpindahCatapult;
result_mc.yfireTrap.text = xpindahFireTrap;
result_mc.yarrowRain.text = xpindahArrowRain;
result_mc.ymeteorid.text = xpindahMeteorid;
result_mc.yacidRain.text = xpindahAcidRain;
result_mc.yearthquake.text = xpindahEarthquake;
result_mc.yimmune.text = xpindahImmune;
result_mc.yinvisible.text = xpindahInvisible;
result_mc.yspecialAttack.text = xpindahSpecialAttack;
result_mc.yduplicate.text = xpindahDuplicate;
if (menangBattle == true) {
_root['xgold' + kotaSerang] += Number(pindahGold) - Number(xpindahGold);
_root['xiron' + kotaSerang] += Number(pindahIron) - Number(xpindahIron);
_root['xwood' + kotaSerang] += Number(pindahWood) - Number(xpindahWood);
_root['xbareman' + kotaSerang] += Number(pindahBareman) - Number(xpindahBareman);
_root['xswordman' + kotaSerang] += Number(pindahSwordman) - Number(xpindahSwordman);
_root['xarrowman' + kotaSerang] += Number(pindahArrowman) - Number(xpindahArrowman);
_root['xspearman' + kotaSerang] += Number(pindahSpearman) - Number(xpindahSpearman);
_root['xfood' + kotaSerang] += Number(pindahFood) - Number(xpindahFood);
_root['xtank' + kotaSerang] += Number(pindahTank) - Number(xpindahTank);
_root['xcopter' + kotaSerang] += Number(pindahCopter) - Number(xpindahCopter);
_root['xmonbot' + kotaSerang] += Number(pindahMonbot) - Number(xpindahMonbot);
_root['xsword' + kotaSerang] += Number(pindahSword) - Number(xpindahSword);
_root['xarrow' + kotaSerang] += Number(pindahArrow) - Number(xpindahArrow);
_root['xspear' + kotaSerang] += Number(pindahSpear) - Number(xpindahSpear);
_root['xarrowTrap' + kotaSerang] += Number(pindahArrowTrap) - Number(xpindahArrowTrap);
_root['xcatapult' + kotaSerang] += Number(pindahCatapult) - Number(xpindahCatapult);
_root['xfireTrap' + kotaSerang] += Number(pindahFireTrap) - Number(xpindahFireTrap);
_root['xarrowRain' + kotaSerang] += Number(pindahArrowRain) - Number(xpindahArrowRain);
_root['xmeteorid' + kotaSerang] += Number(pindahMeteorid) - Number(xpindahMeteorid);
_root['xacidRain' + kotaSerang] += Number(pindahAcidRain) - Number(xpindahAcidRain);
_root['xearthquake' + kotaSerang] += Number(pindahEarthquake) - Number(xpindahEarthquake);
_root['ximmune' + kotaSerang] += Number(pindahImmune) - Number(xpindahImmune);
_root['xinvisible' + kotaSerang] += Number(pindahInvisible) - Number(xpindahInvisible);
_root['xspecialAttack' + kotaSerang] += Number(pindahSpecialAttack) - Number(xpindahSpecialAttack);
_root['xduplicate' + kotaSerang] += Number(pindahDuplicate) - Number(xpindahDuplicate);
_root['xgold' + keKota] -= Number(pindahGold);
_root['xiron' + keKota] -= Number(pindahIron);
_root['xwood' + keKota] -= Number(pindahWood);
_root['xbareman' + keKota] -= Number(pindahBareman);
_root['xswordman' + keKota] -= Number(pindahSwordman);
_root['xarrowman' + keKota] -= Number(pindahArrowman);
_root['xspearman' + keKota] -= Number(pindahSpearman);
_root['xfood' + keKota] -= Number(pindahFood);
_root['xtank' + keKota] -= Number(pindahTank);
_root['xcopter' + keKota] -= Number(pindahCopter);
_root['xmonbot' + keKota] -= Number(pindahMonbot);
_root['xsword' + keKota] -= Number(pindahSword);
_root['xarrow' + keKota] -= Number(pindahArrow);
_root['xspear' + keKota] -= Number(pindahSpear);
_root['xarrowTrap' + keKota] -= Number(pindahArrowTrap);
_root['xcatapult' + keKota] -= Number(pindahCatapult);
_root['xfireTrap' + keKota] -= Number(pindahFireTrap);
_root['xarrowRain' + keKota] -= Number(pindahArrowRain);
_root['xmeteorid' + keKota] -= Number(pindahMeteorid);
_root['xacidRain' + keKota] -= Number(pindahAcidRain);
_root['xearthquake' + keKota] -= Number(pindahEarthquake);
_root['ximmune' + keKota] -= Number(pindahImmune);
_root['xinvisible' + keKota] -= Number(pindahInvisible);
_root['xspecialAttack' + keKota] -= Number(pindahSpecialAttack);
_root['xduplicate' + keKota] -= Number(pindahDuplicate);
_root['xworker' + keKota] += Number(xpindahBareman);
_root['xworker' + keKota] += Number(xpindahSwordman);
_root['xworker' + keKota] += Number(xpindahArrowman);
_root['xworker' + keKota] += Number(xpindahSpearman);
_root['xworker' + keKota] += Number(xpindahTank) * costWorkerKendaraan[1];
_root['xworker' + keKota] += Number(xpindahCopter) * costWorkerKendaraan[2];
_root['xworker' + keKota] += Number(xpindahMonbot) * costWorkerKendaraan[3];
} else {
_root['xgold' + keKota] -= Number(pindahGold);
_root['xiron' + keKota] -= Number(pindahIron);
_root['xwood' + keKota] -= Number(pindahWood);
_root['xbareman' + keKota] -= Number(xpindahBareman);
_root['xswordman' + keKota] -= Number(xpindahSwordman);
_root['xarrowman' + keKota] -= Number(xpindahArrowman);
_root['xspearman' + keKota] -= Number(xpindahSpearman);
_root['xarrowTrap' + keKota] -= Number(xpindahArrowTrap);
_root['xcatapult' + keKota] -= Number(xpindahCatapult);
_root['xfireTrap' + keKota] -= Number(xpindahFireTrap);
_root['xtank' + keKota] -= Number(xpindahTank);
_root['xcopter' + keKota] -= Number(xpindahCopter);
_root['xmonbot' + keKota] -= Number(xpindahMonbot);
_root['xfood' + keKota] -= Number(pindahFood);
_root['xsword' + keKota] -= Number(pindahSword);
_root['xarrow' + keKota] -= Number(pindahArrow);
_root['xspear' + keKota] -= Number(pindahSpear);
_root['xarrowRain' + keKota] -= Number(pindahArrowRain);
_root['xmeteorid' + keKota] -= Number(pindahMeteorid);
_root['xacidRain' + keKota] -= Number(pindahAcidRain);
_root['xearthquake' + keKota] -= Number(pindahEarthquake);
_root['ximmune' + keKota] -= Number(pindahImmune);
_root['xinvisible' + keKota] -= Number(pindahInvisible);
_root['xspecialAttack' + keKota] -= Number(pindahSpecialAttack);
_root['xduplicate' + keKota] -= Number(pindahDuplicate);
_root['xworker' + keKota] += Number(xpindahBareman);
_root['xworker' + keKota] += Number(xpindahSwordman);
_root['xworker' + keKota] += Number(xpindahArrowman);
_root['xworker' + keKota] += Number(xpindahSpearman);
_root['xworker' + keKota] += Number(xpindahTank) * costWorkerKendaraan[1];
_root['xworker' + keKota] += Number(xpindahCopter) * costWorkerKendaraan[2];
_root['xworker' + keKota] += Number(xpindahMonbot) * costWorkerKendaraan[3];
}
}
stop();
clearSemua2();
if (kondisiPreview == 'awal') {
result_mc._visible = false;
menangBattle = false;
cekInitBattle();
} else {
if (kondisiPreview == 'gate1') {
sudahSerangFinal = true;
result_mc._visible = false;
menangBattle = false;
cekInitBattle2();
} else {
if (kondisiPreview == 'gate2') {
result_mc._visible = false;
gotoAndStop(901);
} else {
if (kondisiPreview == 'gate3') {
result_mc._visible = false;
gotoAndStop(901);
} else {
if (kondisiPreview == 'gate4') {
result_mc._visible = false;
gotoAndStop(901);
} else {
if (kondisiPreview == 'tengah') {
result_mc._visible = false;
gotoAndStop(901);
} else {
if (kondisiPreview == 'tengah2') {
result_mc._visible = false;
menangBattle = false;
cekInitBattle2();
} else {
if (kondisiPreview == 'akhir') {
result_mc._visible = true;
cekHasilBattle();
cekResult();
}
}
}
}
}
}
}
}
result_mc.ok_btn.onRelease = function () {
adaKotaMonster = 0;
i = 1;
while (i <= bykKota) {
if (_root['kotaMilik' + i] == 1) {
++adaKotaMonster;
}
++i;
}
if (adaKotaMonster >= 10) {
backBuilding2();
} else {
backBuilding();
}
aksiMap = 'lihat';
if (menangBattle == true) {
++kalahMusuh;
++winBattle;
++tidakKalah;
keKota = kotaSerang;
} else {
--kalahMusuh;
if (kalahMusuh <= 4) {
kalahMusuh = 4;
}
tidakKalah = 0;
keKota = keKota;
}
if (sedangTutorial == true) {
if (menangBattle == true) {
cekTutorial(46);
sudahTutorial46 = false;
gotoAndStop(769);
} else {
cekTutorial(48);
gotoAndStop(737);
}
} else {
gotoAndStop(769);
}
};
}
movieClip 2718 {
}
frame 840 {
play();
delete myListener.onKeyDown;
delete myListener.onKeyUp;
Key.removeListener(myListener);
removeMovieClip(latar_mc);
info_mc2._visible = false;
if (kondisiPreview == 'awal') {
infox = 'DEFENDING THE TOWN AT THE FIELD';
gotoAndPlay(849);
} else {
if (kondisiPreview == 'tengah') {
infox = 'DEFENDING THE TOWN AT THE FRONT GATE';
gotoAndPlay(849);
} else {
if (kondisiPreview == 'tengah2') {
infox = 'DEFENDING THE TOWN AT THE FRONT GATE';
gotoAndPlay(849);
} else {
if (kondisiPreview == 'akhir') {
infox = 'WAITING FOR THE BATTLE RESULT';
gotoAndPlay(864);
}
}
}
}
}
frame 899 {
function cekInitBattle() {
xpindahGold = 0;
xpindahIron = 0;
xpindahWood = 0;
xpindahWorker = 0;
xpindahBareman = 0;
xpindahSwordman = 0;
xpindahArrowman = 0;
xpindahSpearman = 0;
xpindahFood = 0;
xpindahTank = 0;
xpindahCopter = 0;
xpindahMonbot = 0;
xpindahSword = 0;
xpindahArrow = 0;
xpindahSpear = 0;
xpindahArrowTrap = 0;
xpindahCatapult = 0;
xpindahFireTrap = 0;
xpindahArrowRain = 0;
xpindahMeteorid = 0;
xpindahAcidRain = 0;
xpindahEarthquake = 0;
xpindahImmune = 0;
xpindahInvisible = 0;
xpindahSpecialAttack = 0;
xpindahDuplicate = 0;
xpindahWall = 0;
xpindahSpike = 0;
xpindahSpiderWeb = 0;
xpindahTowerGuard = 0;
xpindahZombieTrap = 0;
pindahGold = _root['xgold' + keKota];
pindahIron = _root['xiron' + keKota];
pindahWood = _root['xwood' + keKota];
pindahWorker = _root['xworker' + keKota];
pindahBareman = _root['xbareman' + keKota];
pindahSwordman = _root['xswordman' + keKota];
pindahArrowman = _root['xarrowman' + keKota];
pindahSpearman = _root['xspearman' + keKota];
pindahFood = _root['xfood' + keKota];
pindahTank = _root['xtank' + keKota];
pindahCopter = _root['xcopter' + keKota];
pindahMonbot = _root['xmonbot' + keKota];
pindahSword = _root['xsword' + keKota];
pindahArrow = _root['xarrow' + keKota];
pindahSpear = _root['xspear' + keKota];
pindahArrowTrap = _root['xarrowTrap' + keKota];
pindahCatapult = _root['xcatapult' + keKota];
pindahFireTrap = _root['xfireTrap' + keKota];
pindahArrowRain = _root['xarrowRain' + keKota];
pindahMeteorid = _root['xmeteorid' + keKota];
pindahAcidRain = _root['xacidRain' + keKota];
pindahEarthquake = _root['xearthquake' + keKota];
pindahImmune = _root['ximmune' + keKota];
pindahInvisible = _root['xinvisible' + keKota];
pindahSpecialAttack = _root['xspecialAttack' + keKota];
pindahDuplicate = _root['xduplicate' + keKota];
pindahWall = _root['xwall' + keKota];
pindahSpike = _root['xspike' + keKota];
pindahSpiderWeb = _root['xspiderWeb' + keKota];
pindahTowerGuard = _root['xtowerGuard' + keKota];
pindahZombieTrap = _root['xzombieTrap' + keKota];
gotoAndStop(902);
}
function cekInitBattle2() {
xpindahGold = 0;
xpindahIron = 0;
xpindahWood = 0;
xpindahWorker = 0;
xpindahBareman = 0;
xpindahSwordman = 0;
xpindahArrowman = 0;
xpindahSpearman = 0;
xpindahFood = 0;
xpindahTank = 0;
xpindahCopter = 0;
xpindahMonbot = 0;
xpindahSword = 0;
xpindahArrow = 0;
xpindahSpear = 0;
xpindahArrowTrap = 0;
xpindahCatapult = 0;
xpindahFireTrap = 0;
xpindahArrowRain = 0;
xpindahMeteorid = 0;
xpindahAcidRain = 0;
xpindahEarthquake = 0;
xpindahImmune = 0;
xpindahInvisible = 0;
xpindahSpecialAttack = 0;
xpindahDuplicate = 0;
xpindahWall = 0;
xpindahSpike = 0;
xpindahSpiderWeb = 0;
xpindahTowerGuard = 0;
xpindahZombieTrap = 0;
pindahGold = _root['xgold' + keKota];
pindahIron = _root['xiron' + keKota];
pindahWood = _root['xwood' + keKota];
pindahWorker = _root['xworker' + keKota];
pindahBareman = _root['xbareman' + keKota];
pindahSwordman = _root['xswordman' + keKota];
pindahArrowman = _root['xarrowman' + keKota];
pindahSpearman = _root['xspearman' + keKota];
pindahFood = _root['xfood' + keKota];
pindahTank = _root['xtank' + keKota];
pindahCopter = _root['xcopter' + keKota];
pindahMonbot = _root['xmonbot' + keKota];
pindahSword = _root['xsword' + keKota];
pindahArrow = _root['xarrow' + keKota];
pindahSpear = _root['xspear' + keKota];
pindahArrowTrap = _root['xarrowTrap' + keKota];
pindahCatapult = _root['xcatapult' + keKota];
pindahFireTrap = _root['xfireTrap' + keKota];
pindahArrowRain = _root['xarrowRain' + keKota];
pindahMeteorid = _root['xmeteorid' + keKota];
pindahAcidRain = _root['xacidRain' + keKota];
pindahEarthquake = _root['xearthquake' + keKota];
pindahImmune = _root['ximmune' + keKota];
pindahInvisible = _root['xinvisible' + keKota];
pindahSpecialAttack = _root['xspecialAttack' + keKota];
pindahDuplicate = _root['xduplicate' + keKota];
pindahWall = _root['xwall' + keKota];
pindahSpike = _root['xspike' + keKota];
pindahSpiderWeb = _root['xspiderWeb' + keKota];
pindahTowerGuard = _root['xtowerGuard' + keKota];
pindahZombieTrap = _root['xzombieTrap' + keKota];
gotoAndStop(903);
}
function cekHasilBattle() {
if (menangBattle == true) {
backTerompet();
result_mc.informasi = xnamaKota[keKota] + ' can survive enemy attack, victory!';
} else {
result_mc.informasi = xnamaKota[keKota] + ' conquered by the enemy, defeated!';
}
if (menangBattle == true) {
xpindahGold = Math.ceil(Number(pindahGold) * Math.random() * 0.25);
xpindahIron = Math.ceil(Number(pindahIron) * Math.random() * 0.25);
xpindahWood = Math.ceil(Number(pindahWood) * Math.random() * 0.25);
xpindahWorker = pindahWorker;
xpindahFood = Math.ceil(Number(pindahFood) * Math.random() * 0.25);
} else {
xpindahGold = pindahGold;
xpindahIron = pindahIron;
xpindahWood = pindahWood;
xpindahWorker = pindahWorker;
xpindahBareman = xpindahBareman;
xpindahSwordman = xpindahSwordman;
xpindahArrowman = xpindahArrowman;
xpindahSpearman = xpindahSpearman;
xpindahTank = xpindahTank;
xpindahCopter = xpindahCopter;
xpindahMonbot = xpindahMonbot;
xpindahArrowTrap = xpindahArrowTrap;
xpindahCatapult = xpindahCatapult;
xpindahFireTrap = xpindahFireTrap;
xpindahArrowRain = pindahArrowRain;
xpindahMeteorid = pindahMeteorid;
xpindahAcidRain = pindahAcidRain;
xpindahEarthquake = pindahEarthquake;
xpindahImmune = pindahImmune;
xpindahInvisible = pindahInvisible;
xpindahSpecialAttack = pindahSpecialAttack;
xpindahDuplicate = pindahDuplicate;
xpindahWall = pindahWall;
xpindahSpike = pindahSpike;
xpindahSpiderWeb = pindahSpiderWeb;
xpindahTowerGuard = pindahTowerGuard;
xpindahZombieTrap = pindahZombieTrap;
xpindahFood = pindahFood;
xpindahSword = pindahSword;
xpindahArrow = pindahArrow;
xpindahSpear = pindahSpear;
}
}
function cekResult() {
result_mc.xgold = Number(pindahGold);
result_mc.xiron = Number(pindahIron);
result_mc.xwood = Number(pindahWood);
result_mc.xworker = Number(pindahWorker);
result_mc.xbareman = Number(pindahBareman);
result_mc.xswordman = Number(pindahSwordman);
result_mc.xarrowman = Number(pindahArrowman);
result_mc.xspearman = Number(pindahSpearman);
result_mc.xfood = Number(pindahFood);
result_mc.xtank = Number(pindahTank);
result_mc.xcopter = Number(pindahCopter);
result_mc.xmonbot = Number(pindahMonbot);
result_mc.xsword = Number(pindahSword);
result_mc.xarrow = Number(pindahArrow);
result_mc.xspear = Number(pindahSpear);
result_mc.xarrowTrap = Number(pindahArrowTrap);
result_mc.xcatapult = Number(pindahCatapult);
result_mc.xfireTrap = Number(pindahFireTrap);
result_mc.xarrowRain = Number(pindahArrowRain);
result_mc.xmeteorid = Number(pindahMeteorid);
result_mc.xacidRain = Number(pindahAcidRain);
result_mc.xearthquake = Number(pindahEarthquake);
result_mc.ximmune = Number(pindahImmune);
result_mc.xinvisible = Number(pindahInvisible);
result_mc.xspecialAttack = Number(pindahSpecialAttack);
result_mc.xduplicate = Number(pindahDuplicate);
result_mc.xwall = Number(pindahWall);
result_mc.xspike = Number(pindahSpike);
result_mc.xspiderWeb = Number(pindahSpiderWeb);
result_mc.xtowerGuard = Number(pindahTowerGuard);
result_mc.xzombieTrap = Number(pindahZombieTrap);
result_mc.ygold.text = xpindahGold;
result_mc.yiron.text = xpindahIron;
result_mc.ywood.text = xpindahWood;
result_mc.yworker.text = xpindahWorker;
result_mc.ybareman.text = xpindahBareman;
result_mc.yswordman.text = xpindahSwordman;
result_mc.yarrowman.text = xpindahArrowman;
result_mc.yspearman.text = xpindahSpearman;
result_mc.yfood.text = xpindahFood;
result_mc.ytank.text = xpindahTank;
result_mc.ycopter.text = xpindahCopter;
result_mc.ymonbot.text = xpindahMonbot;
result_mc.ysword.text = xpindahSword;
result_mc.yarrow.text = xpindahArrow;
result_mc.yspear.text = xpindahSpear;
result_mc.yarrowTrap.text = xpindahArrowTrap;
result_mc.ycatapult.text = xpindahCatapult;
result_mc.yfireTrap.text = xpindahFireTrap;
result_mc.yarrowRain.text = xpindahArrowRain;
result_mc.ymeteorid.text = xpindahMeteorid;
result_mc.yacidRain.text = xpindahAcidRain;
result_mc.yearthquake.text = xpindahEarthquake;
result_mc.yimmune.text = xpindahImmune;
result_mc.yinvisible.text = xpindahInvisible;
result_mc.yspecialAttack.text = xpindahSpecialAttack;
result_mc.yduplicate.text = xpindahDuplicate;
result_mc.ywall.text = Number(xpindahWall);
result_mc.yspike.text = Number(xpindahSpike);
result_mc.yspiderWeb.text = Number(xpindahSpiderWeb);
result_mc.ytowerGuard.text = Number(xpindahTowerGuard);
result_mc.yzombieTrap.text = Number(xpindahZombieTrap);
if (menangBattle == true) {
_root['xgold' + keKota] = Number(pindahGold) - Number(xpindahGold);
_root['xiron' + keKota] = Number(pindahIron) - Number(xpindahIron);
_root['xwood' + keKota] = Number(pindahWood) - Number(xpindahWood);
_root['xbareman' + keKota] = Number(pindahBareman) - Number(xpindahBareman);
_root['xswordman' + keKota] = Number(pindahSwordman) - Number(xpindahSwordman);
_root['xarrowman' + keKota] = Number(pindahArrowman) - Number(xpindahArrowman);
_root['xspearman' + keKota] = Number(pindahSpearman) - Number(xpindahSpearman);
_root['xfood' + keKota] = Number(pindahFood) - Number(xpindahFood);
_root['xtank' + keKota] = Number(pindahTank) - Number(xpindahTank);
_root['xcopter' + keKota] = Number(pindahCopter) - Number(xpindahCopter);
_root['xmonbot' + keKota] = Number(pindahMonbot) - Number(xpindahMonbot);
_root['xsword' + keKota] = Number(pindahSword) - Number(xpindahSword);
_root['xarrow' + keKota] = Number(pindahArrow) - Number(xpindahArrow);
_root['xspear' + keKota] = Number(pindahSpear) - Number(xpindahSpear);
_root['xarrowTrap' + keKota] = Number(pindahArrowTrap) - Number(xpindahArrowTrap);
_root['xcatapult' + keKota] = Number(pindahCatapult) - Number(xpindahCatapult);
_root['xfireTrap' + keKota] = Number(pindahFireTrap) - Number(xpindahFireTrap);
_root['xarrowRain' + keKota] = Number(pindahArrowRain) - Number(xpindahArrowRain);
_root['xmeteorid' + keKota] = Number(pindahMeteorid) - Number(xpindahMeteorid);
_root['xacidRain' + keKota] = Number(pindahAcidRain) - Number(xpindahAcidRain);
_root['xearthquake' + keKota] = Number(pindahEarthquake) - Number(xpindahEarthquake);
_root['ximmune' + keKota] = Number(pindahImmune) - Number(xpindahImmune);
_root['xinvisible' + keKota] = Number(pindahInvisible) - Number(xpindahInvisible);
_root['xspecialAttack' + keKota] = Number(pindahSpecialAttack) - Number(xpindahSpecialAttack);
_root['xduplicate' + keKota] = Number(pindahDuplicate) - Number(xpindahDuplicate);
_root['xwall' + keKota] = Number(pindahWall) - Number(xpindahWall);
_root['xspike' + keKota] = Number(pindahSpike) - Number(xpindahSpike);
_root['xspiderWeb' + keKota] = Number(pindahSpiderWeb) - Number(xpindahSpiderWeb);
_root['xtowerGuard' + keKota] = Number(pindahTowerGuard) - Number(xpindahTowerGuard);
_root['xzombieTrap' + keKota] = Number(pindahZombieTrap) - Number(xpindahZombieTrap);
_root['xwelfare' + keKota] *= 0.5;
_root['xwelfare' + keKota] = Math.ceil(_root['xwelfare' + keKota]);
_root['xworker' + keKota] += Number(xpindahBareman);
_root['xworker' + keKota] += Number(xpindahSwordman);
_root['xworker' + keKota] += Number(xpindahArrowman);
_root['xworker' + keKota] += Number(xpindahSpearman);
_root['xworker' + keKota] += Number(xpindahTank) * costWorkerKendaraan[1];
_root['xworker' + keKota] += Number(xpindahCopter) * costWorkerKendaraan[2];
_root['xworker' + keKota] += Number(xpindahMonbot) * costWorkerKendaraan[3];
} else {
_root['xgold' + keKota] = 0;
_root['xiron' + keKota] = 0;
_root['xwood' + keKota] = 0;
_root['xworker' + keKota] = 0;
_root['xbareman' + keKota] = 0;
_root['xswordman' + keKota] = 0;
_root['xarrowman' + keKota] = 0;
_root['xspearman' + keKota] = 0;
_root['xarrowTrap' + keKota] = 0;
_root['xcatapult' + keKota] = 0;
_root['xfireTrap' + keKota] = 0;
_root['xtank' + keKota] = 0;
_root['xcopter' + keKota] = 0;
_root['xmonbot' + keKota] = 0;
_root['xfood' + keKota] = 0;
_root['xsword' + keKota] = 0;
_root['xarrow' + keKota] = 0;
_root['xspear' + keKota] = 0;
_root['xarrowRain' + keKota] = 0;
_root['xmeteorid' + keKota] = 0;
_root['xacidRain' + keKota] = 0;
_root['xearthquake' + keKota] = 0;
_root['ximmune' + keKota] = 0;
_root['xinvisible' + keKota] = 0;
_root['xspecialAttack' + keKota] = 0;
_root['xduplicate' + keKota] = 0;
_root['xwall' + keKota] = 0;
_root['xspike' + keKota] = 0;
_root['xspiderWeb' + keKota] = 0;
_root['xtowerGuard' + keKota] = 0;
_root['xzombieTrap' + keKota] = 0;
_root['risetArmory' + keKota] = false;
_root['risetFactory' + keKota] = false;
_root['risetPark' + keKota] = false;
_root['risetTemple' + keKota] = false;
_root['risetFortress' + keKota] = false;
_root['risetLibrary' + keKota] = false;
_root['risetCatapult' + keKota] = false;
_root['risetFireTrap' + keKota] = false;
_root['risetTank' + keKota] = false;
_root['risetCopter' + keKota] = false;
_root['risetMonbot' + keKota] = false;
_root['risetInvisible' + keKota] = false;
_root['risetSpecialAttack' + keKota] = false;
_root['risetDuplicate' + keKota] = false;
_root['risetZombie' + keKota] = false;
_root['risetFastBuild' + keKota] = false;
_root['risetRawPlus' + keKota] = false;
_root['risetGoldPlus' + keKota] = false;
_root['autoBareman' + keKota] = false;
_root['autoSwordman' + keKota] = false;
_root['autoArrowman' + keKota] = false;
_root['autoSpearman' + keKota] = false;
_root['autoSword' + keKota] = false;
_root['autoArrow' + keKota] = false;
_root['autoSpear' + keKota] = false;
_root['autoTank' + keKota] = false;
_root['autoCopter' + keKota] = false;
_root['autoMonbot' + keKota] = false;
_root['rangerAktif' + keKota] = false;
_root['tirelessAktif' + keKota] = false;
_root['armorPlusAktif' + keKota] = false;
_root['speedPlusAktif' + keKota] = false;
_root['entertainmentAktif' + keKota] = false;
_root['fastBuildAktif' + keKota] = false;
_root['rawPlusAktif' + keKota] = false;
_root['goldPlusAktif' + keKota] = false;
_root['xtech' + keKota] = 0;
_root['xwelfare' + keKota] = 15;
_root['kotaMilik' + keKota] = siapaYangNyerang;
i = 1;
while (i <= maxBangunan) {
xtipeBuilding[i][keKota] = 0;
xposXBuilding[i][keKota] = 0;
xposYBuilding[i][keKota] = 0;
xlevelBuilding[i][keKota] = 0;
xsudahJadiBuilding[i][keKota] = false;
xdelayBuatBuilding[i][keKota] = 0;
++i;
}
}
}
stop();
clearSemua2();
if (kondisiPreview == 'awal') {
result_mc._visible = false;
menangBattle = false;
cekInitBattle();
} else {
if (kondisiPreview == 'tengah') {
result_mc._visible = false;
gotoAndStop(903);
} else {
if (kondisiPreview == 'tengah2') {
result_mc._visible = false;
menangBattle = false;
cekInitBattle2();
} else {
if (kondisiPreview == 'akhir') {
result_mc._visible = true;
cekHasilBattle();
cekResult();
}
}
}
}
result_mc.ok_btn.onRelease = function () {
adaKotaMonster = 0;
i = 1;
while (i <= bykKota) {
if (_root['kotaMilik' + i] == 1) {
++adaKotaMonster;
}
++i;
}
if (adaKotaMonster >= 10) {
backBuilding2();
} else {
backBuilding();
}
aksiMap = 'lihat';
if (menangBattle == true) {
++winBattle;
++tidakKalah;
keKota = keKota;
} else {
tidakKalah = 0;
keKota = 0;
}
gotoAndStop(769);
};
}
movieClip 2787 {
}
frame 900 {
function initAwalBattle() {
jumlahJagoan = 0;
jumlahMusuh = 0;
mulaiBattle = false;
getarBumi = false;
getarBumi2 = false;
sedangDragWeapon = false;
sedangDragSpell = false;
sudahSelesai = false;
sedangPause = false;
}
function initBattle() {
geserKiri = 0;
dalamDrag = 200000;
dalamSpell = 300000;
dalamSoldier = 1;
dalamWeapon = 200;
dalamPeluru = 100;
dalamEfekJagoan = 100;
dalamMusuh = 50;
if (xday <= 100) {
nilaiSoldier = 20;
} else {
if (xday <= 200) {
nilaiSoldier = 25;
} else {
if (xday <= 300) {
nilaiSoldier = 30;
} else {
if (xday <= 400) {
nilaiSoldier = 35;
} else {
if (xday <= 500) {
nilaiSoldier = 40;
} else {
if (xday <= 600) {
nilaiSoldier = 45;
} else {
nilaiSoldier = 50;
}
}
}
}
}
}
if (sedangTutorial == true) {
nilaiSoldier = 10;
}
maximumJagoan = 18;
i = 1;
while (i <= 3) {
j = 1;
while (j <= 6) {
_root['sudahLingkar' + i + j] = false;
++j;
}
++i;
}
i = 1;
while (i <= 3) {
j = 1;
while (j <= 6) {
_root['jenisIsi' + i + j] = 0;
_root['yangIsi' + i + j] = '';
++j;
}
++i;
}
i = 1;
while (i <= 60) {
_root['pasukan' + i]._visible = false;
_root['pasukan' + i].gotoAndStop(1);
++i;
}
wpindahBareman = pindahBareman;
wpindahSwordman = pindahSwordman;
wpindahArrowman = pindahArrowman;
wpindahSpearman = pindahSpearman;
wpindahTank = pindahTank;
wpindahCopter = pindahCopter;
wpindahMonbot = pindahMonbot;
wpindahArrowTrap = pindahArrowTrap;
wpindahCatapult = pindahCatapult;
wpindahFireTrap = pindahFireTrap;
wpindahArrowRain = pindahArrowRain;
wpindahMeteorid = pindahMeteorid;
wpindahAcidRain = pindahAcidRain;
wpindahEarthquake = pindahEarthquake;
wpindahImmune = pindahImmune;
wpindahInvisible = pindahInvisible;
wpindahSpecialAttack = pindahSpecialAttack;
wpindahDuplicate = pindahDuplicate;
}
function buatBackground() {
pilihanKota = posBackground[kotaSerang];
if (pilihanKota == 1) {
background_mc.gotoAndStop(1);
} else {
if (pilihanKota == 2) {
background_mc.gotoAndStop(2);
} else {
if (pilihanKota == 3) {
background_mc.gotoAndStop(3);
} else {
if (pilihanKota == 4) {
background_mc.gotoAndStop(4);
}
}
}
}
background_mc.cacheAsBitmap = true;
posAwalBackgroundX = background_mc._x;
posAwalBackgroundY = background_mc._y;
}
function buatMusuh() {
if (xday <= 100) {
maxMusuh = 10;
} else {
if (xday <= 200) {
maxMusuh = 11;
} else {
if (xday <= 300) {
maxMusuh = 12;
} else {
if (xday <= 400) {
maxMusuh = 13;
} else {
if (xday <= 500) {
maxMusuh = 14;
} else {
if (xday <= 600) {
maxMusuh = 15;
} else {
if (xday <= 700) {
maxMusuh = 16;
} else {
if (xday <= 800) {
maxMusuh = 17;
} else {
maxMusuh = 18;
}
}
}
}
}
}
}
}
if (siapaYangNyerang == 2) {
if (tingkatSulit == 1) {
pilihMusuh = 1 + random(3);
} else {
if (tingkatSulit == 2) {
if (xday <= 500) {
pilihMusuh = 1 + random(3);
} else {
pilihMusuh = 1 + random(4);
}
} else {
if (tingkatSulit == 3) {
if (xday <= 500) {
pilihMusuh = 1 + random(3);
} else {
pilihMusuh = 1 + random(5);
}
}
}
}
if (xday <= 100) {
musuhNyawa = 10;
} else {
if (xday <= 200) {
musuhNyawa = 15;
} else {
if (xday <= 300) {
musuhNyawa = 20;
} else {
if (xday <= 400) {
musuhNyawa = 25;
} else {
if (xday <= 500) {
musuhNyawa = 30;
} else {
if (xday <= 600) {
musuhNyawa = 35;
} else {
if (xday <= 700) {
musuhNyawa = 40;
} else {
musuhNyawa = 45;
}
}
}
}
}
}
}
cekNyawaHuman();
} else {
if (siapaYangNyerang == 0) {
if (sedangTutorial == true) {
pilihMusuh = 1;
} else {
pilihMusuh = 1 + random(2);
}
if (xday <= 100) {
musuhNyawa = 10;
} else {
if (xday <= 200) {
musuhNyawa = 15;
} else {
if (xday <= 300) {
musuhNyawa = 20;
} else {
if (xday <= 400) {
musuhNyawa = 25;
} else {
if (xday <= 500) {
musuhNyawa = 30;
} else {
if (xday <= 600) {
musuhNyawa = 35;
} else {
if (xday <= 700) {
musuhNyawa = 40;
} else {
if (xday <= 800) {
musuhNyawa = 45;
} else {
if (xday <= 900) {
musuhNyawa = 50;
} else {
if (xday <= 1000) {
musuhNyawa = 55;
} else {
if (xday <= 1100) {
musuhNyawa = 60;
} else {
if (xday <= 1200) {
musuhNyawa = 70;
} else {
if (xday <= 1300) {
musuhNyawa = 80;
} else {
if (xday <= 1400) {
musuhNyawa = 90;
} else {
if (xday <= 1500) {
musuhNyawa = 100;
} else {
if (xday <= 1600) {
musuhNyawa = 110;
} else {
if (xday <= 1700) {
musuhNyawa = 120;
} else {
if (xday <= 1800) {
musuhNyawa = 130;
} else {
if (xday <= 1900) {
musuhNyawa = 140;
} else {
musuhNyawa = 150;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
if (tingkatSulit == 3) {
musuhNyawa *= 3;
} else {
if (tingkatSulit == 2) {
musuhNyawa *= 2;
} else {
musuhNyawa *= 1;
}
}
}
}
zrand = random(3);
if (zrand == 0) {
musuhNyawa *= 1;
} else {
if (zrand == 1) {
musuhNyawa *= 1.25;
} else {
if (zrand == 2) {
musuhNyawa *= 1.5;
}
}
}
if (siapaYangNyerang == 0) {
musuhNyawa *= 2;
} else {
musuhNyawa *= pengkalianMusuh;
}
posMusuhKini = new Array('11', '12', '13', '21', '22', '23', '31', '32', '33', '41', '42', '43', '51', '52', '53', '61', '62', '63');
maxPos = posMusuhKini.length;
kiniMusuh = 0;
xposMusuhKiniX = new Array();
xposMusuhKiniY = new Array();
i = 0;
while (i <= maxPos) {
ambilKe = random(posMusuhKini.length);
keAmbil = posMusuhKini[ambilKe];
posMusuhKini[ambilKe] = null;
posMusuhKini.sort();
posMusuhKini.pop();
myStr = new String(keAmbil);
xposMusuhKiniX[i] = Number(myStr.substr(myStr.length - 1, 1));
xposMusuhKiniY[i] = Number(myStr.substr(myStr.length - 2, 1));
++i;
}
i = 0;
while (i <= maxMusuh - 1) {
if (siapaYangNyerang == 2) {
if (xday <= 500) {
pilihMusuh = 1 + random(3);
} else {
pilihMusuh = 1 + random(5);
}
} else {
if (siapaYangNyerang == 0) {
pilihMusuh = 1 + random(2);
}
}
if (sedangTutorial == true) {
pilihMusuh = 1;
}
if (pilihMusuh >= 4 && maxTankMusuh <= 0) {
pilihMusuh = 1 + random(3);
} else {
if (pilihMusuh >= 4 && maxTankMusuh > 0) {
--maxTankMusuh;
}
}
++jumlahMusuh;
if (siapaYangNyerang == 0) {
musuh = attachMovie('barbar' + pilihMusuh, 'musuh_mc' + dalamMusuh, dalamMusuh + 100);
} else {
if (siapaYangNyerang == 2) {
musuh = attachMovie('musuh' + pilihMusuh, 'musuh_mc' + dalamMusuh, dalamMusuh + 100);
}
}
musuh.cacheAsBitmap = true;
musuh._x = background_mc._x + 1250 + 70 * (xposMusuhKiniX[i] - 1);
musuh._y = 180 + 55 * (xposMusuhKiniY[i] - 1);
musuh.jenis = pilihMusuh;
if (pilihMusuh == 4 || pilihMusuh == 5) {
musuh.nyawa = (musuhNyawa + random(5)) * 5;
musuh.scaleAwal = 100;
musuh.range = 550;
musuh.speed = 0.75;
musuh.damage = 5;
} else {
if (pilihMusuh == 2) {
musuh.nyawa = musuhNyawa + random(5);
musuh.scaleAwal = 100;
musuh.range = 450;
musuh.speed = 1.5 + random(2);
musuh.speed *= random(2) + 1;
musuh.damage = 2;
} else {
if (pilihMusuh == 3) {
musuh.nyawa = musuhNyawa + random(5);
musuh.scaleAwal = 100;
musuh.range = 100;
musuh.speed = 2 + random(2);
musuh.speed *= random(2) + 1;
musuh.damage = 3;
} else {
if (sedangTutorial == true) {
musuh.nyawa = 20 + random(5);
} else {
musuh.nyawa = musuhNyawa + random(5);
}
musuh.scaleAwal = 100;
musuh.range = 75;
musuh.speed = 1.5 + random(2);
musuh.speed *= random(2) + 1;
musuh.damage = 1;
}
}
}
musuh.kenaApi = false;
musuh.onEnterFrame = enterMusuh;
++dalamMusuh;
if (dalamMusuh >= 85) {
dalamMusuh = 50;
}
++i;
}
}
function pilihTargetJagoan(indi) {
pilihanJagoan = 0;
arrayKeJagoan = new Array();
i = 1;
while (i <= maximumJagoan) {
if (_root['jagoan_mc' + i] != undefined) {
if (_root['jagoan_mc' + i].nyawa > 0) {
arrayKeJagoan[pilihanJagoan] = i;
++pilihanJagoan;
}
}
++i;
}
if (pilihanJagoan > 0) {
randJagoan = random(pilihanJagoan);
indi.xtarget = _root['jagoan_mc' + arrayKeJagoan[randJagoan]];
} else {
indi.gotoAndStop(1);
}
}
function enterMusuh() {
if (sedangPause == false) {
this._x += geserKiri;
if (mulaiBattle == true) {
if (this.kenaApi == true) {
if (this.batasApi >= this.maxApi) {
this.kenaApi = false;
i = 100;
while (i <= 200) {
this['api_mc' + i]._visible = false;
++i;
}
} else {
++this.batasApi;
}
--this.nyawa;
}
if (this.nyawa <= 0) {
this.nyawa = 0;
if (this._currentframe != 4) {
++killMusuh;
i = 100;
while (i <= 200) {
this['panah_mc' + i]._visible = false;
++i;
}
--jumlahMusuh;
if (jumlahMusuh <= 0) {
cekMenang();
}
this.gotoAndStop(4);
}
} else {
if (this.xtarget.nyawa == undefined || this.xtarget.nyawa <= 0 || this.xtarget.invis == true) {
pilihTargetJagoan(this);
} else {
if (this._x <= this.xtarget._x) {
this.anim._xscale = -this.scaleAwal;
} else {
this.anim._xscale = this.scaleAwal;
}
this.jarak = Math.sqrt(Math.pow(this._x - this.xtarget._x, 2) + Math.pow(this._y - this.xtarget._y, 2));
if (this.jarak <= this.range) {
this.serang = true;
} else {
this.serang = false;
}
if (this.serang == true) {
this.gotoAndStop(3);
} else {
deltaX = this._x - this.xtarget._x;
deltaY = this._y - this.xtarget._y;
angle = -Math.atan2(deltaX, deltaY) / 0.0174532925199433;
if (Math.sqrt(deltaX * deltaX + deltaY * deltaY) > this.speed * speedBattle) {
this._y -= this.speed * speedBattle * Math.cos(angle * 0.0174532925199433);
this._x += this.speed * speedBattle * Math.sin(angle * 0.0174532925199433);
}
}
}
}
}
}
this.jumlah = Math.ceil(this.nyawa);
if (this.jenis == 5) {
this.swapDepths(100 + this._x + this._y * 200);
} else {
this.swapDepths(100 + this._x + this._y * 100);
}
}
function cekSerangMusuh(indi) {
if (indi.jenis == 2) {
cekPanahMusuh(indi);
} else {
if (indi.xtarget.kebal != true) {
if (indi.xtarget.nyawa > 0) {
if (indi.damage != undefined) {
indi.xtarget.nyawa -= indi.damage;
if (indi.xtarget.iniDuplikasi == false) {
if (indi.xtarget.jenis == 1) {
xpindahBareman += indi.damage;
} else {
if (indi.xtarget.jenis == 2) {
xpindahSwordman += indi.damage;
} else {
if (indi.xtarget.jenis == 3) {
xpindahArrowman += indi.damage;
} else {
if (indi.xtarget.jenis == 4) {
xpindahSpearman += indi.damage;
}
}
}
}
}
if (indi.jenis == 4 || indi.jenis == 5) {
cekEfekLedakan2(indi.xtarget);
}
}
}
}
indi.xtarget.xtarget = indi;
}
}
function cekPanahMusuh(indi) {
peluru = attachMovie('panah_mc3', 'peluru_mc' + dalamPeluru, dalamPeluru);
peluru._x = indi._x - 30;
peluru._y = indi._y - 30;
if (siapaYangNyerang == 2) {
peluru._yscale = 75;
peluru._xscale = 75;
} else {
peluru._yscale = 100;
peluru._xscale = 100;
}
peluru.speed = 25;
peluru.arahTembak = 35;
peluru.xtarget = indi.xtarget;
peluru.tujuanX = indi.xtarget._x;
peluru.tujuanY = indi.xtarget._y;
deltaX = peluru._x - peluru.tujuanX;
deltaY = peluru._y - peluru.tujuanY;
angle = -Math.atan2(deltaX, deltaY) / 0.0174532925199433;
peluru._rotation = angle;
peluru.indi = indi;
peluru.onEnterFrame = enterPanahMusuh;
++dalamPeluru;
if (dalamPeluru >= 200) {
dalamPeluru = 100;
}
}
function enterPanahMusuh() {
if (sedangPause == false) {
this._x += geserKiri;
if (this.xtarget.nyawa == undefined) {
deltaX = this._x - this.tujuanX;
deltaY = this._y - this.tujuanY;
angle = -Math.atan2(deltaX, deltaY) / 0.0174532925199433;
this._rotation = angle;
if (Math.sqrt(deltaX * deltaX + deltaY * deltaY) > this.speed) {
this.speed += 0.5;
this._y -= this.speed * Math.cos(angle * 0.0174532925199433);
this._x += this.speed * Math.sin(angle * 0.0174532925199433);
} else {
removeMovieClip(this);
}
} else {
deltaX = this._x - this.xtarget._x;
deltaY = this._y - this.xtarget._y + this.arahTembak;
angle = -Math.atan2(deltaX, deltaY) / 0.0174532925199433;
this._rotation = angle;
if (Math.sqrt(deltaX * deltaX + deltaY * deltaY) > this.speed) {
this.speed += 0.5;
this._y -= this.speed * Math.cos(angle * 0.0174532925199433);
this._x += this.speed * Math.sin(angle * 0.0174532925199433);
} else {
if (this.xtarget.kebal != true) {
if (this.xtarget.nyawa > 0) {
if (this.indi.damage != undefined) {
this.xtarget.nyawa -= this.indi.damage;
if (this.xtarget.iniDuplikasi == false) {
if (this.xtarget.jenis == 1) {
xpindahBareman += this.indi.damage;
} else {
if (this.xtarget.jenis == 2) {
xpindahSwordman += this.indi.damage;
} else {
if (this.xtarget.jenis == 3) {
xpindahArrowman += this.indi.damage;
} else {
if (this.xtarget.jenis == 4) {
xpindahSpearman += this.indi.damage;
}
}
}
}
}
}
}
}
if (this.xtarget.nyawa > 0) {
this.xtarget.attachMovie('panah_mc3', 'panah_mc' + dalamPeluru, dalamPeluru);
this.xtarget['panah_mc' + dalamPeluru].gotoAndStop(2);
this.xtarget['panah_mc' + dalamPeluru]._x = 25 + random(15) + 7;
this.xtarget['panah_mc' + dalamPeluru]._y = -35 + random(15) + 7;
this.xtarget['panah_mc' + dalamPeluru]._rotation = this._rotation - random(15) + 7;
this.xtarget['panah_mc' + dalamPeluru]._xscale = this._xscale;
this.xtarget['panah_mc' + dalamPeluru]._yscale = this._yscale;
++dalamPeluru;
if (dalamPeluru >= 200) {
dalamPeluru = 100;
}
}
removeMovieClip(this);
}
}
}
this.swapDepths(100 + this._x + this._y * 100);
}
function cekEfekLedakan2(indi, indi2) {
if (indi != undefined) {
efek = attachMovie('efekLedakan', 'spell_mc' + dalamSpell, dalamSpell);
efek._x = indi._x;
efek._y = indi._y - 50;
efek._xscale = 75;
efek._yscale = 75;
efek.onEnterFrame = enterEfekApi2;
++dalamSpell;
if (dalamSpell >= 301000) {
dalamSpell = 300000;
}
}
}
function enterEfekApi2() {
if (sedangPause == false) {
this._x += geserKiri;
i = 1;
while (i <= maximumJagoan) {
if (this.hitTest(_root['jagoan_mc' + i].anim)) {
if (_root['jagoan_mc' + i].nyawa > 0) {
_root['jagoan_mc' + i].nyawa -= 0.5;
if (_root['jagoan_mc' + i].jenis == 1) {
xpindahBareman += 0.5;
} else {
if (_root['jagoan_mc' + i].jenis == 2) {
xpindahSwordman += 0.5;
} else {
if (_root['jagoan_mc' + i].jenis == 3) {
xpindahArrowman += 0.5;
} else {
if (_root['jagoan_mc' + i].jenis == 4) {
xpindahSpearman += 0.5;
}
}
}
}
}
}
++i;
}
}
this.swapDepths(100 + this._x + this._y * 100);
}
function cekNormalY(indi) {
if (indi == 'awal') {
i = 50;
while (i <= 85) {
_root['musuh_mc' + i].awalGempaY = _root['musuh_mc' + i]._y;
++i;
}
i = 1;
while (i <= maximumJagoan) {
_root['jagoan_mc' + i].awalGempaY = _root['jagoan_mc' + i]._y;
++i;
}
} else {
if (indi == 'akhir') {
background_mc._y = posAwalBackgroundY;
i = 50;
while (i <= 85) {
_root['musuh_mc' + i]._y = _root['musuh_mc' + i].awalGempaY;
++i;
}
i = 1;
while (i <= maximumJagoan) {
_root['jagoan_mc' + i]._y = _root['jagoan_mc' + i].awalGempaY;
++i;
}
}
}
}
function cekGeserX(indi) {
background_mc._x += indi;
i = 50;
while (i <= 85) {
_root['musuh_mc' + i]._x += indi;
_root['musuh_mc' + i].nyawa -= 1;
++i;
}
i = 1;
while (i <= maximumJagoan) {
_root['jagoan_mc' + i]._x += indi;
++i;
}
}
function cekGeserY(indi) {
background_mc._y += indi;
i = 50;
while (i <= 85) {
_root['musuh_mc' + i]._y += indi;
++i;
}
i = 1;
while (i <= maximumJagoan) {
_root['jagoan_mc' + i]._y += indi;
++i;
}
}
function cekPasukanBuat() {
if (battle_mc.pasukan_mc._currentframe == 1) {
i = 1;
while (i <= 4) {
battle_mc.pasukan_mc['unit' + i].onRelease = klikSoldier;
battle_mc.pasukan_mc['unit' + i].onRollOver = overSoldier;
battle_mc.pasukan_mc['unit' + i].onRollOut = outSoldier;
if (mulaiBattle == true) {
battle_mc.pasukan_mc['unit' + i].enabled = false;
battle_mc.pasukan_mc['unit' + i]._alpha = 50;
} else {
battle_mc.pasukan_mc['unit' + i].enabled = true;
battle_mc.pasukan_mc['unit' + i]._alpha = 100;
}
battle_mc.pasukan_mc['unit' + i].enabled = true;
battle_mc.pasukan_mc['unit' + i]._alpha = 100;
battle_mc.pasukan_mc.jumlah1 = wpindahBareman;
battle_mc.pasukan_mc.jumlah2 = wpindahSwordman;
battle_mc.pasukan_mc.jumlah3 = wpindahArrowman;
battle_mc.pasukan_mc.jumlah4 = wpindahSpearman;
++i;
}
battle_mc.soldier_mc.gotoAndStop(2);
battle_mc.vehicle_mc.gotoAndStop(1);
battle_mc.weapon_mc.gotoAndStop(1);
battle_mc.spell_mc.gotoAndStop(1);
battle_mc.defense_mc.gotoAndStop(1);
} else {
if (battle_mc.pasukan_mc._currentframe == 2) {
i = 5;
while (i <= 7) {
battle_mc.pasukan_mc['unit' + i].onRelease = klikSoldier;
battle_mc.pasukan_mc['unit' + i].onRollOver = overSoldier;
battle_mc.pasukan_mc['unit' + i].onRollOut = outSoldier;
if (mulaiBattle == true) {
battle_mc.pasukan_mc['unit' + i].enabled = false;
battle_mc.pasukan_mc['unit' + i]._alpha = 50;
} else {
battle_mc.pasukan_mc['unit' + i].enabled = true;
battle_mc.pasukan_mc['unit' + i]._alpha = 100;
}
battle_mc.pasukan_mc['unit' + i].enabled = true;
battle_mc.pasukan_mc['unit' + i]._alpha = 100;
battle_mc.pasukan_mc.jumlah5 = wpindahTank;
battle_mc.pasukan_mc.jumlah6 = wpindahCopter;
battle_mc.pasukan_mc.jumlah7 = wpindahMonbot;
++i;
}
battle_mc.soldier_mc.gotoAndStop(1);
battle_mc.vehicle_mc.gotoAndStop(2);
battle_mc.weapon_mc.gotoAndStop(1);
battle_mc.spell_mc.gotoAndStop(1);
battle_mc.defense_mc.gotoAndStop(1);
} else {
if (battle_mc.pasukan_mc._currentframe == 3) {
i = 8;
while (i <= 10) {
battle_mc.pasukan_mc['unit' + i].onRelease = klikWeapon;
battle_mc.pasukan_mc['unit' + i].onRollOver = overWeapon;
battle_mc.pasukan_mc['unit' + i].onRollOut = outWeapon;
if (mulaiBattle == true) {
battle_mc.pasukan_mc['unit' + i].enabled = true;
battle_mc.pasukan_mc['unit' + i]._alpha = 100;
} else {
battle_mc.pasukan_mc['unit' + i].enabled = true;
battle_mc.pasukan_mc['unit' + i]._alpha = 100;
}
battle_mc.pasukan_mc.jumlah8 = wpindahArrowTrap;
battle_mc.pasukan_mc.jumlah9 = wpindahCatapult;
battle_mc.pasukan_mc.jumlah10 = wpindahFireTrap;
++i;
}
battle_mc.soldier_mc.gotoAndStop(1);
battle_mc.vehicle_mc.gotoAndStop(1);
battle_mc.weapon_mc.gotoAndStop(2);
battle_mc.spell_mc.gotoAndStop(1);
battle_mc.defense_mc.gotoAndStop(1);
} else {
if (battle_mc.pasukan_mc._currentframe == 4) {
i = 11;
while (i <= 18) {
battle_mc.pasukan_mc['unit' + i].onRelease = klikSpell;
battle_mc.pasukan_mc['unit' + i].onRollOver = overSpell;
battle_mc.pasukan_mc['unit' + i].onRollOut = outSpell;
if (mulaiBattle == true) {
battle_mc.pasukan_mc['unit' + i].enabled = true;
battle_mc.pasukan_mc['unit' + i]._alpha = 100;
} else {
battle_mc.pasukan_mc['unit' + i].enabled = true;
battle_mc.pasukan_mc['unit' + i]._alpha = 100;
}
battle_mc.pasukan_mc.jumlah11 = wpindahArrowRain;
battle_mc.pasukan_mc.jumlah12 = wpindahMeteorid;
battle_mc.pasukan_mc.jumlah13 = wpindahAcidRain;
battle_mc.pasukan_mc.jumlah14 = wpindahEarthquake;
battle_mc.pasukan_mc.jumlah15 = wpindahImmune;
battle_mc.pasukan_mc.jumlah16 = wpindahInvisible;
battle_mc.pasukan_mc.jumlah17 = wpindahSpecialAttack;
battle_mc.pasukan_mc.jumlah18 = wpindahDuplicate;
++i;
}
battle_mc.soldier_mc.gotoAndStop(1);
battle_mc.vehicle_mc.gotoAndStop(1);
battle_mc.weapon_mc.gotoAndStop(1);
battle_mc.spell_mc.gotoAndStop(2);
battle_mc.defense_mc.gotoAndStop(1);
} else {
if (battle_mc.pasukan_mc._currentframe == 5) {
battle_mc.soldier_mc.gotoAndStop(1);
battle_mc.vehicle_mc.gotoAndStop(1);
battle_mc.weapon_mc.gotoAndStop(1);
battle_mc.spell_mc.gotoAndStop(1);
battle_mc.defense_mc.gotoAndStop(2);
}
}
}
}
}
battle_mc.defense_mc._visible = false;
buatKotak(false);
}
function overSoldier() {
info_mc2._visible = true;
znamaSoldier = new Array('', 'Barehands', 'Swordman', 'Arrowman', 'Spearman', 'Tank', 'Copter', 'Monbot');
myStr = new String(this);
if (isNaN(myStr.substr(myStr.length - 2, 2))) {
indi = myStr.substr(myStr.length - 1, 1);
} else {
indi = myStr.substr(myStr.length - 2, 2);
}
info_mc2.gotoAndStop(2);
info_mc2.xinfo = znamaSoldier[indi];
}
function outSoldier() {
info_mc2._visible = false;
}
function overWeapon() {
info_mc2._visible = true;
znamaWeapon = new Array('', 'Bow Launcher', 'Stone Thrower', 'Fire Thrower');
myStr = new String(this);
if (isNaN(myStr.substr(myStr.length - 2, 2))) {
indi = Number(myStr.substr(myStr.length - 1, 1));
} else {
indi = Number(myStr.substr(myStr.length - 2, 2));
}
info_mc2.gotoAndStop(2);
info_mc2.xinfo = znamaWeapon[indi - 7];
}
function outWeapon() {
info_mc2._visible = false;
}
function overSpell() {
info_mc2._visible = true;
znamaSpell = new Array('', 'Arrow Rain', 'Meteorid', 'Acid Rain', 'Eeathquake', 'Immune', 'Invisible', 'Special Attack', 'Duplicate');
myStr = new String(this);
if (isNaN(myStr.substr(myStr.length - 2, 2))) {
indi = Number(myStr.substr(myStr.length - 1, 1));
} else {
indi = Number(myStr.substr(myStr.length - 2, 2));
}
info_mc2.gotoAndStop(2);
if (indi - 10 <= 4) {
info_mc2.xinfo = znamaSpell[indi - 10] + ', Give to Enemy';
} else {
info_mc2.xinfo = znamaSpell[indi - 10] + ', Give to Monster';
}
}
function outSpell() {
info_mc2._visible = false;
}
function overDefense() {
info_mc2._visible = true;
znamaDefense = new Array('', 'Wall', 'Spike', 'Spider Web', 'Tower Guard', 'Zombie Trap');
myStr = new String(this);
if (isNaN(myStr.substr(myStr.length - 2, 2))) {
indi = Number(myStr.substr(myStr.length - 1, 1));
} else {
indi = Number(myStr.substr(myStr.length - 2, 2));
}
info_mc2.gotoAndStop(2);
info_mc2.xinfo = znamaDefense[indi - 18];
}
function outDefense() {
info_mc2._visible = false;
}
function klikSpell() {
if (mulaiBattle == true) {
myStr = new String(this);
if (isNaN(myStr.substr(myStr.length - 2, 2))) {
indi = myStr.substr(myStr.length - 1, 1);
} else {
indi = myStr.substr(myStr.length - 2, 2);
}
if (battle_mc.pasukan_mc['jumlah' + indi] > 0) {
pilihSpell = indi;
spell = attachMovie('spellTarget', 'drag_mc2', dalamDrag);
spell.bisa._visible = true;
spell._x = _root._xmouse;
spell._y = _root._ymouse + spell._height / 10;
if (pilihSpell >= 15) {
spell._yscale = 150;
spell._xscale = 150;
} else {
spell._yscale = 75;
spell._xscale = 75;
}
spell.startDrag();
sedangDragSpell = true;
battle_mc.remove_mc._visible = true;
}
}
}
function klikWeapon() {
myStr = new String(this);
if (isNaN(myStr.substr(myStr.length - 2, 2))) {
indi = myStr.substr(myStr.length - 1, 1);
} else {
indi = myStr.substr(myStr.length - 2, 2);
}
if (battle_mc.pasukan_mc['jumlah' + indi] > 0) {
pilihWeapon = indi;
weapon2 = attachMovie('panahWeapon', 'drag_mc2', dalamDrag);
weapon2.bisa._visible = true;
weapon2._x = _root._xmouse;
weapon2._y = _root._ymouse + weapon2._height / 10;
if (pilihWeapon == 8) {
weapon2.jumlah = 25;
weapon2.gotoAndStop(1);
} else {
if (pilihWeapon == 9) {
weapon2.jumlah = 50;
weapon2.gotoAndStop(2);
} else {
if (pilihWeapon == 10) {
weapon2.jumlah = 75;
weapon2.gotoAndStop(3);
}
}
}
weapon2.anim.stop();
weapon2.startDrag();
sedangDragWeapon = true;
battle_mc.remove_mc._visible = true;
}
}
function buatSpell(indiX, indiY) {
if (pilihSpell >= 15) {
spell = attachMovie('spellTarget', 'spell_mc' + dalamSpell, dalamSpell);
spell._xscale = 150;
spell._yscale = 150;
} else {
if (pilihSpell == 14) {
spell = attachMovie('efek' + (pilihSpell - 10), 'spell_mc' + dalamSpell, dalamSpell - 270000);
} else {
spell = attachMovie('efek' + (pilihSpell - 10), 'spell_mc' + dalamSpell, dalamSpell);
}
}
if (pilihSpell == 11) {
++xpindahArrowRain;
--wpindahArrowRain;
spell._x = indiX;
spell._y = indiY - 1000;
spell.speedY = 5;
spell.damage = 0.3;
spell.batasBawah = indiY + 50;
} else {
if (pilihSpell == 12) {
backComet();
++xpindahMeteorid;
--wpindahMeteorid;
spell._x = indiX;
spell._y = indiY - 1000;
spell.speedY = 5;
spell.damage = 0.4;
spell.batasBawah = indiY + 50;
} else {
if (pilihSpell == 13) {
++xpindahAcidRain;
--wpindahAcidRain;
spell._x = indiX;
spell._y = indiY - 1000;
spell.speedY = 5;
spell.damage = 0.5;
spell.batasBawah = indiY + 50;
} else {
if (pilihSpell == 14) {
backGempa();
++xpindahEarthquake;
--wpindahEarthquake;
spell._x = indiX;
spell._y = indiY;
spell.damage = 0.1;
spell.awalGempa = 0;
spell.akhirGempa = 25;
spell.getarKe = 1;
cekNormalY('awal');
} else {
if (pilihSpell == 15) {
backSpell3();
++xpindahImmune;
--wpindahImmune;
spell._x = indiX;
spell._y = indiY;
} else {
if (pilihSpell == 16) {
backSpell4();
++xpindahInvisible;
--wpindahInvisible;
spell._x = indiX;
spell._y = indiY;
} else {
if (pilihSpell == 17) {
backSpell1();
++xpindahSpecialAttack;
--wpindahSpecialAttack;
spell._x = indiX;
spell._y = indiY;
} else {
if (pilihSpell == 18) {
backSpell2();
++xpindahDuplicate;
--wpindahDuplicate;
spell._x = indiX;
spell._y = indiY;
}
}
}
}
}
}
}
}
spell.damage *= 10;
battle_mc.pasukan_mc.jumlah11 = wpindahArrowRain;
battle_mc.pasukan_mc.jumlah12 = wpindahMeteorid;
battle_mc.pasukan_mc.jumlah13 = wpindahAcidRain;
battle_mc.pasukan_mc.jumlah14 = wpindahEarthquake;
battle_mc.pasukan_mc.jumlah15 = wpindahImmune;
battle_mc.pasukan_mc.jumlah16 = wpindahInvisible;
battle_mc.pasukan_mc.jumlah17 = wpindahSpecialAttack;
battle_mc.pasukan_mc.jumlah18 = wpindahDuplicate;
spell.tipeSpell = pilihSpell;
spell.onEnterFrame = enterSpell;
++dalamSpell;
if (dalamSpell >= 301000) {
dalamSpell = 300000;
}
}
function enterSpell() {
if (sedangPause == false) {
this._x += geserKiri;
if (this.tipeSpell == 11) {
if (this._y >= this.batasBawah) {
this.gotoAndStop(2);
} else {
this._y += this.speedY;
this.speedY += 2;
}
i = 50;
while (i <= 85) {
if (this.hitTest(_root['musuh_mc' + i].anim)) {
_root['musuh_mc' + i].nyawa -= this.damage;
}
++i;
}
} else {
if (this.tipeSpell == 12) {
if (this._y >= this.batasBawah) {
this.gotoAndStop(2);
} else {
this._y += this.speedY;
this.speedY += 2;
}
i = 50;
while (i <= 85) {
if (this.hitTest(_root['musuh_mc' + i].anim)) {
_root['musuh_mc' + i].nyawa -= this.damage;
}
++i;
}
} else {
if (this.tipeSpell == 13) {
if (this._y >= this.batasBawah) {
this.gotoAndStop(2);
} else {
this._y += this.speedY;
this.speedY += 2;
}
i = 50;
while (i <= 85) {
if (this.hitTest(_root['musuh_mc' + i].anim)) {
_root['musuh_mc' + i].nyawa -= this.damage;
}
++i;
}
} else {
if (this.tipeSpell == 14) {
this._xscale += 1;
this._yscale += 1;
if (this.awalGempa >= this.akhirGempa && this.getarKe == 1) {
cekNormalY('akhir');
getarBumi2 = false;
removeMovieClip(this);
} else {
++this.awalGempa;
if (this.getarKe == 1) {
cekGeserX2(5);
cekGeserY2(5);
++this.getarKe;
} else {
if (this.getarKe == 2) {
cekGeserX2(-10);
cekGeserY2(-10);
++this.getarKe;
} else {
if (this.getarKe == 3) {
cekGeserX2(5);
cekGeserY2(-5);
++this.getarKe;
} else {
if (this.getarKe == 4) {
cekGeserX2(-5);
cekGeserY2(5);
++this.getarKe;
} else {
if (this.getarKe == 5) {
cekGeserX2(7);
cekGeserY2(7);
++this.getarKe;
} else {
if (this.getarKe == 6) {
cekGeserX2(10);
cekGeserY2(-10);
++this.getarKe;
} else {
if (this.getarKe == 7) {
cekGeserX2(-12);
cekGeserY2(7);
++this.getarKe;
} else {
this.getarKe = 1;
}
}
}
}
}
}
}
i = 50;
while (i <= 85) {
if (this.hitTest(_root['musuh_mc' + i].anim)) {
_root['musuh_mc' + i].nyawa -= this.damage;
}
++i;
}
}
} else {
if (this.tipeSpell == 15) {
i = 1;
while (i <= maximumJagoan) {
if (this.hitTest(_root['jagoan_mc' + i].anim)) {
_root['jagoan_mc' + i].awalKebal = 0;
_root['jagoan_mc' + i].akhirKebal = 500;
_root['jagoan_mc' + i].kebal = true;
_root['jagoan_mc' + i].attachMovie('efek5', 'efekKebal' + dalamEfekJagoan, dalamEfekJagoan);
_root['jagoan_mc' + i]['efekKebal' + dalamEfekJagoan]._x = 0;
_root['jagoan_mc' + i]['efekKebal' + dalamEfekJagoan]._y = -35;
++dalamEfekJagoan;
if (dalamEfekJagoan >= 110) {
dalamEfekJagoan = 100;
}
}
++i;
}
removeMovieClip(this);
} else {
if (this.tipeSpell == 16) {
i = 1;
while (i <= maximumJagoan) {
if (this.hitTest(_root['jagoan_mc' + i].anim)) {
_root['jagoan_mc' + i].awalInvis = 0;
_root['jagoan_mc' + i].akhirInvis = 500;
_root['jagoan_mc' + i].invis = true;
_root['jagoan_mc' + i].attachMovie('efek6', 'efekInvis' + dalamEfekJagoan, dalamEfekJagoan);
_root['jagoan_mc' + i]['efekInvis' + dalamEfekJagoan]._x = 0;
_root['jagoan_mc' + i]['efekInvis' + dalamEfekJagoan]._y = -35;
++dalamEfekJagoan;
if (dalamEfekJagoan >= 110) {
dalamEfekJagoan = 100;
}
}
++i;
}
removeMovieClip(this);
} else {
if (this.tipeSpell == 17) {
i = 1;
while (i <= maximumJagoan) {
if (this.hitTest(_root['jagoan_mc' + i].anim)) {
_root['jagoan_mc' + i].awalSpecial = 0;
_root['jagoan_mc' + i].akhirSpecial = 500;
_root['jagoan_mc' + i].special = true;
_root['jagoan_mc' + i].attachMovie('efek7', 'efekSpecial' + dalamEfekJagoan, dalamEfekJagoan);
_root['jagoan_mc' + i]['efekSpecial' + dalamEfekJagoan]._x = 0;
_root['jagoan_mc' + i]['efekSpecial' + dalamEfekJagoan]._y = -35;
++dalamEfekJagoan;
if (dalamEfekJagoan >= 110) {
dalamEfekJagoan = 100;
}
}
++i;
}
removeMovieClip(this);
} else {
if (this.tipeSpell == 18) {
zz = 1;
while (zz <= maximumJagoan) {
if (this.hitTest(_root['jagoan_mc' + zz].anim)) {
if (_root['jagoan_mc' + zz]._x != undefined && _root['jagoan_mc' + zz].nyawa > 0) {
cekDuplicate(_root['jagoan_mc' + zz]);
}
}
++zz;
}
removeMovieClip(this);
}
}
}
}
}
}
}
}
}
}
function cekDuplicate(indi) {
if (indi.duplikasi == false) {
indi.duplikasi = true;
indi.nyawa *= 2;
indi.damage *= 2;
indi.range *= 2;
indi.speed *= 2;
}
}
function cekGeserX2(indi) {
background_mc._x += indi;
i = 50;
while (i <= 85) {
_root['musuh_mc' + i]._x += indi;
++i;
}
i = 1;
while (i <= maximumJagoan) {
_root['jagoan_mc' + i]._x += indi;
++i;
}
}
function cekGeserY2(indi) {
background_mc._y += indi;
i = 50;
while (i <= 85) {
_root['musuh_mc' + i]._y += indi;
++i;
}
i = 1;
while (i <= maximumJagoan) {
_root['jagoan_mc' + i]._y += indi;
++i;
}
}
function buatWeapon(indi) {
if (pilihWeapon == 8) {
--wpindahArrowTrap;
} else {
if (pilihWeapon == 9) {
--wpindahCatapult;
} else {
if (pilihWeapon == 10) {
--wpindahFireTrap;
}
}
}
battle_mc.pasukan_mc.jumlah8 = wpindahArrowTrap;
battle_mc.pasukan_mc.jumlah9 = wpindahCatapult;
battle_mc.pasukan_mc.jumlah10 = wpindahFireTrap;
weapon = attachMovie('weapon' + (pilihWeapon - 7), 'weapon_mc' + dalamWeapon, dalamWeapon + 100);
weapon._x = background_mc._x - 100;
weapon._y = indi + 25;
weapon.speed = 1.5;
if (pilihWeapon == 8) {
weapon.damage = 5;
} else {
if (pilihWeapon == 9) {
weapon.damage = 10;
} else {
if (pilihWeapon == 10) {
weapon.damage = 10;
}
}
}
if (pilihWeapon == 8) {
weapon.ammo = 25;
weapon.range = 875;
} else {
if (pilihWeapon == 9) {
weapon.ammo = 30;
weapon.range = 900;
} else {
if (pilihWeapon == 10) {
weapon.ammo = 35;
weapon.range = 925;
}
}
}
weapon.jenisWeapon = pilihWeapon;
weapon.batasKanan = background_mc._x + 40 + random(15);
weapon.onEnterFrame = enterWeapon;
++dalamWeapon;
if (dalamWeapon >= 300) {
dalamWeapon = 200;
}
}
function enterWeapon() {
if (sedangPause == false) {
this._x += geserKiri;
this.batasKanan += geserKiri;
if (this._x <= this.batasKanan) {
this.gotoAndStop(2);
this._x += this.speed;
} else {
this.bisaSerang = false;
this.xtarget = undefined;
i = 50;
while (i <= 85) {
if (_root['musuh_mc' + i]._x != undefined && _root['musuh_mc' + i].nyawa > 0) {
this.jarak = Math.sqrt(Math.pow(this._x - _root['musuh_mc' + i]._x, 2) + Math.pow(this._y - _root['musuh_mc' + i]._y, 2));
if (this.jarak <= this.range) {
this.xtarget = _root['musuh_mc' + i];
this.bisaSerang = true;
}
}
++i;
}
if (this.ammo <= 0) {
this.ammo = 0;
this.gotoAndStop(1);
} else {
if (this.bisaSerang == true) {
this.gotoAndStop(3);
} else {
this.gotoAndStop(1);
}
}
}
}
this.jumlah = this.ammo;
this.swapDepths(100 + this._x + this._y * 100);
}
function cekSerangWeapon(indi) {
if (indi.jenisWeapon == 8) {
--indi.ammo;
peluru = attachMovie('panah_mc2', 'peluru_mc' + dalamPeluru, dalamPeluru);
peluru._x = indi._x;
peluru._y = indi._y - 25;
peluru._yscale = 100;
peluru._xscale = 100;
peluru.speedX = 20;
peluru.speedY = 10;
peluru.damage = indi.damage;
peluru.xtarget = indi.xtarget;
peluru.batasBawah = indi._y;
peluru.randBawah = random(50);
peluru.indi = indi;
peluru.onEnterFrame = enterWeapon2;
++dalamPeluru;
if (dalamPeluru >= 200) {
dalamPeluru = 100;
}
} else {
if (indi.jenisWeapon == 9) {
--indi.ammo;
peluru = attachMovie('batu_mc', 'peluru_mc' + dalamPeluru, dalamPeluru);
peluru._x = indi._x;
peluru._y = indi._y - 75;
peluru._yscale = 100;
peluru._xscale = 100;
if (indi.jenisWeapon == 9) {
peluru.jarak = Math.sqrt(Math.pow(indi._x - indi.xtarget._x, 2) + Math.pow(indi._y - indi.xtarget._y, 2));
if (peluru.jarak >= 850) {
peluru.speedX = 15;
} else {
if (peluru.jarak >= 800) {
peluru.speedX = 14;
} else {
if (peluru.jarak >= 750) {
peluru.speedX = 13;
} else {
if (peluru.jarak >= 700) {
peluru.speedX = 12;
} else {
if (peluru.jarak >= 650) {
peluru.speedX = 11;
} else {
if (peluru.jarak >= 600) {
peluru.speedX = 10;
} else {
if (peluru.jarak >= 550) {
peluru.speedX = 9;
} else {
if (peluru.jarak >= 500) {
peluru.speedX = 8;
} else {
if (peluru.jarak >= 450) {
peluru.speedX = 7;
} else {
if (peluru.jarak >= 400) {
peluru.speedX = 6;
} else {
peluru.speedX = 5;
}
}
}
}
}
}
}
}
}
}
}
peluru.speedY = 15;
peluru.damage = indi.damage;
peluru.xtarget = indi.xtarget;
peluru.batasBawah = indi._y;
peluru.randBawah = random(50);
peluru.indi = indi;
peluru.onEnterFrame = enterWeapon3;
++dalamPeluru;
if (dalamPeluru >= 200) {
dalamPeluru = 100;
}
} else {
if (indi.jenisWeapon == 10) {
--indi.ammo;
peluru = attachMovie('bolaApi_mc', 'peluru_mc' + dalamPeluru, dalamPeluru);
peluru._x = indi._x + 25;
peluru._y = indi._y - 35;
peluru._yscale = 100;
peluru._xscale = 100;
if (indi.jenisWeapon == 10) {
peluru.jarak = Math.sqrt(Math.pow(indi._x - indi.xtarget._x, 2) + Math.pow(indi._y - indi.xtarget._y, 2));
if (peluru.jarak >= 900) {
peluru.speedX = 20;
} else {
if (peluru.jarak >= 850) {
peluru.speedX = 19;
} else {
if (peluru.jarak >= 800) {
peluru.speedX = 18;
} else {
if (peluru.jarak >= 750) {
peluru.speedX = 17;
} else {
if (peluru.jarak >= 700) {
peluru.speedX = 16;
} else {
if (peluru.jarak >= 650) {
peluru.speedX = 15;
} else {
if (peluru.jarak >= 600) {
peluru.speedX = 14;
} else {
if (peluru.jarak >= 550) {
peluru.speedX = 13;
} else {
if (peluru.jarak >= 500) {
peluru.speedX = 12;
} else {
if (peluru.jarak >= 450) {
peluru.speedX = 11;
} else {
if (peluru.jarak >= 400) {
peluru.speedX = 10;
} else {
peluru.speedX = 9;
}
}
}
}
}
}
}
}
}
}
}
}
peluru.speedY = 10;
peluru.damage = indi.damage;
peluru.xtarget = indi.xtarget;
peluru.batasBawah = indi._y;
peluru.randBawah = random(50);
peluru.indi = indi;
peluru.onEnterFrame = enterWeapon4;
++dalamPeluru;
if (dalamPeluru >= 200) {
dalamPeluru = 100;
}
}
}
}
}
function enterWeapon2() {
if (sedangPause == false) {
this._x += geserKiri;
this._x += this.speedX;
this._y -= this.speedY;
this.speedY -= 0.5;
this._rotation += 1.5;
i = 50;
while (i <= 85) {
if (this.hitTest(_root['musuh_mc' + i].anim)) {
if (_root['musuh_mc' + i].nyawa > 0) {
_root['musuh_mc' + i].nyawa -= this.damage;
_root['musuh_mc' + i].attachMovie('panah_mc2', 'panah_mc' + dalamPeluru, dalamPeluru);
_root['musuh_mc' + i]['panah_mc' + dalamPeluru].gotoAndStop(2);
_root['musuh_mc' + i]['panah_mc' + dalamPeluru]._x = -35 + random(15) + 7;
_root['musuh_mc' + i]['panah_mc' + dalamPeluru]._y = -35 + random(15) + 7;
_root['musuh_mc' + i]['panah_mc' + dalamPeluru]._rotation = 45 + random(15);
_root['musuh_mc' + i]['panah_mc' + dalamPeluru]._xscale = this._xscale;
_root['musuh_mc' + i]['panah_mc' + dalamPeluru]._yscale = this._yscale;
++dalamPeluru;
if (dalamPeluru >= 200) {
dalamPeluru = 100;
}
removeMovieClip(this);
}
}
++i;
}
if (this.speedY <= 0) {
if (this._y >= this.batasBawah + this.randBawah) {
delete this.onEnterFrame;
this.onEnterFrame = enterWeaponx;
}
}
}
}
function enterWeapon3() {
if (sedangPause == false) {
this._x += geserKiri;
this._x += this.speedX;
this._y -= this.speedY;
this.speedY -= 0.5;
this._rotation += 1.5;
i = 50;
while (i <= 85) {
if (this.hitTest(_root['musuh_mc' + i].anim)) {
if (_root['musuh_mc' + i].nyawa > 0) {
_root['musuh_mc' + i].nyawa -= this.damage;
removeMovieClip(this);
}
}
++i;
}
if (this.speedY <= 0) {
if (this._y >= this.batasBawah + this.randBawah) {
delete this.onEnterFrame;
this.onEnterFrame = enterWeaponx;
}
}
}
}
function enterWeapon4() {
if (sedangPause == false) {
this._x += geserKiri;
this._x += this.speedX;
this._y -= this.speedY;
this.speedY -= 0.5;
this._rotation += 1.5;
this.lewatSini = false;
i = 50;
while (i <= 85) {
if (this.hitTest(_root['musuh_mc' + i].anim)) {
if (_root['musuh_mc' + i].nyawa > 0) {
_root['musuh_mc' + i].nyawa -= this.damage;
_root['musuh_mc' + i].kenaApi = true;
_root['musuh_mc' + i].batasApi = 0;
_root['musuh_mc' + i].maxApi = 100;
z = 1;
while (z <= 5) {
_root['musuh_mc' + i].attachMovie('efekApi', 'api_mc' + dalamPeluru, dalamPeluru);
_root['musuh_mc' + i]['api_mc' + dalamPeluru]._x = -random(30) + 15;
_root['musuh_mc' + i]['api_mc' + dalamPeluru]._y = -35 - random(30) + 15;
_root['musuh_mc' + i]['api_mc' + dalamPeluru]._xscale = 25 + random(25);
_root['musuh_mc' + i]['api_mc' + dalamPeluru]._yscale = 25 + random(25);
++dalamPeluru;
if (dalamPeluru >= 200) {
dalamPeluru = 100;
}
++z;
}
this.lewatSini = true;
removeMovieClip(this);
}
}
++i;
}
if (this.lewatSini == false) {
if (this.speedY <= 0) {
if (this._y >= this.batasBawah + this.randBawah) {
if (this != undefined) {
efek = attachMovie('efekApi2', 'api_mc' + dalamPeluru, dalamPeluru);
efek._x = this._x;
efek._y = this._y;
efek._xscale = 25 + random(25);
efek._yscale = 25 + random(25);
efek.onEnterFrame = enterEfekApi;
++dalamPeluru;
if (dalamPeluru >= 200) {
dalamPeluru = 100;
}
removeMovieClip(this);
}
}
}
}
}
}
function enterEfekApi() {
if (sedangPause == false) {
this._x += geserKiri;
i = 50;
while (i <= 85) {
if (this.hitTest(_root['musuh_mc' + i].anim)) {
_root['musuh_mc' + i].nyawa -= 0.5;
}
++i;
}
}
}
function enterWeaponx() {
if (sedangPause == false) {
this._x += geserKiri;
this._alpha -= 0.5;
}
}
function klikSoldier() {
myStr = new String(this);
indi = myStr.substr(myStr.length - 1, 1);
if (battle_mc.pasukan_mc['jumlah' + indi] > 0) {
pilihSoldier = indi;
soldier = attachMovie('soldier' + indi, 'drag_mc', dalamDrag);
soldier.cacheAsBitmap = true;
soldier._x = _root._xmouse;
soldier._y = _root._ymouse + soldier._height / 10;
soldier._alpha = 60;
if (pilihSoldier >= 5) {
if (pilihSoldier == 5) {
soldier.jumlah = 250;
} else {
if (pilihSoldier == 6) {
soldier.jumlah = 250;
} else {
if (pilihSoldier == 7) {
soldier.jumlah = 1000;
}
}
}
} else {
if (battle_mc.pasukan_mc['jumlah' + pilihSoldier] >= nilaiSoldier) {
soldier.jumlah = nilaiSoldier;
} else {
soldier.jumlah = battle_mc.pasukan_mc['jumlah' + pilihSoldier];
}
}
soldier.gotoAndStop(1);
soldier.anim.stop();
soldier.startDrag();
buatKotak(true);
}
}
function buatKotak(indi) {
if (indi == true) {
dalamLingkar = 1;
sedangDrag = true;
i = 1;
while (i <= 3) {
j = 1;
while (j <= 6) {
if (_root['sudahLingkar' + i + j] == false) {
lingkar = attachMovie('lingkar_mc', 'lingkar_mc' + i + j, dalamLingkar + 100000);
if (mulaiBattle == false) {
lingkar._x = background_mc._x + 100 + 70 * (i - 1);
lingkar._y = 180 + 55 * (j - 1);
} else {
lingkar._x = 100 + 70 * (i - 1);
lingkar._y = 180 + 55 * (j - 1);
}
lingkar.keI = i;
lingkar.keJ = j;
lingkar.jenisIsi = _root['jenisIsi' + i + j];
lingkar.onRelease = klikLingkar;
lingkar._alpha = 75;
lingkar._visible = true;
lingkar.onEnterFrame = enterLingkar;
++dalamLingkar;
}
++j;
}
++i;
}
dalamLingkar = 1;
i = 1;
while (i <= 3) {
j = 1;
while (j <= 6) {
if (_root['jenisIsi' + i + j] >= 5 && pilihSoldier >= 5) {
_root['lingkar_mc' + (i - 2) + j]._visible = false;
_root['lingkar_mc' + (i - 1) + j]._visible = false;
_root['lingkar_mc' + i + j]._visible = false;
_root['lingkar_mc' + (i + 1) + j]._visible = false;
_root['lingkar_mc' + (i + 2) + j]._visible = false;
}
++dalamLingkar;
++j;
}
++i;
}
if (mulaiBattle == true) {
i = 1;
while (i <= 3) {
j = 1;
while (j <= 6) {
if (_root['jenisIsi' + i + j] == pilihSoldier && _root['yangIsi' + i + j].nyawa <= 0) {
_root['lingkar_mc' + i + j]._visible = true;
} else {
_root['lingkar_mc' + i + j]._visible = false;
}
++j;
}
++i;
}
}
battle_mc.remove_mc._visible = true;
} else {
xdalamLingkar = 1;
sedangDrag = false;
i = 1;
while (i <= 3) {
j = 1;
while (j <= 6) {
removeMovieClip(_root['lingkar_mc' + i + j]);
++xdalamLingkar;
++j;
}
++i;
}
battle_mc.remove_mc._visible = false;
removeMovieClip(drag_mc);
stopDrag();
}
}
function enterLingkar() {
if (sedangPause == false) {
if (mulaiBattle == false) {
this._x += geserKiri;
}
}
}
function klikLingkar() {
if (sedangDrag == true) {
cekSoldierBuat(this);
}
}
function cekSoldierBuat(indi, indi2) {
bisaBuatSoldier = false;
i = 1;
while (i <= maximumJagoan) {
if (_root['jagoan_mc' + i].nyawa == undefined) {
xdalamSoldier = i;
i = maximumJagoan;
bisaBuatSoldier = true;
}
++i;
}
if (bisaBuatSoldier == true) {
if (mulaiBattle == false) {
if (indi == 'auto') {
_root['jenisIsi' + xposJagoanKiniX[z] + xposJagoanKiniY[z]] = pilihSoldier;
_root['sudahLingkar' + xposJagoanKiniX[z] + xposJagoanKiniY[z]] = true;
} else {
_root['jenisIsi' + indi.keI + indi.keJ] = pilihSoldier;
_root['sudahLingkar' + indi.keI + indi.keJ] = true;
}
}
++jumlahJagoan;
soldier = attachMovie('soldier' + pilihSoldier, 'jagoan_mc' + xdalamSoldier, xdalamSoldier + 100);
soldier.cacheAsBitmap = true;
if (indi == 'auto') {
_root['yangIsi' + xposJagoanKiniX[z] + xposJagoanKiniY[z]] = soldier;
} else {
_root['yangIsi' + indi.keI + indi.keJ] = soldier;
}
if (indi == 'auto') {
soldier._x = background_mc._x + 100 + 70 * xposJagoanKiniX[z];
soldier._y = 170 + 50 * xposJagoanKiniY[z];
} else {
if (mulaiBattle == false) {
soldier._x = indi._x;
soldier._y = indi._y + 15;
} else {
soldier._x = background_mc._x + indi._x;
soldier._y = indi._y + 15;
}
}
if (pilihSoldier == 5) {
soldier.scaleAwal = 75;
} else {
if (pilihSoldier == 6) {
soldier.scaleAwal = 75;
} else {
soldier.scaleAwal = 100;
}
}
if (pilihSoldier >= 5) {
if (pilihSoldier == 5) {
soldier.nyawa = 500;
} else {
if (pilihSoldier == 6) {
soldier.nyawa = 1000;
} else {
if (pilihSoldier == 7) {
soldier.nyawa = 2000;
}
}
}
} else {
if (indi2 == 'duplikat') {
soldier.nyawa = indi.nyawa;
} else {
if (battle_mc.pasukan_mc['jumlah' + pilihSoldier] >= nilaiSoldier) {
soldier.nyawa = nilaiSoldier;
} else {
soldier.nyawa = battle_mc.pasukan_mc['jumlah' + pilihSoldier];
}
}
}
if (pilihSoldier == 1) {
wpindahBareman -= nilaiSoldier;
if (wpindahBareman <= 0) {
wpindahBareman = 0;
}
soldier.damage = _root['xbaremanPower' + keKota] * 2;
soldier.range = 50;
soldier.speed = 3;
soldier.tipeSenjata = 'melee';
} else {
if (pilihSoldier == 2) {
wpindahSwordman -= nilaiSoldier;
if (wpindahSwordman <= 0) {
wpindahSwordman = 0;
}
soldier.damage = _root['xswordmanPower' + keKota] * 2;
soldier.range = 75;
soldier.speed = 2;
soldier.tipeSenjata = 'melee';
} else {
if (pilihSoldier == 3) {
wpindahArrowman -= nilaiSoldier;
if (wpindahArrowman <= 0) {
wpindahArrowman = 0;
}
soldier.damage = _root['xarrowmanPower' + keKota] * 2;
soldier.range = 750;
soldier.speed = 1.5;
soldier.tipeSenjata = 'range';
} else {
if (pilihSoldier == 4) {
wpindahSpearman -= nilaiSoldier;
if (wpindahSpearman <= 0) {
wpindahSpearman = 0;
}
soldier.damage = _root['xspearmanPower' + keKota] * 2;
soldier.range = 100;
soldier.speed = 2.5;
soldier.tipeSenjata = 'melee';
} else {
if (pilihSoldier == 5) {
--wpindahTank;
if (wpindahTank <= 0) {
wpindahTank = 0;
}
soldier.damage = 10;
soldier.range = 550;
soldier.speed = 1;
soldier.tipeSenjata = 'range';
} else {
if (pilihSoldier == 6) {
--wpindahCopter;
if (wpindahCopter <= 0) {
wpindahCopter = 0;
}
soldier.damage = 10;
soldier.range = 600;
soldier.speed = 1.5;
soldier.tipeSenjata = 'range';
} else {
if (pilihSoldier == 7) {
--wpindahMonbot;
if (wpindahMonbot <= 0) {
wpindahMonbot = 0;
}
soldier.damage = 50;
soldier.range = 50;
soldier.speed = 1.25;
soldier.tipeSenjata = 'melee';
}
}
}
}
}
}
}
if (_root['rangerAktif' + keKota] == true) {
soldier.range *= 2;
}
if (_root['tirelessAktif' + keKota] == true) {
soldier.damage *= 2;
}
if (_root['armorPlusAktif' + keKota] == true) {
soldier.nyawa *= 2;
}
if (_root['speedPlusAktif' + keKota] == true) {
soldier.speed *= 2;
}
_root['pasukan' + xdalamSoldier]._visible = true;
_root['pasukan' + xdalamSoldier].gotoAndStop(pilihSoldier);
_root['pasukan' + xdalamSoldier].jumlah = soldier.nyawa;
soldier.kebal = false;
soldier.invis = false;
soldier.special = false;
if (indi2 == 'duplikat') {
soldier.iniDuplikasi = true;
soldier.duplikasi = true;
} else {
soldier.iniDuplikasi = false;
soldier.duplikasi = false;
}
soldier.nomorJagoan = xdalamSoldier;
soldier.jenis = pilihSoldier;
soldier.damage *= 0.02;
pilihTargetMusuh(soldier);
soldier.onEnterFrame = enterSoldier;
if (pilihSoldier >= 5) {
--battle_mc.pasukan_mc['jumlah' + pilihSoldier];
} else {
battle_mc.pasukan_mc['jumlah' + pilihSoldier] -= nilaiSoldier;
if (battle_mc.pasukan_mc['jumlah' + pilihSoldier] <= 0) {
battle_mc.pasukan_mc['jumlah' + pilihSoldier] = 0;
}
}
buatKotak(false);
} else {
cekInfo('Can\'t unleash another units, maximum soldiers on the field reached');
}
}
function klikSoldierJadi() {
if (mulaiBattle == false) {
if (this.jenis == 1) {
wpindahBareman += Number(this.nyawa);
} else {
if (this.jenis == 2) {
wpindahSwordman += Number(this.nyawa);
} else {
if (this.jenis == 3) {
wpindahArrowman += Number(this.nyawa);
} else {
if (this.jenis == 4) {
wpindahSpearman += Number(this.nyawa);
} else {
if (this.jenis == 5) {
++wpindahTank;
} else {
if (this.jenis == 6) {
++wpindahCopter;
soldier.tipeSenjata = 'melee';
} else {
if (this.jenis == 7) {
++wpindahMonbot;
}
}
}
}
}
}
}
battle_mc.pasukan_mc.jumlah1 = wpindahBareman;
battle_mc.pasukan_mc.jumlah2 = wpindahSwordman;
battle_mc.pasukan_mc.jumlah3 = wpindahArrowman;
battle_mc.pasukan_mc.jumlah4 = wpindahSpearman;
battle_mc.pasukan_mc.jumlah5 = wpindahTank;
battle_mc.pasukan_mc.jumlah6 = wpindahCopter;
battle_mc.pasukan_mc.jumlah7 = wpindahMonbot;
removeMovieClip(this);
}
}
function pilihTargetMusuh(indi) {
pilihanMusuh = 0;
arrayKeMusuh = new Array();
i = 50;
while (i <= 85) {
if (_root['musuh_mc' + i] != undefined) {
if (_root['musuh_mc' + i].nyawa > 0) {
arrayKeMusuh[pilihanMusuh] = i;
++pilihanMusuh;
}
}
++i;
}
if (pilihanMusuh > 0) {
randMusuh = random(pilihanMusuh);
indi.xtarget = _root['musuh_mc' + arrayKeMusuh[randMusuh]];
} else {
indi.gotoAndStop(1);
}
}
function enterSoldier() {
if (sedangPause == false) {
this._x += geserKiri;
if (mulaiBattle == true) {
if (this.kebal == true) {
i = 100;
while (i <= 110) {
this['efekKebal' + i]._visible = true;
++i;
}
if (this.awalKebal >= this.akhirKebal) {
this.kebal = false;
} else {
++this.awalKebal;
}
} else {
i = 100;
while (i <= 110) {
this['efekKebal' + i]._visible = false;
++i;
}
}
if (this.invis == true) {
this._alpha = 30;
i = 100;
while (i <= 110) {
this['efekInvis' + i]._visible = true;
++i;
}
if (this.awalInvis >= this.akhirInvis) {
this.invis = false;
} else {
++this.awalInvis;
}
} else {
this._alpha = 100;
i = 100;
while (i <= 110) {
this['efekInvis' + i]._visible = false;
++i;
}
}
if (this.special == true) {
i = 100;
while (i <= 110) {
this['efekSpecial' + i]._visible = true;
++i;
}
if (this.awalSpecial >= this.akhirSpecial) {
this.special = false;
} else {
++this.awalSpecial;
}
} else {
i = 100;
while (i <= 110) {
this['efekSpecial' + i]._visible = false;
++i;
}
}
if (this.nyawa <= 0) {
this.nyawa = 0;
if (this._currentframe != 4) {
if (this.iniDuplikasi == false) {
if (this.jenis == 5) {
++xpindahTank;
} else {
if (this.jenis == 6) {
++xpindahCopter;
} else {
if (this.jenis == 7) {
++xpindahMonbot;
}
}
}
}
i = 100;
while (i <= 200) {
this['panah_mc' + i]._visible = false;
++i;
}
--jumlahJagoan;
if (jumlahJagoan <= 0) {
cekKalah();
}
this.gotoAndStop(4);
}
} else {
if (this.xtarget.nyawa == undefined || this.xtarget.nyawa <= 0) {
pilihTargetMusuh(this);
} else {
if (this._x <= this.xtarget._x) {
this.anim._xscale = this.scaleAwal;
} else {
this.anim._xscale = -this.scaleAwal;
}
this.jarak = Math.sqrt(Math.pow(this._x - this.xtarget._x, 2) + Math.pow(this._y - this.xtarget._y, 2));
if (this.jarak <= this.range) {
this.serang = true;
} else {
this.serang = false;
}
if (this.serang == true) {
this.gotoAndStop(3);
} else {
this.gotoAndStop(2);
deltaX = this._x - this.xtarget._x;
deltaY = this._y - this.xtarget._y;
angle = -Math.atan2(deltaX, deltaY) / 0.0174532925199433;
if (Math.sqrt(deltaX * deltaX + deltaY * deltaY) > this.speed * speedBattle) {
this._y -= this.speed * speedBattle * Math.cos(angle * 0.0174532925199433);
this._x += this.speed * speedBattle * Math.sin(angle * 0.0174532925199433);
}
}
}
}
}
}
this.jumlah = Math.ceil(this.nyawa);
if (this.nyawa <= 0) {
_root['pasukan' + this.nomorJagoan].jumlah = this.jumlah;
_root['pasukan' + this.nomorJagoan]._visible = false;
} else {
_root['pasukan' + this.nomorJagoan].jumlah = this.jumlah;
_root['pasukan' + this.nomorJagoan]._visible = true;
}
if (this.jenis == 6) {
this.swapDepths(100 + this._x + this._y * 200);
} else {
this.swapDepths(100 + this._x + this._y * 100);
}
}
function cekSerangJagoan(indi) {
if (indi.special == true) {
efekSpecialJagoan(indi.xtarget);
}
if (indi.jenis == 7) {
cekGetarBumi();
} else {
if (indi.jenis == 5 || indi.jenis == 6) {
cekEfekLedakan(indi.xtarget);
}
}
if (indi.jenis == 3) {
buatPanah(indi);
} else {
indi.xtarget.nyawa -= indi.damage;
}
indi.xtarget.xtarget = indi;
}
function efekSpecialJagoan(indi) {
i = 1;
while (i <= 2) {
if (indi != undefined) {
efek = attachMovie('efekApi2', 'api_mc' + dalamSpell, dalamSpell);
efek._x = indi._x + random(150) - 75;
efek._y = indi._y - 50 + random(150) - 75;
efek._xscale = 25 + random(25);
efek._yscale = 25 + random(25);
efek.gotoAndPlay(random(5) + 1);
efek.onEnterFrame = enterEfekApi;
++dalamSpell;
if (dalamSpell >= 301000) {
dalamSpell = 300000;
}
}
++i;
}
if (indi != undefined) {
efek = attachMovie('efekLedakan', 'spell_mc' + dalamSpell, dalamSpell);
efek._x = indi._x;
efek._y = indi._y - 50;
efek._xscale = 75;
efek._yscale = 75;
efek.onEnterFrame = enterEfekApi;
++dalamSpell;
if (dalamSpell >= 301000) {
dalamSpell = 300000;
}
}
}
function cekEfekLedakan(indi) {
if (indi != undefined) {
efek = attachMovie('efekLedakan', 'spell_mc' + dalamSpell, dalamSpell);
efek._x = indi._x;
efek._y = indi._y - 50;
efek._xscale = 75;
efek._yscale = 75;
efek.onEnterFrame = enterEfekApi;
++dalamSpell;
if (dalamSpell >= 301000) {
dalamSpell = 300000;
}
}
}
function cekGetarBumi() {
if (getarBumi == false) {
cekNormalY('awal');
getarKe = 1;
getarBumi = true;
}
}
function buatPanah(indi) {
peluru = attachMovie('panah_mc', 'peluru_mc' + dalamPeluru, dalamPeluru);
peluru._x = indi._x;
peluru._y = indi._y - 25;
peluru._yscale = 80;
peluru._xscale = 80;
peluru.speed = 25;
peluru.arahTembak = 35;
peluru.xtarget = indi.xtarget;
peluru.tujuanX = indi.xtarget._x;
peluru.tujuanY = indi.xtarget._y;
peluru.indi = indi;
peluru.onEnterFrame = enterPanah;
++dalamPeluru;
if (dalamPeluru >= 200) {
dalamPeluru = 100;
}
}
function enterPanah() {
if (sedangPause == false) {
this._x += geserKiri;
this._x += geserKiri;
if (this.xtarget.nyawa == undefined) {
deltaX = this._x - this.tujuanX;
deltaY = this._y - this.tujuanY;
angle = -Math.atan2(deltaX, deltaY) / 0.0174532925199433;
this._rotation = angle;
if (Math.sqrt(deltaX * deltaX + deltaY * deltaY) > this.speed) {
this.speed += 0.5;
this._y -= this.speed * Math.cos(angle * 0.0174532925199433);
this._x += this.speed * Math.sin(angle * 0.0174532925199433);
} else {
removeMovieClip(this);
}
} else {
deltaX = this._x - this.xtarget._x;
deltaY = this._y - this.xtarget._y + this.arahTembak;
angle = -Math.atan2(deltaX, deltaY) / 0.0174532925199433;
this._rotation = angle;
if (Math.sqrt(deltaX * deltaX + deltaY * deltaY) > this.speed) {
this.speed += 0.5;
this._y -= this.speed * Math.cos(angle * 0.0174532925199433);
this._x += this.speed * Math.sin(angle * 0.0174532925199433);
} else {
this.xtarget.nyawa -= this.indi.damage;
if (this.xtarget.nyawa > 0) {
this.xtarget.attachMovie('panah_mc', 'panah_mc' + dalamPeluru, dalamPeluru);
this.xtarget['panah_mc' + dalamPeluru].gotoAndStop(2);
this.xtarget['panah_mc' + dalamPeluru]._x = -65 + random(15) + 7;
this.xtarget['panah_mc' + dalamPeluru]._y = -35 + random(15) + 7;
this.xtarget['panah_mc' + dalamPeluru]._rotation = this._rotation - random(15) + 7;
this.xtarget['panah_mc' + dalamPeluru]._xscale = this._xscale;
this.xtarget['panah_mc' + dalamPeluru]._yscale = this._yscale;
++dalamPeluru;
if (dalamPeluru >= 200) {
dalamPeluru = 100;
}
}
removeMovieClip(this);
}
}
}
this.swapDepths(100 + this._x + this._y * 100);
}
function resetUnit() {
i = 1;
while (i <= maximumJagoan) {
removeMovieClip(_root['jagoan_mc' + i]);
++i;
}
jumlahJagoan = 0;
initBattle();
battle_mc.pasukan_mc.gotoAndStop(1);
cekPasukanBuat();
buatKotak(false);
}
function cekPause(indi) {
if (indi == true) {
sedangDragWeapon = false;
sedangDragSpell = false;
sedangDragSpell2 = false;
removeMovieClip(drag_mc2);
buatKotak(false);
}
if (indi == true) {
battle_mc.soldier_mc.enabled = false;
battle_mc.vehicle_mc.enabled = false;
battle_mc.weapon_mc.enabled = false;
battle_mc.spell_mc.enabled = false;
battle_mc.retreat_btn.enabled = false;
battle_mc.defense_mc.enabled = false;
i = 1;
while (i <= 23) {
battle_mc.pasukan_mc['unit' + i].enabled = false;
++i;
}
i = 50;
while (i <= 85) {
_root['musuh_mc' + i].anim.stop();
++i;
}
i = 1;
while (i <= maximumJagoan) {
_root['jagoan_mc' + i].anim.stop();
++i;
}
} else {
if (indi == false) {
battle_mc.soldier_mc.enabled = true;
battle_mc.vehicle_mc.enabled = true;
battle_mc.weapon_mc.enabled = true;
battle_mc.spell_mc.enabled = true;
battle_mc.retreat_btn.enabled = true;
battle_mc.defense_mc.enabled = true;
i = 1;
while (i <= 23) {
battle_mc.pasukan_mc['unit' + i].enabled = true;
++i;
}
i = 50;
while (i <= 85) {
_root['musuh_mc' + i].anim.play();
++i;
}
i = 1;
while (i <= maximumJagoan) {
_root['jagoan_mc' + i].anim.play();
++i;
}
}
}
}
function jagoanLari() {
this._x += geserKiri;
this._x -= this.speed * 4;
this.gotoAndStop(2);
this.anim._xscale = -this.scaleAwal;
this.swapDepths(100 + this._x + this._y * 100);
}
function clearSemua2() {
delete myListener.onKeyDown;
delete myListener.onKeyUp;
Key.removeListener(myListener);
delete _root.onEnterFrame;
delete _root.onMouseDown;
delete _root.onMouseMove;
removeMovieClip(drag_mc);
removeMovieClip(drag_mc2);
removeMovieClip(pause_mc);
i = 50;
while (i <= 85) {
removeMovieClip(_root['musuh_mc' + i]);
++i;
}
i = 1;
while (i <= maximumJagoan) {
removeMovieClip(_root['jagoan_mc' + i]);
++i;
}
i = 100;
while (i <= 200) {
removeMovieClip(_root['peluru_mc' + i]);
++i;
}
i = 200;
while (i <= 300) {
removeMovieClip(_root['weapon_mc' + i]);
++i;
}
i = 300000;
while (i <= 301000) {
removeMovieClip(_root['spell_mc' + i]);
++i;
}
dalamLingkar = 1;
i = 1;
while (i <= 3) {
j = 1;
while (j <= 6) {
removeMovieClip(_root['lingkar_mc' + i + j]);
++dalamLingkar;
++j;
}
++i;
}
}
function cekKalah() {
if (sudahSelesai == false) {
sudahSelesai = true;
i = 50;
while (i <= 85) {
_root['musuh_mc' + i].gotoAndStop(1);
++i;
}
menangBattle = false;
idLanjut = setInterval(lanjutMain, 2000);
}
}
function cekMenang() {
if (sudahSelesai == false) {
sudahSelesai = true;
i = 1;
while (i <= maximumJagoan) {
_root['jagoan_mc' + i].gotoAndStop(1);
++i;
}
menangBattle = true;
idLanjut = setInterval(lanjutMain, 2000);
}
}
function lanjutMain() {
clearSemua2();
clearInterval(idLanjut);
if (xpindahBareman >= pindahBareman) {
xpindahBareman = pindahBareman;
}
if (xpindahSwordman >= pindahSwordman) {
xpindahSwordman = pindahSwordman;
}
if (xpindahArrowman >= pindahArrowman) {
xpindahArrowman = pindahArrowman;
}
if (xpindahSpearman >= pindahSpearman) {
xpindahSpearman = pindahSpearman;
}
if (xpindahTank >= pindahTank) {
xpindahTank = pindahTank;
}
if (xpindahCopter >= pindahCopter) {
xpindahCopter = pindahCopter;
}
if (xpindahMonbot >= pindahMonbot) {
xpindahMonbot = pindahMonbot;
}
xpindahBareman = Math.floor(xpindahBareman);
xpindahSwordman = Math.floor(xpindahSwordman);
xpindahArrowman = Math.floor(xpindahArrowman);
xpindahSpearman = Math.floor(xpindahSpearman);
xpindahTank = Math.floor(xpindahTank);
xpindahCopter = Math.floor(xpindahCopter);
xpindahMonbot = Math.floor(xpindahMonbot);
if (menangBattle == true) {
kondisiPreview = 'tengah';
} else {
kondisiPreview = 'akhir';
}
gotoAndStop(770);
}
function cekSpeed() {
if (speedBattle == 1) {
battle_mc.speed_mc.gotoAndStop(1);
} else {
if (speedBattle == 2) {
battle_mc.speed_mc.gotoAndStop(2);
}
}
}
stop();
if (sedangTutorial == true) {
cekTutorial(42);
}
tipeAttackMusuh = 'attack';
backBattle1();
initAwalBattle();
initBattle();
buatBackground();
buatMusuh();
cekJumlahTankMusuh();
_root.onEnterFrame = function () {
if (sedangPause == false) {
if (_root._xmouse <= 10 || geserKeKiri == true) {
if (background_mc._x <= -20) {
geserKiri = 10 * speedBattle;
} else {
geserKiri = 0;
}
} else {
if (_root._xmouse >= 790 || geserKeKanan == true) {
if (background_mc._x >= -780) {
geserKiri = -10 * speedBattle;
} else {
geserKiri = 0;
}
} else {
geserKiri = 0;
}
}
background_mc._x += geserKiri;
if (getarBumi == true) {
if (getarKe == 1) {
cekGeserX(5);
cekGeserY(5);
++getarKe;
} else {
if (getarKe == 2) {
cekGeserX(-10);
cekGeserY(-10);
++getarKe;
} else {
if (getarKe == 3) {
cekGeserX(5);
cekGeserY(-5);
++getarKe;
} else {
if (getarKe == 4) {
cekGeserX(-5);
cekGeserY(5);
++getarKe;
} else {
if (getarKe == 5) {
cekGeserX(7);
cekGeserY(7);
++getarKe;
} else {
if (getarKe == 6) {
cekGeserX(10);
cekGeserY(-10);
++getarKe;
} else {
if (getarKe == 7) {
cekGeserX(-12);
cekGeserY(7);
++getarKe;
} else {
if (getarKe == 8) {
cekGeserX(5);
cekGeserY(5);
++getarKe;
} else {
if (getarKe == 9) {
cekGeserX(-10);
cekGeserY(-10);
++getarKe;
} else {
if (getarKe == 10) {
cekGeserX(5);
cekGeserY(-5);
++getarKe;
} else {
if (getarKe == 11) {
cekGeserX(-5);
cekGeserY(5);
++getarKe;
} else {
if (getarKe == 12) {
cekGeserX(7);
cekGeserY(7);
++getarKe;
} else {
if (getarKe == 13) {
cekGeserX(10);
cekGeserY(-10);
++getarKe;
} else {
if (getarKe == 14) {
cekGeserX(-12);
cekGeserY(7);
++getarKe;
} else {
cekNormalY('akhir');
getarBumi = false;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
if (mulaiBattle == true) {
adaMati1 = false;
adaMati2 = false;
adaMati3 = false;
adaMati4 = false;
adaMati5 = false;
adaMati6 = false;
adaMati7 = false;
i = 1;
while (i <= 3) {
j = 1;
while (j <= 6) {
if (_root['yangIsi' + i + j].nyawa <= 0) {
_root['adaMati' + _root['jenisIsi' + i + j]] = true;
}
++j;
}
++i;
}
i = 1;
while (i <= 7) {
if (_root['adaMati' + i] == true) {
battle_mc.pasukan_mc['unit' + i].gotoAndStop(1);
battle_mc.pasukan_mc['unit' + i].enabled = true;
} else {
battle_mc.pasukan_mc['unit' + i].gotoAndStop(2);
battle_mc.pasukan_mc['unit' + i].enabled = false;
}
++i;
}
}
}
if (battle_mc.pasukan_mc.jumlah11 <= 0) {
battle_mc.pasukan_mc.jumlah11 = 0;
}
if (battle_mc.pasukan_mc.jumlah12 <= 0) {
battle_mc.pasukan_mc.jumlah12 = 0;
}
if (battle_mc.pasukan_mc.jumlah13 <= 0) {
battle_mc.pasukan_mc.jumlah13 = 0;
}
if (battle_mc.pasukan_mc.jumlah14 <= 0) {
battle_mc.pasukan_mc.jumlah14 = 0;
}
if (battle_mc.pasukan_mc.jumlah15 <= 0) {
battle_mc.pasukan_mc.jumlah15 = 0;
}
if (battle_mc.pasukan_mc.jumlah16 <= 0) {
battle_mc.pasukan_mc.jumlah16 = 0;
}
if (battle_mc.pasukan_mc.jumlah17 <= 0) {
battle_mc.pasukan_mc.jumlah17 = 0;
}
if (battle_mc.pasukan_mc.jumlah18 <= 0) {
battle_mc.pasukan_mc.jumlah18 = 0;
}
};
battle_mc.soldier_mc.onRelease = function () {
sedangDragWeapon = false;
sedangDragSpell = false;
removeMovieClip(drag_mc2);
buatKotak(false);
battle_mc.pasukan_mc.gotoAndStop(1);
cekPasukanBuat();
};
battle_mc.vehicle_mc.onRelease = function () {
sedangDragWeapon = false;
sedangDragSpell = false;
removeMovieClip(drag_mc2);
buatKotak(false);
battle_mc.pasukan_mc.gotoAndStop(2);
cekPasukanBuat();
};
battle_mc.weapon_mc.onRelease = function () {
sedangDragWeapon = false;
sedangDragSpell = false;
removeMovieClip(drag_mc2);
buatKotak(false);
battle_mc.pasukan_mc.gotoAndStop(3);
cekPasukanBuat();
};
battle_mc.spell_mc.onRelease = function () {
sedangDragWeapon = false;
sedangDragSpell = false;
removeMovieClip(drag_mc2);
buatKotak(false);
battle_mc.pasukan_mc.gotoAndStop(4);
cekPasukanBuat();
};
battle_mc.defense_mc.onRelease = function () {
sedangDragWeapon = false;
sedangDragSpell = false;
removeMovieClip(drag_mc2);
buatKotak(false);
battle_mc.pasukan_mc.gotoAndStop(5);
cekPasukanBuat();
};
battle_mc.remove_mc._visible = false;
battle_mc.remove_mc.onRelease = function () {
sedangDragWeapon = false;
sedangDragSpell = false;
removeMovieClip(drag_mc2);
buatKotak(false);
};
battle_mc.pasukan_mc.gotoAndStop(1);
cekPasukanBuat();
_root.onMouseDown = function () {
if (sedangPause == false) {
if (sedangDragWeapon == true) {
if (_root._ymouse >= 200 && _root._ymouse <= 425) {
buatWeapon(_root._ymouse);
sedangDragWeapon = false;
stopDrag();
removeMovieClip(drag_mc2);
}
} else {
if (sedangDragSpell == true) {
if (pilihSpell == 14) {
if (_root._ymouse >= 200 && _root._ymouse <= 475) {
if (getarBumi2 == false) {
getarBumi2 = true;
buatSpell(_root._xmouse, _root._ymouse);
sedangDragSpell = false;
stopDrag();
removeMovieClip(drag_mc2);
}
}
} else {
if (_root._ymouse >= 125 && _root._ymouse <= 475) {
buatSpell(_root._xmouse, _root._ymouse);
sedangDragSpell = false;
stopDrag();
removeMovieClip(drag_mc2);
}
}
}
}
}
};
_root.onMouseMove = function () {
if (sedangDragWeapon == true) {
if (_root._ymouse >= 200 && _root._ymouse <= 425) {
drag_mc2.bisa._visible = false;
} else {
drag_mc2.bisa._visible = true;
}
} else {
if (sedangDragSpell == true) {
if (pilihSpell == 14) {
if (getarBumi2 == true) {
drag_mc2.bisa._visible = true;
} else {
if (_root._ymouse >= 200 && _root._ymouse <= 475) {
drag_mc2.bisa._visible = false;
} else {
drag_mc2.bisa._visible = true;
}
}
} else {
if (_root._ymouse >= 125 && _root._ymouse <= 475) {
drag_mc2.bisa._visible = false;
} else {
drag_mc2.bisa._visible = true;
}
}
}
}
};
battle_mc.reset_btn.onRelease = function () {
resetUnit();
};
battle_mc.auto_btn.onRelease = function () {
resetUnit();
bykPasukanBuat = 17;
xposJagoanKiniX = new Array();
xposJagoanKiniY = new Array();
posJagoanKini = new Array('11', '12', '13', '21', '22', '23', '31', '32', '33', '41', '42', '43', '51', '52', '53', '61', '62', '63');
i = 0;
while (i <= 5) {
ambilKe = random(posJagoanKini.length);
keAmbil = posJagoanKini[ambilKe];
myStr = new String(posJagoanKini[ambilKe]);
indi = myStr.substr(myStr.length - 1, 1);
if (indi == '3') {
posJagoanKini[ambilKe] = null;
posJagoanKini.sort();
posJagoanKini.pop();
posJagoanKini[ambilKe - 1] = null;
posJagoanKini.sort();
posJagoanKini.pop();
posJagoanKini[ambilKe - 2] = null;
posJagoanKini.sort();
posJagoanKini.pop();
} else {
if (indi == '2') {
posJagoanKini[ambilKe] = null;
posJagoanKini.sort();
posJagoanKini.pop();
posJagoanKini[ambilKe] = null;
posJagoanKini.sort();
posJagoanKini.pop();
posJagoanKini[ambilKe - 1] = null;
posJagoanKini.sort();
posJagoanKini.pop();
} else {
if (indi == '1') {
posJagoanKini[ambilKe] = null;
posJagoanKini.sort();
posJagoanKini.pop();
posJagoanKini[ambilKe] = null;
posJagoanKini.sort();
posJagoanKini.pop();
posJagoanKini[ambilKe] = null;
posJagoanKini.sort();
posJagoanKini.pop();
}
}
}
myStr2 = new String(keAmbil);
xposJagoanKiniX[i] = Number(myStr2.substr(myStr2.length - 1, 1));
xposJagoanKiniY[i] = Number(myStr2.substr(myStr2.length - 2, 1));
++i;
}
z = 0;
while (z <= 5) {
if (wpindahMonbot > 0) {
--bykPasukanBuat;
pilihSoldier = 7;
cekSoldierBuat('auto');
} else {
if (wpindahCopter > 0) {
--bykPasukanBuat;
pilihSoldier = 6;
cekSoldierBuat('auto');
} else {
if (wpindahTank > 0) {
--bykPasukanBuat;
pilihSoldier = 5;
cekSoldierBuat('auto');
}
}
}
++z;
}
posJagoanKini = new Array('11', '12', '13', '21', '22', '23', '31', '32', '33', '41', '42', '43', '51', '52', '53', '61', '62', '63');
i = 1;
while (i <= 17) {
myStr = new String(posJagoanKini[i]);
posX = Number(myStr.substr(myStr.length - 1, 1));
posY = Number(myStr.substr(myStr.length - 2, 1));
if (_root['sudahLingkar' + posX + posY] == true) {
posJagoanKini[i] = null;
posJagoanKini.sort();
posJagoanKini.pop();
}
++i;
}
xposJagoanKiniX = new Array();
xposJagoanKiniY = new Array();
i = 0;
while (i <= bykPasukanBuat) {
ambilKe = random(posJagoanKini.length);
keAmbil = posJagoanKini[ambilKe];
posJagoanKini[ambilKe] = null;
posJagoanKini.sort();
posJagoanKini.pop();
myStr = new String(keAmbil);
xposJagoanKiniX[i] = Number(myStr.substr(myStr.length - 1, 1));
xposJagoanKiniY[i] = Number(myStr.substr(myStr.length - 2, 1));
++i;
}
z = 0;
while (z <= bykPasukanBuat) {
if (wpindahSpearman > 0) {
pilihSoldier = 4;
cekSoldierBuat('auto');
} else {
if (wpindahArrowman > 0) {
pilihSoldier = 3;
cekSoldierBuat('auto');
} else {
if (wpindahSwordman > 0) {
pilihSoldier = 2;
cekSoldierBuat('auto');
} else {
if (wpindahBareman > 0) {
pilihSoldier = 1;
cekSoldierBuat('auto');
}
}
}
}
++z;
}
};
battle_mc.pause_btn._visible = false;
battle_mc.start_btn.onRelease = function () {
if (jumlahJagoan > 0) {
battle_mc.pause_btn._visible = true;
mulaiBattle = true;
z = 50;
while (z <= dalamMusuh) {
pilihTargetJagoan(_root['musuh_mc' + z]);
++z;
}
i = 1;
while (i <= 3) {
j = 1;
while (j <= 6) {
_root['sudahLingkar' + i + j] = false;
++j;
}
++i;
}
i = 1;
while (i <= maximumJagoan) {
delete _root['jagoan_mc' + i].onRelease;
++i;
}
battle_mc.start_btn._visible = false;
battle_mc.reset_btn._visible = false;
battle_mc.auto_btn._visible = false;
cekPasukanBuat();
if (sedangTutorial == true) {
cekTutorial(43);
}
} else {
cekInfo('Please place at least one units on the battlefield or click auto button');
}
};
if (sedangTutorial == true) {
battle_mc.retreat_btn._visible = false;
} else {
battle_mc.retreat_btn._visible = true;
}
battle_mc.retreat_btn.onRelease = function () {
battle_mc.retreat_btn._visible = false;
i = 1;
while (i <= maximumJagoan) {
_root['jagoan_mc' + i].onEnterFrame = jagoanLari;
++i;
}
cekKalah();
};
battle_mc.pause_btn.onRelease = function () {
if (sedangPause == false) {
pause_mc = attachMovie('pause_mc', 'pause_mc', 1199905);
pause_mc._x = 400;
pause_mc._y = 300;
sedangPause = true;
} else {
removeMovieClip(pause_mc);
sedangPause = false;
}
cekPause(sedangPause);
};
cekSpeed();
battle_mc.speed_mc.onRelease = function () {
if (speedBattle == 1) {
speedBattle = 2;
} else {
if (speedBattle == 2) {
speedBattle = 1;
}
}
cekSpeed();
};
geserKeKiri = false;
geserKeKanan = false;
myListener = new Object();
myListener.onKeyDown = function () {
if (Key.getCode() == 65 || Key.getCode() == 37) {
geserKeKiri = true;
}
if (Key.getCode() == 68 || Key.getCode() == 39) {
geserKeKanan = true;
}
};
myListener.onKeyUp = function () {
if (Key.getCode() == 65 || Key.getCode() == 37) {
geserKeKiri = false;
}
if (Key.getCode() == 68 || Key.getCode() == 39) {
geserKeKanan = false;
}
};
Key.addListener(myListener);
}
movieClip 2794 {
}
movieClip 2800 {
}
movieClip 2805 {
}
movieClip 2810 {
}
movieClip 2811 {
frame 1 {
stop();
}
}
movieClip 2819 {
frame 1 {
stop();
}
}
movieClip 2823 {
frame 1 {
stop();
}
}
movieClip 2827 {
frame 1 {
stop();
}
}
movieClip 2831 {
frame 1 {
stop();
}
}
movieClip 2832 {
frame 1 {
stop();
}
}
movieClip 2833 {
frame 1 {
stop();
}
}
movieClip 2834 {
frame 1 {
stop();
}
}
movieClip 2835 {
frame 1 {
stop();
}
}
movieClip 2841 {
frame 1 {
stop();
}
}
movieClip 2843 {
frame 1 {
stop();
}
}
movieClip 2845 {
frame 1 {
stop();
}
}
movieClip 2849 {
}
movieClip 2850 {
}
movieClip 2851 {
}
movieClip 2856 {
}
movieClip 2857 {
}
movieClip 2858 {
}
movieClip 2860 {
}
movieClip 2863 {
}
movieClip 2865 {
}
movieClip 2867 {
}
movieClip 2869 {
}
movieClip 2879 {
}
movieClip 2881 {
}
movieClip 2882 {
}
movieClip 2884 {
}
movieClip 2885 {
}
movieClip 2891 {
frame 1 {
stop();
}
}
movieClip 2913 {
frame 1 {
stop();
}
}
movieClip 2914 {
}
movieClip 2922 {
frame 1 {
stop();
}
}
frame 901 {
function initBattle() {
dalamBenteng = 75;
delayMusuhKeluar = 0;
geserKiri = 0;
dalamDrag = 200000;
dalamSpell = 300000;
dalamSoldier = 1;
dalamWeapon = 200;
dalamPeluru = 100;
dalamEfekJagoan = 100;
dalamMusuh = 50;
dalamMusuh2 = 25;
if (xday <= 100) {
nilaiSoldier = 20;
} else {
if (xday <= 200) {
nilaiSoldier = 25;
} else {
if (xday <= 300) {
nilaiSoldier = 30;
} else {
if (xday <= 400) {
nilaiSoldier = 35;
} else {
if (xday <= 500) {
nilaiSoldier = 40;
} else {
if (xday <= 600) {
nilaiSoldier = 45;
} else {
nilaiSoldier = 50;
}
}
}
}
}
}
if (sedangTutorial == true) {
nilaiSoldier = 10;
}
maximumJagoan = 29;
kiniVehicle = 0;
getarBumi = false;
getarBumi2 = false;
mulaiBattle = true;
sudahSelesai = false;
sedangDragWeapon = false;
sedangDragSpell = false;
sedangDragSpell2 = false;
adaSerangBase = false;
sedangPause = false;
musuhSpell = 0;
maxMusuhSpell = 200;
jumlahMusuh = 0;
totalMusuh = 0;
wpindahBareman = pindahBareman - xpindahBareman;
wpindahSwordman = pindahSwordman - xpindahSwordman;
wpindahArrowman = pindahArrowman - xpindahArrowman;
wpindahSpearman = pindahSpearman - xpindahSpearman;
wpindahTank = pindahTank - xpindahTank;
wpindahCopter = pindahCopter - xpindahCopter;
wpindahMonbot = pindahMonbot - xpindahMonbot;
wpindahArrowTrap = pindahArrowTrap - xpindahArrowTrap;
wpindahCatapult = pindahCatapult - xpindahCatapult;
wpindahFireTrap = pindahFireTrap - xpindahFireTrap;
wpindahArrowRain = pindahArrowRain - xpindahArrowRain;
wpindahMeteorid = pindahMeteorid - xpindahMeteorid;
wpindahAcidRain = pindahAcidRain - xpindahAcidRain;
wpindahEarthquake = pindahEarthquake - xpindahEarthquake;
wpindahImmune = pindahImmune - xpindahImmune;
wpindahInvisible = pindahInvisible - xpindahInvisible;
wpindahSpecialAttack = pindahSpecialAttack - xpindahSpecialAttack;
wpindahDuplicate = pindahDuplicate - xpindahDuplicate;
if (xday <= 100) {
nyawaBenteng = 500;
maxMusuh = 20 + random(5);
maxMusuhKeluar = 60;
defenseKita = 3;
} else {
if (xday <= 200) {
nyawaBenteng = 1000;
maxMusuh = 25 + random(5);
maxMusuhKeluar = 55;
defenseKita = 4;
} else {
if (xday <= 300) {
nyawaBenteng = 1500;
maxMusuh = 30 + random(5);
maxMusuhKeluar = 50;
defenseKita = 5;
} else {
if (xday <= 400) {
nyawaBenteng = 2000;
maxMusuh = 35 + random(5);
maxMusuhKeluar = 45;
defenseKita = 6;
} else {
if (xday <= 500) {
nyawaBenteng = 2500;
maxMusuh = 40 + random(5);
maxMusuhKeluar = 40;
defenseKita = 7;
} else {
if (xday <= 600) {
nyawaBenteng = 3000;
maxMusuh = 45 + random(5);
maxMusuhKeluar = 30;
defenseKita = 8;
} else {
if (xday <= 700) {
nyawaBenteng = 3500;
maxMusuh = 50 + random(5);
maxMusuhKeluar = 25;
defenseKita = 9;
} else {
nyawaBenteng = 4000;
maxMusuh = 55 + random(5);
maxMusuhKeluar = 20;
defenseKita = 10;
}
}
}
}
}
}
}
nyawaBenteng *= 2;
if (kondisiPreview == 'gate1') {
maxMusuh = 50;
nyawaBenteng = 5000;
maxMusuhKeluar = 50;
} else {
if (kondisiPreview == 'gate2') {
maxMusuh = 75;
nyawaBenteng = 7500;
maxMusuhKeluar = 40;
} else {
if (kondisiPreview == 'gate3') {
maxMusuh = 100;
nyawaBenteng = 10000;
maxMusuhKeluar = 30;
} else {
if (kondisiPreview == 'gate4') {
maxMusuh = 125;
nyawaBenteng = 12500;
maxMusuhKeluar = 20;
}
}
}
}
nyawaBenteng *= 2;
if (siapaYangNyerang == 0) {
maxMusuhKeluar *= 2;
}
defenseKita = 1;
if (sedangTutorial == true) {
nyawaBenteng *= 0.5;
maxMusuhKeluar *= 0.75;
maxMusuhKeluar2 = maxMusuhKeluar * 0.5;
} else {
maxMusuhKeluar *= 0.5;
maxMusuhKeluar2 = maxMusuhKeluar * 0.25;
}
maxMusuh *= 2.5;
maxMusuh = Math.ceil(maxMusuh);
totalMusuh = maxMusuh;
}
function buatBenteng() {
if (siapaYangNyerang == 2) {
benteng = attachMovie('bentengHuman', 'benteng_mc', dalamBenteng);
} else {
benteng = attachMovie('bentengBarbar', 'benteng_mc', dalamBenteng);
}
benteng.cacheAsBitmap = true;
benteng._x = background_mc._x + 3000;
benteng._y = 475;
posAwalBentengY = benteng._y;
benteng.onEnterFrame = enterBenteng;
}
function enterBenteng() {
if (sedangPause == false) {
this._x += geserKiri;
if (nyawaBenteng <= 0) {
totalMusuh = 0;
nyawaBenteng = 0;
cekMenang();
}
}
this.jumlah = Math.ceil(nyawaBenteng);
}
function buatBackground() {
pilihanKota = posBackground[kotaSerang];
if (pilihanKota == 1) {
background_mc.gotoAndStop(1);
} else {
if (pilihanKota == 2) {
background_mc.gotoAndStop(2);
} else {
if (pilihanKota == 3) {
background_mc.gotoAndStop(3);
} else {
if (pilihanKota == 4) {
background_mc.gotoAndStop(4);
}
}
}
}
background_mc.cacheAsBitmap = true;
posAwalBackgroundX = background_mc._x;
posAwalBackgroundY = background_mc._y;
}
function buatGuard() {
if (xday <= 100) {
musuhNyawa = 20;
} else {
if (xday <= 200) {
musuhNyawa = 25;
} else {
if (xday <= 300) {
musuhNyawa = 30;
} else {
if (xday <= 400) {
musuhNyawa = 35;
} else {
if (xday <= 500) {
musuhNyawa = 40;
} else {
if (xday <= 600) {
musuhNyawa = 45;
} else {
if (xday <= 700) {
musuhNyawa = 50;
} else {
musuhNyawa = 55;
}
}
}
}
}
}
}
if (kondisiPreview == 'gate1') {
musuhNyawa = 100;
} else {
if (kondisiPreview == 'gate2') {
musuhNyawa = 150;
} else {
if (kondisiPreview == 'gate3') {
musuhNyawa = 200;
} else {
if (kondisiPreview == 'gate4') {
musuhNyawa = 250;
}
}
}
}
i = 1;
while (i <= 3) {
pilihMusuh = 2;
musuh = attachMovie('musuh' + pilihMusuh, 'musuh_mc' + dalamMusuh, dalamMusuh + i);
musuh.cacheAsBitmap = true;
musuh._x = benteng_mc._x + 30 - 32 * i;
musuh._y = benteng_mc._y - 175;
musuh.jenis = pilihMusuh;
if (pilihMusuh == 2) {
musuh.nyawa = musuhNyawa + random(5);
musuh.scaleAwal = 100;
musuh.range = 850;
musuh.range2 = 850;
musuh.speed = 0;
musuh.speed2 = 0;
musuh.damage = 3;
}
musuh.special = false;
musuh.duplikasi = false;
musuh.nyawa *= 2;
musuh.guard = true;
musuh.kenaApi = false;
musuh.onEnterFrame = enterMusuh;
++dalamMusuh;
if (dalamMusuh >= 85) {
dalamMusuh = 50;
}
++i;
}
}
function buatGuard2() {
if (xday <= 100) {
musuhNyawa = 20;
} else {
if (xday <= 200) {
musuhNyawa = 25;
} else {
if (xday <= 300) {
musuhNyawa = 30;
} else {
if (xday <= 400) {
musuhNyawa = 35;
} else {
if (xday <= 500) {
musuhNyawa = 40;
} else {
if (xday <= 600) {
musuhNyawa = 45;
} else {
if (xday <= 700) {
musuhNyawa = 50;
} else {
musuhNyawa = 55;
}
}
}
}
}
}
}
if (kondisiPreview == 'gate1') {
musuhNyawa = 200;
} else {
if (kondisiPreview == 'gate2') {
musuhNyawa = 250;
} else {
if (kondisiPreview == 'gate3') {
musuhNyawa = 300;
} else {
if (kondisiPreview == 'gate4') {
musuhNyawa = 350;
}
}
}
}
musuhNyawa *= 2;
i = 1;
while (i <= 1) {
pilihMusuh = 2;
musuh = attachMovie('weaponMusuh' + pilihMusuh, 'musuh_mc' + dalamMusuh, dalamMusuh + i);
musuh.cacheAsBitmap = true;
musuh._x = benteng_mc._x + 100;
musuh._y = benteng_mc._y - 125;
musuh.jenis = pilihMusuh;
if (pilihMusuh == 2) {
musuh.nyawa = musuhNyawa + random(5);
musuh.scaleAwal = 100;
musuh.range = 850;
musuh.range2 = 850;
musuh.speed = 0;
musuh.speed2 = 0;
musuh.damage = 3;
}
musuh.special = false;
musuh.duplikasi = false;
musuh.nyawa *= 2;
musuh.guard = true;
musuh.kenaApi = false;
musuh.onEnterFrame = enterMusuh;
++dalamMusuh;
if (dalamMusuh >= 85) {
dalamMusuh = 50;
}
++i;
}
}
function cekSerangWeaponMusuh(indi) {
peluru = attachMovie('batu_mc', 'peluru_mc' + dalamPeluru, dalamPeluru);
peluru._x = indi._x;
peluru._y = indi._y - 75;
peluru._yscale = 100;
peluru._xscale = 100;
peluru.jarak = Math.sqrt(Math.pow(indi._x - indi.xtarget._x, 2) + Math.pow(indi._y - indi.xtarget._y, 2));
if (peluru.jarak >= 850) {
peluru.speedX = 15;
} else {
if (peluru.jarak >= 800) {
peluru.speedX = 14;
} else {
if (peluru.jarak >= 750) {
peluru.speedX = 13;
} else {
if (peluru.jarak >= 700) {
peluru.speedX = 12;
} else {
if (peluru.jarak >= 650) {
peluru.speedX = 11;
} else {
if (peluru.jarak >= 600) {
peluru.speedX = 10;
} else {
if (peluru.jarak >= 550) {
peluru.speedX = 9;
} else {
if (peluru.jarak >= 500) {
peluru.speedX = 8;
} else {
if (peluru.jarak >= 450) {
peluru.speedX = 7;
} else {
if (peluru.jarak >= 400) {
peluru.speedX = 6;
} else {
peluru.speedX = 5;
}
}
}
}
}
}
}
}
}
}
peluru.speedX -= 1;
peluru.speedY = 15;
peluru.damage = indi.damage;
peluru.xtarget = indi.xtarget;
peluru.batasBawah = indi._y + 50;
peluru.randBawah = random(50);
peluru.indi = indi;
peluru.onEnterFrame = enterWeaponMusuh3;
++dalamPeluru;
if (dalamPeluru >= 200) {
dalamPeluru = 100;
}
}
function enterWeaponMusuh3() {
if (sedangPause == false) {
this._x += geserKiri;
this._x -= this.speedX;
this._y -= this.speedY;
this.speedY -= 0.5;
this._rotation += 1.5;
i = 1;
while (i <= maximumJagoan) {
if (this.hitTest(_root['jagoan_mc' + i].anim)) {
if (_root['jagoan_mc' + i].nyawa > 0) {
_root['jagoan_mc' + i].nyawa -= this.damage;
if (_root['jagoan_mc' + i].jenis == 1) {
xpindahBareman += this.damage;
} else {
if (_root['jagoan_mc' + i].jenis == 2) {
xpindahSwordman += this.damage;
} else {
if (_root['jagoan_mc' + i].jenis == 3) {
xpindahArrowman += this.damage;
} else {
if (_root['jagoan_mc' + i].jenis == 4) {
xpindahSpearman += this.damage;
}
}
}
}
removeMovieClip(this);
}
}
++i;
}
if (this.speedY <= 0) {
if (this._y >= this.batasBawah + this.randBawah) {
delete this.onEnterFrame;
this.onEnterFrame = enterWeaponx;
}
}
}
}
function buatMusuh() {
if (siapaYangNyerang == 2) {
if (tingkatSulit == 1) {
if (kotaSerang == 21) {
pilihMusuh = 1 + random(4);
} else {
pilihMusuh = 1 + random(3);
}
} else {
if (tingkatSulit == 2) {
if (kotaSerang == 21) {
pilihMusuh = 1 + random(5);
} else {
if (xday <= 500) {
pilihMusuh = 1 + random(3);
} else {
pilihMusuh = 1 + random(4);
}
}
} else {
if (tingkatSulit == 3) {
if (kotaSerang == 21) {
pilihMusuh = 2 + random(4);
} else {
if (xday <= 500) {
pilihMusuh = 1 + random(3);
} else {
pilihMusuh = 1 + random(5);
}
}
}
}
}
if (xday <= 100) {
musuhNyawa = 10;
} else {
if (xday <= 200) {
musuhNyawa = 15;
} else {
if (xday <= 300) {
musuhNyawa = 20;
} else {
if (xday <= 400) {
musuhNyawa = 25;
} else {
if (xday <= 500) {
musuhNyawa = 30;
} else {
if (xday <= 600) {
musuhNyawa = 35;
} else {
if (xday <= 700) {
musuhNyawa = 40;
} else {
musuhNyawa = 45;
}
}
}
}
}
}
}
cekNyawaHuman();
} else {
if (siapaYangNyerang == 0) {
pilihMusuh = 1 + random(2);
if (xday <= 50) {
musuhNyawa = 10;
} else {
if (xday <= 100) {
musuhNyawa = 15;
} else {
if (xday <= 150) {
musuhNyawa = 20;
} else {
if (xday <= 200) {
musuhNyawa = 25;
} else {
if (xday <= 250) {
musuhNyawa = 30;
} else {
if (xday <= 300) {
musuhNyawa = 35;
} else {
if (xday <= 350) {
musuhNyawa = 40;
} else {
if (xday <= 400) {
musuhNyawa = 45;
} else {
if (xday <= 450) {
musuhNyawa = 50;
} else {
if (xday <= 500) {
musuhNyawa = 55;
} else {
if (xday <= 550) {
musuhNyawa = 60;
} else {
if (xday <= 600) {
musuhNyawa = 70;
} else {
if (xday <= 650) {
musuhNyawa = 80;
} else {
if (xday <= 700) {
musuhNyawa = 90;
} else {
if (xday <= 750) {
musuhNyawa = 100;
} else {
if (xday <= 800) {
musuhNyawa = 110;
} else {
if (xday <= 850) {
musuhNyawa = 120;
} else {
if (xday <= 900) {
musuhNyawa = 130;
} else {
if (xday <= 950) {
musuhNyawa = 140;
} else {
musuhNyawa = 150;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
if (tingkatSulit == 3) {
musuhNyawa *= 3;
} else {
if (tingkatSulit == 2) {
musuhNyawa *= 2;
} else {
musuhNyawa *= 1;
}
}
}
}
if (siapaYangNyerang == 0) {
musuhNyawa *= 2;
} else {
musuhNyawa *= pengkalianMusuh;
}
if (totalMusuh > 0) {
bisaBuatMusuh = false;
i = 50;
while (i <= 65) {
if (_root['musuh_mc' + i].nyawa == undefined) {
xdalamMusuh = i;
i = 80;
bisaBuatMusuh = true;
}
++i;
}
if (bisaBuatMusuh == true) {
removeMovieClip(_root['musuh_mc' + xdalamMusuh]);
randKeluarMusuh = random(4) + 1;
if (pilihMusuh >= 4 && maxTankMusuh <= 0) {
pilihMusuh = 1 + random(3);
} else {
if (pilihMusuh >= 4 && maxTankMusuh > 0) {
--maxTankMusuh;
}
}
if (sedangTutorial == true) {
pilihMusuh = 1;
}
++jumlahMusuh;
if (siapaYangNyerang == 0) {
musuh = attachMovie('barbar' + pilihMusuh, 'musuh_mc' + xdalamMusuh, xdalamMusuh + 100);
} else {
if (siapaYangNyerang == 2) {
musuh = attachMovie('musuh' + pilihMusuh, 'musuh_mc' + xdalamMusuh, xdalamMusuh + 100);
}
}
musuh.cacheAsBitmap = true;
musuh._x = background_mc._x + 2750 + 100;
if (pilihMusuh == 5) {
musuh.heli = true;
musuh._y = 210 + 40 * randKeluarMusuh;
} else {
musuh._y = 310 + 40 * randKeluarMusuh;
}
musuh.jenis = pilihMusuh;
randSpeed = random(3);
if (pilihMusuh == 4 || pilihMusuh == 5) {
musuh.nyawa = (musuhNyawa + random(5)) * 10;
musuh.scaleAwal = 100;
musuh.range = 550;
musuh.range2 = 650;
if (randSpeed == 0) {
musuh.speed = 1.5;
} else {
if (randSpeed == 1) {
musuh.speed = 3 + random(2);
} else {
if (randSpeed == 2) {
musuh.speed = 0.5;
}
}
}
musuh.speed2 = musuh.speed * 2;
musuh.damage = 5;
musuh.tipeSenjata = 'range';
} else {
if (pilihMusuh == 2) {
musuh.nyawa = musuhNyawa + random(5);
musuh.scaleAwal = 100;
musuh.range = 450;
musuh.range2 = 550;
if (randSpeed == 0) {
musuh.speed = 1 + random(2);
} else {
if (randSpeed == 1) {
musuh.speed = 1.5;
} else {
if (randSpeed == 2) {
musuh.speed = 2.5 + random(2);
}
}
}
musuh.speed2 = musuh.speed * 4;
musuh.damage = 2;
musuh.tipeSenjata = 'range';
} else {
if (pilihMusuh == 3) {
musuh.nyawa = musuhNyawa + random(5);
musuh.scaleAwal = 100;
musuh.range = 100;
musuh.range2 = 450;
if (randSpeed == 0) {
musuh.speed = 2 + random(2);
} else {
if (randSpeed == 1) {
musuh.speed = 0.5;
} else {
if (randSpeed == 2) {
musuh.speed = 2.5 + random(2);
}
}
}
musuh.speed2 = musuh.speed * 4;
musuh.damage = 3;
musuh.tipeSenjata = 'melee';
} else {
if (sedangTutorial == true) {
musuh.nyawa = 5 + random(5);
} else {
musuh.nyawa = musuhNyawa + random(5);
}
musuh.scaleAwal = 100;
musuh.range = 75;
musuh.range2 = 350;
if (randSpeed == 0) {
musuh.speed = 2 + random(2);
} else {
if (randSpeed == 1) {
musuh.speed = 0.5;
} else {
if (randSpeed == 2) {
musuh.speed = 2.5 + random(2);
}
}
}
musuh.speed2 = musuh.speed * 4;
musuh.damage = 1;
musuh.tipeSenjata = 'melee';
}
}
}
musuh.kenaApi = false;
musuh.onEnterFrame = enterMusuh;
}
}
}
function enterMusuh() {
if (sedangPause == false) {
this._x += geserKiri;
if (sudahSelesai == false) {
if (this.nyawa <= 0) {
this.nyawa = 0;
if (this._currentframe != 4) {
++killMusuh;
--totalMusuh;
if (totalMusuh <= 0) {
nyawaBenteng = 0;
cekMenang();
}
i = 100;
while (i <= 200) {
this['panah_mc' + i]._visible = false;
++i;
}
this.gotoAndStop(4);
}
} else {
if (this.xtarget.nyawa <= 0 || this.xtarget.nyawa == undefined || this.xtarget.invis == true) {
this.xtarget = undefined;
}
if (this.xtarget == undefined || this.xtarget.nyawa <= 0) {
i = 1;
while (i <= maximumJagoan) {
if (_root['jagoan_mc' + i].nyawa != undefined) {
this.jarak = Math.sqrt(Math.pow(this._x - _root['jagoan_mc' + i]._x, 2) + Math.pow(this._y - _root['jagoan_mc' + i]._y, 2));
if (this.jarak <= this.range2) {
if (this.tipeSenjata == 'melee' && _root['jagoan_mc' + i].heli == true) {
} else {
this.xtarget = _root['jagoan_mc' + i];
i = maximumJagoan;
}
}
}
++i;
}
} else {
this.jarak = Math.sqrt(Math.pow(this._x - this.xtarget._x, 2) + Math.pow(this._y - this.xtarget._y, 2));
if (this.jarak > this.range2) {
this.xtarget = undefined;
}
}
if (this.xtarget != undefined) {
if (this._x <= this.xtarget._x) {
this.anim._xscale = -this.scaleAwal;
} else {
this.anim._xscale = this.scaleAwal;
}
this.jarak = Math.sqrt(Math.pow(this._x - this.xtarget._x, 2) + Math.pow(this._y - this.xtarget._y, 2));
if (this.jarak <= this.range) {
this.gotoAndStop(3);
} else {
this.gotoAndStop(2);
deltaX = this._x - this.xtarget._x;
deltaY = this._y - this.xtarget._y;
angle = -Math.atan2(deltaX, deltaY) / 0.0174532925199433;
if (Math.sqrt(deltaX * deltaX + deltaY * deltaY) > this.speed2 * speedBattle) {
this._y -= this.speed2 * speedBattle * Math.cos(angle * 0.0174532925199433);
this._x += this.speed2 * speedBattle * Math.sin(angle * 0.0174532925199433);
}
}
} else {
this.anim._xscale = this.scaleAwal;
this._x -= this.speed * speedBattle;
this.gotoAndStop(2);
}
if (this._x <= background_mc._x - 100) {
--defenseKita;
if (defenseKita <= 0) {
cekKalah();
} else {
--totalMusuh;
if (totalMusuh <= 0) {
nyawaBenteng = 0;
cekMenang();
}
}
removeMovieClip(this);
}
}
}
}
this.jumlah = Math.ceil(this.nyawa);
if (this.guard == true) {
} else {
if (this.jenis == 5) {
this.swapDepths(100 + this._x + this._y * 200);
} else {
this.swapDepths(100 + this._x + this._y * 100);
}
}
}
function cekSerangMusuh(indi) {
if (indi.special == true) {
efekSpecialMusuh(indi.xtarget);
}
if (indi.jenis == 2) {
cekPanahMusuh(indi);
} else {
if (indi.xtarget.tipeApa == 'weapon') {
--indi.xtarget.ammo;
if (indi.xtarget.ammo <= 0) {
indi.xtarget.nyawa = 0;
if (indi.xtarget.jenisWeapon == 8) {
++xpindahArrowTrap;
} else {
if (indi.xtarget.jenisWeapon == 9) {
++xpindahCatapult;
} else {
if (indi.xtarget.jenisWeapon == 10) {
++xpindahFireTrap;
}
}
}
removeMovieClip(indi.xtarget);
}
}
if (indi.xtarget.kebal != true) {
if (indi.xtarget.nyawa > 0) {
if (indi.damage != undefined) {
indi.xtarget.nyawa -= indi.damage;
if (indi.xtarget.iniDuplikasi == false) {
if (indi.xtarget.jenis == 1) {
xpindahBareman += indi.damage;
} else {
if (indi.xtarget.jenis == 2) {
xpindahSwordman += indi.damage;
} else {
if (indi.xtarget.jenis == 3) {
xpindahArrowman += indi.damage;
} else {
if (indi.xtarget.jenis == 4) {
xpindahSpearman += indi.damage;
}
}
}
}
}
if (indi.jenis == 4 || indi.jenis == 5) {
cekEfekLedakan2(indi.xtarget);
}
}
}
}
}
}
function cekPanahMusuh(indi) {
peluru = attachMovie('panah_mc3', 'peluru_mc' + dalamPeluru, dalamPeluru);
peluru._x = indi._x - 30;
peluru._y = indi._y - 30;
if (siapaYangNyerang == 2) {
peluru._yscale = 75;
peluru._xscale = 75;
} else {
peluru._yscale = 100;
peluru._xscale = 100;
}
peluru.speed = 25;
peluru.arahTembak = 35;
peluru.xtarget = indi.xtarget;
peluru.tujuanX = indi.xtarget._x;
peluru.tujuanY = indi.xtarget._y;
deltaX = peluru._x - peluru.tujuanX;
deltaY = peluru._y - peluru.tujuanY;
angle = -Math.atan2(deltaX, deltaY) / 0.0174532925199433;
peluru._rotation = angle;
peluru.indi = indi;
peluru.onEnterFrame = enterPanahMusuh;
++dalamPeluru;
if (dalamPeluru >= 200) {
dalamPeluru = 100;
}
}
function enterPanahMusuh() {
if (sedangPause == false) {
this._x += geserKiri;
if (this.xtarget.nyawa == undefined) {
deltaX = this._x - this.tujuanX;
deltaY = this._y - this.tujuanY;
angle = -Math.atan2(deltaX, deltaY) / 0.0174532925199433;
this._rotation = angle;
if (Math.sqrt(deltaX * deltaX + deltaY * deltaY) > this.speed) {
this.speed += 0.5;
this._y -= this.speed * Math.cos(angle * 0.0174532925199433);
this._x += this.speed * Math.sin(angle * 0.0174532925199433);
} else {
removeMovieClip(this);
}
} else {
deltaX = this._x - this.xtarget._x;
deltaY = this._y - this.xtarget._y + this.arahTembak;
angle = -Math.atan2(deltaX, deltaY) / 0.0174532925199433;
this._rotation = angle;
if (Math.sqrt(deltaX * deltaX + deltaY * deltaY) > this.speed) {
this.speed += 0.5;
this._y -= this.speed * Math.cos(angle * 0.0174532925199433);
this._x += this.speed * Math.sin(angle * 0.0174532925199433);
} else {
if (this.xtarget.tipeApa == 'weapon') {
--this.xtarget.ammo;
if (this.xtarget.ammo <= 0) {
this.xtarget.nyawa = 0;
if (this.xtarget.jenisWeapon == 8) {
++xpindahArrowTrap;
} else {
if (this.xtarget.jenisWeapon == 9) {
++xpindahCatapult;
} else {
if (this.xtarget.jenisWeapon == 10) {
++xpindahFireTrap;
}
}
}
removeMovieClip(this.xtarget);
}
}
if (this.xtarget.kebal != true) {
if (this.xtarget.nyawa > 0) {
if (this.indi.damage != undefined) {
this.xtarget.nyawa -= this.indi.damage;
if (this.xtarget.iniDuplikasi == false) {
if (this.xtarget.jenis == 1) {
xpindahBareman += this.indi.damage;
} else {
if (this.xtarget.jenis == 2) {
xpindahSwordman += this.indi.damage;
} else {
if (this.xtarget.jenis == 3) {
xpindahArrowman += this.indi.damage;
} else {
if (this.xtarget.jenis == 4) {
xpindahSpearman += this.indi.damage;
}
}
}
}
}
}
}
}
if (this.xtarget.nyawa > 0) {
this.xtarget.attachMovie('panah_mc3', 'panah_mc' + dalamPeluru, dalamPeluru);
this.xtarget['panah_mc' + dalamPeluru].gotoAndStop(2);
this.xtarget['panah_mc' + dalamPeluru]._x = 25 + random(15) + 7;
this.xtarget['panah_mc' + dalamPeluru]._y = -35 + random(15) + 7;
this.xtarget['panah_mc' + dalamPeluru]._rotation = this._rotation - random(15) + 7;
this.xtarget['panah_mc' + dalamPeluru]._xscale = this._xscale;
this.xtarget['panah_mc' + dalamPeluru]._yscale = this._yscale;
++dalamPeluru;
if (dalamPeluru >= 200) {
dalamPeluru = 100;
}
}
removeMovieClip(this);
}
}
}
this.swapDepths(100 + this._x + this._y * 100);
}
function cekEfekLedakan2(indi, indi2) {
if (indi != undefined) {
efek = attachMovie('efekLedakan', 'spell_mc' + dalamSpell, dalamSpell);
efek._x = indi._x;
efek._y = indi._y - 50;
efek._xscale = 75;
efek._yscale = 75;
efek.onEnterFrame = enterEfekApi2;
++dalamSpell;
if (dalamSpell >= 301000) {
dalamSpell = 300000;
}
}
}
function enterEfekApi2() {
if (sedangPause == false) {
this._x += geserKiri;
i = 1;
while (i <= maximumJagoan) {
if (this.hitTest(_root['jagoan_mc' + i].anim)) {
if (_root['jagoan_mc' + i].nyawa > 0) {
_root['jagoan_mc' + i].nyawa -= 0.5;
if (_root['jagoan_mc' + i].jenis == 1) {
xpindahBareman += 0.5;
} else {
if (_root['jagoan_mc' + i].jenis == 2) {
xpindahSwordman += 0.5;
} else {
if (_root['jagoan_mc' + i].jenis == 3) {
xpindahArrowman += 0.5;
} else {
if (_root['jagoan_mc' + i].jenis == 4) {
xpindahSpearman += 0.5;
}
}
}
}
}
}
++i;
}
}
this.swapDepths(100 + this._x + this._y * 100);
}
function cekSpellMusuh2() {
rand = random(2);
if (rand == 0) {
i = 1;
while (i <= maximumJagoan) {
indiX = _root['jagoan_mc' + i]._x + 50;
indiY = _root['jagoan_mc' + i]._y;
i = maximumJagoan;
++i;
}
z = 11;
while (z <= 14) {
pilihSpellMusuh = z;
if (pilihSpellMusuh == 14) {
spell = attachMovie('efek' + (pilihSpellMusuh - 10) + 'x', 'spell_mc' + dalamSpell, dalamSpell - 270000);
} else {
spell = attachMovie('efek' + (pilihSpellMusuh - 10), 'spell_mc' + dalamSpell, dalamSpell);
}
if (pilihSpellMusuh == 11) {
spell._x = indiX;
spell._y = indiY - 1000;
spell.speedY = 5;
spell.damage = 0.3;
spell.batasBawah = indiY + 50;
} else {
if (pilihSpellMusuh == 12) {
backComet();
spell._x = indiX;
spell._y = indiY - 1000;
spell.speedY = 5;
spell.damage = 0.4;
spell.batasBawah = indiY + 50;
} else {
if (pilihSpellMusuh == 13) {
spell._x = indiX;
spell._y = indiY - 1000;
spell.speedY = 5;
spell.damage = 0.5;
spell.batasBawah = indiY + 50;
} else {
if (pilihSpellMusuh == 14) {
backGempa();
spell._x = indiX;
spell._y = indiY;
spell.damage = 0.1;
spell.awalGempa = 0;
spell.akhirGempa = 25;
spell.getarKe = 1;
}
}
}
}
if (siapaYangNyerang == 2) {
spell.damage *= 15;
} else {
spell.damage *= 7.5;
}
spell.tipeSpell = pilihSpellMusuh;
spell.onEnterFrame = enterSpellMusuh;
++dalamSpell;
if (dalamSpell >= 301000) {
dalamSpell = 300000;
}
++z;
}
} else {
i = 50;
while (i <= 65) {
if (_root['musuh_mc' + i].special != true) {
indiX = _root['musuh_mc' + i]._x;
indiY = _root['musuh_mc' + i]._y;
i = 80;
}
++i;
}
pilihSpellMusuh = random(2) + 15;
if (pilihSpellMusuh == 14) {
spell = attachMovie('efek' + (pilihSpellMusuh - 10) + 'x', 'spell_mc' + dalamSpell, dalamSpell - 270000);
} else {
spell = attachMovie('efek' + (pilihSpellMusuh - 10), 'spell_mc' + dalamSpell, dalamSpell);
}
if (pilihSpellMusuh == 11) {
spell._x = indiX;
spell._y = indiY - 1000;
spell.speedY = 5;
spell.damage = 0.3;
spell.batasBawah = indiY + 50;
} else {
if (pilihSpellMusuh == 12) {
backComet();
spell._x = indiX;
spell._y = indiY - 1000;
spell.speedY = 5;
spell.damage = 0.4;
spell.batasBawah = indiY + 50;
} else {
if (pilihSpellMusuh == 13) {
spell._x = indiX;
spell._y = indiY - 1000;
spell.speedY = 5;
spell.damage = 0.5;
spell.batasBawah = indiY + 50;
} else {
if (pilihSpellMusuh == 14) {
backGempa();
spell._x = indiX;
spell._y = indiY;
spell.damage = 0.1;
spell.awalGempa = 0;
spell.akhirGempa = 25;
spell.getarKe = 1;
} else {
if (pilihSpellMusuh == 15) {
backSpell1();
spell._x = indiX;
spell._y = indiY;
} else {
if (pilihSpellMusuh == 16) {
backSpell2();
spell._x = indiX;
spell._y = indiY;
}
}
}
}
}
}
if (siapaYangNyerang == 2) {
spell.damage *= 15;
} else {
spell.damage *= 7.5;
}
spell.tipeSpell = pilihSpellMusuh;
spell.onEnterFrame = enterSpellMusuh;
++dalamSpell;
if (dalamSpell >= 301000) {
dalamSpell = 300000;
}
}
}
function cekSpellMusuh() {
if (siapaYangNyerang == 0) {
if (xday >= 1000) {
rand = random(2);
} else {
rand = 0;
}
} else {
rand = random(2);
}
if (rand == 0) {
i = 1;
while (i <= maximumJagoan) {
indiX = _root['jagoan_mc' + i]._x + 50;
indiY = _root['jagoan_mc' + i]._y;
i = maximumJagoan;
++i;
}
if (xday >= 1000) {
pilihSpellMusuh = random(4) + 11;
} else {
if (xday >= 500) {
pilihSpellMusuh = random(2) + 11;
} else {
if (xday >= hariSpell) {
pilihSpellMusuh = 11;
}
}
}
} else {
i = 50;
while (i <= 65) {
if (_root['musuh_mc' + i].special != true) {
indiX = _root['musuh_mc' + i]._x;
indiY = _root['musuh_mc' + i]._y;
i = 80;
}
++i;
}
pilihSpellMusuh = random(2) + 15;
}
if (pilihSpellMusuh == 14) {
spell = attachMovie('efek' + (pilihSpellMusuh - 10) + 'x', 'spell_mc' + dalamSpell, dalamSpell - 270000);
} else {
spell = attachMovie('efek' + (pilihSpellMusuh - 10), 'spell_mc' + dalamSpell, dalamSpell);
}
if (pilihSpellMusuh == 11) {
spell._x = indiX;
spell._y = indiY - 1000;
spell.speedY = 5;
spell.damage = 0.3;
spell.batasBawah = indiY + 50;
} else {
if (pilihSpellMusuh == 12) {
backComet();
spell._x = indiX;
spell._y = indiY - 1000;
spell.speedY = 5;
spell.damage = 0.4;
spell.batasBawah = indiY + 50;
} else {
if (pilihSpellMusuh == 13) {
spell._x = indiX;
spell._y = indiY - 1000;
spell.speedY = 5;
spell.damage = 0.5;
spell.batasBawah = indiY + 50;
} else {
if (pilihSpellMusuh == 14) {
backGempa();
spell._x = indiX;
spell._y = indiY;
spell.damage = 0.1;
spell.awalGempa = 0;
spell.akhirGempa = 25;
spell.getarKe = 1;
} else {
if (pilihSpellMusuh == 15) {
backSpell1();
spell._x = indiX;
spell._y = indiY;
} else {
if (pilihSpellMusuh == 16) {
backSpell2();
spell._x = indiX;
spell._y = indiY;
}
}
}
}
}
}
if (siapaYangNyerang == 2) {
spell.damage *= 15;
} else {
spell.damage *= 7.5;
}
spell.tipeSpell = pilihSpellMusuh;
spell.onEnterFrame = enterSpellMusuh;
++dalamSpell;
if (dalamSpell >= 301000) {
dalamSpell = 300000;
}
}
function enterSpellMusuh() {
if (sedangPause == false) {
this._x += geserKiri;
if (this.tipeSpell == 11) {
if (this._y >= this.batasBawah) {
this.gotoAndStop(2);
} else {
this._y += this.speedY;
this.speedY += 2;
}
i = 1;
while (i <= maximumJagoan) {
if (this.hitTest(_root['jagoan_mc' + i].anim)) {
if (_root['jagoan_mc' + i].nyawa > 0) {
_root['jagoan_mc' + i].nyawa -= this.damage;
if (_root['jagoan_mc' + i].jenis == 1) {
xpindahBareman += this.damage;
} else {
if (_root['jagoan_mc' + i].jenis == 2) {
xpindahSwordman += this.damage;
} else {
if (_root['jagoan_mc' + i].jenis == 3) {
xpindahArrowman += this.damage;
} else {
if (_root['jagoan_mc' + i].jenis == 4) {
xpindahSpearman += this.damage;
}
}
}
}
}
}
++i;
}
} else {
if (this.tipeSpell == 12) {
if (this._y >= this.batasBawah) {
this.gotoAndStop(2);
} else {
this._y += this.speedY;
this.speedY += 2;
}
i = 1;
while (i <= maximumJagoan) {
if (this.hitTest(_root['jagoan_mc' + i].anim)) {
if (_root['jagoan_mc' + i].nyawa > 0) {
_root['jagoan_mc' + i].nyawa -= this.damage;
if (_root['jagoan_mc' + i].jenis == 1) {
xpindahBareman += this.damage;
} else {
if (_root['jagoan_mc' + i].jenis == 2) {
xpindahSwordman += this.damage;
} else {
if (_root['jagoan_mc' + i].jenis == 3) {
xpindahArrowman += this.damage;
} else {
if (_root['jagoan_mc' + i].jenis == 4) {
xpindahSpearman += this.damage;
}
}
}
}
}
}
++i;
}
} else {
if (this.tipeSpell == 13) {
if (this._y >= this.batasBawah) {
this.gotoAndStop(2);
} else {
this._y += this.speedY;
this.speedY += 2;
}
i = 1;
while (i <= maximumJagoan) {
if (this.hitTest(_root['jagoan_mc' + i].anim)) {
if (_root['jagoan_mc' + i].nyawa > 0) {
_root['jagoan_mc' + i].nyawa -= this.damage;
if (_root['jagoan_mc' + i].jenis == 1) {
xpindahBareman += this.damage;
} else {
if (_root['jagoan_mc' + i].jenis == 2) {
xpindahSwordman += this.damage;
} else {
if (_root['jagoan_mc' + i].jenis == 3) {
xpindahArrowman += this.damage;
} else {
if (_root['jagoan_mc' + i].jenis == 4) {
xpindahSpearman += this.damage;
}
}
}
}
}
}
++i;
}
} else {
if (this.tipeSpell == 14) {
this._xscale += 1;
this._yscale += 1;
if (this.awalGempa >= this.akhirGempa && this.getarKe == 1) {
cekNormalY('akhir');
getarBumi2 = false;
removeMovieClip(this);
} else {
++this.awalGempa;
if (this.getarKe == 1) {
cekGeserX2(5);
cekGeserY2(5);
++this.getarKe;
} else {
if (this.getarKe == 2) {
cekGeserX2(-10);
cekGeserY2(-10);
++this.getarKe;
} else {
if (this.getarKe == 3) {
cekGeserX2(5);
cekGeserY2(-5);
++this.getarKe;
} else {
if (this.getarKe == 4) {
cekGeserX2(-5);
cekGeserY2(5);
++this.getarKe;
} else {
if (this.getarKe == 5) {
cekGeserX2(7);
cekGeserY2(7);
++this.getarKe;
} else {
if (this.getarKe == 6) {
cekGeserX2(10);
cekGeserY2(-10);
++this.getarKe;
} else {
if (this.getarKe == 7) {
cekGeserX2(-12);
cekGeserY2(7);
++this.getarKe;
} else {
this.getarKe = 1;
}
}
}
}
}
}
}
i = 1;
while (i <= maximumJagoan) {
if (this.hitTest(_root['jagoan_mc' + i].anim)) {
if (_root['jagoan_mc' + i].nyawa > 0) {
_root['jagoan_mc' + i].nyawa -= this.damage;
if (_root['jagoan_mc' + i].jenis == 1) {
xpindahBareman += this.damage;
} else {
if (_root['jagoan_mc' + i].jenis == 2) {
xpindahSwordman += this.damage;
} else {
if (_root['jagoan_mc' + i].jenis == 3) {
xpindahArrowman += this.damage;
} else {
if (_root['jagoan_mc' + i].jenis == 4) {
xpindahSpearman += this.damage;
}
}
}
}
}
}
++i;
}
}
} else {
if (this.tipeSpell == 15) {
i = 50;
while (i <= 65) {
if (this.hitTest(_root['musuh_mc' + i].anim)) {
_root['musuh_mc' + i].awalSpecial = 0;
_root['musuh_mc' + i].akhirSpecial = 500;
_root['musuh_mc' + i].special = true;
_root['musuh_mc' + i].attachMovie('efek7', 'efekSpecial' + dalamEfekJagoan, dalamEfekJagoan);
_root['musuh_mc' + i]['efekSpecial' + dalamEfekJagoan]._x = 0;
_root['musuh_mc' + i]['efekSpecial' + dalamEfekJagoan]._y = -35;
++dalamEfekJagoan;
if (dalamEfekJagoan >= 110) {
dalamEfekJagoan = 100;
}
}
++i;
}
removeMovieClip(this);
} else {
if (this.tipeSpell == 16) {
zz = 50;
while (zz <= 80) {
if (this.hitTest(_root['musuh_mc' + zz].anim)) {
if (_root['musuh_mc' + zz]._x != undefined && _root['musuh_mc' + zz].nyawa > 0) {
cekDuplicate(_root['musuh_mc' + zz]);
_root['musuh_mc' + zz].attachMovie('efek8', 'efekSpecial' + dalamEfekJagoan, dalamEfekJagoan);
_root['musuh_mc' + zz]['efekSpecial' + dalamEfekJagoan]._x = 0;
_root['musuh_mc' + zz]['efekSpecial' + dalamEfekJagoan]._y = -35;
++dalamEfekJagoan;
if (dalamEfekJagoan >= 110) {
dalamEfekJagoan = 100;
}
}
}
++zz;
}
removeMovieClip(this);
}
}
}
}
}
}
}
}
function cekNormalY(indi) {
if (indi == 'awal') {
i = 50;
while (i <= 85) {
_root['musuh_mc' + i].awalGempaY = _root['musuh_mc' + i]._y;
++i;
}
i = 1;
while (i <= maximumJagoan) {
_root['jagoan_mc' + i].awalGempaY = _root['jagoan_mc' + i]._y;
++i;
}
} else {
if (indi == 'akhir') {
background_mc._y = posAwalBackgroundY;
benteng_mc._y = posAwalBentengY;
i = 50;
while (i <= 85) {
_root['musuh_mc' + i]._y = _root['musuh_mc' + i].awalGempaY;
++i;
}
i = 1;
while (i <= maximumJagoan) {
_root['jagoan_mc' + i]._y = _root['jagoan_mc' + i].awalGempaY;
++i;
}
}
}
}
function cekGeserX(indi) {
background_mc._x += indi;
i = 50;
while (i <= 65) {
_root['musuh_mc' + i]._x += indi;
_root['musuh_mc' + i].nyawa -= 1;
++i;
}
nyawaBenteng -= 1;
i = 1;
while (i <= maximumJagoan) {
_root['jagoan_mc' + i]._x += indi;
++i;
}
benteng_mc._x += indi;
}
function cekGeserY(indi) {
background_mc._y += indi;
i = 50;
while (i <= 65) {
_root['musuh_mc' + i]._y += indi;
++i;
}
i = 1;
while (i <= maximumJagoan) {
_root['jagoan_mc' + i]._y += indi;
++i;
}
benteng_mc._y += indi;
}
function cekPasukanBuat() {
battle_mc.all_btn._visible = false;
if (battle_mc.pasukan_mc._currentframe == 1) {
i = 1;
while (i <= 4) {
battle_mc.pasukan_mc['unit' + i].onRelease = klikSoldier;
battle_mc.pasukan_mc['unit' + i].onRollOver = overSoldier;
battle_mc.pasukan_mc['unit' + i].onRollOut = outSoldier;
battle_mc.pasukan_mc['unit' + i].enabled = true;
battle_mc.pasukan_mc['unit' + i]._alpha = 100;
battle_mc.pasukan_mc.jumlah1 = wpindahBareman;
battle_mc.pasukan_mc.jumlah2 = wpindahSwordman;
battle_mc.pasukan_mc.jumlah3 = wpindahArrowman;
battle_mc.pasukan_mc.jumlah4 = wpindahSpearman;
++i;
}
battle_mc.soldier_mc.gotoAndStop(2);
battle_mc.vehicle_mc.gotoAndStop(1);
battle_mc.weapon_mc.gotoAndStop(1);
battle_mc.spell_mc.gotoAndStop(1);
battle_mc.defense_mc.gotoAndStop(1);
} else {
if (battle_mc.pasukan_mc._currentframe == 2) {
i = 5;
while (i <= 7) {
battle_mc.pasukan_mc['unit' + i].onRelease = klikSoldier;
battle_mc.pasukan_mc['unit' + i].onRollOver = overSoldier;
battle_mc.pasukan_mc['unit' + i].onRollOut = outSoldier;
battle_mc.pasukan_mc['unit' + i].enabled = true;
battle_mc.pasukan_mc['unit' + i]._alpha = 100;
battle_mc.pasukan_mc.jumlah5 = wpindahTank;
battle_mc.pasukan_mc.jumlah6 = wpindahCopter;
battle_mc.pasukan_mc.jumlah7 = wpindahMonbot;
++i;
}
battle_mc.soldier_mc.gotoAndStop(1);
battle_mc.vehicle_mc.gotoAndStop(2);
battle_mc.weapon_mc.gotoAndStop(1);
battle_mc.spell_mc.gotoAndStop(1);
battle_mc.defense_mc.gotoAndStop(1);
} else {
if (battle_mc.pasukan_mc._currentframe == 3) {
i = 8;
while (i <= 10) {
battle_mc.pasukan_mc['unit' + i].onRelease = klikWeapon;
battle_mc.pasukan_mc['unit' + i].onRollOver = overWeapon;
battle_mc.pasukan_mc['unit' + i].onRollOut = outWeapon;
battle_mc.pasukan_mc['unit' + i].enabled = true;
battle_mc.pasukan_mc['unit' + i]._alpha = 100;
battle_mc.pasukan_mc.jumlah8 = wpindahArrowTrap;
battle_mc.pasukan_mc.jumlah9 = wpindahCatapult;
battle_mc.pasukan_mc.jumlah10 = wpindahFireTrap;
++i;
}
battle_mc.soldier_mc.gotoAndStop(1);
battle_mc.vehicle_mc.gotoAndStop(1);
battle_mc.weapon_mc.gotoAndStop(2);
battle_mc.spell_mc.gotoAndStop(1);
battle_mc.defense_mc.gotoAndStop(1);
} else {
if (battle_mc.pasukan_mc._currentframe == 4) {
battle_mc.all_btn._visible = true;
battle_mc.all_btn.onRelease = klikSpell2;
i = 11;
while (i <= 18) {
battle_mc.pasukan_mc['unit' + i].onRelease = klikSpell;
battle_mc.pasukan_mc['unit' + i].onRollOver = overSpell;
battle_mc.pasukan_mc['unit' + i].onRollOut = outSpell;
battle_mc.pasukan_mc['unit' + i].enabled = true;
battle_mc.pasukan_mc['unit' + i]._alpha = 100;
battle_mc.pasukan_mc.jumlah11 = wpindahArrowRain;
battle_mc.pasukan_mc.jumlah12 = wpindahMeteorid;
battle_mc.pasukan_mc.jumlah13 = wpindahAcidRain;
battle_mc.pasukan_mc.jumlah14 = wpindahEarthquake;
battle_mc.pasukan_mc.jumlah15 = wpindahImmune;
battle_mc.pasukan_mc.jumlah16 = wpindahInvisible;
battle_mc.pasukan_mc.jumlah17 = wpindahSpecialAttack;
battle_mc.pasukan_mc.jumlah18 = wpindahDuplicate;
++i;
}
battle_mc.soldier_mc.gotoAndStop(1);
battle_mc.vehicle_mc.gotoAndStop(1);
battle_mc.weapon_mc.gotoAndStop(1);
battle_mc.spell_mc.gotoAndStop(2);
battle_mc.defense_mc.gotoAndStop(1);
} else {
if (battle_mc.pasukan_mc._currentframe == 5) {
battle_mc.soldier_mc.gotoAndStop(1);
battle_mc.vehicle_mc.gotoAndStop(1);
battle_mc.weapon_mc.gotoAndStop(1);
battle_mc.spell_mc.gotoAndStop(1);
battle_mc.defense_mc.gotoAndStop(2);
}
}
}
}
}
battle_mc.defense_mc._visible = false;
buatKotak(false);
}
function overSoldier() {
info_mc2._visible = true;
znamaSoldier = new Array('', 'Barehands', 'Swordman', 'Arrowman', 'Spearman', 'Tank', 'Copter', 'Monbot');
myStr = new String(this);
if (isNaN(myStr.substr(myStr.length - 2, 2))) {
indi = myStr.substr(myStr.length - 1, 1);
} else {
indi = myStr.substr(myStr.length - 2, 2);
}
info_mc2.gotoAndStop(2);
info_mc2.xinfo = znamaSoldier[indi];
}
function outSoldier() {
info_mc2._visible = false;
}
function overWeapon() {
info_mc2._visible = true;
znamaWeapon = new Array('', 'Bow Launcher', 'Stone Thrower', 'Fire Thrower');
myStr = new String(this);
if (isNaN(myStr.substr(myStr.length - 2, 2))) {
indi = Number(myStr.substr(myStr.length - 1, 1));
} else {
indi = Number(myStr.substr(myStr.length - 2, 2));
}
info_mc2.gotoAndStop(2);
info_mc2.xinfo = znamaWeapon[indi - 7];
}
function outWeapon() {
info_mc2._visible = false;
}
function overSpell() {
info_mc2._visible = true;
znamaSpell = new Array('', 'Arrow Rain', 'Meteorid', 'Acid Rain', 'Eeathquake', 'Immune', 'Invisible', 'Special Attack', 'Duplicate');
myStr = new String(this);
if (isNaN(myStr.substr(myStr.length - 2, 2))) {
indi = Number(myStr.substr(myStr.length - 1, 1));
} else {
indi = Number(myStr.substr(myStr.length - 2, 2));
}
info_mc2.gotoAndStop(2);
if (indi - 10 <= 4) {
info_mc2.xinfo = znamaSpell[indi - 10] + ', Give to Enemy';
} else {
info_mc2.xinfo = znamaSpell[indi - 10] + ', Give to Monster';
}
}
function outSpell() {
info_mc2._visible = false;
}
function overDefense() {
info_mc2._visible = true;
znamaDefense = new Array('', 'Wall', 'Spike', 'Spider Web', 'Tower Guard', 'Zombie Trap');
myStr = new String(this);
if (isNaN(myStr.substr(myStr.length - 2, 2))) {
indi = Number(myStr.substr(myStr.length - 1, 1));
} else {
indi = Number(myStr.substr(myStr.length - 2, 2));
}
info_mc2.gotoAndStop(2);
info_mc2.xinfo = znamaDefense[indi - 18];
}
function outDefense() {
info_mc2._visible = false;
}
function buatSpell(indiX, indiY) {
if (pilihSpell >= 15) {
spell = attachMovie('spellTarget', 'spell_mc' + dalamSpell, dalamSpell);
spell._xscale = 150;
spell._yscale = 150;
} else {
if (pilihSpell == 14) {
spell = attachMovie('efek' + (pilihSpell - 10) + 'x', 'spell_mc' + dalamSpell, dalamSpell - 270000);
} else {
spell = attachMovie('efek' + (pilihSpell - 10), 'spell_mc' + dalamSpell, dalamSpell);
}
}
if (pilihSpell == 11) {
++xpindahArrowRain;
--wpindahArrowRain;
spell._x = indiX;
spell._y = indiY - 1000;
spell.speedY = 5;
spell.damage = 0.3;
spell.batasBawah = indiY + 50;
} else {
if (pilihSpell == 12) {
backComet();
++xpindahMeteorid;
--wpindahMeteorid;
spell._x = indiX;
spell._y = indiY - 1000;
spell.speedY = 5;
spell.damage = 0.4;
spell.batasBawah = indiY + 50;
} else {
if (pilihSpell == 13) {
++xpindahAcidRain;
--wpindahAcidRain;
spell._x = indiX;
spell._y = indiY - 1000;
spell.speedY = 5;
spell.damage = 0.5;
spell.batasBawah = indiY + 50;
} else {
if (pilihSpell == 14) {
backGempa();
++xpindahEarthquake;
--wpindahEarthquake;
spell._x = indiX;
spell._y = indiY;
spell.damage = 0.1;
spell.awalGempa = 0;
spell.akhirGempa = 25;
spell.getarKe = 1;
} else {
if (pilihSpell == 15) {
backSpell3();
++xpindahImmune;
--wpindahImmune;
spell._x = indiX;
spell._y = indiY;
} else {
if (pilihSpell == 16) {
backSpell4();
++xpindahInvisible;
--wpindahInvisible;
spell._x = indiX;
spell._y = indiY;
} else {
if (pilihSpell == 17) {
backSpell1();
++xpindahSpecialAttack;
--wpindahSpecialAttack;
spell._x = indiX;
spell._y = indiY;
} else {
if (pilihSpell == 18) {
backSpell2();
++xpindahDuplicate;
--wpindahDuplicate;
spell._x = indiX;
spell._y = indiY;
}
}
}
}
}
}
}
}
spell.damage *= 10;
battle_mc.pasukan_mc.jumlah11 = wpindahArrowRain;
battle_mc.pasukan_mc.jumlah12 = wpindahMeteorid;
battle_mc.pasukan_mc.jumlah13 = wpindahAcidRain;
battle_mc.pasukan_mc.jumlah14 = wpindahEarthquake;
battle_mc.pasukan_mc.jumlah15 = wpindahImmune;
battle_mc.pasukan_mc.jumlah16 = wpindahInvisible;
battle_mc.pasukan_mc.jumlah17 = wpindahSpecialAttack;
battle_mc.pasukan_mc.jumlah18 = wpindahDuplicate;
spell.tipeSpell = pilihSpell;
spell.onEnterFrame = enterSpell;
++dalamSpell;
if (dalamSpell >= 301000) {
dalamSpell = 300000;
}
}
function buatSpell2(indiX, indiY) {
zi = 11;
while (zi <= 18) {
gagalBuat = false;
if (zi == 11 && wpindahArrowRain <= 0) {
gagalBuat = true;
} else {
if (zi == 12 && wpindahMeteorid <= 0) {
gagalBuat = true;
} else {
if (zi == 13 && wpindahAcidRain <= 0) {
gagalBuat = true;
} else {
if (zi == 14 && wpindahEarthquake <= 0) {
gagalBuat = true;
} else {
if (zi == 15 && wpindahImmune <= 0) {
gagalBuat = true;
} else {
if (zi == 16 && wpindahInvisible <= 0) {
gagalBuat = true;
} else {
if (zi == 17 && wpindahSpecialAttack <= 0) {
gagalBuat = true;
} else {
if (zi == 18 && wpindahDuplicate <= 0) {
gagalBuat = true;
}
}
}
}
}
}
}
}
if (gagalBuat == false) {
if (zi >= 15) {
spell = attachMovie('spellTarget', 'spell_mc' + dalamSpell, dalamSpell);
spell._xscale = 150;
spell._yscale = 150;
} else {
if (zi == 14) {
spell = attachMovie('efek' + (zi - 10) + 'x', 'spell_mc' + dalamSpell, dalamSpell - 270000);
} else {
spell = attachMovie('efek' + (zi - 10), 'spell_mc' + dalamSpell, dalamSpell);
}
}
if (zi == 11) {
++xpindahArrowRain;
--wpindahArrowRain;
spell._x = indiX;
spell._y = indiY - 1000;
spell.speedY = 5;
spell.damage = 0.3;
spell.batasBawah = indiY + 50;
} else {
if (zi == 12) {
backComet();
++xpindahMeteorid;
--wpindahMeteorid;
spell._x = indiX;
spell._y = indiY - 1500;
spell.speedY = 5;
spell.damage = 0.4;
spell.batasBawah = indiY + 50;
} else {
if (zi == 13) {
++xpindahAcidRain;
--wpindahAcidRain;
spell._x = indiX;
spell._y = indiY - 2000;
spell.speedY = 5;
spell.damage = 0.5;
spell.batasBawah = indiY + 50;
} else {
if (zi == 14) {
backGempa();
++xpindahEarthquake;
--wpindahEarthquake;
spell._x = indiX;
spell._y = indiY;
spell.damage = 0.1;
spell.awalGempa = 0;
spell.akhirGempa = 25;
cekNormalY('awal');
} else {
if (zi == 15) {
backSpell3();
++xpindahImmune;
--wpindahImmune;
spell._x = indiX;
spell._y = indiY;
} else {
if (zi == 16) {
backSpell4();
++xpindahInvisible;
--wpindahInvisible;
spell._x = indiX;
spell._y = indiY;
} else {
if (zi == 17) {
backSpell1();
++xpindahSpecialAttack;
--wpindahSpecialAttack;
spell._x = indiX;
spell._y = indiY;
} else {
if (zi == 18) {
backSpell2();
++xpindahDuplicate;
--wpindahDuplicate;
spell._x = indiX;
spell._y = indiY;
}
}
}
}
}
}
}
}
battle_mc.pasukan_mc.jumlah11 = wpindahArrowRain;
battle_mc.pasukan_mc.jumlah12 = wpindahMeteorid;
battle_mc.pasukan_mc.jumlah13 = wpindahAcidRain;
battle_mc.pasukan_mc.jumlah14 = wpindahEarthquake;
battle_mc.pasukan_mc.jumlah15 = wpindahImmune;
battle_mc.pasukan_mc.jumlah16 = wpindahInvisible;
battle_mc.pasukan_mc.jumlah17 = wpindahSpecialAttack;
battle_mc.pasukan_mc.jumlah18 = wpindahDuplicate;
spell.tipeSpell = zi;
spell.onEnterFrame = enterSpell;
++dalamSpell;
if (dalamSpell >= 301000) {
dalamSpell = 300000;
}
}
++zi;
}
}
function enterSpell() {
if (sedangPause == false) {
this._x += geserKiri;
if (this.tipeSpell == 11) {
if (this._y >= this.batasBawah) {
this.gotoAndStop(2);
} else {
this._y += this.speedY;
this.speedY += 2;
}
i = 50;
while (i <= 65) {
if (this.hitTest(_root['musuh_mc' + i].anim)) {
_root['musuh_mc' + i].nyawa -= this.damage;
}
++i;
}
} else {
if (this.tipeSpell == 12) {
if (this._y >= this.batasBawah) {
this.gotoAndStop(2);
} else {
this._y += this.speedY;
this.speedY += 2;
}
i = 50;
while (i <= 65) {
if (this.hitTest(_root['musuh_mc' + i].anim)) {
_root['musuh_mc' + i].nyawa -= this.damage;
}
++i;
}
} else {
if (this.tipeSpell == 13) {
if (this._y >= this.batasBawah) {
this.gotoAndStop(2);
} else {
this._y += this.speedY;
this.speedY += 2;
}
i = 50;
while (i <= 65) {
if (this.hitTest(_root['musuh_mc' + i].anim)) {
_root['musuh_mc' + i].nyawa -= this.damage;
}
++i;
}
} else {
if (this.tipeSpell == 14) {
this._xscale += 1;
this._yscale += 1;
if (this.awalGempa >= this.akhirGempa && this.getarKe == 1) {
cekNormalY('akhir');
getarBumi2 = false;
removeMovieClip(this);
} else {
++this.awalGempa;
if (this.getarKe == 1) {
cekGeserX2(5);
cekGeserY2(5);
++this.getarKe;
} else {
if (this.getarKe == 2) {
cekGeserX2(-10);
cekGeserY2(-10);
++this.getarKe;
} else {
if (this.getarKe == 3) {
cekGeserX2(5);
cekGeserY2(-5);
++this.getarKe;
} else {
if (this.getarKe == 4) {
cekGeserX2(-5);
cekGeserY2(5);
++this.getarKe;
} else {
if (this.getarKe == 5) {
cekGeserX2(7);
cekGeserY2(7);
++this.getarKe;
} else {
if (this.getarKe == 6) {
cekGeserX2(10);
cekGeserY2(-10);
++this.getarKe;
} else {
if (this.getarKe == 7) {
cekGeserX2(-12);
cekGeserY2(7);
++this.getarKe;
} else {
this.getarKe = 1;
}
}
}
}
}
}
}
i = 50;
while (i <= 65) {
if (this.hitTest(_root['musuh_mc' + i].anim)) {
_root['musuh_mc' + i].nyawa -= this.damage;
}
++i;
}
}
} else {
if (this.tipeSpell == 15) {
i = 1;
while (i <= maximumJagoan) {
if (this.hitTest(_root['jagoan_mc' + i].anim)) {
_root['jagoan_mc' + i].awalKebal = 0;
_root['jagoan_mc' + i].akhirKebal = 500;
_root['jagoan_mc' + i].kebal = true;
_root['jagoan_mc' + i].attachMovie('efek5', 'efekKebal' + dalamEfekJagoan, dalamEfekJagoan);
_root['jagoan_mc' + i]['efekKebal' + dalamEfekJagoan]._x = 0;
_root['jagoan_mc' + i]['efekKebal' + dalamEfekJagoan]._y = -35;
++dalamEfekJagoan;
if (dalamEfekJagoan >= 110) {
dalamEfekJagoan = 100;
}
}
++i;
}
removeMovieClip(this);
} else {
if (this.tipeSpell == 16) {
i = 1;
while (i <= maximumJagoan) {
if (this.hitTest(_root['jagoan_mc' + i].anim)) {
_root['jagoan_mc' + i].awalInvis = 0;
_root['jagoan_mc' + i].akhirInvis = 500;
_root['jagoan_mc' + i].invis = true;
_root['jagoan_mc' + i].attachMovie('efek6', 'efekInvis' + dalamEfekJagoan, dalamEfekJagoan);
_root['jagoan_mc' + i]['efekInvis' + dalamEfekJagoan]._x = 0;
_root['jagoan_mc' + i]['efekInvis' + dalamEfekJagoan]._y = -35;
++dalamEfekJagoan;
if (dalamEfekJagoan >= 110) {
dalamEfekJagoan = 100;
}
}
++i;
}
removeMovieClip(this);
} else {
if (this.tipeSpell == 17) {
i = 1;
while (i <= maximumJagoan) {
if (this.hitTest(_root['jagoan_mc' + i].anim)) {
_root['jagoan_mc' + i].awalSpecial = 0;
_root['jagoan_mc' + i].akhirSpecial = 500;
_root['jagoan_mc' + i].special = true;
_root['jagoan_mc' + i].attachMovie('efek7', 'efekSpecial' + dalamEfekJagoan, dalamEfekJagoan);
_root['jagoan_mc' + i]['efekSpecial' + dalamEfekJagoan]._x = 0;
_root['jagoan_mc' + i]['efekSpecial' + dalamEfekJagoan]._y = -35;
++dalamEfekJagoan;
if (dalamEfekJagoan >= 110) {
dalamEfekJagoan = 100;
}
}
++i;
}
removeMovieClip(this);
} else {
if (this.tipeSpell == 18) {
zz = 1;
while (zz <= maximumJagoan) {
if (this.hitTest(_root['jagoan_mc' + zz].anim)) {
if (_root['jagoan_mc' + zz]._x != undefined && _root['jagoan_mc' + zz].nyawa > 0) {
cekDuplicate(_root['jagoan_mc' + zz]);
}
}
++zz;
}
removeMovieClip(this);
}
}
}
}
}
}
}
}
}
}
function cekDuplicate(indi) {
if (indi.duplikasi == false) {
indi.duplikasi = true;
indi.nyawa *= 2;
indi.damage *= 2;
indi.range *= 2;
indi.speed *= 2;
}
}
function cekGeserX2(indi) {
background_mc._x += indi;
i = 50;
while (i <= 65) {
_root['musuh_mc' + i]._x += indi;
++i;
}
i = 1;
while (i <= maximumJagoan) {
_root['jagoan_mc' + i]._x += indi;
++i;
}
benteng_mc._x += indi;
}
function cekGeserY2(indi) {
background_mc._y += indi;
i = 50;
while (i <= 65) {
_root['musuh_mc' + i]._y += indi;
++i;
}
i = 1;
while (i <= maximumJagoan) {
_root['jagoan_mc' + i]._y += indi;
++i;
}
benteng_mc._y += indi;
}
function buatWeapon(indi) {
bisaBuatSoldier = false;
i = 1;
while (i <= maximumJagoan) {
if (_root['jagoan_mc' + i].nyawa == undefined) {
xdalamSoldier = i;
i = maximumJagoan;
bisaBuatSoldier = true;
}
++i;
}
if (bisaBuatSoldier == true) {
if (pilihWeapon == 8) {
--wpindahArrowTrap;
} else {
if (pilihWeapon == 9) {
--wpindahCatapult;
} else {
if (pilihWeapon == 10) {
--wpindahFireTrap;
}
}
}
battle_mc.pasukan_mc.jumlah8 = wpindahArrowTrap;
battle_mc.pasukan_mc.jumlah9 = wpindahCatapult;
battle_mc.pasukan_mc.jumlah10 = wpindahFireTrap;
weapon = attachMovie('weapon' + (pilihWeapon - 7), 'jagoan_mc' + xdalamSoldier, xdalamSoldier + 100);
weapon._x = background_mc._x - 100;
weapon._y = indi + 25;
weapon.speed = 1.5;
if (pilihWeapon == 8) {
weapon.damage = 5;
} else {
if (pilihWeapon == 9) {
weapon.damage = 10;
} else {
if (pilihWeapon == 10) {
weapon.damage = 10;
}
}
}
if (pilihWeapon == 8) {
weapon.ammo = 15;
weapon.range = 875;
} else {
if (pilihWeapon == 9) {
weapon.ammo = 20;
weapon.range = 900;
} else {
if (pilihWeapon == 10) {
weapon.ammo = 25;
weapon.range = 925;
}
}
}
weapon.nyawa = weapon.ammo;
weapon.tipeApa = 'weapon';
weapon.jenisWeapon = pilihWeapon;
weapon.batasKanan = background_mc._x + 40 + random(15);
weapon.onEnterFrame = enterWeapon;
} else {
cekInfo('Can\'t unleash another weapons, maximum weapons on the field reached');
}
}
function enterWeapon() {
if (sedangPause == false) {
this._x += geserKiri;
this.batasKanan += geserKiri;
if (this._x <= this.batasKanan) {
this.gotoAndStop(2);
this._x += this.speed;
} else {
this.bisaSerang = false;
this.xtarget = undefined;
i = 50;
while (i <= 65) {
if (_root['musuh_mc' + i]._x != undefined && _root['musuh_mc' + i].nyawa > 0) {
this.jarak = Math.sqrt(Math.pow(this._x - _root['musuh_mc' + i]._x, 2) + Math.pow(this._y - _root['musuh_mc' + i]._y, 2));
if (this.jarak <= this.range) {
this.xtarget = _root['musuh_mc' + i];
this.bisaSerang = true;
}
}
++i;
}
if (this.ammo <= 0) {
this.ammo = 0;
this.gotoAndStop(1);
} else {
if (this.bisaSerang == true) {
this.gotoAndStop(3);
} else {
this.gotoAndStop(1);
}
}
}
}
this.jumlah = this.ammo;
this.swapDepths(100 + this._x + this._y * 100);
}
function cekSerangWeapon(indi) {
if (indi.jenisWeapon == 8) {
--indi.ammo;
peluru = attachMovie('panah_mc2', 'peluru_mc' + dalamPeluru, dalamPeluru);
peluru._x = indi._x;
peluru._y = indi._y - 25;
peluru._yscale = 100;
peluru._xscale = 100;
peluru.speedX = 20;
peluru.speedY = 10;
peluru.damage = indi.damage;
peluru.xtarget = indi.xtarget;
peluru.batasBawah = indi._y;
peluru.randBawah = random(50);
peluru.indi = indi;
peluru.onEnterFrame = enterWeapon2;
++dalamPeluru;
if (dalamPeluru >= 200) {
dalamPeluru = 100;
}
} else {
if (indi.jenisWeapon == 9) {
--indi.ammo;
peluru = attachMovie('batu_mc', 'peluru_mc' + dalamPeluru, dalamPeluru);
peluru._x = indi._x;
peluru._y = indi._y - 75;
peluru._yscale = 100;
peluru._xscale = 100;
if (indi.jenisWeapon == 9) {
peluru.jarak = Math.sqrt(Math.pow(indi._x - indi.xtarget._x, 2) + Math.pow(indi._y - indi.xtarget._y, 2));
if (peluru.jarak >= 850) {
peluru.speedX = 15;
} else {
if (peluru.jarak >= 800) {
peluru.speedX = 14;
} else {
if (peluru.jarak >= 750) {
peluru.speedX = 13;
} else {
if (peluru.jarak >= 700) {
peluru.speedX = 12;
} else {
if (peluru.jarak >= 650) {
peluru.speedX = 11;
} else {
if (peluru.jarak >= 600) {
peluru.speedX = 10;
} else {
if (peluru.jarak >= 550) {
peluru.speedX = 9;
} else {
if (peluru.jarak >= 500) {
peluru.speedX = 8;
} else {
if (peluru.jarak >= 450) {
peluru.speedX = 7;
} else {
if (peluru.jarak >= 400) {
peluru.speedX = 6;
} else {
peluru.speedX = 5;
}
}
}
}
}
}
}
}
}
}
}
peluru.speedY = 15;
peluru.damage = indi.damage;
peluru.xtarget = indi.xtarget;
peluru.batasBawah = indi._y;
peluru.randBawah = random(50);
peluru.indi = indi;
peluru.onEnterFrame = enterWeapon3;
++dalamPeluru;
if (dalamPeluru >= 200) {
dalamPeluru = 100;
}
} else {
if (indi.jenisWeapon == 10) {
--indi.ammo;
peluru = attachMovie('bolaApi_mc', 'peluru_mc' + dalamPeluru, dalamPeluru);
peluru._x = indi._x + 25;
peluru._y = indi._y - 35;
peluru._yscale = 100;
peluru._xscale = 100;
if (indi.jenisWeapon == 10) {
peluru.jarak = Math.sqrt(Math.pow(indi._x - indi.xtarget._x, 2) + Math.pow(indi._y - indi.xtarget._y, 2));
if (peluru.jarak >= 900) {
peluru.speedX = 20;
} else {
if (peluru.jarak >= 850) {
peluru.speedX = 19;
} else {
if (peluru.jarak >= 800) {
peluru.speedX = 18;
} else {
if (peluru.jarak >= 750) {
peluru.speedX = 17;
} else {
if (peluru.jarak >= 700) {
peluru.speedX = 16;
} else {
if (peluru.jarak >= 650) {
peluru.speedX = 15;
} else {
if (peluru.jarak >= 600) {
peluru.speedX = 14;
} else {
if (peluru.jarak >= 550) {
peluru.speedX = 13;
} else {
if (peluru.jarak >= 500) {
peluru.speedX = 12;
} else {
if (peluru.jarak >= 450) {
peluru.speedX = 11;
} else {
if (peluru.jarak >= 400) {
peluru.speedX = 10;
} else {
peluru.speedX = 9;
}
}
}
}
}
}
}
}
}
}
}
}
peluru.speedY = 10;
peluru.damage = indi.damage;
peluru.xtarget = indi.xtarget;
peluru.batasBawah = indi._y;
peluru.randBawah = random(50);
peluru.indi = indi;
peluru.onEnterFrame = enterWeapon4;
++dalamPeluru;
if (dalamPeluru >= 200) {
dalamPeluru = 100;
}
}
}
}
}
function enterWeapon2() {
if (sedangPause == false) {
this._x += geserKiri;
this._x += this.speedX;
this._y -= this.speedY;
this.speedY -= 0.5;
this._rotation += 1.5;
i = 50;
while (i <= 65) {
if (this.hitTest(_root['musuh_mc' + i].anim)) {
if (_root['musuh_mc' + i].nyawa > 0) {
_root['musuh_mc' + i].nyawa -= this.damage;
_root['musuh_mc' + i].attachMovie('panah_mc2', 'panah_mc' + dalamPeluru, dalamPeluru);
_root['musuh_mc' + i]['panah_mc' + dalamPeluru].gotoAndStop(2);
_root['musuh_mc' + i]['panah_mc' + dalamPeluru]._x = -35 + random(15) + 7;
_root['musuh_mc' + i]['panah_mc' + dalamPeluru]._y = -35 + random(15) + 7;
_root['musuh_mc' + i]['panah_mc' + dalamPeluru]._rotation = 45 + random(15);
_root['musuh_mc' + i]['panah_mc' + dalamPeluru]._xscale = this._xscale;
_root['musuh_mc' + i]['panah_mc' + dalamPeluru]._yscale = this._yscale;
++dalamPeluru;
if (dalamPeluru >= 200) {
dalamPeluru = 100;
}
removeMovieClip(this);
}
}
++i;
}
if (this.speedY <= 0) {
if (this._y >= this.batasBawah + this.randBawah) {
delete this.onEnterFrame;
this.onEnterFrame = enterWeaponx;
}
}
}
}
function enterWeapon3() {
if (sedangPause == false) {
this._x += geserKiri;
this._x += this.speedX;
this._y -= this.speedY;
this.speedY -= 0.5;
this._rotation += 1.5;
i = 50;
while (i <= 65) {
if (this.hitTest(_root['musuh_mc' + i].anim)) {
if (_root['musuh_mc' + i].nyawa > 0) {
_root['musuh_mc' + i].nyawa -= this.damage;
removeMovieClip(this);
}
}
++i;
}
if (this.speedY <= 0) {
if (this._y >= this.batasBawah + this.randBawah) {
delete this.onEnterFrame;
this.onEnterFrame = enterWeaponx;
}
}
}
}
function enterWeapon4() {
if (sedangPause == false) {
this._x += geserKiri;
this._x += this.speedX;
this._y -= this.speedY;
this.speedY -= 0.5;
this._rotation += 1.5;
this.lewatSini = false;
i = 50;
while (i <= 65) {
if (this.hitTest(_root['musuh_mc' + i].anim)) {
if (_root['musuh_mc' + i].nyawa > 0) {
_root['musuh_mc' + i].nyawa -= this.damage;
_root['musuh_mc' + i].kenaApi = true;
_root['musuh_mc' + i].batasApi = 0;
_root['musuh_mc' + i].maxApi = 100;
z = 1;
while (z <= 5) {
_root['musuh_mc' + i].attachMovie('efekApi', 'api_mc' + dalamPeluru, dalamPeluru);
_root['musuh_mc' + i]['api_mc' + dalamPeluru]._x = -random(30) + 15;
_root['musuh_mc' + i]['api_mc' + dalamPeluru]._y = -35 - random(30) + 15;
_root['musuh_mc' + i]['api_mc' + dalamPeluru]._xscale = 25 + random(25);
_root['musuh_mc' + i]['api_mc' + dalamPeluru]._yscale = 25 + random(25);
++dalamPeluru;
if (dalamPeluru >= 200) {
dalamPeluru = 100;
}
++z;
}
this.lewatSini = true;
removeMovieClip(this);
}
}
++i;
}
if (this.lewatSini == false) {
if (this.speedY <= 0) {
if (this._y >= this.batasBawah + this.randBawah) {
if (this != undefined) {
efek = attachMovie('efekApi2', 'api_mc' + dalamPeluru, dalamPeluru);
efek._x = this._x;
efek._y = this._y;
efek._xscale = 25 + random(25);
efek._yscale = 25 + random(25);
efek.onEnterFrame = enterEfekApi;
++dalamPeluru;
if (dalamPeluru >= 200) {
dalamPeluru = 100;
}
removeMovieClip(this);
}
}
}
}
}
}
function enterEfekApi() {
if (sedangPause == false) {
this._x += geserKiri;
i = 50;
while (i <= 65) {
if (this.hitTest(_root['musuh_mc' + i].anim)) {
_root['musuh_mc' + i].nyawa -= 0.5;
}
++i;
}
}
}
function enterWeaponx() {
if (sedangPause == false) {
this._x += geserKiri;
this._alpha -= 0.5;
}
}
function klikSoldier(zindi, zindi2) {
bisaBuatSoldier = false;
i = 1;
while (i <= maximumJagoan) {
if (_root['jagoan_mc' + i].nyawa == undefined) {
xdalamSoldier = i;
i = maximumJagoan;
bisaBuatSoldier = true;
}
++i;
}
if (bisaBuatSoldier == true) {
bisaBuatSoldier2 = true;
if (pilihSoldier >= 5) {
if (kiniVehicle >= 10) {
bisaBuatSoldier2 = false;
} else {
bisaBuatSoldier2 = true;
}
} else {
bisaBuatSoldier2 = true;
}
if (bisaBuatSoldier2 == true) {
myStr = new String(this);
indi = myStr.substr(myStr.length - 1, 1);
if (battle_mc.pasukan_mc['jumlah' + indi] > 0 || zindi2 == 'duplikat') {
if (zindi2 != 'duplikat') {
pilihSoldier = indi;
}
randKeluarJagoan = random(4) + 1;
++defenseKita;
soldier = attachMovie('soldier' + pilihSoldier, 'jagoan_mc' + xdalamSoldier, xdalamSoldier + 100);
soldier.cacheAsBitmap = true;
if (zindi2 != 'duplikat') {
soldier._x = background_mc._x - 50;
if (pilihSoldier == 6) {
soldier._y = 210 + 40 * randKeluarJagoan;
} else {
soldier._y = 310 + 40 * randKeluarJagoan;
}
} else {
soldier._x = zindi._x + random(50) - 25;
soldier._y = zindi._y + random(50) - 25;
}
if (pilihSoldier >= 5) {
++kiniVehicle;
if (pilihSoldier == 5) {
soldier.nyawa = 500;
} else {
if (pilihSoldier == 6) {
soldier.nyawa = 1000;
} else {
if (pilihSoldier == 7) {
soldier.nyawa = 2000;
}
}
}
} else {
if (zindi2 == 'duplikat') {
soldier.nyawa = zindi.nyawa;
} else {
if (battle_mc.pasukan_mc['jumlah' + pilihSoldier] >= nilaiSoldier) {
soldier.nyawa = nilaiSoldier;
} else {
soldier.nyawa = battle_mc.pasukan_mc['jumlah' + pilihSoldier];
}
}
}
if (pilihSoldier == 5) {
soldier.scaleAwal = 75;
} else {
if (pilihSoldier == 6) {
soldier.scaleAwal = 75;
} else {
soldier.scaleAwal = 100;
}
}
if (pilihSoldier == 1) {
wpindahBareman -= nilaiSoldier;
if (wpindahBareman <= 0) {
wpindahBareman = 0;
}
soldier.damage = _root['xbaremanPower' + keKota] * 2;
soldier.range = 50;
soldier.speed = 3;
soldier.tipeSenjata = 'melee';
} else {
if (pilihSoldier == 2) {
wpindahSwordman -= nilaiSoldier;
if (wpindahSwordman <= 0) {
wpindahSwordman = 0;
}
soldier.damage = _root['xswordmanPower' + keKota] * 2;
soldier.range = 75;
soldier.speed = 2;
soldier.tipeSenjata = 'melee';
} else {
if (pilihSoldier == 3) {
wpindahArrowman -= nilaiSoldier;
if (wpindahArrowman <= 0) {
wpindahArrowman = 0;
}
soldier.damage = _root['xarrowmanPower' + keKota] * 2;
soldier.range = 350;
soldier.speed = 1.5;
soldier.tipeSenjata = 'range';
} else {
if (pilihSoldier == 4) {
wpindahSpearman -= nilaiSoldier;
if (wpindahSpearman <= 0) {
wpindahSpearman = 0;
}
soldier.damage = _root['xspearmanPower' + keKota] * 2;
soldier.range = 100;
soldier.speed = 2.5;
soldier.tipeSenjata = 'melee';
} else {
if (pilihSoldier == 5) {
--wpindahTank;
if (wpindahTank <= 0) {
wpindahTank = 0;
}
soldier.damage = 10;
soldier.range = 400;
soldier.speed = 1;
soldier.tipeSenjata = 'range';
} else {
if (pilihSoldier == 6) {
--wpindahCopter;
if (wpindahCopter <= 0) {
wpindahCopter = 0;
}
soldier.damage = 10;
soldier.range = 450;
soldier.speed = 1.5;
soldier.tipeSenjata = 'range';
soldier.heli = true;
} else {
if (pilihSoldier == 7) {
--wpindahMonbot;
if (wpindahMonbot <= 0) {
wpindahMonbot = 0;
}
soldier.damage = 50;
soldier.range = 50;
soldier.speed = 1.25;
soldier.tipeSenjata = 'range';
}
}
}
}
}
}
}
soldier.speed *= 1.75;
if (_root['rangerAktif' + keKota] == true) {
soldier.range *= 2;
}
if (_root['tirelessAktif' + keKota] == true) {
soldier.damage *= 2;
}
if (_root['armorPlusAktif' + keKota] == true) {
soldier.nyawa *= 2;
}
if (_root['speedPlusAktif' + keKota] == true) {
soldier.speed *= 2;
}
_root['pasukan' + xdalamSoldier]._visible = true;
_root['pasukan' + xdalamSoldier].gotoAndStop(pilihSoldier);
_root['pasukan' + xdalamSoldier].jumlah = soldier.nyawa;
if (zindi2 == 'duplikat') {
soldier.speed += 1;
}
soldier.kebal = false;
soldier.invis = false;
soldier.special = false;
if (zindi2 == 'duplikat') {
soldier.iniDuplikasi = true;
soldier.duplikasi = true;
} else {
soldier.iniDuplikasi = false;
soldier.duplikasi = false;
}
soldier.serangBase = false;
soldier.nomorJagoan = xdalamSoldier;
soldier.jenis = pilihSoldier;
if (pilihSoldier <= 4) {
soldier.damage *= 0.02;
}
pilihTargetMusuh(soldier);
soldier.onEnterFrame = enterSoldier;
if (pilihSoldier >= 5) {
--battle_mc.pasukan_mc['jumlah' + pilihSoldier];
} else {
battle_mc.pasukan_mc['jumlah' + pilihSoldier] -= nilaiSoldier;
if (battle_mc.pasukan_mc['jumlah' + pilihSoldier] <= 0) {
battle_mc.pasukan_mc['jumlah' + pilihSoldier] = 0;
}
}
if (sedangTutorial == true) {
cekTutorial(45);
}
}
} else {
cekInfo('Can\'t unleash another vehicle units, maximum vehicle on the field reached');
}
} else {
cekInfo('Can\'t unleash another units, maximum soldiers on the field reached');
}
}
function enterSoldier() {
if (sedangPause == false) {
this._x += geserKiri;
if (sudahSelesai == false) {
if (this.nyawa <= 0) {
this.nyawa = 0;
if (this._currentframe != 4) {
if (this.jenis >= 5) {
--kiniVehicle;
}
--defenseKita;
if (defenseKita <= 0) {
cekKalah();
}
if (this.iniDuplikasi == false) {
if (this.jenis == 5) {
++xpindahTank;
} else {
if (this.jenis == 6) {
++xpindahCopter;
} else {
if (this.jenis == 7) {
++xpindahMonbot;
}
}
}
}
i = 100;
while (i <= 200) {
this['panah_mc' + i]._visible = false;
++i;
}
this.gotoAndStop(4);
}
} else {
if (this.kebal == true) {
i = 100;
while (i <= 110) {
this['efekKebal' + i]._visible = true;
++i;
}
if (this.awalKebal >= this.akhirKebal) {
this.kebal = false;
} else {
++this.awalKebal;
}
} else {
i = 100;
while (i <= 110) {
this['efekKebal' + i]._visible = false;
++i;
}
}
if (this.invis == true) {
this._alpha = 30;
i = 100;
while (i <= 110) {
this['efekInvis' + i]._visible = true;
++i;
}
if (this.awalInvis >= this.akhirInvis) {
this.invis = false;
} else {
++this.awalInvis;
}
} else {
this._alpha = 100;
i = 100;
while (i <= 110) {
this['efekInvis' + i]._visible = false;
++i;
}
}
if (this.special == true) {
i = 100;
while (i <= 110) {
this['efekSpecial' + i]._visible = true;
++i;
}
if (this.awalSpecial >= this.akhirSpecial) {
this.special = false;
} else {
++this.awalSpecial;
}
} else {
i = 100;
while (i <= 110) {
this['efekSpecial' + i]._visible = false;
++i;
}
}
if (this.xtarget.nyawa <= 0 || this.xtarget.nyawa == undefined) {
this.xtarget = undefined;
}
if (this.xtarget == undefined || this.xtarget.nyawa <= 0) {
i = 80;
while (i >= 50) {
if (_root['musuh_mc' + i].nyawa != undefined) {
this.jarak = Math.sqrt(Math.pow(this._x - _root['musuh_mc' + i]._x, 2) + Math.pow(this._y - _root['musuh_mc' + i]._y, 2));
if (this.jarak <= this.range) {
if (this.tipeSenjata == 'melee' && _root['musuh_mc' + i].heli == true) {
} else {
this.xtarget = _root['musuh_mc' + i];
i = 50;
}
}
}
--i;
}
} else {
this.jarak = Math.sqrt(Math.pow(this._x - this.xtarget._x, 2) + Math.pow(this._y - this.xtarget._y, 2));
if (this.jarak > this.range) {
this.xtarget = undefined;
}
if (this._x > this.xtarget._x) {
this.xtarget = undefined;
}
}
if (this.tipeSenjata == 'range') {
if (this._x >= background_mc._x + 100 + 2800 - this.range / 2) {
this.gotoAndStop(3);
this.serangBase = true;
adaSerangBase = true;
} else {
if (this.xtarget != undefined) {
this.gotoAndStop(3);
} else {
this._x += this.speed * speedBattle;
this.gotoAndStop(2);
}
}
} else {
if (this._x >= background_mc._x + 100 + 2800 - this.range) {
this.gotoAndStop(3);
this.serangBase = true;
adaSerangBase = true;
} else {
if (this.xtarget != undefined) {
this.gotoAndStop(3);
} else {
this._x += this.speed * speedBattle;
this.gotoAndStop(2);
}
}
}
}
}
}
this.jumlah = Math.ceil(this.nyawa);
if (this.jenis == 6) {
this.swapDepths(100 + this._x + this._y * 200);
} else {
this.swapDepths(100 + this._x + this._y * 100);
}
}
function cekSerangJagoan(indi) {
if (indi.special == true) {
efekSpecialJagoan(indi.xtarget);
}
if (indi.jenis == 7) {
cekGetarBumi();
} else {
if (indi.jenis == 5 || indi.jenis == 6) {
if (indi.serangBase == true) {
cekEfekLedakan(benteng_mc, 'benteng');
} else {
cekEfekLedakan(indi.xtarget);
}
}
}
if (indi.serangBase == true) {
if (indi.jenis == 3) {
buatPanah2(indi);
} else {
nyawaBenteng -= indi.damage;
}
} else {
if (indi.jenis == 3) {
buatPanah(indi);
} else {
indi.xtarget.nyawa -= indi.damage;
}
}
}
function efekSpecialJagoan(indi) {
i = 1;
while (i <= 2) {
if (indi != undefined) {
efek = attachMovie('efekApi2', 'api_mc' + dalamSpell, dalamSpell);
efek._x = indi._x + random(150) - 75;
efek._y = indi._y - 50 + random(150) - 75;
efek._xscale = 25 + random(25);
efek._yscale = 25 + random(25);
efek.gotoAndPlay(random(5) + 1);
efek.onEnterFrame = enterEfekApi;
++dalamSpell;
if (dalamSpell >= 301000) {
dalamSpell = 300000;
}
}
++i;
}
if (indi != undefined) {
efek = attachMovie('efekLedakan', 'spell_mc' + dalamSpell, dalamSpell);
efek._x = indi._x;
efek._y = indi._y - 50;
efek._xscale = 75;
efek._yscale = 75;
efek.onEnterFrame = enterEfekApi;
++dalamSpell;
if (dalamSpell >= 301000) {
dalamSpell = 300000;
}
}
}
function efekSpecialMusuh(indi) {
i = 1;
while (i <= 2) {
if (indi != undefined) {
efek = attachMovie('efekApi2', 'api_mc' + dalamSpell, dalamSpell);
efek._x = indi._x + random(150) - 75;
efek._y = indi._y - 50 + random(150) - 75;
efek._xscale = 25 + random(25);
efek._yscale = 25 + random(25);
efek.gotoAndPlay(random(5) + 1);
efek.onEnterFrame = enterEfekApi2;
++dalamSpell;
if (dalamSpell >= 301000) {
dalamSpell = 300000;
}
}
++i;
}
if (indi != undefined) {
efek = attachMovie('efekLedakan', 'spell_mc' + dalamSpell, dalamSpell);
efek._x = indi._x;
efek._y = indi._y - 50;
efek._xscale = 75;
efek._yscale = 75;
efek.onEnterFrame = enterEfekApi2;
++dalamSpell;
if (dalamSpell >= 301000) {
dalamSpell = 300000;
}
}
}
function cekGetarBumi() {
if (getarBumi == false) {
cekNormalY('awal');
getarKe = 1;
getarBumi = true;
}
}
function cekEfekLedakan(indi, indi2) {
efek = attachMovie('efekLedakan', 'spell_mc' + dalamSpell, dalamSpell);
if (indi2 == 'benteng') {
efek._x = benteng_mc._x;
efek._y = benteng_mc._y - 175;
} else {
efek._x = indi._x;
efek._y = indi._y - 50;
}
efek._xscale = 75;
efek._yscale = 75;
efek.onEnterFrame = enterEfekApi;
++dalamSpell;
if (dalamSpell >= 301000) {
dalamSpell = 300000;
}
if (efek._x == 0 || efek._x == undefined) {
removeMovieClip(efek);
}
}
function enterEfekApi() {
if (sedangPause == false) {
this._x += geserKiri;
i = 50;
while (i <= 65) {
if (this.hitTest(_root['musuh_mc' + i].anim)) {
_root['musuh_mc' + i].nyawa -= 0.5;
}
++i;
}
if (this.hitTest(_root.benteng_mc)) {
nyawaBenteng -= 1;
}
}
}
function buatPanah(indi) {
peluru = attachMovie('panah_mc', 'peluru_mc' + dalamPeluru, dalamPeluru);
peluru._x = indi._x;
peluru._y = indi._y - 25;
peluru._yscale = 80;
peluru._xscale = 80;
peluru.speed = 25;
peluru.arahTembak = 35;
peluru.xtarget = indi.xtarget;
peluru.tujuanX = indi.xtarget._x;
peluru.tujuanY = indi.xtarget._y;
peluru.indi = indi;
peluru.onEnterFrame = enterPanah;
++dalamPeluru;
if (dalamPeluru >= 200) {
dalamPeluru = 100;
}
}
function enterPanah() {
if (sedangPause == false) {
this._x += geserKiri;
if (this.xtarget.nyawa == undefined) {
deltaX = this._x - this.tujuanX;
deltaY = this._y - this.tujuanY;
angle = -Math.atan2(deltaX, deltaY) / 0.0174532925199433;
this._rotation = angle;
if (Math.sqrt(deltaX * deltaX + deltaY * deltaY) > this.speed) {
this.speed += 0.5;
this._y -= this.speed * Math.cos(angle * 0.0174532925199433);
this._x += this.speed * Math.sin(angle * 0.0174532925199433);
} else {
removeMovieClip(this);
}
} else {
deltaX = this._x - this.xtarget._x;
deltaY = this._y - this.xtarget._y + this.arahTembak;
angle = -Math.atan2(deltaX, deltaY) / 0.0174532925199433;
this._rotation = angle;
if (Math.sqrt(deltaX * deltaX + deltaY * deltaY) > this.speed) {
this.speed += 0.5;
this._y -= this.speed * Math.cos(angle * 0.0174532925199433);
this._x += this.speed * Math.sin(angle * 0.0174532925199433);
} else {
this.xtarget.nyawa -= this.indi.damage;
if (this.xtarget.nyawa > 0) {
this.xtarget.attachMovie('panah_mc', 'panah_mc' + dalamPeluru, dalamPeluru);
this.xtarget['panah_mc' + dalamPeluru].gotoAndStop(2);
this.xtarget['panah_mc' + dalamPeluru]._x = -75 + random(15) + 7;
this.xtarget['panah_mc' + dalamPeluru]._y = -35 + random(15) + 7;
this.xtarget['panah_mc' + dalamPeluru]._rotation = this._rotation - random(15) + 7;
this.xtarget['panah_mc' + dalamPeluru]._xscale = this._xscale;
this.xtarget['panah_mc' + dalamPeluru]._yscale = this._yscale;
++dalamPeluru;
if (dalamPeluru >= 200) {
dalamPeluru = 100;
}
}
removeMovieClip(this);
}
}
}
this.swapDepths(100 + this._x + this._y * 100);
}
function buatPanah2(indi) {
peluru = attachMovie('panah_mc', 'peluru_mc' + dalamPeluru, dalamPeluru);
peluru._x = indi._x;
peluru._y = indi._y - 25;
peluru._yscale = 80;
peluru._xscale = 80;
peluru.speed = 25;
peluru.randX = random(50) - 25;
peluru.randY = random(50) - 25;
peluru.xtarget = benteng_mc;
peluru.indi = indi;
peluru.onEnterFrame = enterPanah2;
++dalamPeluru;
if (dalamPeluru >= 200) {
dalamPeluru = 100;
}
}
function enterPanah2() {
if (sedangPause == false) {
this._x += geserKiri;
deltaX = this._x - this.xtarget._x + this.randX;
deltaY = this._y - (this.xtarget._y - 100) + this.randY;
angle = -Math.atan2(deltaX, deltaY) / 0.0174532925199433;
this._rotation = angle;
if (Math.sqrt(deltaX * deltaX + deltaY * deltaY) > this.speed) {
this.speed += 0.5;
this._y -= this.speed * Math.cos(angle * 0.0174532925199433);
this._x += this.speed * Math.sin(angle * 0.0174532925199433);
} else {
nyawaBenteng -= this.indi.damage;
this.xtarget.attachMovie('panah_mc', 'panah_mc' + dalamPeluru, dalamPeluru);
this.xtarget['panah_mc' + dalamPeluru].gotoAndStop(2);
this.xtarget['panah_mc' + dalamPeluru]._x = -15 + random(50) - 25 + random(15) + 7;
this.xtarget['panah_mc' + dalamPeluru]._y = -115 - this.randY + random(10) - 5;
this.xtarget['panah_mc' + dalamPeluru]._rotation = this._rotation - random(15) + 7;
this.xtarget['panah_mc' + dalamPeluru]._xscale = this._xscale;
this.xtarget['panah_mc' + dalamPeluru]._yscale = this._yscale;
++dalamPeluru;
if (dalamPeluru >= 200) {
dalamPeluru = 100;
}
removeMovieClip(this);
}
}
this.swapDepths(100 + this._x + this._y * 100);
}
function klikSpell() {
if (mulaiBattle == true) {
myStr = new String(this);
if (isNaN(myStr.substr(myStr.length - 2, 2))) {
indi = myStr.substr(myStr.length - 1, 1);
} else {
indi = myStr.substr(myStr.length - 2, 2);
}
if (battle_mc.pasukan_mc['jumlah' + indi] > 0) {
pilihSpell = indi;
spell = attachMovie('spellTarget', 'drag_mc2', dalamDrag);
spell.bisa._visible = true;
spell._x = _root._xmouse;
spell._y = _root._ymouse + spell._height / 10;
if (pilihSpell >= 15) {
spell._yscale = 150;
spell._xscale = 150;
} else {
spell._yscale = 75;
spell._xscale = 75;
}
spell.startDrag();
sedangDragSpell = true;
sedangDragSpell2 = false;
battle_mc.remove_mc._visible = true;
}
}
}
function klikSpell2() {
if (mulaiBattle == true) {
myStr = new String(this);
bisaBuatSpell2 = false;
i = 11;
while (i <= 18) {
if (battle_mc.pasukan_mc['jumlah' + i] > 0) {
bisaBuatSpell2 = true;
}
++i;
}
if (bisaBuatSpell2 == true) {
spell = attachMovie('spellTarget2', 'drag_mc2', dalamDrag);
spell.bisa._visible = true;
spell._x = _root._xmouse;
spell._y = _root._ymouse + spell._height / 10;
if (pilihSpell >= 15) {
spell._yscale = 150;
spell._xscale = 150;
} else {
spell._yscale = 75;
spell._xscale = 75;
}
spell.startDrag();
sedangDragSpell = false;
sedangDragSpell2 = true;
battle_mc.remove_mc._visible = true;
}
}
}
function klikWeapon() {
myStr = new String(this);
if (isNaN(myStr.substr(myStr.length - 2, 2))) {
indi = myStr.substr(myStr.length - 1, 1);
} else {
indi = myStr.substr(myStr.length - 2, 2);
}
if (battle_mc.pasukan_mc['jumlah' + indi] > 0) {
pilihWeapon = indi;
weapon2 = attachMovie('panahWeapon', 'drag_mc2', dalamDrag);
weapon2.bisa._visible = true;
weapon2._x = _root._xmouse;
weapon2._y = _root._ymouse + weapon2._height / 10;
if (pilihWeapon == 8) {
weapon2.jumlah = 25;
weapon2.gotoAndStop(1);
} else {
if (pilihWeapon == 9) {
weapon2.jumlah = 50;
weapon2.gotoAndStop(2);
} else {
if (pilihWeapon == 10) {
weapon2.jumlah = 75;
weapon2.gotoAndStop(3);
}
}
}
weapon2.anim.stop();
weapon2.startDrag();
sedangDragWeapon = true;
battle_mc.remove_mc._visible = true;
}
}
function cekPause(indi) {
if (indi == true) {
sedangDragWeapon = false;
sedangDragSpell = false;
sedangDragSpell2 = false;
removeMovieClip(drag_mc2);
buatKotak(false);
}
if (indi == true) {
battle_mc.soldier_mc.enabled = false;
battle_mc.vehicle_mc.enabled = false;
battle_mc.weapon_mc.enabled = false;
battle_mc.spell_mc.enabled = false;
battle_mc.retreat_btn.enabled = false;
battle_mc.defense_mc.enabled = false;
battle_mc.all_btn.enabled = false;
i = 1;
while (i <= 23) {
battle_mc.pasukan_mc['unit' + i].enabled = false;
++i;
}
i = 50;
while (i <= 85) {
_root['musuh_mc' + i].anim.stop();
++i;
}
i = 1;
while (i <= maximumJagoan) {
_root['jagoan_mc' + i].anim.stop();
++i;
}
} else {
if (indi == false) {
battle_mc.soldier_mc.enabled = true;
battle_mc.vehicle_mc.enabled = true;
battle_mc.weapon_mc.enabled = true;
battle_mc.spell_mc.enabled = true;
battle_mc.retreat_btn.enabled = true;
battle_mc.defense_mc.enabled = true;
battle_mc.all_btn.enabled = true;
i = 1;
while (i <= 23) {
battle_mc.pasukan_mc['unit' + i].enabled = true;
++i;
}
i = 50;
while (i <= 85) {
_root['musuh_mc' + i].anim.play();
++i;
}
i = 1;
while (i <= maximumJagoan) {
_root['jagoan_mc' + i].anim.play();
++i;
}
}
}
}
function jagoanLari() {
this._x += geserKiri;
this._x -= this.speed * 4;
this.gotoAndStop(2);
this.anim._xscale = -this.scaleAwal;
this.swapDepths(100 + this._x + this._y * 100);
}
function clearSemua2() {
delete myListener.onKeyDown;
delete myListener.onKeyUp;
Key.removeListener(myListener);
delete _root.onEnterFrame;
delete _root.onMouseDown;
delete _root.onMouseMove;
removeMovieClip(benteng_mc);
removeMovieClip(drag_mc);
removeMovieClip(drag_mc2);
removeMovieClip(pause_mc);
i = 50;
while (i <= 65) {
removeMovieClip(_root['musuh_mc' + i]);
++i;
}
i = 50;
while (i <= 65) {
removeMovieClip(_root['xmusuh_mc' + i]);
++i;
}
i = 1;
while (i <= maximumJagoan) {
removeMovieClip(_root['jagoan_mc' + i]);
++i;
}
i = 100;
while (i <= 200) {
removeMovieClip(_root['peluru_mc' + i]);
++i;
}
i = 200;
while (i <= 300) {
removeMovieClip(_root['weapon_mc' + i]);
++i;
}
i = 300000;
while (i <= 301000) {
removeMovieClip(_root['spell_mc' + i]);
++i;
}
}
function cekKalah() {
if (sudahSelesai == false) {
sudahSelesai = true;
i = 50;
while (i <= 65) {
_root['musuh_mc' + i].gotoAndStop(1);
++i;
}
i = 1;
while (i <= maximumJagoan) {
_root['jagoan_mc' + i].gotoAndStop(4);
++i;
}
menangBattle = false;
idLanjut = setInterval(lanjutMain, 2000);
}
}
function cekMenang() {
if (sudahSelesai == false) {
sudahSelesai = true;
benteng_mc.gotoAndStop(2);
i = 100;
while (i <= 200) {
benteng_mc['panah_mc' + i]._visible = false;
++i;
}
i = 1;
while (i <= maximumJagoan) {
_root['jagoan_mc' + i].gotoAndStop(1);
++i;
}
i = 50;
while (i <= 65) {
_root['musuh_mc' + i].onEnterFrame = musuhLari;
++i;
}
menangBattle = true;
idLanjut = setInterval(lanjutMain, 2000);
}
}
function musuhLari() {
this._x += geserKiri;
this._x += this.speed * 4;
this.gotoAndStop(2);
this.anim._xscale = -this.scaleAwal;
this.swapDepths(100 + this._x + this._y * 100);
}
function lanjutMain() {
clearSemua2();
clearInterval(idLanjut);
if (xpindahBareman >= pindahBareman) {
xpindahBareman = pindahBareman;
}
if (xpindahSwordman >= pindahSwordman) {
xpindahSwordman = pindahSwordman;
}
if (xpindahArrowman >= pindahArrowman) {
xpindahArrowman = pindahArrowman;
}
if (xpindahSpearman >= pindahSpearman) {
xpindahSpearman = pindahSpearman;
}
if (xpindahTank >= pindahTank) {
xpindahTank = pindahTank;
}
if (xpindahCopter >= pindahCopter) {
xpindahCopter = pindahCopter;
}
if (xpindahMonbot >= pindahMonbot) {
xpindahMonbot = pindahMonbot;
}
xpindahBareman = Math.floor(xpindahBareman);
xpindahSwordman = Math.floor(xpindahSwordman);
xpindahArrowman = Math.floor(xpindahArrowman);
xpindahSpearman = Math.floor(xpindahSpearman);
xpindahTank = Math.floor(xpindahTank);
xpindahCopter = Math.floor(xpindahCopter);
xpindahMonbot = Math.floor(xpindahMonbot);
if (kotaSerang == 21) {
if (menangBattle == true) {
if (kondisiPreview == 'gate1') {
kondisiPreview = 'gate2';
} else {
if (kondisiPreview == 'gate2') {
kondisiPreview = 'gate3';
} else {
if (kondisiPreview == 'gate3') {
kondisiPreview = 'gate4';
} else {
if (kondisiPreview == 'gate4') {
kondisiPreview = 'akhir';
}
}
}
}
gotoAndStop(770);
} else {
kondisiPreview = 'akhir';
gotoAndStop(770);
}
} else {
kondisiPreview = 'akhir';
gotoAndStop(770);
}
}
function cekSpeed() {
if (speedBattle == 1) {
battle_mc.speed_mc.gotoAndStop(1);
} else {
if (speedBattle == 2) {
battle_mc.speed_mc.gotoAndStop(2);
}
}
}
stop();
if (sedangTutorial == true) {
cekTutorial(44);
}
tipeAttackMusuh = 'attack';
frameKota.namaKota = xnamaKota[kotaSerang];
backBattle2();
initBattle();
buatBenteng();
buatBackground();
cekJumlahTankMusuh();
if (kotaSerang == 21) {
buatGuard();
buatGuard2();
} else {
if (siapaYangNyerang == 2) {
buatGuard();
if (xday >= 1000) {
buatGuard2();
}
}
}
_root.onEnterFrame = function () {
if (sedangPause == false) {
if (tingkatSulit == 3) {
hariSpell = 250;
} else {
hariSpell = 500;
}
if (siapaYangNyerang == 2) {
if (musuhSpell >= maxMusuhSpell) {
musuhSpell = 0;
if (kotaSerang == 21) {
cekSpellMusuh2();
} else {
cekSpellMusuh();
}
} else {
++musuhSpell;
}
} else {
if (xday >= hariSpell) {
if (musuhSpell >= maxMusuhSpell) {
musuhSpell = 0;
cekSpellMusuh();
} else {
++musuhSpell;
}
}
}
if (adaSerangBase == true) {
if (delayMusuhKeluar >= maxMusuhKeluar2) {
if (tingkatSulit >= 2) {
buatMusuh();
buatMusuh();
buatMusuh();
buatMusuh();
buatMusuh();
adaSerangBase = false;
delayMusuhKeluar = 0;
} else {
buatMusuh();
adaSerangBase = false;
delayMusuhKeluar = 0;
}
} else {
++delayMusuhKeluar;
}
} else {
if (delayMusuhKeluar >= maxMusuhKeluar) {
buatMusuh();
delayMusuhKeluar = 0;
} else {
++delayMusuhKeluar;
}
}
if (_root._xmouse <= 10 || geserKeKiri == true) {
if (background_mc._x <= -20) {
geserKiri = 10 * speedBattle * 3;
} else {
geserKiri = 0;
}
} else {
if (_root._xmouse >= 790 || geserKeKanan == true) {
if (background_mc._x >= -2350) {
geserKiri = -10 * speedBattle * 3;
} else {
geserKiri = 0;
}
} else {
geserKiri = 0;
}
}
background_mc._x += geserKiri;
if (getarBumi == true) {
if (getarKe == 1) {
cekGeserX(5);
cekGeserY(5);
++getarKe;
} else {
if (getarKe == 2) {
cekGeserX(-10);
cekGeserY(-10);
++getarKe;
} else {
if (getarKe == 3) {
cekGeserX(5);
cekGeserY(-5);
++getarKe;
} else {
if (getarKe == 4) {
cekGeserX(-5);
cekGeserY(5);
++getarKe;
} else {
if (getarKe == 5) {
cekGeserX(7);
cekGeserY(7);
++getarKe;
} else {
if (getarKe == 6) {
cekGeserX(10);
cekGeserY(-10);
++getarKe;
} else {
if (getarKe == 7) {
cekGeserX(-12);
cekGeserY(7);
++getarKe;
} else {
if (getarKe == 8) {
cekGeserX(5);
cekGeserY(5);
++getarKe;
} else {
if (getarKe == 9) {
cekGeserX(-10);
cekGeserY(-10);
++getarKe;
} else {
if (getarKe == 10) {
cekGeserX(5);
cekGeserY(-5);
++getarKe;
} else {
if (getarKe == 11) {
cekGeserX(-5);
cekGeserY(5);
++getarKe;
} else {
if (getarKe == 12) {
cekGeserX(7);
cekGeserY(7);
++getarKe;
} else {
if (getarKe == 13) {
cekGeserX(10);
cekGeserY(-10);
++getarKe;
} else {
if (getarKe == 14) {
cekGeserX(-12);
cekGeserY(7);
++getarKe;
} else {
cekNormalY('akhir');
getarBumi = false;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
if (defenseKita <= 0) {
defenseKita = 0;
}
if (totalMusuh <= 0) {
totalMusuh = 0;
}
ourDefense.jumlah = defenseKita;
enemyLeft.jumlah = totalMusuh;
enemyBase.jumlah = Math.ceil(nyawaBenteng);
}
if (battle_mc.pasukan_mc.jumlah11 <= 0) {
battle_mc.pasukan_mc.jumlah11 = 0;
}
if (battle_mc.pasukan_mc.jumlah12 <= 0) {
battle_mc.pasukan_mc.jumlah12 = 0;
}
if (battle_mc.pasukan_mc.jumlah13 <= 0) {
battle_mc.pasukan_mc.jumlah13 = 0;
}
if (battle_mc.pasukan_mc.jumlah14 <= 0) {
battle_mc.pasukan_mc.jumlah14 = 0;
}
if (battle_mc.pasukan_mc.jumlah15 <= 0) {
battle_mc.pasukan_mc.jumlah15 = 0;
}
if (battle_mc.pasukan_mc.jumlah16 <= 0) {
battle_mc.pasukan_mc.jumlah16 = 0;
}
if (battle_mc.pasukan_mc.jumlah17 <= 0) {
battle_mc.pasukan_mc.jumlah17 = 0;
}
if (battle_mc.pasukan_mc.jumlah18 <= 0) {
battle_mc.pasukan_mc.jumlah18 = 0;
}
};
ourDefense.onRollOver = function () {
this.gotoAndStop(2);
};
ourDefense.onRollOut = function () {
this.gotoAndStop(1);
};
enemyLeft.onRollOver = function () {
this.gotoAndStop(2);
};
enemyLeft.onRollOut = function () {
this.gotoAndStop(1);
};
enemyBase.onRollOver = function () {
this.gotoAndStop(2);
};
enemyBase.onRollOut = function () {
this.gotoAndStop(1);
};
battle_mc.soldier_mc.onRelease = function () {
sedangDragWeapon = false;
sedangDragSpell = false;
sedangDragSpell2 = false;
removeMovieClip(drag_mc2);
buatKotak(false);
battle_mc.pasukan_mc.gotoAndStop(1);
cekPasukanBuat();
};
battle_mc.vehicle_mc.onRelease = function () {
sedangDragWeapon = false;
sedangDragSpell = false;
sedangDragSpell2 = false;
removeMovieClip(drag_mc2);
buatKotak(false);
battle_mc.pasukan_mc.gotoAndStop(2);
cekPasukanBuat();
};
battle_mc.weapon_mc.onRelease = function () {
sedangDragWeapon = false;
sedangDragSpell = false;
sedangDragSpell2 = false;
removeMovieClip(drag_mc2);
buatKotak(false);
battle_mc.pasukan_mc.gotoAndStop(3);
cekPasukanBuat();
};
battle_mc.spell_mc.onRelease = function () {
sedangDragWeapon = false;
sedangDragSpell = false;
sedangDragSpell2 = false;
removeMovieClip(drag_mc2);
buatKotak(false);
battle_mc.pasukan_mc.gotoAndStop(4);
cekPasukanBuat();
};
battle_mc.defense_mc.onRelease = function () {
sedangDragWeapon = false;
sedangDragSpell = false;
sedangDragSpell2 = false;
removeMovieClip(drag_mc2);
buatKotak(false);
battle_mc.pasukan_mc.gotoAndStop(5);
cekPasukanBuat();
};
battle_mc.remove_mc._visible = false;
battle_mc.remove_mc.onRelease = function () {
sedangDragWeapon = false;
sedangDragSpell = false;
sedangDragSpell2 = false;
removeMovieClip(drag_mc2);
buatKotak(false);
};
battle_mc.pasukan_mc.gotoAndStop(1);
cekPasukanBuat();
_root.onMouseDown = function () {
if (sedangPause == false) {
if (sedangDragWeapon == true) {
if (_root._ymouse >= 325 && _root._ymouse <= 475) {
buatWeapon(_root._ymouse);
sedangDragWeapon = false;
stopDrag();
removeMovieClip(drag_mc2);
}
} else {
if (sedangDragSpell == true) {
if (pilihSpell == 14) {
if (_root._ymouse >= 275 && _root._ymouse <= 475) {
if (getarBumi2 == false) {
getarBumi2 = true;
buatSpell(_root._xmouse, _root._ymouse);
sedangDragSpell = false;
stopDrag();
removeMovieClip(drag_mc2);
}
}
} else {
if (_root._ymouse >= 125 && _root._ymouse <= 475) {
buatSpell(_root._xmouse, _root._ymouse);
sedangDragSpell = false;
stopDrag();
removeMovieClip(drag_mc2);
}
}
} else {
if (sedangDragSpell2 == true) {
if (_root._ymouse >= 125 && _root._ymouse <= 475) {
buatSpell2(_root._xmouse, _root._ymouse);
sedangDragSpell = false;
stopDrag();
removeMovieClip(drag_mc2);
}
}
}
}
}
};
_root.onMouseMove = function () {
if (sedangDragWeapon == true) {
if (_root._ymouse >= 325 && _root._ymouse <= 475) {
drag_mc2.bisa._visible = false;
} else {
drag_mc2.bisa._visible = true;
}
} else {
if (sedangDragSpell == true) {
if (pilihSpell == 14) {
if (getarBumi2 == true) {
drag_mc2.bisa._visible = true;
} else {
if (_root._ymouse >= 275 && _root._ymouse <= 475) {
drag_mc2.bisa._visible = false;
} else {
drag_mc2.bisa._visible = true;
}
}
} else {
if (_root._ymouse >= 125 && _root._ymouse <= 475) {
drag_mc2.bisa._visible = false;
} else {
drag_mc2.bisa._visible = true;
}
}
} else {
if (sedangDragSpell2 == true) {
if (_root._ymouse >= 125 && _root._ymouse <= 475) {
drag_mc2.bisa._visible = false;
} else {
drag_mc2.bisa._visible = true;
}
}
}
}
};
if (sedangTutorial == true) {
battle_mc.retreat_btn._visible = false;
} else {
battle_mc.retreat_btn._visible = true;
}
battle_mc.retreat_btn.onRelease = function () {
battle_mc.retreat_btn._visible = false;
i = 1;
while (i <= maximumJagoan) {
_root['jagoan_mc' + i].onEnterFrame = jagoanLari;
++i;
}
cekKalah();
};
battle_mc.pause_btn.onRelease = function () {
if (sedangPause == false) {
pause_mc = attachMovie('pause_mc', 'pause_mc', 1199905);
pause_mc._x = 400;
pause_mc._y = 300;
sedangPause = true;
} else {
removeMovieClip(pause_mc);
sedangPause = false;
}
cekPause(sedangPause);
};
cekSpeed();
battle_mc.speed_mc.onRelease = function () {
if (speedBattle == 1) {
speedBattle = 2;
} else {
if (speedBattle == 2) {
speedBattle = 1;
}
}
cekSpeed();
};
geserKeKiri = false;
geserKeKanan = false;
myListener = new Object();
myListener.onKeyDown = function () {
if (Key.getCode() == 65 || Key.getCode() == 37) {
geserKeKiri = true;
}
if (Key.getCode() == 68 || Key.getCode() == 39) {
geserKeKanan = true;
}
};
myListener.onKeyUp = function () {
if (Key.getCode() == 65 || Key.getCode() == 37) {
geserKeKiri = false;
}
if (Key.getCode() == 68 || Key.getCode() == 39) {
geserKeKanan = false;
}
};
Key.addListener(myListener);
}
movieClip 2924 {
}
movieClip 2925 {
frame 1 {
stop();
}
}
movieClip 2929 {
frame 1 {
stop();
}
}
movieClip 2935 {
}
movieClip 2938 {
frame 1 {
stop();
}
}
movieClip 2941 {
frame 1 {
stop();
}
}
movieClip 2944 {
frame 1 {
stop();
}
}
frame 902 {
function initAwalBattle() {
jumlahJagoan = 0;
jumlahMusuh = 0;
mulaiBattle = true;
getarBumi = false;
getarBumi2 = false;
sedangDragWeapon = false;
sedangDragSpell = false;
sudahSelesai = false;
sudahDatangJagoan = false;
sedangPause = false;
}
function initBattle() {
geserKiri = 0;
dalamDrag = 200000;
dalamSpell = 300000;
dalamSoldier = 1;
dalamLaba = 500;
dalamBenteng = 300;
dalamWeapon = 200;
dalamPeluru = 100;
dalamEfekJagoan = 100;
dalamMusuh = 50;
if (xday <= 100) {
nilaiSoldier = 20;
} else {
if (xday <= 200) {
nilaiSoldier = 25;
} else {
if (xday <= 300) {
nilaiSoldier = 30;
} else {
if (xday <= 400) {
nilaiSoldier = 35;
} else {
if (xday <= 500) {
nilaiSoldier = 40;
} else {
if (xday <= 600) {
nilaiSoldier = 45;
} else {
nilaiSoldier = 50;
}
}
}
}
}
}
maximumJagoan = 29;
kiniVehicle = 0;
waktuDatangJagoan = 60;
kiniDatangJagoan = 0;
maxDatangJagoan = 30;
i = 1;
while (i <= 10) {
j = 1;
while (j <= 4) {
_root['sudahLingkar' + i + j] = false;
++j;
}
++i;
}
i = 1;
while (i <= 60) {
_root['pasukan' + i]._visible = false;
_root['pasukan' + i].gotoAndStop(1);
++i;
}
wpindahBareman = pindahBareman;
wpindahSwordman = pindahSwordman;
wpindahArrowman = pindahArrowman;
wpindahSpearman = pindahSpearman;
wpindahTank = pindahTank;
wpindahCopter = pindahCopter;
wpindahMonbot = pindahMonbot;
wpindahArrowTrap = pindahArrowTrap;
wpindahCatapult = pindahCatapult;
wpindahFireTrap = pindahFireTrap;
wpindahArrowRain = pindahArrowRain;
wpindahMeteorid = pindahMeteorid;
wpindahAcidRain = pindahAcidRain;
wpindahEarthquake = pindahEarthquake;
wpindahImmune = pindahImmune;
wpindahInvisible = pindahInvisible;
wpindahSpecialAttack = pindahSpecialAttack;
wpindahDuplicate = pindahDuplicate;
wpindahWall = pindahWall;
wpindahSpike = pindahSpike;
wpindahSpiderWeb = pindahSpiderWeb;
wpindahTowerGuard = pindahTowerGuard;
wpindahZombieTrap = pindahZombieTrap;
delayMusuhKeluar = 0;
if (xday <= 100) {
maxMusuhKeluar = 60;
defenseKita = 3;
} else {
if (xday <= 200) {
maxMusuhKeluar = 55;
defenseKita = 4;
} else {
if (xday <= 300) {
maxMusuhKeluar = 50;
defenseKita = 5;
} else {
if (xday <= 400) {
maxMusuhKeluar = 45;
defenseKita = 6;
} else {
if (xday <= 500) {
maxMusuhKeluar = 40;
defenseKita = 7;
} else {
if (xday <= 600) {
maxMusuhKeluar = 35;
defenseKita = 8;
} else {
if (xday <= 700) {
maxMusuhKeluar = 30;
defenseKita = 9;
} else {
maxMusuhKeluar = 25;
defenseKita = 10;
}
}
}
}
}
}
}
defenseKita = 1;
maxMusuhKeluar *= 0.5;
maxMusuh = jumlahPasukanMusuhSerang;
maxMusuh *= 2.5;
jumlahPasukanMusuhSerang *= 2.5;
maxMusuh = Math.ceil(maxMusuh);
totalMusuh = maxMusuh;
}
function buatBackground() {
pilihanKota = posBackground[kotaSerang];
if (pilihanKota == 1) {
background_mc.gotoAndStop(1);
} else {
if (pilihanKota == 2) {
background_mc.gotoAndStop(2);
} else {
if (pilihanKota == 3) {
background_mc.gotoAndStop(3);
} else {
if (pilihanKota == 4) {
background_mc.gotoAndStop(4);
}
}
}
}
background_mc.cacheAsBitmap = true;
posAwalBackgroundX = background_mc._x;
posAwalBackgroundY = background_mc._y;
}
function buatMusuh() {
if (siapaYangNyerang == 2) {
if (tingkatSulit == 1) {
pilihMusuh = 1 + random(3);
} else {
if (tingkatSulit == 2) {
if (xday <= 500) {
pilihMusuh = 1 + random(3);
} else {
pilihMusuh = 1 + random(4);
}
} else {
if (tingkatSulit == 3) {
if (xday <= 500) {
pilihMusuh = 1 + random(3);
} else {
pilihMusuh = 1 + random(5);
}
}
}
}
if (xday <= 100) {
musuhNyawa = 10;
} else {
if (xday <= 200) {
musuhNyawa = 15;
} else {
if (xday <= 300) {
musuhNyawa = 20;
} else {
if (xday <= 400) {
musuhNyawa = 25;
} else {
if (xday <= 500) {
musuhNyawa = 30;
} else {
if (xday <= 600) {
musuhNyawa = 35;
} else {
if (xday <= 700) {
musuhNyawa = 40;
} else {
musuhNyawa = 45;
}
}
}
}
}
}
}
cekNyawaHuman();
} else {
if (siapaYangNyerang == 0) {
if (xday >= 1000) {
wrand = random(2);
if (wrand == 0) {
pilihMusuh = 1 + random(2);
} else {
pilihMusuh = 2;
}
} else {
pilihMusuh = 1 + random(2);
}
if (xday <= 100) {
musuhNyawa = 10;
} else {
if (xday <= 200) {
musuhNyawa = 15;
} else {
if (xday <= 300) {
musuhNyawa = 20;
} else {
if (xday <= 400) {
musuhNyawa = 25;
} else {
if (xday <= 500) {
musuhNyawa = 30;
} else {
if (xday <= 600) {
musuhNyawa = 35;
} else {
if (xday <= 700) {
musuhNyawa = 40;
} else {
if (xday <= 800) {
musuhNyawa = 45;
} else {
if (xday <= 900) {
musuhNyawa = 50;
} else {
if (xday <= 1000) {
musuhNyawa = 55;
} else {
if (xday <= 1100) {
musuhNyawa = 60;
} else {
if (xday <= 1200) {
musuhNyawa = 70;
} else {
if (xday <= 1300) {
musuhNyawa = 80;
} else {
if (xday <= 1400) {
musuhNyawa = 90;
} else {
if (xday <= 1500) {
musuhNyawa = 100;
} else {
if (xday <= 1600) {
musuhNyawa = 110;
} else {
if (xday <= 1700) {
musuhNyawa = 120;
} else {
if (xday <= 1800) {
musuhNyawa = 130;
} else {
if (xday <= 1900) {
musuhNyawa = 140;
} else {
musuhNyawa = 150;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
if (tingkatSulit == 3) {
musuhNyawa *= 3;
} else {
if (tingkatSulit == 2) {
musuhNyawa *= 2;
} else {
musuhNyawa *= 1;
}
}
}
}
if (siapaYangNyerang == 0) {
musuhNyawa *= 2;
} else {
musuhNyawa *= pengkalianMusuh;
}
if (totalMusuh > 0) {
bisaBuatMusuh = false;
i = 50;
while (i <= 65) {
if (_root['musuh_mc' + i].nyawa == undefined) {
xdalamMusuh = i;
i = 80;
bisaBuatMusuh = true;
}
++i;
}
if (bisaBuatMusuh == true) {
removeMovieClip(_root['musuh_mc' + xdalamMusuh]);
randKeluarMusuh = random(4) + 1;
if (pilihMusuh >= 4 && maxTankMusuh <= 0) {
pilihMusuh = 1 + random(3);
} else {
if (pilihMusuh >= 4 && maxTankMusuh > 0) {
--maxTankMusuh;
}
}
++jumlahMusuh;
if (siapaYangNyerang == 0) {
musuh = attachMovie('barbar' + pilihMusuh, 'musuh_mc' + xdalamMusuh, xdalamMusuh + 100);
} else {
if (siapaYangNyerang == 2) {
musuh = attachMovie('musuh' + pilihMusuh, 'musuh_mc' + xdalamMusuh, xdalamMusuh + 100);
}
}
musuh.cacheAsBitmap = true;
musuh._x = background_mc._x - 150 + 1700;
musuh._y = 190 + 85 * (randKeluarMusuh - 1);
musuh.jenis = pilihMusuh;
musuh.barisKe = randKeluarMusuh;
randSpeed = random(3);
if (pilihMusuh == 4 || pilihMusuh == 5) {
musuh.nyawa = (musuhNyawa + random(5)) * 5;
musuh.scaleAwal = 100;
musuh.range = 550;
if (randSpeed == 0) {
musuh.speed = 1.5;
} else {
if (randSpeed == 1) {
musuh.speed = 3 + random(2);
} else {
if (randSpeed == 2) {
musuh.speed = 0.5;
}
}
}
musuh.speed2 = musuh.speed * 2;
musuh.damage = 5;
musuh.tipeSenjata = 'range';
} else {
if (pilihMusuh == 2) {
musuh.nyawa = musuhNyawa + random(5);
musuh.scaleAwal = 100;
musuh.range = 450;
if (randSpeed == 0) {
musuh.speed = 1 + random(2);
} else {
if (randSpeed == 1) {
musuh.speed = 1.5;
} else {
if (randSpeed == 2) {
musuh.speed = 2.5 + random(2);
}
}
}
musuh.speed2 = musuh.speed * 4;
musuh.damage = 2;
musuh.tipeSenjata = 'range';
} else {
if (pilihMusuh == 3) {
musuh.nyawa = musuhNyawa + random(5);
musuh.scaleAwal = 100;
musuh.range = 100;
if (randSpeed == 0) {
musuh.speed = 2 + random(2);
} else {
if (randSpeed == 1) {
musuh.speed = 0.5;
} else {
if (randSpeed == 2) {
musuh.speed = 2.5 + random(2);
}
}
}
musuh.speed2 = musuh.speed * 4;
musuh.damage = 3;
musuh.tipeSenjata = 'melee';
} else {
musuh.nyawa = musuhNyawa + random(5);
musuh.scaleAwal = 100;
musuh.range = 50;
if (randSpeed == 0) {
musuh.speed = 2 + random(2);
} else {
if (randSpeed == 1) {
musuh.speed = 0.5;
} else {
if (randSpeed == 2) {
musuh.speed = 2.5 + random(2);
}
}
}
musuh.speed2 = musuh.speed * 4;
musuh.damage = 1;
musuh.tipeSenjata = 'melee';
}
}
}
musuh.kenaApi = false;
musuh.onEnterFrame = enterMusuh;
}
}
}
function enterMusuh() {
if (sedangPause == false) {
this._x += geserKiri;
if (sudahSelesai == false) {
if (this.nyawa <= 0) {
this.nyawa = 0;
if (this._currentframe != 4) {
++killMusuh;
--jumlahPasukanMusuhSerang;
--totalMusuh;
if (totalMusuh <= 0) {
cekMenang();
}
i = 100;
while (i <= 200) {
this['panah_mc' + i]._visible = false;
++i;
}
this.gotoAndStop(4);
}
} else {
if (this.xtarget.nyawa <= 0 || this.xtarget.nyawa == undefined || this.xtarget.invis == true) {
this.xtarget = undefined;
this.serangBalik = undefined;
}
if (this.xtarget == undefined || this.xtarget.nyawa <= 0) {
i = 1;
while (i <= maximumJagoan) {
if (_root['jagoan_mc' + i].nyawa != undefined) {
this.jarak = Math.sqrt(Math.pow(this._x - _root['jagoan_mc' + i]._x, 2) + Math.pow(this._y - _root['jagoan_mc' + i]._y, 2));
if (this.jarak <= this.range) {
this.xtarget = _root['jagoan_mc' + i];
i = maximumJagoan;
}
}
++i;
}
} else {
this.jarak = Math.sqrt(Math.pow(this._x - this.xtarget._x, 2) + Math.pow(this._y - this.xtarget._y, 2));
if (this.jarak > this.range) {
if (this.xtarget.tipeSenjata == 'range') {
this.xtarget = undefined;
} else {
if (this.serangBalik != true) {
this.xtarget = undefined;
}
}
}
if (this._x < this.xtarget._x) {
if (this.serangBalik != true) {
this.xtarget = undefined;
}
}
}
if (this.serangBalik == true) {
if (this.xtarget == undefined) {
this.anim._xscale = this.scaleAwal;
} else {
if (this._x <= this.xtarget._x) {
this.anim._xscale = -this.scaleAwal;
} else {
this.anim._xscale = this.scaleAwal;
}
}
} else {
this.anim._xscale = this.scaleAwal;
}
i = 300;
while (i <= 350) {
if (_root['benteng_mc' + i].nyawa != undefined) {
if (this.barisKe == _root['benteng_mc' + i].barisKe) {
if (_root['benteng_mc' + i].tipeBenteng == 20) {
if (this.hitTest(_root['benteng_mc' + i])) {
this.nyawa -= _root['benteng_mc' + i].damage;
_root['benteng_mc' + i].nyawa -= _root['benteng_mc' + i].damage;
}
} else {
if (_root['benteng_mc' + i].tipeBenteng == 21) {
this.jarak2 = Math.sqrt(Math.pow(this._x - _root['benteng_mc' + i]._x, 2) + Math.pow(this._y - _root['benteng_mc' + i]._y, 2));
if (this.jarak2 <= _root['benteng_mc' + i].range) {
_root['benteng_mc' + i].gotoAndStop(2);
_root['benteng_mc' + i].xtarget = this;
}
} else {
if (_root['benteng_mc' + i].tipeBenteng == 22) {
this.jarak2 = Math.sqrt(Math.pow(this._x - _root['benteng_mc' + i]._x, 2) + Math.pow(this._y - _root['benteng_mc' + i]._y, 2));
if (this.jarak2 <= _root['benteng_mc' + i].range) {
_root['benteng_mc' + i].gotoAndStop(2);
_root['benteng_mc' + i].xtarget = this;
}
} else {
if (_root['benteng_mc' + i].tipeBenteng == 23) {
if (this.hitTest(_root['benteng_mc' + i])) {
_root['benteng_mc' + i].gotoAndStop(2);
}
}
}
}
}
}
}
++i;
}
if (this.xtarget != undefined) {
if (this._x >= this.xtarget._x) {
this.anim._xscale = this.scaleAwal;
} else {
this.anim._xscale = -this.scaleAwal;
}
this.gotoAndStop(3);
} else {
this.anim._xscale = this.scaleAwal;
if (this.xtarget.nyawa <= 0 || this.xtarget.nyawa == undefined) {
this.xtarget = undefined;
}
if (this.xtarget.nyawa <= 0 || this.xtarget.nyawa == undefined) {
i = 300;
while (i <= 350) {
if (_root['benteng_mc' + i].nyawa != undefined) {
if (this.barisKe == _root['benteng_mc' + i].barisKe) {
if (_root['benteng_mc' + i].tipeBenteng != 20) {
this.jarak = Math.sqrt(Math.pow(this._x - _root['benteng_mc' + i]._x, 2) + Math.pow(this._y - _root['benteng_mc' + i]._y, 2));
if (this.jarak <= this.range) {
this.xtarget = _root['benteng_mc' + i];
i = 350;
}
}
}
}
++i;
}
}
if (this.xtarget != undefined) {
if (this._x <= this.xtarget._x) {
this.anim._xscale = -this.scaleAwal;
} else {
this.anim._xscale = this.scaleAwal;
}
this.gotoAndStop(3);
} else {
this.anim._xscale = this.scaleAwal;
this._x -= this.speed * speedBattle;
this.gotoAndStop(2);
}
}
if (this._x <= background_mc._x - 100) {
--defenseKita;
if (defenseKita <= 0) {
cekKalah();
} else {
--totalMusuh;
if (totalMusuh <= 0) {
cekMenang();
}
}
removeMovieClip(this);
}
}
}
}
this.jumlah = Math.ceil(this.nyawa);
if (this.jenis == 5) {
this.swapDepths(100 + this._x + this._y * 200);
} else {
this.swapDepths(100 + this._x + this._y * 100);
}
}
function cekSerangMusuh(indi) {
if (indi.jenis == 2) {
cekPanahMusuh(indi);
} else {
if (indi.xtarget.tipeApa == 'weapon') {
--indi.xtarget.ammo;
if (indi.xtarget.ammo <= 0) {
indi.xtarget.nyawa = 0;
if (indi.xtarget.jenisWeapon == 8) {
++xpindahArrowTrap;
} else {
if (indi.xtarget.jenisWeapon == 9) {
++xpindahCatapult;
} else {
if (indi.xtarget.jenisWeapon == 10) {
++xpindahFireTrap;
}
}
}
removeMovieClip(indi.xtarget);
}
}
if (indi.xtarget.kebal != true) {
if (indi.xtarget.nyawa > 0) {
if (indi.damage != undefined) {
indi.xtarget.nyawa -= indi.damage;
if (indi.xtarget.iniDuplikasi == false) {
if (indi.xtarget.jenis == 1) {
xpindahBareman += indi.damage;
} else {
if (indi.xtarget.jenis == 2) {
xpindahSwordman += indi.damage;
} else {
if (indi.xtarget.jenis == 3) {
xpindahArrowman += indi.damage;
} else {
if (indi.xtarget.jenis == 4) {
xpindahSpearman += indi.damage;
}
}
}
}
}
if (indi.jenis == 4 || indi.jenis == 5) {
cekEfekLedakan2(indi.xtarget);
}
}
}
}
}
}
function cekPanahMusuh(indi) {
peluru = attachMovie('panah_mc3', 'peluru_mc' + dalamPeluru, dalamPeluru);
peluru._x = indi._x - 30;
peluru._y = indi._y - 30;
if (siapaYangNyerang == 2) {
peluru._yscale = 75;
peluru._xscale = 75;
} else {
peluru._yscale = 100;
peluru._xscale = 100;
}
peluru.speed = 25;
peluru.arahTembak = 35;
peluru.xtarget = indi.xtarget;
peluru.tujuanX = indi.xtarget._x;
peluru.tujuanY = indi.xtarget._y;
deltaX = peluru._x - peluru.tujuanX;
deltaY = peluru._y - peluru.tujuanY;
angle = -Math.atan2(deltaX, deltaY) / 0.0174532925199433;
peluru._rotation = angle;
peluru.indi = indi;
peluru.onEnterFrame = enterPanahMusuh;
++dalamPeluru;
if (dalamPeluru >= 200) {
dalamPeluru = 100;
}
}
function enterPanahMusuh() {
if (sedangPause == false) {
this._x += geserKiri;
if (this.xtarget.nyawa == undefined) {
deltaX = this._x - this.tujuanX;
deltaY = this._y - this.tujuanY;
angle = -Math.atan2(deltaX, deltaY) / 0.0174532925199433;
this._rotation = angle;
if (Math.sqrt(deltaX * deltaX + deltaY * deltaY) > this.speed) {
this.speed += 0.5;
this._y -= this.speed * Math.cos(angle * 0.0174532925199433);
this._x += this.speed * Math.sin(angle * 0.0174532925199433);
} else {
removeMovieClip(this);
}
} else {
deltaX = this._x - this.xtarget._x;
deltaY = this._y - this.xtarget._y + this.arahTembak;
angle = -Math.atan2(deltaX, deltaY) / 0.0174532925199433;
this._rotation = angle;
if (Math.sqrt(deltaX * deltaX + deltaY * deltaY) > this.speed) {
this.speed += 0.5;
this._y -= this.speed * Math.cos(angle * 0.0174532925199433);
this._x += this.speed * Math.sin(angle * 0.0174532925199433);
} else {
if (this.xtarget.tipeApa == 'weapon') {
--this.xtarget.ammo;
if (this.xtarget.ammo <= 0) {
this.xtarget.nyawa = 0;
if (this.xtarget.jenisWeapon == 8) {
++xpindahArrowTrap;
} else {
if (this.xtarget.jenisWeapon == 9) {
++xpindahCatapult;
} else {
if (this.xtarget.jenisWeapon == 10) {
++xpindahFireTrap;
}
}
}
removeMovieClip(this.xtarget);
}
}
if (this.xtarget.kebal != true) {
if (this.xtarget.nyawa > 0) {
if (this.indi.damage != undefined) {
this.xtarget.nyawa -= this.indi.damage;
if (this.xtarget.iniDuplikasi == false) {
if (this.xtarget.jenis == 1) {
xpindahBareman += this.indi.damage;
} else {
if (this.xtarget.jenis == 2) {
xpindahSwordman += this.indi.damage;
} else {
if (this.xtarget.jenis == 3) {
xpindahArrowman += this.indi.damage;
} else {
if (this.xtarget.jenis == 4) {
xpindahSpearman += this.indi.damage;
}
}
}
}
}
}
}
}
if (this.xtarget.nyawa > 0) {
this.xtarget.attachMovie('panah_mc3', 'panah_mc' + dalamPeluru, dalamPeluru);
this.xtarget['panah_mc' + dalamPeluru].gotoAndStop(2);
this.xtarget['panah_mc' + dalamPeluru]._x = 25 + random(15) + 7;
this.xtarget['panah_mc' + dalamPeluru]._y = -35 + random(15) + 7;
this.xtarget['panah_mc' + dalamPeluru]._rotation = this._rotation - random(15) + 7;
this.xtarget['panah_mc' + dalamPeluru]._xscale = this._xscale;
this.xtarget['panah_mc' + dalamPeluru]._yscale = this._yscale;
++dalamPeluru;
if (dalamPeluru >= 200) {
dalamPeluru = 100;
}
}
removeMovieClip(this);
}
}
}
this.swapDepths(100 + this._x + this._y * 100);
}
function cekEfekLedakan2(indi, indi2) {
if (indi != undefined) {
efek = attachMovie('efekLedakan', 'spell_mc' + dalamSpell, dalamSpell);
efek._x = indi._x;
efek._y = indi._y - 50;
efek._xscale = 75;
efek._yscale = 75;
efek.onEnterFrame = enterEfekApi2;
++dalamSpell;
if (dalamSpell >= 301000) {
dalamSpell = 300000;
}
}
}
function enterEfekApi2() {
if (sedangPause == false) {
this._x += geserKiri;
i = 1;
while (i <= maximumJagoan) {
if (this.hitTest(_root['jagoan_mc' + i].anim)) {
if (_root['jagoan_mc' + i].nyawa > 0) {
_root['jagoan_mc' + i].nyawa -= 0.5;
if (_root['jagoan_mc' + i].jenis == 1) {
xpindahBareman += 0.5;
} else {
if (_root['jagoan_mc' + i].jenis == 2) {
xpindahSwordman += 0.5;
} else {
if (_root['jagoan_mc' + i].jenis == 3) {
xpindahArrowman += 0.5;
} else {
if (_root['jagoan_mc' + i].jenis == 4) {
xpindahSpearman += 0.5;
}
}
}
}
}
}
++i;
}
}
this.swapDepths(100 + this._x + this._y * 100);
}
function cekNormalY(indi) {
if (indi == 'awal') {
i = 50;
while (i <= 85) {
_root['musuh_mc' + i].awalGempaY = _root['musuh_mc' + i]._y;
++i;
}
i = 1;
while (i <= maximumJagoan) {
_root['jagoan_mc' + i].awalGempaY = _root['jagoan_mc' + i]._y;
++i;
}
} else {
if (indi == 'akhir') {
background_mc._y = posAwalBackgroundY;
i = 50;
while (i <= 85) {
_root['musuh_mc' + i]._y = _root['musuh_mc' + i].awalGempaY;
++i;
}
i = 1;
while (i <= maximumJagoan) {
_root['jagoan_mc' + i]._y = _root['jagoan_mc' + i].awalGempaY;
++i;
}
}
}
}
function cekGeserX(indi) {
background_mc._x += indi;
i = 50;
while (i <= 65) {
_root['musuh_mc' + i]._x += indi;
_root['musuh_mc' + i].nyawa -= 1;
++i;
}
nyawaBenteng -= 1;
i = 1;
while (i <= maximumJagoan) {
_root['jagoan_mc' + i]._x += indi;
++i;
}
benteng_mc._x += indi;
}
function cekGeserY(indi) {
background_mc._y += indi;
i = 50;
while (i <= 65) {
_root['musuh_mc' + i]._y += indi;
++i;
}
i = 1;
while (i <= maximumJagoan) {
_root['jagoan_mc' + i]._y += indi;
++i;
}
benteng_mc._y += indi;
}
function cekPasukanBuat() {
battle_mc.all_btn._visible = false;
if (battle_mc.pasukan_mc._currentframe == 1) {
i = 1;
while (i <= 4) {
battle_mc.pasukan_mc['unit' + i].onRelease = klikSoldier;
battle_mc.pasukan_mc['unit' + i].onRollOver = overSoldier;
battle_mc.pasukan_mc['unit' + i].onRollOut = outSoldier;
battle_mc.pasukan_mc['unit' + i].enabled = true;
battle_mc.pasukan_mc['unit' + i]._alpha = 100;
battle_mc.pasukan_mc.jumlah1 = wpindahBareman;
battle_mc.pasukan_mc.jumlah2 = wpindahSwordman;
battle_mc.pasukan_mc.jumlah3 = wpindahArrowman;
battle_mc.pasukan_mc.jumlah4 = wpindahSpearman;
++i;
}
battle_mc.soldier_mc.gotoAndStop(2);
battle_mc.vehicle_mc.gotoAndStop(1);
battle_mc.weapon_mc.gotoAndStop(1);
battle_mc.spell_mc.gotoAndStop(1);
battle_mc.defense_mc.gotoAndStop(1);
} else {
if (battle_mc.pasukan_mc._currentframe == 2) {
i = 5;
while (i <= 7) {
battle_mc.pasukan_mc['unit' + i].onRelease = klikSoldier;
battle_mc.pasukan_mc['unit' + i].onRollOver = overSoldier;
battle_mc.pasukan_mc['unit' + i].onRollOut = outSoldier;
battle_mc.pasukan_mc['unit' + i].enabled = true;
battle_mc.pasukan_mc['unit' + i]._alpha = 100;
battle_mc.pasukan_mc.jumlah5 = wpindahTank;
battle_mc.pasukan_mc.jumlah6 = wpindahCopter;
battle_mc.pasukan_mc.jumlah7 = wpindahMonbot;
++i;
}
battle_mc.soldier_mc.gotoAndStop(1);
battle_mc.vehicle_mc.gotoAndStop(2);
battle_mc.weapon_mc.gotoAndStop(1);
battle_mc.spell_mc.gotoAndStop(1);
battle_mc.defense_mc.gotoAndStop(1);
} else {
if (battle_mc.pasukan_mc._currentframe == 3) {
i = 8;
while (i <= 10) {
battle_mc.pasukan_mc['unit' + i].onRelease = klikWeapon;
battle_mc.pasukan_mc['unit' + i].onRollOver = overWeapon;
battle_mc.pasukan_mc['unit' + i].onRollOut = outWeapon;
battle_mc.pasukan_mc['unit' + i].enabled = true;
battle_mc.pasukan_mc['unit' + i]._alpha = 100;
battle_mc.pasukan_mc.jumlah8 = wpindahArrowTrap;
battle_mc.pasukan_mc.jumlah9 = wpindahCatapult;
battle_mc.pasukan_mc.jumlah10 = wpindahFireTrap;
++i;
}
battle_mc.soldier_mc.gotoAndStop(1);
battle_mc.vehicle_mc.gotoAndStop(1);
battle_mc.weapon_mc.gotoAndStop(2);
battle_mc.spell_mc.gotoAndStop(1);
battle_mc.defense_mc.gotoAndStop(1);
} else {
if (battle_mc.pasukan_mc._currentframe == 4) {
battle_mc.all_btn._visible = true;
battle_mc.all_btn.onRelease = klikSpell2;
i = 11;
while (i <= 18) {
battle_mc.pasukan_mc['unit' + i].onRelease = klikSpell;
battle_mc.pasukan_mc['unit' + i].onRollOver = overSpell;
battle_mc.pasukan_mc['unit' + i].onRollOut = outSpell;
battle_mc.pasukan_mc['unit' + i].enabled = true;
battle_mc.pasukan_mc['unit' + i]._alpha = 100;
battle_mc.pasukan_mc.jumlah11 = wpindahArrowRain;
battle_mc.pasukan_mc.jumlah12 = wpindahMeteorid;
battle_mc.pasukan_mc.jumlah13 = wpindahAcidRain;
battle_mc.pasukan_mc.jumlah14 = wpindahEarthquake;
battle_mc.pasukan_mc.jumlah15 = wpindahImmune;
battle_mc.pasukan_mc.jumlah16 = wpindahInvisible;
battle_mc.pasukan_mc.jumlah17 = wpindahSpecialAttack;
battle_mc.pasukan_mc.jumlah18 = wpindahDuplicate;
++i;
}
battle_mc.soldier_mc.gotoAndStop(1);
battle_mc.vehicle_mc.gotoAndStop(1);
battle_mc.weapon_mc.gotoAndStop(1);
battle_mc.spell_mc.gotoAndStop(2);
battle_mc.defense_mc.gotoAndStop(1);
} else {
if (battle_mc.pasukan_mc._currentframe == 5) {
i = 19;
while (i <= 23) {
battle_mc.pasukan_mc['unit' + i].onRelease = klikDefense;
battle_mc.pasukan_mc['unit' + i].onRollOver = overDefense;
battle_mc.pasukan_mc['unit' + i].onRollOut = outDefense;
battle_mc.pasukan_mc['unit' + i].enabled = true;
battle_mc.pasukan_mc['unit' + i]._alpha = 100;
battle_mc.pasukan_mc.jumlah19 = wpindahWall;
battle_mc.pasukan_mc.jumlah20 = wpindahSpike;
battle_mc.pasukan_mc.jumlah21 = wpindahSpiderWeb;
battle_mc.pasukan_mc.jumlah22 = wpindahTowerGuard;
battle_mc.pasukan_mc.jumlah23 = wpindahZombieTrap;
++i;
}
battle_mc.soldier_mc.gotoAndStop(1);
battle_mc.vehicle_mc.gotoAndStop(1);
battle_mc.weapon_mc.gotoAndStop(1);
battle_mc.spell_mc.gotoAndStop(1);
battle_mc.defense_mc.gotoAndStop(2);
}
}
}
}
}
buatKotak(false);
}
function overSoldier() {
info_mc2._visible = true;
znamaSoldier = new Array('', 'Barehands', 'Swordman', 'Arrowman', 'Spearman', 'Tank', 'Copter', 'Monbot');
myStr = new String(this);
if (isNaN(myStr.substr(myStr.length - 2, 2))) {
indi = myStr.substr(myStr.length - 1, 1);
} else {
indi = myStr.substr(myStr.length - 2, 2);
}
info_mc2.gotoAndStop(2);
info_mc2.xinfo = znamaSoldier[indi];
}
function outSoldier() {
info_mc2._visible = false;
}
function overWeapon() {
info_mc2._visible = true;
znamaWeapon = new Array('', 'Bow Launcher', 'Stone Thrower', 'Fire Thrower');
myStr = new String(this);
if (isNaN(myStr.substr(myStr.length - 2, 2))) {
indi = Number(myStr.substr(myStr.length - 1, 1));
} else {
indi = Number(myStr.substr(myStr.length - 2, 2));
}
info_mc2.gotoAndStop(2);
info_mc2.xinfo = znamaWeapon[indi - 7];
}
function outWeapon() {
info_mc2._visible = false;
}
function overSpell() {
info_mc2._visible = true;
znamaSpell = new Array('', 'Arrow Rain', 'Meteorid', 'Acid Rain', 'Eeathquake', 'Immune', 'Invisible', 'Special Attack', 'Duplicate');
myStr = new String(this);
if (isNaN(myStr.substr(myStr.length - 2, 2))) {
indi = Number(myStr.substr(myStr.length - 1, 1));
} else {
indi = Number(myStr.substr(myStr.length - 2, 2));
}
info_mc2.gotoAndStop(2);
if (indi - 10 <= 4) {
info_mc2.xinfo = znamaSpell[indi - 10] + ', Give to Enemy';
} else {
info_mc2.xinfo = znamaSpell[indi - 10] + ', Give to Monster';
}
}
function outSpell() {
info_mc2._visible = false;
}
function overDefense() {
info_mc2._visible = true;
znamaDefense = new Array('', 'Wall', 'Spike', 'Spider Web', 'Tower Guard', 'Zombie Trap');
myStr = new String(this);
if (isNaN(myStr.substr(myStr.length - 2, 2))) {
indi = Number(myStr.substr(myStr.length - 1, 1));
} else {
indi = Number(myStr.substr(myStr.length - 2, 2));
}
info_mc2.gotoAndStop(2);
info_mc2.xinfo = znamaDefense[indi - 18];
}
function outDefense() {
info_mc2._visible = false;
}
function klikSoldier(zindi, zindi2) {
bisaBuatSoldier = false;
i = 1;
while (i <= maximumJagoan) {
if (_root['jagoan_mc' + i].nyawa == undefined) {
xdalamSoldier = i;
i = maximumJagoan;
bisaBuatSoldier = true;
}
++i;
}
if (bisaBuatSoldier == true) {
bisaBuatSoldier2 = true;
if (pilihSoldier >= 5) {
if (kiniVehicle >= 10) {
bisaBuatSoldier2 = false;
} else {
bisaBuatSoldier2 = true;
}
} else {
bisaBuatSoldier2 = true;
}
if (bisaBuatSoldier2 == true) {
myStr = new String(this);
indi = myStr.substr(myStr.length - 1, 1);
if (battle_mc.pasukan_mc['jumlah' + indi] > 0 || zindi2 == 'duplikat') {
if (zindi2 != 'duplikat') {
pilihSoldier = indi;
}
randKeluarJagoan = random(4) + 1;
++defenseKita;
soldier = attachMovie('soldier' + pilihSoldier, 'jagoan_mc' + xdalamSoldier, xdalamSoldier + 100);
soldier.cacheAsBitmap = true;
if (zindi2 != 'duplikat') {
soldier._x = background_mc._x - 50;
soldier._y = 190 + 85 * (randKeluarJagoan - 1);
} else {
soldier._x = zindi._x + random(50) - 25;
soldier._y = zindi._y + random(50) - 25;
}
if (pilihSoldier >= 5) {
++kiniVehicle;
if (pilihSoldier == 5) {
soldier.nyawa = 500;
} else {
if (pilihSoldier == 6) {
soldier.nyawa = 1000;
} else {
if (pilihSoldier == 7) {
soldier.nyawa = 2000;
}
}
}
} else {
if (zindi2 == 'duplikat') {
soldier.nyawa = zindi.nyawa;
} else {
if (battle_mc.pasukan_mc['jumlah' + pilihSoldier] >= nilaiSoldier) {
soldier.nyawa = nilaiSoldier;
} else {
soldier.nyawa = battle_mc.pasukan_mc['jumlah' + pilihSoldier];
}
}
}
if (pilihSoldier == 5) {
soldier.scaleAwal = 75;
} else {
if (pilihSoldier == 6) {
soldier.scaleAwal = 75;
} else {
soldier.scaleAwal = 100;
}
}
if (pilihSoldier == 1) {
wpindahBareman -= nilaiSoldier;
if (wpindahBareman <= 0) {
wpindahBareman = 0;
}
soldier.damage = _root['xbaremanPower' + keKota] * 2;
soldier.range = 50;
soldier.speed = 3;
soldier.tipeSenjata = 'melee';
} else {
if (pilihSoldier == 2) {
wpindahSwordman -= nilaiSoldier;
if (wpindahSwordman <= 0) {
wpindahSwordman = 0;
}
soldier.damage = _root['xswordmanPower' + keKota] * 2;
soldier.range = 75;
soldier.speed = 2;
soldier.tipeSenjata = 'melee';
} else {
if (pilihSoldier == 3) {
wpindahArrowman -= nilaiSoldier;
if (wpindahArrowman <= 0) {
wpindahArrowman = 0;
}
soldier.damage = _root['xarrowmanPower' + keKota] * 2;
soldier.range = 450;
soldier.speed = 1.5;
soldier.tipeSenjata = 'range';
} else {
if (pilihSoldier == 4) {
wpindahSpearman -= nilaiSoldier;
if (wpindahSpearman <= 0) {
wpindahSpearman = 0;
}
soldier.damage = _root['xspearmanPower' + keKota] * 2;
soldier.range = 100;
soldier.speed = 2.5;
soldier.tipeSenjata = 'melee';
} else {
if (pilihSoldier == 5) {
--wpindahTank;
if (wpindahTank <= 0) {
wpindahTank = 0;
}
soldier.damage = 10;
soldier.range = 550;
soldier.speed = 1;
soldier.tipeSenjata = 'range';
} else {
if (pilihSoldier == 6) {
--wpindahCopter;
if (wpindahCopter <= 0) {
wpindahCopter = 0;
}
soldier.damage = 10;
soldier.range = 600;
soldier.speed = 1.5;
soldier.tipeSenjata = 'range';
} else {
if (pilihSoldier == 7) {
--wpindahMonbot;
if (wpindahMonbot <= 0) {
wpindahMonbot = 0;
}
soldier.damage = 50;
soldier.range = 50;
soldier.speed = 1.25;
soldier.tipeSenjata = 'melee';
}
}
}
}
}
}
}
if (_root['rangerAktif' + keKota] == true) {
soldier.range *= 2;
}
if (_root['tirelessAktif' + keKota] == true) {
soldier.damage *= 2;
}
if (_root['armorPlusAktif' + keKota] == true) {
soldier.nyawa *= 2;
}
if (_root['speedPlusAktif' + keKota] == true) {
soldier.speed *= 2;
}
_root['pasukan' + xdalamSoldier]._visible = true;
_root['pasukan' + xdalamSoldier].gotoAndStop(pilihSoldier);
_root['pasukan' + xdalamSoldier].jumlah = soldier.nyawa;
soldier.range2 = 400;
if (zindi2 == 'duplikat') {
soldier.speed += 0.5;
}
soldier.speed2 = soldier.speed * 4;
soldier.kebal = false;
soldier.invis = false;
soldier.special = false;
if (zindi2 == 'duplikat') {
soldier.iniDuplikasi = true;
soldier.duplikasi = true;
} else {
soldier.iniDuplikasi = false;
soldier.duplikasi = false;
}
soldier.serangBase = false;
soldier.nomorJagoan = xdalamSoldier;
soldier.jenis = pilihSoldier;
if (pilihSoldier <= 4) {
soldier.damage *= 0.02;
}
pilihTargetMusuh(soldier);
soldier.onEnterFrame = enterSoldier;
if (pilihSoldier >= 5) {
--battle_mc.pasukan_mc['jumlah' + pilihSoldier];
} else {
battle_mc.pasukan_mc['jumlah' + pilihSoldier] -= nilaiSoldier;
if (battle_mc.pasukan_mc['jumlah' + pilihSoldier] <= 0) {
battle_mc.pasukan_mc['jumlah' + pilihSoldier] = 0;
}
}
}
} else {
cekInfo('Can\'t unleash another vehicle units, maximum vehicle on the field reached');
}
} else {
cekInfo('Can\'t unleash another units, maximum soldiers on the field reached');
}
}
function enterSoldier() {
if (sedangPause == false) {
this._x += geserKiri;
if (sudahSelesai == false) {
if (this.nyawa <= 0) {
this.nyawa = 0;
if (this._currentframe != 4) {
if (this.jenis >= 5) {
--kiniVehicle;
}
--defenseKita;
if (defenseKita <= 0) {
cekKalah();
}
if (this.iniDuplikasi == false) {
if (this.jenis == 5) {
++xpindahTank;
} else {
if (this.jenis == 6) {
++xpindahCopter;
} else {
if (this.jenis == 7) {
++xpindahMonbot;
}
}
}
}
i = 100;
while (i <= 200) {
this['panah_mc' + i]._visible = false;
++i;
}
this.gotoAndStop(4);
}
} else {
if (this.kebal == true) {
i = 100;
while (i <= 110) {
this['efekKebal' + i]._visible = true;
++i;
}
if (this.awalKebal >= this.akhirKebal) {
this.kebal = false;
} else {
++this.awalKebal;
}
} else {
i = 100;
while (i <= 110) {
this['efekKebal' + i]._visible = false;
++i;
}
}
if (this.invis == true) {
this._alpha = 30;
i = 100;
while (i <= 110) {
this['efekInvis' + i]._visible = true;
++i;
}
if (this.awalInvis >= this.akhirInvis) {
this.invis = false;
} else {
++this.awalInvis;
}
} else {
this._alpha = 100;
i = 100;
while (i <= 110) {
this['efekInvis' + i]._visible = false;
++i;
}
}
if (this.special == true) {
i = 100;
while (i <= 110) {
this['efekSpecial' + i]._visible = true;
++i;
}
if (this.awalSpecial >= this.akhirSpecial) {
this.special = false;
} else {
++this.awalSpecial;
}
} else {
i = 100;
while (i <= 110) {
this['efekSpecial' + i]._visible = false;
++i;
}
}
if (this.xtarget.nyawa <= 0 || this.xtarget.nyawa == undefined) {
this.xtarget = undefined;
}
if (this.xtarget == undefined || this.xtarget.nyawa <= 0) {
i = 80;
while (i >= 50) {
if (_root['musuh_mc' + i].nyawa != undefined) {
this.jarak = Math.sqrt(Math.pow(this._x - _root['musuh_mc' + i]._x, 2) + Math.pow(this._y - _root['musuh_mc' + i]._y, 2));
if (this.jarak <= this.range2) {
this.xtarget = _root['musuh_mc' + i];
i = 50;
}
}
--i;
}
} else {
this.jarak = Math.sqrt(Math.pow(this._x - this.xtarget._x, 2) + Math.pow(this._y - this.xtarget._y, 2));
if (this.jarak > this.range2) {
}
}
if (this.xtarget != undefined) {
if (this._x <= this.xtarget._x) {
this.anim._xscale = this.scaleAwal;
} else {
this.anim._xscale = -this.scaleAwal;
}
this.jarak = Math.sqrt(Math.pow(this._x - this.xtarget._x, 2) + Math.pow(this._y - this.xtarget._y, 2));
if (this.jarak <= this.range) {
this.xtarget.serangBalik = true;
this.xtarget.xtarget = this;
this.gotoAndStop(3);
} else {
this.gotoAndStop(2);
deltaX = this._x - this.xtarget._x;
deltaY = this._y - this.xtarget._y;
angle = -Math.atan2(deltaX, deltaY) / 0.0174532925199433;
if (Math.sqrt(deltaX * deltaX + deltaY * deltaY) > this.speed2 * speedBattle) {
this._y -= this.speed2 * speedBattle * Math.cos(angle * 0.0174532925199433);
this._x += this.speed2 * speedBattle * Math.sin(angle * 0.0174532925199433);
}
}
} else {
if (this._x >= background_mc._x - 150 + 3000) {
this.anim._xscale = this.scaleAwal;
this.gotoAndStop(1);
} else {
this.anim._xscale = this.scaleAwal;
this._x += this.speed * speedBattle;
this.gotoAndStop(2);
}
}
}
}
}
this.jumlah = Math.ceil(this.nyawa);
if (this.jenis == 6) {
this.swapDepths(100 + this._x + this._y * 200);
} else {
this.swapDepths(100 + this._x + this._y * 100);
}
}
function cekSerangJagoan(indi) {
if (indi.special == true) {
efekSpecialJagoan(indi.xtarget);
}
if (indi.jenis == 7) {
cekGetarBumi();
} else {
if (indi.jenis == 5 || indi.jenis == 6) {
if (indi.serangBase == true) {
cekEfekLedakan(benteng_mc, 'benteng');
} else {
cekEfekLedakan(indi.xtarget);
}
}
}
if (indi.jenis == 3) {
buatPanah(indi);
} else {
indi.xtarget.nyawa -= indi.damage;
}
}
function efekSpecialJagoan(indi) {
i = 1;
while (i <= 2) {
if (indi != undefined) {
efek = attachMovie('efekApi2', 'api_mc' + dalamSpell, dalamSpell);
efek._x = indi._x + random(150) - 75;
efek._y = indi._y - 50 + random(150) - 75;
efek._xscale = 25 + random(25);
efek._yscale = 25 + random(25);
efek.gotoAndPlay(random(5) + 1);
efek.onEnterFrame = enterEfekApi;
++dalamSpell;
if (dalamSpell >= 301000) {
dalamSpell = 300000;
}
}
++i;
}
if (indi != undefined) {
efek = attachMovie('efekLedakan', 'spell_mc' + dalamSpell, dalamSpell);
efek._x = indi._x;
efek._y = indi._y - 50;
efek._xscale = 75;
efek._yscale = 75;
efek.onEnterFrame = enterEfekApi;
++dalamSpell;
if (dalamSpell >= 301000) {
dalamSpell = 300000;
}
}
}
function efekSpecialMusuh(indi) {
i = 1;
while (i <= 2) {
if (indi != undefined) {
efek = attachMovie('efekApi2', 'api_mc' + dalamSpell, dalamSpell);
efek._x = indi._x + random(150) - 75;
efek._y = indi._y - 50 + random(150) - 75;
efek._xscale = 25 + random(25);
efek._yscale = 25 + random(25);
efek.gotoAndPlay(random(5) + 1);
efek.onEnterFrame = enterEfekApi2;
++dalamSpell;
if (dalamSpell >= 301000) {
dalamSpell = 300000;
}
}
++i;
}
if (indi != undefined) {
efek = attachMovie('efekLedakan', 'spell_mc' + dalamSpell, dalamSpell);
efek._x = indi._x;
efek._y = indi._y - 50;
efek._xscale = 75;
efek._yscale = 75;
efek.onEnterFrame = enterEfekApi2;
++dalamSpell;
if (dalamSpell >= 301000) {
dalamSpell = 300000;
}
}
}
function cekGetarBumi() {
if (getarBumi == false) {
cekNormalY('awal');
getarKe = 1;
getarBumi = true;
}
}
function cekEfekLedakan(indi, indi2) {
efek = attachMovie('efekLedakan', 'spell_mc' + dalamSpell, dalamSpell);
efek._x = indi._x;
if (indi2 == 'benteng') {
efek._y = indi._y - 175;
} else {
efek._y = indi._y - 50;
}
efek._xscale = 75;
efek._yscale = 75;
efek.onEnterFrame = enterEfekApi;
++dalamSpell;
if (dalamSpell >= 301000) {
dalamSpell = 300000;
}
if (efek._x == 0 || efek._x == undefined) {
removeMovieClip(efek);
}
}
function enterEfekApi() {
if (sedangPause == false) {
this._x += geserKiri;
i = 50;
while (i <= 65) {
if (this.hitTest(_root['musuh_mc' + i].anim)) {
_root['musuh_mc' + i].nyawa -= 0.5;
}
++i;
}
if (this.hitTest(_root.benteng_mc)) {
nyawaBenteng -= 1;
}
}
}
function buatPanah(indi) {
peluru = attachMovie('panah_mc', 'peluru_mc' + dalamPeluru, dalamPeluru);
peluru._x = indi._x;
peluru._y = indi._y - 25;
peluru._yscale = 80;
peluru._xscale = 80;
peluru.speed = 25;
peluru.arahTembak = 35;
peluru.xtarget = indi.xtarget;
peluru.tujuanX = indi.xtarget._x;
peluru.tujuanY = indi.xtarget._y;
peluru.indi = indi;
peluru.onEnterFrame = enterPanah;
++dalamPeluru;
if (dalamPeluru >= 200) {
dalamPeluru = 100;
}
}
function enterPanah() {
if (sedangPause == false) {
this._x += geserKiri;
if (this.xtarget.nyawa == undefined) {
deltaX = this._x - this.tujuanX;
deltaY = this._y - this.tujuanY;
angle = -Math.atan2(deltaX, deltaY) / 0.0174532925199433;
this._rotation = angle;
if (Math.sqrt(deltaX * deltaX + deltaY * deltaY) > this.speed) {
this.speed += 0.5;
this._y -= this.speed * Math.cos(angle * 0.0174532925199433);
this._x += this.speed * Math.sin(angle * 0.0174532925199433);
} else {
removeMovieClip(this);
}
} else {
deltaX = this._x - this.xtarget._x;
deltaY = this._y - this.xtarget._y + this.arahTembak;
angle = -Math.atan2(deltaX, deltaY) / 0.0174532925199433;
this._rotation = angle;
if (Math.sqrt(deltaX * deltaX + deltaY * deltaY) > this.speed) {
this.speed += 0.5;
this._y -= this.speed * Math.cos(angle * 0.0174532925199433);
this._x += this.speed * Math.sin(angle * 0.0174532925199433);
} else {
this.xtarget.nyawa -= this.indi.damage;
if (this.xtarget.nyawa > 0) {
this.xtarget.attachMovie('panah_mc', 'panah_mc' + dalamPeluru, dalamPeluru);
this.xtarget['panah_mc' + dalamPeluru].gotoAndStop(2);
this.xtarget['panah_mc' + dalamPeluru]._x = -75 + random(15) + 7;
this.xtarget['panah_mc' + dalamPeluru]._y = -35 + random(15) + 7;
this.xtarget['panah_mc' + dalamPeluru]._rotation = this._rotation - random(15) + 7;
this.xtarget['panah_mc' + dalamPeluru]._xscale = this._xscale;
this.xtarget['panah_mc' + dalamPeluru]._yscale = this._yscale;
++dalamPeluru;
if (dalamPeluru >= 200) {
dalamPeluru = 100;
}
}
removeMovieClip(this);
}
}
}
this.swapDepths(100 + this._x + this._y * 100);
}
function klikWeapon() {
myStr = new String(this);
if (isNaN(myStr.substr(myStr.length - 2, 2))) {
indi = myStr.substr(myStr.length - 1, 1);
} else {
indi = myStr.substr(myStr.length - 2, 2);
}
if (battle_mc.pasukan_mc['jumlah' + indi] > 0) {
pilihWeapon = indi;
weapon2 = attachMovie('panahWeapon', 'drag_mc2', dalamDrag);
weapon2.bisa._visible = true;
weapon2._x = _root._xmouse;
weapon2._y = _root._ymouse + weapon2._height / 10;
if (pilihWeapon == 8) {
weapon2.jumlah = 25;
weapon2.gotoAndStop(1);
} else {
if (pilihWeapon == 9) {
weapon2.jumlah = 50;
weapon2.gotoAndStop(2);
} else {
if (pilihWeapon == 10) {
weapon2.jumlah = 75;
weapon2.gotoAndStop(3);
}
}
}
weapon2.anim.stop();
weapon2.startDrag();
sedangDragWeapon = true;
battle_mc.remove_mc._visible = true;
}
}
function klikSpell() {
if (mulaiBattle == true) {
myStr = new String(this);
if (isNaN(myStr.substr(myStr.length - 2, 2))) {
indi = myStr.substr(myStr.length - 1, 1);
} else {
indi = myStr.substr(myStr.length - 2, 2);
}
if (battle_mc.pasukan_mc['jumlah' + indi] > 0) {
pilihSpell = indi;
spell = attachMovie('spellTarget', 'drag_mc2', dalamDrag);
spell.bisa._visible = true;
spell._x = _root._xmouse;
spell._y = _root._ymouse + spell._height / 10;
if (pilihSpell >= 15) {
spell._yscale = 150;
spell._xscale = 150;
} else {
spell._yscale = 75;
spell._xscale = 75;
}
spell.startDrag();
sedangDragSpell = true;
battle_mc.remove_mc._visible = true;
}
}
}
function buatSpell(indiX, indiY) {
if (pilihSpell >= 15) {
spell = attachMovie('spellTarget', 'spell_mc' + dalamSpell, dalamSpell);
spell._xscale = 150;
spell._yscale = 150;
} else {
if (pilihSpell == 14) {
spell = attachMovie('efek' + (pilihSpell - 10) + 'x', 'spell_mc' + dalamSpell, dalamSpell - 270000);
} else {
spell = attachMovie('efek' + (pilihSpell - 10), 'spell_mc' + dalamSpell, dalamSpell);
}
}
if (pilihSpell == 11) {
++xpindahArrowRain;
--wpindahArrowRain;
spell._x = indiX;
spell._y = indiY - 1000;
spell.speedY = 5;
spell.damage = 0.3;
spell.batasBawah = indiY + 50;
} else {
if (pilihSpell == 12) {
backComet();
++xpindahMeteorid;
--wpindahMeteorid;
spell._x = indiX;
spell._y = indiY - 1000;
spell.speedY = 5;
spell.damage = 0.4;
spell.batasBawah = indiY + 50;
} else {
if (pilihSpell == 13) {
++xpindahAcidRain;
--wpindahAcidRain;
spell._x = indiX;
spell._y = indiY - 1000;
spell.speedY = 5;
spell.damage = 0.5;
spell.batasBawah = indiY + 50;
} else {
if (pilihSpell == 14) {
backGempa();
++xpindahEarthquake;
--wpindahEarthquake;
spell._x = indiX;
spell._y = indiY;
spell.damage = 0.1;
spell.awalGempa = 0;
spell.akhirGempa = 25;
spell.getarKe = 1;
cekNormalY('awal');
} else {
if (pilihSpell == 15) {
backSpell3();
++xpindahImmune;
--wpindahImmune;
spell._x = indiX;
spell._y = indiY;
} else {
if (pilihSpell == 16) {
backSpell4();
++xpindahInvisible;
--wpindahInvisible;
spell._x = indiX;
spell._y = indiY;
} else {
if (pilihSpell == 17) {
backSpell1();
++xpindahSpecialAttack;
--wpindahSpecialAttack;
spell._x = indiX;
spell._y = indiY;
} else {
if (pilihSpell == 18) {
backSpell2();
++xpindahDuplicate;
--wpindahDuplicate;
spell._x = indiX;
spell._y = indiY;
}
}
}
}
}
}
}
}
spell.damage *= 10;
battle_mc.pasukan_mc.jumlah11 = wpindahArrowRain;
battle_mc.pasukan_mc.jumlah12 = wpindahMeteorid;
battle_mc.pasukan_mc.jumlah13 = wpindahAcidRain;
battle_mc.pasukan_mc.jumlah14 = wpindahEarthquake;
battle_mc.pasukan_mc.jumlah15 = wpindahImmune;
battle_mc.pasukan_mc.jumlah16 = wpindahInvisible;
battle_mc.pasukan_mc.jumlah17 = wpindahSpecialAttack;
battle_mc.pasukan_mc.jumlah18 = wpindahDuplicate;
spell.tipeSpell = pilihSpell;
spell.onEnterFrame = enterSpell;
++dalamSpell;
if (dalamSpell >= 301000) {
dalamSpell = 300000;
}
}
function enterSpell() {
if (sedangPause == false) {
this._x += geserKiri;
if (this.tipeSpell == 11) {
if (this._y >= this.batasBawah) {
this.gotoAndStop(2);
} else {
this._y += this.speedY;
this.speedY += 2;
}
i = 50;
while (i <= 65) {
if (this.hitTest(_root['musuh_mc' + i].anim)) {
_root['musuh_mc' + i].nyawa -= this.damage;
}
++i;
}
} else {
if (this.tipeSpell == 12) {
if (this._y >= this.batasBawah) {
this.gotoAndStop(2);
} else {
this._y += this.speedY;
this.speedY += 2;
}
i = 50;
while (i <= 65) {
if (this.hitTest(_root['musuh_mc' + i].anim)) {
_root['musuh_mc' + i].nyawa -= this.damage;
}
++i;
}
} else {
if (this.tipeSpell == 13) {
if (this._y >= this.batasBawah) {
this.gotoAndStop(2);
} else {
this._y += this.speedY;
this.speedY += 2;
}
i = 50;
while (i <= 65) {
if (this.hitTest(_root['musuh_mc' + i].anim)) {
_root['musuh_mc' + i].nyawa -= this.damage;
}
++i;
}
} else {
if (this.tipeSpell == 14) {
this._xscale += 1;
this._yscale += 1;
if (this.awalGempa >= this.akhirGempa && this.getarKe == 1) {
cekNormalY('akhir');
getarBumi2 = false;
removeMovieClip(this);
} else {
++this.awalGempa;
if (this.getarKe == 1) {
cekGeserX2(5);
cekGeserY2(5);
++this.getarKe;
} else {
if (this.getarKe == 2) {
cekGeserX2(-10);
cekGeserY2(-10);
++this.getarKe;
} else {
if (this.getarKe == 3) {
cekGeserX2(5);
cekGeserY2(-5);
++this.getarKe;
} else {
if (this.getarKe == 4) {
cekGeserX2(-5);
cekGeserY2(5);
++this.getarKe;
} else {
if (this.getarKe == 5) {
cekGeserX2(7);
cekGeserY2(7);
++this.getarKe;
} else {
if (this.getarKe == 6) {
cekGeserX2(10);
cekGeserY2(-10);
++this.getarKe;
} else {
if (this.getarKe == 7) {
cekGeserX2(-12);
cekGeserY2(7);
++this.getarKe;
} else {
this.getarKe = 1;
}
}
}
}
}
}
}
i = 50;
while (i <= 65) {
if (this.hitTest(_root['musuh_mc' + i].anim)) {
_root['musuh_mc' + i].nyawa -= this.damage;
}
++i;
}
}
} else {
if (this.tipeSpell == 15) {
i = 1;
while (i <= maximumJagoan) {
if (this.hitTest(_root['jagoan_mc' + i].anim)) {
_root['jagoan_mc' + i].awalKebal = 0;
_root['jagoan_mc' + i].akhirKebal = 500;
_root['jagoan_mc' + i].kebal = true;
_root['jagoan_mc' + i].attachMovie('efek5', 'efekKebal' + dalamEfekJagoan, dalamEfekJagoan);
_root['jagoan_mc' + i]['efekKebal' + dalamEfekJagoan]._x = 0;
_root['jagoan_mc' + i]['efekKebal' + dalamEfekJagoan]._y = -35;
++dalamEfekJagoan;
if (dalamEfekJagoan >= 110) {
dalamEfekJagoan = 100;
}
}
++i;
}
removeMovieClip(this);
} else {
if (this.tipeSpell == 16) {
i = 1;
while (i <= maximumJagoan) {
if (this.hitTest(_root['jagoan_mc' + i].anim)) {
_root['jagoan_mc' + i].awalInvis = 0;
_root['jagoan_mc' + i].akhirInvis = 500;
_root['jagoan_mc' + i].invis = true;
_root['jagoan_mc' + i].attachMovie('efek6', 'efekInvis' + dalamEfekJagoan, dalamEfekJagoan);
_root['jagoan_mc' + i]['efekInvis' + dalamEfekJagoan]._x = 0;
_root['jagoan_mc' + i]['efekInvis' + dalamEfekJagoan]._y = -35;
++dalamEfekJagoan;
if (dalamEfekJagoan >= 110) {
dalamEfekJagoan = 100;
}
}
++i;
}
removeMovieClip(this);
} else {
if (this.tipeSpell == 17) {
i = 1;
while (i <= maximumJagoan) {
if (this.hitTest(_root['jagoan_mc' + i].anim)) {
_root['jagoan_mc' + i].awalSpecial = 0;
_root['jagoan_mc' + i].akhirSpecial = 500;
_root['jagoan_mc' + i].special = true;
_root['jagoan_mc' + i].attachMovie('efek7', 'efekSpecial' + dalamEfekJagoan, dalamEfekJagoan);
_root['jagoan_mc' + i]['efekSpecial' + dalamEfekJagoan]._x = 0;
_root['jagoan_mc' + i]['efekSpecial' + dalamEfekJagoan]._y = -35;
++dalamEfekJagoan;
if (dalamEfekJagoan >= 110) {
dalamEfekJagoan = 100;
}
}
++i;
}
removeMovieClip(this);
} else {
if (this.tipeSpell == 18) {
zz = 1;
while (zz <= maximumJagoan) {
if (this.hitTest(_root['jagoan_mc' + zz].anim)) {
if (_root['jagoan_mc' + zz]._x != undefined && _root['jagoan_mc' + zz].nyawa > 0) {
cekDuplicate(_root['jagoan_mc' + zz]);
}
}
++zz;
}
removeMovieClip(this);
}
}
}
}
}
}
}
}
}
}
function cekDuplicate(indi) {
if (indi.duplikasi == false) {
indi.duplikasi = true;
indi.nyawa *= 2;
indi.damage *= 2;
indi.range *= 2;
indi.speed *= 2;
}
}
function cekGeserX2(indi) {
background_mc._x += indi;
i = 50;
while (i <= 65) {
_root['musuh_mc' + i]._x += indi;
++i;
}
i = 1;
while (i <= maximumJagoan) {
_root['jagoan_mc' + i]._x += indi;
++i;
}
benteng_mc._x += indi;
}
function cekGeserY2(indi) {
background_mc._y += indi;
i = 50;
while (i <= 65) {
_root['musuh_mc' + i]._y += indi;
++i;
}
i = 1;
while (i <= maximumJagoan) {
_root['jagoan_mc' + i]._y += indi;
++i;
}
benteng_mc._y += indi;
}
function buatWeapon(indi) {
bisaBuatSoldier = false;
i = 1;
while (i <= maximumJagoan) {
if (_root['jagoan_mc' + i].nyawa == undefined) {
xdalamSoldier = i;
i = maximumJagoan;
bisaBuatSoldier = true;
}
++i;
}
if (bisaBuatSoldier == true) {
if (pilihWeapon == 8) {
--wpindahArrowTrap;
} else {
if (pilihWeapon == 9) {
--wpindahCatapult;
} else {
if (pilihWeapon == 10) {
--wpindahFireTrap;
}
}
}
battle_mc.pasukan_mc.jumlah8 = wpindahArrowTrap;
battle_mc.pasukan_mc.jumlah9 = wpindahCatapult;
battle_mc.pasukan_mc.jumlah10 = wpindahFireTrap;
weapon = attachMovie('weapon' + (pilihWeapon - 7), 'jagoan_mc' + xdalamSoldier, xdalamSoldier + 100);
weapon._x = background_mc._x - 100;
weapon._y = indi + 25;
weapon.speed = 1.5;
if (pilihWeapon == 8) {
weapon.damage = 5;
} else {
if (pilihWeapon == 9) {
weapon.damage = 10;
} else {
if (pilihWeapon == 10) {
weapon.damage = 10;
}
}
}
if (pilihWeapon == 8) {
weapon.ammo = 15;
weapon.range = 875;
} else {
if (pilihWeapon == 9) {
weapon.ammo = 20;
weapon.range = 900;
} else {
if (pilihWeapon == 10) {
weapon.ammo = 25;
weapon.range = 925;
}
}
}
weapon.nyawa = weapon.ammo;
weapon.tipeApa = 'weapon';
weapon.jenisWeapon = pilihWeapon;
weapon.batasKanan = background_mc._x + 40 + random(15);
weapon.onEnterFrame = enterWeapon;
} else {
cekInfo('Can\'t unleash another weapons, maximum weapons on the field reached');
}
}
function enterWeapon() {
if (sedangPause == false) {
this._x += geserKiri;
this.batasKanan += geserKiri;
if (this._x <= this.batasKanan) {
this.gotoAndStop(2);
this._x += this.speed;
} else {
this.bisaSerang = false;
this.xtarget = undefined;
i = 50;
while (i <= 65) {
if (_root['musuh_mc' + i]._x != undefined && _root['musuh_mc' + i].nyawa > 0) {
this.jarak = Math.sqrt(Math.pow(this._x - _root['musuh_mc' + i]._x, 2) + Math.pow(this._y - _root['musuh_mc' + i]._y, 2));
if (this.jarak <= this.range) {
this.xtarget = _root['musuh_mc' + i];
this.bisaSerang = true;
}
}
++i;
}
if (this.ammo <= 0) {
this.ammo = 0;
this.gotoAndStop(1);
} else {
if (this.bisaSerang == true) {
this.gotoAndStop(3);
} else {
this.gotoAndStop(1);
}
}
}
}
this.jumlah = this.ammo;
this.swapDepths(100 + this._x + this._y * 100);
}
function cekSerangWeapon(indi) {
if (indi.jenisWeapon == 8) {
--indi.ammo;
peluru = attachMovie('panah_mc2', 'peluru_mc' + dalamPeluru, dalamPeluru);
peluru._x = indi._x;
peluru._y = indi._y - 25;
peluru._yscale = 100;
peluru._xscale = 100;
peluru.speedX = 20;
peluru.speedY = 10;
peluru.damage = indi.damage;
peluru.xtarget = indi.xtarget;
peluru.batasBawah = indi._y;
peluru.randBawah = random(50);
peluru.indi = indi;
peluru.onEnterFrame = enterWeapon2;
++dalamPeluru;
if (dalamPeluru >= 200) {
dalamPeluru = 100;
}
} else {
if (indi.jenisWeapon == 9) {
--indi.ammo;
peluru = attachMovie('batu_mc', 'peluru_mc' + dalamPeluru, dalamPeluru);
peluru._x = indi._x;
peluru._y = indi._y - 75;
peluru._yscale = 100;
peluru._xscale = 100;
if (indi.jenisWeapon == 9) {
peluru.jarak = Math.sqrt(Math.pow(indi._x - indi.xtarget._x, 2) + Math.pow(indi._y - indi.xtarget._y, 2));
if (peluru.jarak >= 850) {
peluru.speedX = 15;
} else {
if (peluru.jarak >= 800) {
peluru.speedX = 14;
} else {
if (peluru.jarak >= 750) {
peluru.speedX = 13;
} else {
if (peluru.jarak >= 700) {
peluru.speedX = 12;
} else {
if (peluru.jarak >= 650) {
peluru.speedX = 11;
} else {
if (peluru.jarak >= 600) {
peluru.speedX = 10;
} else {
if (peluru.jarak >= 550) {
peluru.speedX = 9;
} else {
if (peluru.jarak >= 500) {
peluru.speedX = 8;
} else {
if (peluru.jarak >= 450) {
peluru.speedX = 7;
} else {
if (peluru.jarak >= 400) {
peluru.speedX = 6;
} else {
peluru.speedX = 5;
}
}
}
}
}
}
}
}
}
}
}
peluru.speedY = 15;
peluru.damage = indi.damage;
peluru.xtarget = indi.xtarget;
peluru.batasBawah = indi._y;
peluru.randBawah = random(50);
peluru.indi = indi;
peluru.onEnterFrame = enterWeapon3;
++dalamPeluru;
if (dalamPeluru >= 200) {
dalamPeluru = 100;
}
} else {
if (indi.jenisWeapon == 10) {
--indi.ammo;
peluru = attachMovie('bolaApi_mc', 'peluru_mc' + dalamPeluru, dalamPeluru);
peluru._x = indi._x + 25;
peluru._y = indi._y - 35;
peluru._yscale = 100;
peluru._xscale = 100;
if (indi.jenisWeapon == 10) {
peluru.jarak = Math.sqrt(Math.pow(indi._x - indi.xtarget._x, 2) + Math.pow(indi._y - indi.xtarget._y, 2));
if (peluru.jarak >= 900) {
peluru.speedX = 20;
} else {
if (peluru.jarak >= 850) {
peluru.speedX = 19;
} else {
if (peluru.jarak >= 800) {
peluru.speedX = 18;
} else {
if (peluru.jarak >= 750) {
peluru.speedX = 17;
} else {
if (peluru.jarak >= 700) {
peluru.speedX = 16;
} else {
if (peluru.jarak >= 650) {
peluru.speedX = 15;
} else {
if (peluru.jarak >= 600) {
peluru.speedX = 14;
} else {
if (peluru.jarak >= 550) {
peluru.speedX = 13;
} else {
if (peluru.jarak >= 500) {
peluru.speedX = 12;
} else {
if (peluru.jarak >= 450) {
peluru.speedX = 11;
} else {
if (peluru.jarak >= 400) {
peluru.speedX = 10;
} else {
peluru.speedX = 9;
}
}
}
}
}
}
}
}
}
}
}
}
peluru.speedY = 10;
peluru.damage = indi.damage;
peluru.xtarget = indi.xtarget;
peluru.batasBawah = indi._y;
peluru.randBawah = random(50);
peluru.indi = indi;
peluru.onEnterFrame = enterWeapon4;
++dalamPeluru;
if (dalamPeluru >= 200) {
dalamPeluru = 100;
}
}
}
}
}
function enterWeapon2() {
if (sedangPause == false) {
this._x += geserKiri;
this._x += this.speedX;
this._y -= this.speedY;
this.speedY -= 0.5;
this._rotation += 1.5;
i = 50;
while (i <= 65) {
if (this.hitTest(_root['musuh_mc' + i].anim)) {
if (_root['musuh_mc' + i].nyawa > 0) {
_root['musuh_mc' + i].nyawa -= this.damage;
_root['musuh_mc' + i].attachMovie('panah_mc2', 'panah_mc' + dalamPeluru, dalamPeluru);
_root['musuh_mc' + i]['panah_mc' + dalamPeluru].gotoAndStop(2);
_root['musuh_mc' + i]['panah_mc' + dalamPeluru]._x = -35 + random(15) + 7;
_root['musuh_mc' + i]['panah_mc' + dalamPeluru]._y = -35 + random(15) + 7;
_root['musuh_mc' + i]['panah_mc' + dalamPeluru]._rotation = 45 + random(15);
_root['musuh_mc' + i]['panah_mc' + dalamPeluru]._xscale = this._xscale;
_root['musuh_mc' + i]['panah_mc' + dalamPeluru]._yscale = this._yscale;
++dalamPeluru;
if (dalamPeluru >= 200) {
dalamPeluru = 100;
}
removeMovieClip(this);
}
}
++i;
}
if (this.speedY <= 0) {
if (this._y >= this.batasBawah + this.randBawah) {
delete this.onEnterFrame;
this.onEnterFrame = enterWeaponx;
}
}
}
}
function enterWeapon3() {
if (sedangPause == false) {
this._x += geserKiri;
this._x += this.speedX;
this._y -= this.speedY;
this.speedY -= 0.5;
this._rotation += 1.5;
i = 50;
while (i <= 65) {
if (this.hitTest(_root['musuh_mc' + i].anim)) {
if (_root['musuh_mc' + i].nyawa > 0) {
_root['musuh_mc' + i].nyawa -= this.damage;
removeMovieClip(this);
}
}
++i;
}
if (this.speedY <= 0) {
if (this._y >= this.batasBawah + this.randBawah) {
delete this.onEnterFrame;
this.onEnterFrame = enterWeaponx;
}
}
}
}
function enterWeapon4() {
if (sedangPause == false) {
this._x += geserKiri;
this._x += this.speedX;
this._y -= this.speedY;
this.speedY -= 0.5;
this._rotation += 1.5;
this.lewatSini = false;
i = 50;
while (i <= 65) {
if (this.hitTest(_root['musuh_mc' + i].anim)) {
if (_root['musuh_mc' + i].nyawa > 0) {
_root['musuh_mc' + i].nyawa -= this.damage;
_root['musuh_mc' + i].kenaApi = true;
_root['musuh_mc' + i].batasApi = 0;
_root['musuh_mc' + i].maxApi = 100;
z = 1;
while (z <= 5) {
_root['musuh_mc' + i].attachMovie('efekApi', 'api_mc' + dalamPeluru, dalamPeluru);
_root['musuh_mc' + i]['api_mc' + dalamPeluru]._x = -random(30) + 15;
_root['musuh_mc' + i]['api_mc' + dalamPeluru]._y = -35 - random(30) + 15;
_root['musuh_mc' + i]['api_mc' + dalamPeluru]._xscale = 25 + random(25);
_root['musuh_mc' + i]['api_mc' + dalamPeluru]._yscale = 25 + random(25);
++dalamPeluru;
if (dalamPeluru >= 200) {
dalamPeluru = 100;
}
++z;
}
this.lewatSini = true;
removeMovieClip(this);
}
}
++i;
}
if (this.lewatSini == false) {
if (this.speedY <= 0) {
if (this._y >= this.batasBawah + this.randBawah) {
if (this != undefined) {
efek = attachMovie('efekApi2', 'api_mc' + dalamPeluru, dalamPeluru);
efek._x = this._x;
efek._y = this._y;
efek._xscale = 25 + random(25);
efek._yscale = 25 + random(25);
efek.onEnterFrame = enterEfekApi;
++dalamPeluru;
if (dalamPeluru >= 200) {
dalamPeluru = 100;
}
removeMovieClip(this);
}
}
}
}
}
}
function enterEfekApi() {
if (sedangPause == false) {
this._x += geserKiri;
i = 50;
while (i <= 65) {
if (this.hitTest(_root['musuh_mc' + i].anim)) {
_root['musuh_mc' + i].nyawa -= 0.5;
}
++i;
}
}
}
function enterWeaponx() {
if (sedangPause == false) {
this._x += geserKiri;
this._alpha -= 0.5;
}
}
function cekPause(indi) {
if (indi == true) {
sedangDragWeapon = false;
sedangDragSpell = false;
sedangDragSpell2 = false;
removeMovieClip(drag_mc2);
buatKotak(false);
}
if (indi == true) {
battle_mc.soldier_mc.enabled = false;
battle_mc.vehicle_mc.enabled = false;
battle_mc.weapon_mc.enabled = false;
battle_mc.spell_mc.enabled = false;
battle_mc.retreat_btn.enabled = false;
battle_mc.defense_mc.enabled = false;
battle_mc.all_btn.enabled = false;
i = 1;
while (i <= 23) {
battle_mc.pasukan_mc['unit' + i].enabled = false;
++i;
}
i = 50;
while (i <= 85) {
_root['musuh_mc' + i].anim.stop();
++i;
}
i = 1;
while (i <= maximumJagoan) {
_root['jagoan_mc' + i].anim.stop();
++i;
}
} else {
if (indi == false) {
battle_mc.soldier_mc.enabled = true;
battle_mc.vehicle_mc.enabled = true;
battle_mc.weapon_mc.enabled = true;
battle_mc.spell_mc.enabled = true;
battle_mc.retreat_btn.enabled = true;
battle_mc.defense_mc.enabled = true;
battle_mc.all_btn.enabled = true;
i = 1;
while (i <= 23) {
battle_mc.pasukan_mc['unit' + i].enabled = true;
++i;
}
i = 50;
while (i <= 85) {
_root['musuh_mc' + i].anim.play();
++i;
}
i = 1;
while (i <= maximumJagoan) {
_root['jagoan_mc' + i].anim.play();
++i;
}
}
}
}
function jagoanLari() {
this._x += geserKiri;
this._x -= this.speed * 4;
this.gotoAndStop(2);
this.anim._xscale = -this.scaleAwal;
this.swapDepths(100 + this._x + this._y * 100);
}
function klikDefense() {
myStr = new String(this);
if (isNaN(myStr.substr(myStr.length - 2, 2))) {
indi = myStr.substr(myStr.length - 1, 1);
} else {
indi = myStr.substr(myStr.length - 2, 2);
}
if (battle_mc.pasukan_mc['jumlah' + indi] > 0) {
pilihBenteng = indi;
benteng = attachMovie('benteng' + (indi - 18), 'drag_mc', dalamDrag);
benteng.cacheAsBitmap = true;
benteng._x = _root._xmouse;
if (pilihBenteng == 22) {
benteng._xscale = 75;
benteng._yscale = 75;
} else {
benteng._xscale = 100;
benteng._yscale = 100;
}
benteng.jumlah = 1;
benteng._y = _root._ymouse + benteng._height / 10;
benteng.gotoAndStop(1);
benteng.anim.stop();
benteng.startDrag();
buatKotak(true);
}
}
function buatKotak(indi) {
if (indi == true) {
dalamLingkar = 1;
sedangDrag = true;
i = 1;
while (i <= 10) {
j = 1;
while (j <= 4) {
if (_root['sudahLingkar' + i + j] == false) {
lingkar = attachMovie('lingkar_mc', 'lingkar_mc' + i + j, dalamLingkar + 100000);
lingkar.cacheAsBitmap = true;
lingkar._x = background_mc._x + 200 + 100 * (i - 1);
lingkar._y = 190 + 85 * (j - 1);
lingkar.keI = i;
lingkar.keJ = j;
lingkar.jenisIsi = _root['jenisIsi' + i + j];
lingkar.onRelease = klikLingkar;
lingkar._alpha = 75;
lingkar._visible = true;
lingkar.onEnterFrame = enterLingkar;
++dalamLingkar;
}
++j;
}
++i;
}
battle_mc.remove_mc._visible = true;
} else {
xdalamLingkar = 1;
sedangDrag = false;
i = 1;
while (i <= 10) {
j = 1;
while (j <= 4) {
removeMovieClip(_root['lingkar_mc' + i + j]);
++xdalamLingkar;
++j;
}
++i;
}
battle_mc.remove_mc._visible = false;
removeMovieClip(drag_mc);
stopDrag();
}
}
function enterLingkar() {
if (sedangPause == false) {
this._x += geserKiri;
}
}
function klikLingkar() {
if (sedangDrag == true) {
cekBentengBuat(this);
}
}
function cekBentengBuat(indi) {
bisaBuatBenteng = false;
i = 300;
while (i <= 350) {
if (_root['benteng_mc' + i].nyawa == undefined) {
xdalamBenteng = i;
i = 350;
bisaBuatBenteng = true;
}
++i;
}
if (bisaBuatBenteng == true) {
if (pilihBenteng == 19) {
--wpindahWall;
} else {
if (pilihBenteng == 20) {
--wpindahSpike;
} else {
if (pilihBenteng == 21) {
--wpindahSpiderWeb;
} else {
if (pilihBenteng == 22) {
--wpindahTowerGuard;
} else {
if (pilihBenteng == 23) {
--wpindahZombieTrap;
}
}
}
}
}
battle_mc.pasukan_mc.jumlah19 = wpindahWall;
battle_mc.pasukan_mc.jumlah20 = wpindahSpike;
battle_mc.pasukan_mc.jumlah21 = wpindahSpiderWeb;
battle_mc.pasukan_mc.jumlah22 = wpindahTowerGuard;
battle_mc.pasukan_mc.jumlah23 = wpindahZombieTrap;
_root['sudahLingkar' + indi.keI + indi.keJ] = true;
defense = attachMovie('benteng' + (pilihBenteng - 18), 'benteng_mc' + xdalamBenteng, xdalamBenteng + 100);
defense.cacheAsBitmap = true;
defense._x = indi._x;
defense._y = indi._y;
defense.keI = indi.keI;
defense.keJ = indi.keJ;
myStr = new String(indi);
indix = Number(myStr.substr(myStr.length - 1, 1));
defense.barisKe = indix;
if (pilihBenteng == 19) {
defense.nyawa = 200;
} else {
if (pilihBenteng == 20) {
defense.nyawa = 25;
defense.damage = 1;
} else {
if (pilihBenteng == 21) {
defense.nyawa = 30;
defense.damage = 1;
defense.range = 450;
} else {
if (pilihBenteng == 22) {
defense.nyawa = 50;
defense.damage = 3;
defense.range = 750;
defense._yscale = 75;
defense._xscale = 75;
} else {
if (pilihBenteng == 23) {
defense.nyawa = 55;
defense.damage = 3;
}
}
}
}
}
defense.tipeBenteng = pilihBenteng;
defense.onEnterFrame = enterDefense;
buatKotak(false);
}
}
function enterDefense() {
if (sedangPause == false) {
this._x += geserKiri;
if (this.nyawa <= 0) {
this.nyawa = 0;
_root['sudahLingkar' + this.keI + this.keJ] = false;
if (this.tipeBenteng == 19) {
xpindahWall += 1;
} else {
if (this.tipeBenteng == 20) {
xpindahSpike += 1;
} else {
if (this.tipeBenteng == 21) {
xpindahSpiderWeb += 1;
} else {
if (this.tipeBenteng == 22) {
xpindahTowerGuard += 1;
} else {
if (this.tipeBenteng == 23) {
xpindahZombieTrap += 1;
}
}
}
}
}
removeMovieClip(this);
}
}
this.jumlah = Math.ceil(this.nyawa);
if (this.tipeBenteng == 20) {
this.swapDepths(100 + this._x + this._y * 50);
} else {
this.swapDepths(100 + this._x + this._y * 100);
}
}
function keluarZombie(indi) {
zombie = attachMovie('zombie_mc', 'zombie_mc' + dalamLaba, dalamLaba);
zombie._x = indi._x + 5;
zombie._y = indi._y + 5;
zombie.nyawa = indi.nyawa;
zombie.damage = 1;
zombie.speed = 0.5;
zombie.barisKe = indi.barisKe;
zombie.randY = random(10);
zombie.onEnterFrame = enterZombie;
++dalamLaba;
if (dalamLaba >= 600) {
dalamLaba = 500;
}
}
function enterZombie() {
if (sedangPause == false) {
this._x += geserKiri;
this._x += this.speed * speedBattle;
i = 50;
while (i <= 65) {
if (this.hitTest(_root['musuh_mc' + i])) {
if (_root['musuh_mc' + i].nyawa != undefined && _root['musuh_mc' + i].nyawa > 0) {
if (this.barisKe == _root['musuh_mc' + i].barisKe) {
_root['musuh_mc' + i].nyawa -= this.damage;
--this.nyawa;
}
}
}
++i;
}
if (this.nyawa <= 0) {
this.nyawa = 0;
removeMovieClip(this);
}
}
this.jumlah = Math.ceil(this.nyawa);
this.swapDepths(100 + this._x + this._y * 100);
}
function keluarLabaLaba(indi) {
laba = attachMovie('laba_mc', 'laba_mc' + dalamLaba, dalamLaba);
laba._x = indi._x + 60;
laba._y = indi._y + 10;
laba.nyawa = indi.nyawa;
laba.damage = 1;
laba.speed = 1.5;
laba.randY = random(10);
laba.xtarget = indi.xtarget;
laba.onEnterFrame = enterLaba;
++dalamLaba;
if (dalamLaba >= 600) {
dalamLaba = 500;
}
}
function enterLaba() {
if (sedangPause == false) {
this._x += geserKiri;
deltaX = this._x - this.xtarget._x;
deltaY = this._y - this.xtarget._y - this.randY;
angle = -Math.atan2(deltaX, deltaY) / 0.0174532925199433;
if (Math.sqrt(deltaX * deltaX + deltaY * deltaY) > this.speed * speedBattle) {
this._y -= this.speed * speedBattle * Math.cos(angle * 0.0174532925199433);
this._x += this.speed * speedBattle * Math.sin(angle * 0.0174532925199433);
} else {
this.nyawa -= this.damage * 2;
this.xtarget.nyawa -= this.damage;
if (this.nyawa <= 0) {
this.nyawa = 0;
removeMovieClip(this);
}
}
}
this.jumlah = Math.ceil(this.nyawa);
this.swapDepths(100 + this._x + this._y * 100);
}
function cekSerangPanah(indi) {
buatPanahTower(indi);
}
function buatPanahTower(indi) {
peluru = attachMovie('panah_mc', 'peluru_mc' + dalamPeluru, dalamPeluru);
peluru._x = indi._x + 30;
peluru._y = indi._y - 80;
peluru._yscale = 75;
peluru._xscale = 75;
peluru.speed = 25;
peluru.arahTembak = 35;
peluru.xtarget = indi.xtarget;
peluru.tujuanX = indi.xtarget._x;
peluru.tujuanY = indi.xtarget._y;
deltaX = peluru._x - peluru.tujuanX;
deltaY = peluru._y - peluru.tujuanY;
angle = -Math.atan2(deltaX, deltaY) / 0.0174532925199433;
peluru._rotation = angle;
peluru.indi = indi;
peluru.onEnterFrame = enterPanahTower;
++dalamPeluru;
if (dalamPeluru >= 200) {
dalamPeluru = 100;
}
}
function enterPanahTower() {
if (sedangPause == false) {
this._x += geserKiri;
if (this.xtarget.nyawa == undefined) {
deltaX = this._x - this.tujuanX;
deltaY = this._y - this.tujuanY;
angle = -Math.atan2(deltaX, deltaY) / 0.0174532925199433;
this._rotation = angle;
if (Math.sqrt(deltaX * deltaX + deltaY * deltaY) > this.speed) {
this.speed += 0.5;
this._y -= this.speed * Math.cos(angle * 0.0174532925199433);
this._x += this.speed * Math.sin(angle * 0.0174532925199433);
} else {
removeMovieClip(this);
}
} else {
deltaX = this._x - this.xtarget._x;
deltaY = this._y - this.xtarget._y + this.arahTembak;
angle = -Math.atan2(deltaX, deltaY) / 0.0174532925199433;
this._rotation = angle;
if (Math.sqrt(deltaX * deltaX + deltaY * deltaY) > this.speed) {
this.speed += 0.5;
this._y -= this.speed * Math.cos(angle * 0.0174532925199433);
this._x += this.speed * Math.sin(angle * 0.0174532925199433);
} else {
this.xtarget.nyawa -= this.indi.damage;
if (this.xtarget.nyawa > 0) {
this.xtarget.attachMovie('panah_mc', 'panah_mc' + dalamPeluru, dalamPeluru);
this.xtarget['panah_mc' + dalamPeluru].gotoAndStop(2);
this.xtarget['panah_mc' + dalamPeluru]._x = -75 + random(15) + 7;
this.xtarget['panah_mc' + dalamPeluru]._y = -35 + random(15) + 7;
this.xtarget['panah_mc' + dalamPeluru]._rotation = this._rotation - random(15) + 7;
this.xtarget['panah_mc' + dalamPeluru]._xscale = this._xscale;
this.xtarget['panah_mc' + dalamPeluru]._yscale = this._yscale;
++dalamPeluru;
if (dalamPeluru >= 200) {
dalamPeluru = 100;
}
}
removeMovieClip(this);
}
}
}
this.swapDepths(100 + this._x + this._y * 100);
}
function clearSemua2() {
delete myListener.onKeyDown;
delete myListener.onKeyUp;
Key.removeListener(myListener);
delete _root.onEnterFrame;
delete _root.onMouseDown;
delete _root.onMouseMove;
removeMovieClip(benteng_mc);
removeMovieClip(drag_mc);
removeMovieClip(drag_mc2);
removeMovieClip(pause_mc);
i = 50;
while (i <= 65) {
removeMovieClip(_root['musuh_mc' + i]);
++i;
}
i = 1;
while (i <= maximumJagoan) {
removeMovieClip(_root['jagoan_mc' + i]);
++i;
}
i = 100;
while (i <= 200) {
removeMovieClip(_root['peluru_mc' + i]);
++i;
}
i = 200;
while (i <= 300) {
removeMovieClip(_root['weapon_mc' + i]);
++i;
}
i = 300;
while (i <= 350) {
removeMovieClip(_root['benteng_mc' + i]);
++i;
}
i = 500;
while (i <= 600) {
removeMovieClip(_root['laba_mc' + i]);
++i;
}
i = 500;
while (i <= 600) {
removeMovieClip(_root['zombie_mc' + i]);
++i;
}
i = 300000;
while (i <= 301000) {
removeMovieClip(_root['spell_mc' + i]);
++i;
}
i = 1;
while (i <= 10) {
j = 1;
while (j <= 4) {
removeMovieClip(_root['lingkar_mc' + i + j]);
++j;
}
++i;
}
}
function cekKalah() {
if (sudahSelesai == false) {
sudahSelesai = true;
i = 50;
while (i <= 65) {
_root['musuh_mc' + i].gotoAndStop(1);
++i;
}
i = 1;
while (i <= maximumJagoan) {
_root['jagoan_mc' + i].gotoAndStop(4);
++i;
}
menangBattle = false;
idLanjut = setInterval(lanjutMain, 2000);
}
}
function cekMenang() {
if (sudahSelesai == false) {
sudahSelesai = true;
benteng_mc.gotoAndStop(2);
i = 100;
while (i <= 200) {
benteng_mc['panah_mc' + i]._visible = false;
++i;
}
i = 1;
while (i <= maximumJagoan) {
_root['jagoan_mc' + i].gotoAndStop(1);
++i;
}
i = 50;
while (i <= 65) {
_root['musuh_mc' + i].onEnterFrame = musuhLari;
++i;
}
menangBattle = true;
idLanjut = setInterval(lanjutMain, 2000);
}
}
function musuhLari() {
this._x += geserKiri;
this._x += this.speed * 4;
this.gotoAndStop(2);
this.anim._xscale = -this.scaleAwal;
this.swapDepths(100 + this._x + this._y * 100);
}
function lanjutMain() {
clearSemua2();
clearInterval(idLanjut);
if (xpindahBareman >= pindahBareman) {
xpindahBareman = pindahBareman;
}
if (xpindahSwordman >= pindahSwordman) {
xpindahSwordman = pindahSwordman;
}
if (xpindahArrowman >= pindahArrowman) {
xpindahArrowman = pindahArrowman;
}
if (xpindahSpearman >= pindahSpearman) {
xpindahSpearman = pindahSpearman;
}
if (xpindahTank >= pindahTank) {
xpindahTank = pindahTank;
}
if (xpindahCopter >= pindahCopter) {
xpindahCopter = pindahCopter;
}
if (xpindahMonbot >= pindahMonbot) {
xpindahMonbot = pindahMonbot;
}
xpindahBareman = Math.floor(xpindahBareman);
xpindahSwordman = Math.floor(xpindahSwordman);
xpindahArrowman = Math.floor(xpindahArrowman);
xpindahSpearman = Math.floor(xpindahSpearman);
xpindahTank = Math.floor(xpindahTank);
xpindahCopter = Math.floor(xpindahCopter);
xpindahMonbot = Math.floor(xpindahMonbot);
if (menangBattle == true) {
kondisiPreview = 'akhir';
} else {
kondisiPreview = 'tengah';
}
gotoAndStop(840);
}
function cekSpeed() {
if (speedBattle == 1) {
battle_mc.speed_mc.gotoAndStop(1);
} else {
if (speedBattle == 2) {
battle_mc.speed_mc.gotoAndStop(2);
}
}
}
stop();
tipeAttackMusuh = 'defense';
frameKota.namaKota = xnamaKota[keKota];
backBattle1();
initAwalBattle();
initBattle();
buatBackground();
cekJumlahTankMusuh();
_root.onEnterFrame = function () {
if (sedangPause == false) {
if (waktuDatangJagoan <= 0) {
sudahDatangJagoan = true;
datangJagoan = 'Our troops are in the line';
battle_mc.soldier_mc._visible = true;
battle_mc.vehicle_mc._visible = true;
battle_mc.weapon_mc._visible = true;
battle_mc.spell_mc._visible = true;
} else {
if (kiniDatangJagoan >= maxDatangJagoan) {
kiniDatangJagoan = 0;
--waktuDatangJagoan;
} else {
++kiniDatangJagoan;
}
datangJagoan = 'Our troops will arrived in countdown ' + waktuDatangJagoan;
battle_mc.soldier_mc._visible = false;
battle_mc.vehicle_mc._visible = false;
battle_mc.weapon_mc._visible = false;
battle_mc.spell_mc._visible = false;
}
if (delayMusuhKeluar >= maxMusuhKeluar) {
buatMusuh();
delayMusuhKeluar = 0;
} else {
++delayMusuhKeluar;
}
if (_root._xmouse <= 10 || geserKeKiri == true) {
if (background_mc._x <= -20) {
geserKiri = 10 * speedBattle;
} else {
geserKiri = 0;
}
} else {
if (_root._xmouse >= 790 || geserKeKanan == true) {
if (background_mc._x >= -780) {
geserKiri = -10 * speedBattle;
} else {
geserKiri = 0;
}
} else {
geserKiri = 0;
}
}
background_mc._x += geserKiri;
if (getarBumi == true) {
if (getarKe == 1) {
cekGeserX(5);
cekGeserY(5);
++getarKe;
} else {
if (getarKe == 2) {
cekGeserX(-10);
cekGeserY(-10);
++getarKe;
} else {
if (getarKe == 3) {
cekGeserX(5);
cekGeserY(-5);
++getarKe;
} else {
if (getarKe == 4) {
cekGeserX(-5);
cekGeserY(5);
++getarKe;
} else {
if (getarKe == 5) {
cekGeserX(7);
cekGeserY(7);
++getarKe;
} else {
if (getarKe == 6) {
cekGeserX(10);
cekGeserY(-10);
++getarKe;
} else {
if (getarKe == 7) {
cekGeserX(-12);
cekGeserY(7);
++getarKe;
} else {
if (getarKe == 8) {
cekGeserX(5);
cekGeserY(5);
++getarKe;
} else {
if (getarKe == 9) {
cekGeserX(-10);
cekGeserY(-10);
++getarKe;
} else {
if (getarKe == 10) {
cekGeserX(5);
cekGeserY(-5);
++getarKe;
} else {
if (getarKe == 11) {
cekGeserX(-5);
cekGeserY(5);
++getarKe;
} else {
if (getarKe == 12) {
cekGeserX(7);
cekGeserY(7);
++getarKe;
} else {
if (getarKe == 13) {
cekGeserX(10);
cekGeserY(-10);
++getarKe;
} else {
if (getarKe == 14) {
cekGeserX(-12);
cekGeserY(7);
++getarKe;
} else {
cekNormalY('akhir');
getarBumi = false;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
if (defenseKita <= 0) {
defenseKita = 0;
}
if (totalMusuh <= 0) {
totalMusuh = 0;
}
ourDefense.jumlah = defenseKita;
enemyLeft.jumlah = totalMusuh;
}
if (battle_mc.pasukan_mc.jumlah11 <= 0) {
battle_mc.pasukan_mc.jumlah11 = 0;
}
if (battle_mc.pasukan_mc.jumlah12 <= 0) {
battle_mc.pasukan_mc.jumlah12 = 0;
}
if (battle_mc.pasukan_mc.jumlah13 <= 0) {
battle_mc.pasukan_mc.jumlah13 = 0;
}
if (battle_mc.pasukan_mc.jumlah14 <= 0) {
battle_mc.pasukan_mc.jumlah14 = 0;
}
if (battle_mc.pasukan_mc.jumlah15 <= 0) {
battle_mc.pasukan_mc.jumlah15 = 0;
}
if (battle_mc.pasukan_mc.jumlah16 <= 0) {
battle_mc.pasukan_mc.jumlah16 = 0;
}
if (battle_mc.pasukan_mc.jumlah17 <= 0) {
battle_mc.pasukan_mc.jumlah17 = 0;
}
if (battle_mc.pasukan_mc.jumlah18 <= 0) {
battle_mc.pasukan_mc.jumlah18 = 0;
}
};
ourDefense.onRollOver = function () {
this.gotoAndStop(2);
};
ourDefense.onRollOut = function () {
this.gotoAndStop(1);
};
enemyLeft.onRollOver = function () {
this.gotoAndStop(2);
};
enemyLeft.onRollOut = function () {
this.gotoAndStop(1);
};
battle_mc.soldier_mc.onRelease = function () {
sedangDragWeapon = false;
sedangDragSpell = false;
removeMovieClip(drag_mc2);
buatKotak(false);
battle_mc.pasukan_mc.gotoAndStop(1);
cekPasukanBuat();
};
battle_mc.vehicle_mc.onRelease = function () {
sedangDragWeapon = false;
sedangDragSpell = false;
removeMovieClip(drag_mc2);
buatKotak(false);
battle_mc.pasukan_mc.gotoAndStop(2);
cekPasukanBuat();
};
battle_mc.weapon_mc.onRelease = function () {
sedangDragWeapon = false;
sedangDragSpell = false;
removeMovieClip(drag_mc2);
buatKotak(false);
battle_mc.pasukan_mc.gotoAndStop(3);
cekPasukanBuat();
};
battle_mc.spell_mc.onRelease = function () {
sedangDragWeapon = false;
sedangDragSpell = false;
removeMovieClip(drag_mc2);
buatKotak(false);
battle_mc.pasukan_mc.gotoAndStop(4);
cekPasukanBuat();
};
battle_mc.defense_mc.onRelease = function () {
sedangDragWeapon = false;
sedangDragSpell = false;
removeMovieClip(drag_mc2);
buatKotak(false);
battle_mc.pasukan_mc.gotoAndStop(5);
cekPasukanBuat();
};
battle_mc.remove_mc._visible = false;
battle_mc.remove_mc.onRelease = function () {
sedangDragWeapon = false;
sedangDragSpell = false;
removeMovieClip(drag_mc2);
buatKotak(false);
};
battle_mc.pasukan_mc.gotoAndStop(5);
cekPasukanBuat();
_root.onMouseDown = function () {
if (sedangPause == false) {
if (sedangDragWeapon == true) {
if (_root._ymouse >= 200 && _root._ymouse <= 425) {
buatWeapon(_root._ymouse);
sedangDragWeapon = false;
stopDrag();
removeMovieClip(drag_mc2);
}
} else {
if (sedangDragSpell == true) {
if (pilihSpell == 14) {
if (_root._ymouse >= 150 && _root._ymouse <= 475) {
if (getarBumi2 == false) {
getarBumi2 = true;
buatSpell(_root._xmouse, _root._ymouse);
sedangDragSpell = false;
stopDrag();
removeMovieClip(drag_mc2);
}
}
} else {
if (_root._ymouse >= 125 && _root._ymouse <= 475) {
buatSpell(_root._xmouse, _root._ymouse);
sedangDragSpell = false;
stopDrag();
removeMovieClip(drag_mc2);
}
}
}
}
}
};
_root.onMouseMove = function () {
if (sedangDragWeapon == true) {
if (_root._ymouse >= 200 && _root._ymouse <= 425) {
drag_mc2.bisa._visible = false;
} else {
drag_mc2.bisa._visible = true;
}
} else {
if (sedangDragSpell == true) {
if (pilihSpell == 14) {
if (getarBumi2 == true) {
drag_mc2.bisa._visible = true;
} else {
if (_root._ymouse >= 150 && _root._ymouse <= 475) {
drag_mc2.bisa._visible = false;
} else {
drag_mc2.bisa._visible = true;
}
}
} else {
if (_root._ymouse >= 125 && _root._ymouse <= 475) {
drag_mc2.bisa._visible = false;
} else {
drag_mc2.bisa._visible = true;
}
}
}
}
};
battle_mc.retreat_btn.onRelease = function () {
battle_mc.retreat_btn._visible = false;
i = 1;
while (i <= maximumJagoan) {
_root['jagoan_mc' + i].onEnterFrame = jagoanLari;
++i;
}
cekKalah();
};
battle_mc.pause_btn.onRelease = function () {
if (sedangPause == false) {
pause_mc = attachMovie('pause_mc', 'pause_mc', 1199905);
pause_mc._x = 400;
pause_mc._y = 300;
sedangPause = true;
} else {
removeMovieClip(pause_mc);
sedangPause = false;
}
cekPause(sedangPause);
};
cekSpeed();
battle_mc.speed_mc.onRelease = function () {
if (speedBattle == 1) {
speedBattle = 2;
} else {
if (speedBattle == 2) {
speedBattle = 1;
}
}
cekSpeed();
};
geserKeKiri = false;
geserKeKanan = false;
myListener = new Object();
myListener.onKeyDown = function () {
if (Key.getCode() == 65 || Key.getCode() == 37) {
geserKeKiri = true;
}
if (Key.getCode() == 68 || Key.getCode() == 39) {
geserKeKanan = true;
}
};
myListener.onKeyUp = function () {
if (Key.getCode() == 65 || Key.getCode() == 37) {
geserKeKiri = false;
}
if (Key.getCode() == 68 || Key.getCode() == 39) {
geserKeKanan = false;
}
};
Key.addListener(myListener);
}
movieClip 2945 {
}
movieClip 2948 {
frame 1 {
stop();
}
}
movieClip 2951 {
frame 1 {
stop();
}
}
frame 903 {
function initBattle() {
dalamBenteng = 75;
delayMusuhKeluar = 0;
geserKiri = 0;
dalamDrag = 200000;
dalamSpell = 300000;
dalamSoldier = 1;
dalamWeapon = 200;
dalamPeluru = 100;
dalamEfekJagoan = 100;
dalamMusuh = 50;
if (xday <= 100) {
nilaiSoldier = 20;
} else {
if (xday <= 200) {
nilaiSoldier = 25;
} else {
if (xday <= 300) {
nilaiSoldier = 30;
} else {
if (xday <= 400) {
nilaiSoldier = 35;
} else {
if (xday <= 500) {
nilaiSoldier = 40;
} else {
if (xday <= 600) {
nilaiSoldier = 45;
} else {
nilaiSoldier = 50;
}
}
}
}
}
}
maximumJagoan = 29;
kiniVehicle = 0;
musuhSpell = 0;
maxMusuhSpell = 200;
getarBumi = false;
getarBumi2 = false;
mulaiBattle = true;
sudahSelesai = false;
sedangDragWeapon = false;
sedangDragSpell = false;
sedangDragSpell2 = false;
adaSerangBase = false;
sedangPause = false;
jumlahMusuh = 0;
totalMusuh = 0;
wpindahBareman = pindahBareman;
wpindahSwordman = pindahSwordman;
wpindahArrowman = pindahArrowman;
wpindahSpearman = pindahSpearman;
wpindahTank = pindahTank;
wpindahCopter = pindahCopter;
wpindahMonbot = pindahMonbot;
wpindahArrowTrap = pindahArrowTrap;
wpindahCatapult = pindahCatapult;
wpindahFireTrap = pindahFireTrap;
wpindahArrowRain = pindahArrowRain;
wpindahMeteorid = pindahMeteorid;
wpindahAcidRain = pindahAcidRain;
wpindahEarthquake = pindahEarthquake;
wpindahImmune = pindahImmune;
wpindahInvisible = pindahInvisible;
wpindahSpecialAttack = pindahSpecialAttack;
wpindahDuplicate = pindahDuplicate;
wpindahWall = pindahWall;
wpindahSpike = pindahSpike;
wpindahSpiderWeb = pindahSpiderWeb;
wpindahTowerGuard = pindahTowerGuard;
wpindahZombieTrap = pindahZombieTrap;
if (xday <= 100) {
nyawaBenteng = 500;
maxMusuhKeluar = 60;
defenseKita = 3;
} else {
if (xday <= 200) {
nyawaBenteng = 1000;
maxMusuhKeluar = 55;
defenseKita = 4;
} else {
if (xday <= 300) {
nyawaBenteng = 1500;
maxMusuhKeluar = 50;
defenseKita = 5;
} else {
if (xday <= 400) {
nyawaBenteng = 2000;
maxMusuhKeluar = 45;
defenseKita = 6;
} else {
if (xday <= 500) {
nyawaBenteng = 2500;
maxMusuhKeluar = 40;
defenseKita = 7;
} else {
if (xday <= 600) {
nyawaBenteng = 3000;
maxMusuhKeluar = 30;
defenseKita = 8;
} else {
if (xday <= 700) {
nyawaBenteng = 3500;
maxMusuhKeluar = 25;
defenseKita = 9;
} else {
nyawaBenteng = 4000;
maxMusuhKeluar = 20;
defenseKita = 10;
}
}
}
}
}
}
}
defenseKita = 3;
maxMusuhKeluar *= 0.5;
maxMusuh = jumlahPasukanMusuhSerang;
maxMusuh = Math.ceil(maxMusuh);
maxMusuhKeluar2 = maxMusuhKeluar * 0.5;
totalMusuh = maxMusuh;
}
function buatBenteng() {
benteng = attachMovie('bentengJagoan', 'benteng_mc', dalamBenteng);
benteng.cacheAsBitmap = true;
benteng._x = background_mc._x + 300;
benteng._y = 475;
posAwalBentengY = benteng._y;
benteng.onEnterFrame = enterBenteng;
}
function enterBenteng() {
if (sedangPause == false) {
this._x += geserKiri;
if (nyawaBenteng <= 0) {
nyawaBenteng = 0;
defenseKita = 0;
cekKalah();
}
}
this.jumlah = Math.ceil(nyawaBenteng);
}
function buatGuard() {
if (xday <= 100) {
musuhNyawa = 20;
} else {
if (xday <= 200) {
musuhNyawa = 25;
} else {
if (xday <= 300) {
musuhNyawa = 30;
} else {
if (xday <= 400) {
musuhNyawa = 35;
} else {
if (xday <= 500) {
musuhNyawa = 40;
} else {
if (xday <= 600) {
musuhNyawa = 45;
} else {
if (xday <= 700) {
musuhNyawa = 50;
} else {
musuhNyawa = 55;
}
}
}
}
}
}
}
i = 1;
while (i <= 2) {
soldier = attachMovie('guard' + i, 'jagoan_mc' + dalamSoldier, i + 25);
soldier.cacheAsBitmap = true;
if (i == 1) {
soldier._x = benteng_mc._x - 50;
soldier._y = benteng_mc._y - 180;
} else {
if (i == 2) {
soldier._x = benteng_mc._x + 50;
soldier._y = benteng_mc._y - 130;
}
}
if (i == 1) {
soldier.nyawa = musuhNyawa + random(5);
soldier.scaleAwal = 100;
soldier.range = 1000;
soldier.range2 = 1000;
soldier.speed = 0;
soldier.speed2 = 0;
soldier.damage = 2;
soldier.jenis = 3;
} else {
if (i == 2) {
soldier.nyawa = musuhNyawa + random(5);
soldier.scaleAwal = 100;
soldier.range = 850;
soldier.range2 = 850;
soldier.speed = 0;
soldier.speed2 = 0;
soldier.damage = 4;
soldier.jenisWeapon = 11;
}
}
soldier.nyawa *= 100;
soldier.guard = true;
soldier.onEnterFrame = enterSoldier;
++dalamSoldier;
if (dalamSoldier >= maximumJagoan) {
dalamSoldier = maximumJagoan;
}
++i;
}
}
function buatBackground() {
pilihanKota = posBackground[kotaSerang];
if (pilihanKota == 1) {
background_mc.gotoAndStop(1);
} else {
if (pilihanKota == 2) {
background_mc.gotoAndStop(2);
} else {
if (pilihanKota == 3) {
background_mc.gotoAndStop(3);
} else {
if (pilihanKota == 4) {
background_mc.gotoAndStop(4);
}
}
}
}
background_mc.cacheAsBitmap = true;
posAwalBackgroundX = background_mc._x;
posAwalBackgroundY = background_mc._y;
}
function buatMusuh() {
if (siapaYangNyerang == 2) {
if (tingkatSulit == 1) {
pilihMusuh = 1 + random(3);
} else {
if (tingkatSulit == 2) {
if (xday <= 500) {
pilihMusuh = 1 + random(3);
} else {
pilihMusuh = 1 + random(4);
}
} else {
if (tingkatSulit == 3) {
if (xday <= 500) {
pilihMusuh = 1 + random(3);
} else {
pilihMusuh = 1 + random(5);
}
}
}
}
if (xday <= 100) {
musuhNyawa = 10;
} else {
if (xday <= 200) {
musuhNyawa = 15;
} else {
if (xday <= 300) {
musuhNyawa = 20;
} else {
if (xday <= 400) {
musuhNyawa = 25;
} else {
if (xday <= 500) {
musuhNyawa = 30;
} else {
if (xday <= 600) {
musuhNyawa = 35;
} else {
if (xday <= 700) {
musuhNyawa = 40;
} else {
musuhNyawa = 45;
}
}
}
}
}
}
}
cekNyawaHuman();
} else {
if (siapaYangNyerang == 0) {
pilihMusuh = 1 + random(2);
if (xday <= 100) {
musuhNyawa = 10;
} else {
if (xday <= 200) {
musuhNyawa = 15;
} else {
if (xday <= 300) {
musuhNyawa = 20;
} else {
if (xday <= 400) {
musuhNyawa = 25;
} else {
if (xday <= 500) {
musuhNyawa = 30;
} else {
if (xday <= 600) {
musuhNyawa = 35;
} else {
if (xday <= 700) {
musuhNyawa = 40;
} else {
if (xday <= 800) {
musuhNyawa = 45;
} else {
if (xday <= 900) {
musuhNyawa = 50;
} else {
if (xday <= 1000) {
musuhNyawa = 55;
} else {
if (xday <= 1100) {
musuhNyawa = 60;
} else {
if (xday <= 1200) {
musuhNyawa = 70;
} else {
if (xday <= 1300) {
musuhNyawa = 80;
} else {
if (xday <= 1400) {
musuhNyawa = 90;
} else {
if (xday <= 1500) {
musuhNyawa = 100;
} else {
if (xday <= 1600) {
musuhNyawa = 110;
} else {
if (xday <= 1700) {
musuhNyawa = 120;
} else {
if (xday <= 1800) {
musuhNyawa = 130;
} else {
if (xday <= 1900) {
musuhNyawa = 140;
} else {
musuhNyawa = 150;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
if (tingkatSulit == 3) {
musuhNyawa *= 3;
} else {
if (tingkatSulit == 2) {
musuhNyawa *= 2;
} else {
musuhNyawa *= 1;
}
}
}
}
if (siapaYangNyerang == 0) {
musuhNyawa *= 2;
} else {
musuhNyawa *= pengkalianMusuh;
}
if (totalMusuh > 0) {
bisaBuatMusuh = false;
i = 50;
while (i <= 65) {
if (_root['musuh_mc' + i].nyawa == undefined) {
xdalamMusuh = i;
i = 80;
bisaBuatMusuh = true;
}
++i;
}
if (bisaBuatMusuh == true) {
removeMovieClip(_root['musuh_mc' + xdalamMusuh]);
randKeluarMusuh = random(4) + 1;
if (pilihMusuh >= 4 && maxTankMusuh <= 0) {
pilihMusuh = 1 + random(3);
} else {
if (pilihMusuh >= 4 && maxTankMusuh > 0) {
--maxTankMusuh;
}
}
++jumlahMusuh;
if (siapaYangNyerang == 0) {
musuh = attachMovie('barbar' + pilihMusuh, 'musuh_mc' + xdalamMusuh, xdalamMusuh + 100);
} else {
if (siapaYangNyerang == 2) {
musuh = attachMovie('musuh' + pilihMusuh, 'musuh_mc' + xdalamMusuh, xdalamMusuh + 100);
}
}
musuh.cacheAsBitmap = true;
musuh._x = background_mc._x - 150 + 3000 + 300;
if (pilihMusuh == 5) {
musuh._y = 210 + 40 * randKeluarMusuh;
musuh.heli = true;
} else {
musuh._y = 310 + 40 * randKeluarMusuh;
}
musuh.jenis = pilihMusuh;
randSpeed = random(3);
if (pilihMusuh == 4 || pilihMusuh == 5) {
musuh.nyawa = (musuhNyawa + random(5)) * 10;
musuh.scaleAwal = 100;
musuh.range = 550;
musuh.range2 = 650;
if (randSpeed == 0) {
musuh.speed = 1.5;
} else {
if (randSpeed == 1) {
musuh.speed = 3 + random(2);
} else {
if (randSpeed == 2) {
musuh.speed = 0.5;
}
}
}
musuh.speed2 = musuh.speed * 2;
musuh.damage = 5;
musuh.tipeSenjata = 'range';
} else {
if (pilihMusuh == 2) {
musuh.nyawa = musuhNyawa + random(5);
musuh.scaleAwal = 100;
musuh.range = 450;
musuh.range2 = 550;
if (randSpeed == 0) {
musuh.speed = 1 + random(2);
} else {
if (randSpeed == 1) {
musuh.speed = 1.5;
} else {
if (randSpeed == 2) {
musuh.speed = 2.5 + random(2);
}
}
}
musuh.speed2 = musuh.speed * 4;
musuh.damage = 2;
musuh.tipeSenjata = 'range';
} else {
if (pilihMusuh == 3) {
musuh.nyawa = musuhNyawa + random(5);
musuh.scaleAwal = 100;
musuh.range = 100;
musuh.range2 = 450;
if (randSpeed == 0) {
musuh.speed = 2 + random(2);
} else {
if (randSpeed == 1) {
musuh.speed = 0.5;
} else {
if (randSpeed == 2) {
musuh.speed = 2.5 + random(2);
}
}
}
musuh.speed2 = musuh.speed * 4;
musuh.damage = 3;
musuh.tipeSenjata = 'melee';
} else {
musuh.nyawa = musuhNyawa + random(5);
musuh.scaleAwal = 100;
musuh.range = 75;
musuh.range2 = 350;
if (randSpeed == 0) {
musuh.speed = 2 + random(2);
} else {
if (randSpeed == 1) {
musuh.speed = 0.5;
} else {
if (randSpeed == 2) {
musuh.speed = 2.5 + random(2);
}
}
}
musuh.speed2 = musuh.speed * 4;
musuh.damage = 1;
musuh.tipeSenjata = 'melee';
}
}
}
musuh.speed *= 1.5;
musuh.kenaApi = false;
musuh.onEnterFrame = enterMusuh;
}
}
}
function enterMusuh() {
if (sedangPause == false) {
this._x += geserKiri;
if (sudahSelesai == false) {
if (this.nyawa <= 0) {
this.nyawa = 0;
if (this._currentframe != 4) {
++killMusuh;
--totalMusuh;
if (totalMusuh <= 0) {
totalMusuh = 0;
cekMenang();
}
i = 100;
while (i <= 200) {
this['panah_mc' + i]._visible = false;
++i;
}
this.gotoAndStop(4);
}
} else {
if (this.xtarget.nyawa <= 0 || this.xtarget.nyawa == undefined || this.xtarget.invis == true) {
this.xtarget = undefined;
this.serangBalik = undefined;
}
if (this.xtarget == undefined || this.xtarget.nyawa <= 0) {
i = 1;
while (i <= maximumJagoan) {
if (_root['jagoan_mc' + i].nyawa != undefined) {
this.jarak = Math.sqrt(Math.pow(this._x - _root['jagoan_mc' + i]._x, 2) + Math.pow(this._y - _root['jagoan_mc' + i]._y, 2));
if (this.jarak <= this.range) {
if (_root['jagoan_mc' + i].guard != true) {
if (this.tipeSenjata == 'melee' && _root['jagoan_mc' + i].heli == true) {
} else {
this.xtarget = _root['jagoan_mc' + i];
i = maximumJagoan;
}
}
}
}
++i;
}
} else {
this.jarak = Math.sqrt(Math.pow(this._x - this.xtarget._x, 2) + Math.pow(this._y - this.xtarget._y, 2));
if (this.jarak > this.range) {
if (this.xtarget.tipeSenjata == 'range') {
this.xtarget = undefined;
} else {
if (this.serangBalik != true) {
this.xtarget = undefined;
}
}
}
if (this._x < this.xtarget._x) {
if (this.serangBalik != true) {
this.xtarget = undefined;
}
}
}
if (this.serangBalik == true) {
if (this.xtarget == undefined) {
this.anim._xscale = this.scaleAwal;
} else {
if (this._x <= this.xtarget._x) {
this.anim._xscale = -this.scaleAwal;
} else {
this.anim._xscale = this.scaleAwal;
}
}
} else {
this.anim._xscale = this.scaleAwal;
}
if (this._x <= background_mc._x + 375 + this.range) {
this.serangBase = true;
this.gotoAndStop(3);
} else {
if (this.xtarget != undefined) {
if (this._x <= this.xtarget._x) {
this.anim._xscale = -this.scaleAwal;
} else {
this.anim._xscale = this.scaleAwal;
}
this.serangBase = false;
this.gotoAndStop(3);
} else {
this._x -= this.speed * speedBattle;
this.gotoAndStop(2);
}
}
}
}
}
this.jumlah = Math.ceil(this.nyawa);
if (this.jenis == 5) {
this.swapDepths(100 + this._x + this._y * 200);
} else {
this.swapDepths(100 + this._x + this._y * 100);
}
}
function cekSerangMusuh(indi) {
if (indi.jenis == 2) {
if (indi.serangBase == true) {
cekPanahMusuhBase(indi);
} else {
cekPanahMusuh(indi);
}
} else {
if (indi.serangBase == true) {
nyawaBenteng -= indi.damage;
if (indi.jenis == 4 || indi.jenis == 5) {
cekEfekLedakan3();
}
} else {
if (indi.xtarget.tipeApa == 'weapon') {
--indi.xtarget.ammo;
if (indi.xtarget.ammo <= 0) {
indi.xtarget.nyawa = 0;
if (indi.xtarget.jenisWeapon == 8) {
++xpindahArrowTrap;
} else {
if (indi.xtarget.jenisWeapon == 9) {
++xpindahCatapult;
} else {
if (indi.xtarget.jenisWeapon == 10) {
++xpindahFireTrap;
}
}
}
removeMovieClip(indi.xtarget);
}
}
if (indi.xtarget.kebal != true) {
if (indi.xtarget.nyawa > 0) {
if (indi.damage != undefined) {
indi.xtarget.nyawa -= indi.damage;
if (indi.xtarget.iniDuplikasi == false) {
if (indi.xtarget.jenis == 1) {
xpindahBareman += indi.damage;
} else {
if (indi.xtarget.jenis == 2) {
xpindahSwordman += indi.damage;
} else {
if (indi.xtarget.jenis == 3) {
xpindahArrowman += indi.damage;
} else {
if (indi.xtarget.jenis == 4) {
xpindahSpearman += indi.damage;
}
}
}
}
}
if (indi.jenis == 4 || indi.jenis == 5) {
cekEfekLedakan2(indi.xtarget);
}
}
}
}
}
}
}
function cekPanahMusuh(indi) {
peluru = attachMovie('panah_mc3', 'peluru_mc' + dalamPeluru, dalamPeluru);
peluru._x = indi._x - 30;
peluru._y = indi._y - 30;
if (siapaYangNyerang == 2) {
peluru._yscale = 75;
peluru._xscale = 75;
} else {
peluru._yscale = 100;
peluru._xscale = 100;
}
peluru.speed = 25;
peluru.arahTembak = 35;
peluru.xtarget = indi.xtarget;
peluru.tujuanX = indi.xtarget._x;
peluru.tujuanY = indi.xtarget._y;
deltaX = peluru._x - peluru.tujuanX;
deltaY = peluru._y - peluru.tujuanY;
angle = -Math.atan2(deltaX, deltaY) / 0.0174532925199433;
peluru._rotation = angle;
peluru.indi = indi;
peluru.onEnterFrame = enterPanahMusuh;
++dalamPeluru;
if (dalamPeluru >= 200) {
dalamPeluru = 100;
}
}
function enterPanahMusuh() {
if (sedangPause == false) {
this._x += geserKiri;
if (this.xtarget.nyawa == undefined) {
deltaX = this._x - this.tujuanX;
deltaY = this._y - this.tujuanY;
angle = -Math.atan2(deltaX, deltaY) / 0.0174532925199433;
this._rotation = angle;
if (Math.sqrt(deltaX * deltaX + deltaY * deltaY) > this.speed) {
this.speed += 0.5;
this._y -= this.speed * Math.cos(angle * 0.0174532925199433);
this._x += this.speed * Math.sin(angle * 0.0174532925199433);
} else {
removeMovieClip(this);
}
} else {
deltaX = this._x - this.xtarget._x;
deltaY = this._y - this.xtarget._y + this.arahTembak;
angle = -Math.atan2(deltaX, deltaY) / 0.0174532925199433;
this._rotation = angle;
if (Math.sqrt(deltaX * deltaX + deltaY * deltaY) > this.speed) {
this.speed += 0.5;
this._y -= this.speed * Math.cos(angle * 0.0174532925199433);
this._x += this.speed * Math.sin(angle * 0.0174532925199433);
} else {
if (this.xtarget.tipeApa == 'weapon') {
--this.xtarget.ammo;
if (this.xtarget.ammo <= 0) {
this.xtarget.nyawa = 0;
if (this.xtarget.jenisWeapon == 8) {
++xpindahArrowTrap;
} else {
if (this.xtarget.jenisWeapon == 9) {
++xpindahCatapult;
} else {
if (this.xtarget.jenisWeapon == 10) {
++xpindahFireTrap;
}
}
}
removeMovieClip(this.xtarget);
}
}
if (this.xtarget.kebal != true) {
if (this.xtarget.nyawa > 0) {
if (this.indi.damage != undefined) {
this.xtarget.nyawa -= this.indi.damage;
if (this.xtarget.iniDuplikasi == false) {
if (this.xtarget.jenis == 1) {
xpindahBareman += this.indi.damage;
} else {
if (this.xtarget.jenis == 2) {
xpindahSwordman += this.indi.damage;
} else {
if (this.xtarget.jenis == 3) {
xpindahArrowman += this.indi.damage;
} else {
if (this.xtarget.jenis == 4) {
xpindahSpearman += this.indi.damage;
}
}
}
}
}
}
}
}
if (this.xtarget.nyawa > 0) {
this.xtarget.attachMovie('panah_mc3', 'panah_mc' + dalamPeluru, dalamPeluru);
this.xtarget['panah_mc' + dalamPeluru].gotoAndStop(2);
this.xtarget['panah_mc' + dalamPeluru]._x = 25 + random(15) + 7;
this.xtarget['panah_mc' + dalamPeluru]._y = -35 + random(15) + 7;
this.xtarget['panah_mc' + dalamPeluru]._rotation = this._rotation - random(15) + 7;
this.xtarget['panah_mc' + dalamPeluru]._xscale = this._xscale;
this.xtarget['panah_mc' + dalamPeluru]._yscale = this._yscale;
++dalamPeluru;
if (dalamPeluru >= 200) {
dalamPeluru = 100;
}
}
removeMovieClip(this);
}
}
}
this.swapDepths(100 + this._x + this._y * 100);
}
function cekPanahMusuhBase(indi) {
peluru = attachMovie('panah_mc3', 'peluru_mc' + dalamPeluru, dalamPeluru);
peluru._x = indi._x - 30;
peluru._y = indi._y - 30;
peluru._yscale = 75;
peluru._xscale = 75;
peluru.speed = 25;
peluru.arahTembak = 100;
peluru.xtarget = benteng_mc;
peluru.tujuanX = benteng_mc._x;
peluru.tujuanY = benteng_mc._y - 100;
deltaX = peluru._x - peluru.tujuanX;
deltaY = peluru._y - peluru.tujuanY;
angle = -Math.atan2(deltaX, deltaY) / 0.0174532925199433;
peluru._rotation = angle;
peluru.indi = indi;
peluru.onEnterFrame = enterPanahMusuhBase;
++dalamPeluru;
if (dalamPeluru >= 200) {
dalamPeluru = 100;
}
}
function enterPanahMusuhBase() {
if (sedangPause == false) {
this._x += geserKiri;
deltaX = this._x - this.xtarget._x;
deltaY = this._y - this.xtarget._y + this.arahTembak;
angle = -Math.atan2(deltaX, deltaY) / 0.0174532925199433;
this._rotation = angle;
if (Math.sqrt(deltaX * deltaX + deltaY * deltaY) > this.speed) {
this.speed += 0.5;
this._y -= this.speed * Math.cos(angle * 0.0174532925199433);
this._x += this.speed * Math.sin(angle * 0.0174532925199433);
} else {
nyawaBenteng -= this.indi.damage;
if (nyawaBenteng > 0) {
this.xtarget.attachMovie('panah_mc3', 'panah_mc' + dalamPeluru, dalamPeluru);
this.xtarget['panah_mc' + dalamPeluru].gotoAndStop(2);
this.xtarget['panah_mc' + dalamPeluru]._x = 5 + random(15) + 7;
this.xtarget['panah_mc' + dalamPeluru]._y = -105 + random(15) + 7;
this.xtarget['panah_mc' + dalamPeluru]._rotation = this._rotation - random(15) + 7;
this.xtarget['panah_mc' + dalamPeluru]._xscale = this._xscale;
this.xtarget['panah_mc' + dalamPeluru]._yscale = this._yscale;
++dalamPeluru;
if (dalamPeluru >= 200) {
dalamPeluru = 100;
}
}
removeMovieClip(this);
}
}
this.swapDepths(100 + this._x + this._y * 100);
}
function cekEfekLedakan2(indi, indi2) {
if (indi != undefined) {
efek = attachMovie('efekLedakan', 'spell_mc' + dalamSpell, dalamSpell);
efek._x = indi._x;
efek._y = indi._y - 50;
efek._xscale = 75;
efek._yscale = 75;
efek.onEnterFrame = enterEfekApi2;
++dalamSpell;
if (dalamSpell >= 301000) {
dalamSpell = 300000;
}
}
}
function enterEfekApi2() {
if (sedangPause == false) {
this._x += geserKiri;
i = 1;
while (i <= maximumJagoan) {
if (this.hitTest(_root['jagoan_mc' + i].anim)) {
if (_root['jagoan_mc' + i].nyawa > 0) {
_root['jagoan_mc' + i].nyawa -= 0.5;
if (_root['jagoan_mc' + i].jenis == 1) {
xpindahBareman += 0.5;
} else {
if (_root['jagoan_mc' + i].jenis == 2) {
xpindahSwordman += 0.5;
} else {
if (_root['jagoan_mc' + i].jenis == 3) {
xpindahArrowman += 0.5;
} else {
if (_root['jagoan_mc' + i].jenis == 4) {
xpindahSpearman += 0.5;
}
}
}
}
}
}
++i;
}
}
this.swapDepths(100 + this._x + this._y * 100);
}
function cekEfekLedakan3() {
if (indi != undefined) {
efek = attachMovie('efekLedakan', 'spell_mc' + dalamSpell, dalamSpell);
efek._x = benteng_mc._x;
efek._y = benteng_mc._y - 50;
efek._xscale = 75;
efek._yscale = 75;
efek.onEnterFrame = enterEfekApi3;
++dalamSpell;
if (dalamSpell >= 301000) {
dalamSpell = 300000;
}
}
}
function enterEfekApi3() {
if (sedangPause == false) {
this._x += geserKiri;
if (this.hitTest(benteng_mc)) {
nyawaBenteng -= 0.5;
}
}
this.swapDepths(100 + this._x + this._y * 100);
}
function cekSpellMusuh2() {
rand = random(2);
if (rand == 0) {
i = maximumJagoan;
while (i >= 1) {
if (_root['jagoan_mc' + i]._x != undefined) {
indiX = _root['jagoan_mc' + i]._x + 50;
indiY = _root['jagoan_mc' + i]._y;
i = 1;
}
--i;
}
z = 11;
while (z <= 14) {
pilihSpellMusuh = z;
if (pilihSpellMusuh == 14) {
spell = attachMovie('efek' + (pilihSpellMusuh - 10) + 'x', 'spell_mc' + dalamSpell, dalamSpell - 270000);
} else {
spell = attachMovie('efek' + (pilihSpellMusuh - 10), 'spell_mc' + dalamSpell, dalamSpell);
}
if (pilihSpellMusuh == 11) {
spell._x = indiX;
spell._y = indiY - 1000;
spell.speedY = 5;
spell.damage = 0.3;
spell.batasBawah = indiY + 50;
} else {
if (pilihSpellMusuh == 12) {
backComet();
spell._x = indiX;
spell._y = indiY - 1000;
spell.speedY = 5;
spell.damage = 0.4;
spell.batasBawah = indiY + 50;
} else {
if (pilihSpellMusuh == 13) {
spell._x = indiX;
spell._y = indiY - 1000;
spell.speedY = 5;
spell.damage = 0.5;
spell.batasBawah = indiY + 50;
} else {
if (pilihSpellMusuh == 14) {
backGempa();
spell._x = indiX;
spell._y = indiY;
spell.damage = 0.1;
spell.awalGempa = 0;
spell.akhirGempa = 25;
spell.getarKe = 1;
}
}
}
}
if (siapaYangNyerang == 2) {
spell.damage *= 15;
} else {
spell.damage *= 7.5;
}
spell.tipeSpell = pilihSpellMusuh;
spell.onEnterFrame = enterSpellMusuh;
++dalamSpell;
if (dalamSpell >= 301000) {
dalamSpell = 300000;
}
++z;
}
} else {
i = 50;
while (i <= 65) {
if (_root['musuh_mc' + i].special != true) {
indiX = _root['musuh_mc' + i]._x;
indiY = _root['musuh_mc' + i]._y;
i = 80;
}
++i;
}
pilihSpellMusuh = random(2) + 15;
if (pilihSpellMusuh == 14) {
spell = attachMovie('efek' + (pilihSpellMusuh - 10) + 'x', 'spell_mc' + dalamSpell, dalamSpell - 270000);
} else {
spell = attachMovie('efek' + (pilihSpellMusuh - 10), 'spell_mc' + dalamSpell, dalamSpell);
}
if (pilihSpellMusuh == 11) {
spell._x = indiX;
spell._y = indiY - 1000;
spell.speedY = 5;
spell.damage = 0.3;
spell.batasBawah = indiY + 50;
} else {
if (pilihSpellMusuh == 12) {
backComet();
spell._x = indiX;
spell._y = indiY - 1000;
spell.speedY = 5;
spell.damage = 0.4;
spell.batasBawah = indiY + 50;
} else {
if (pilihSpellMusuh == 13) {
spell._x = indiX;
spell._y = indiY - 1000;
spell.speedY = 5;
spell.damage = 0.5;
spell.batasBawah = indiY + 50;
} else {
if (pilihSpellMusuh == 14) {
backGempa();
spell._x = indiX;
spell._y = indiY;
spell.damage = 0.1;
spell.awalGempa = 0;
spell.akhirGempa = 25;
spell.getarKe = 1;
} else {
if (pilihSpellMusuh == 15) {
backSpell1();
spell._x = indiX;
spell._y = indiY;
} else {
if (pilihSpellMusuh == 16) {
backSpell2();
spell._x = indiX;
spell._y = indiY;
}
}
}
}
}
}
if (siapaYangNyerang == 2) {
spell.damage *= 15;
} else {
spell.damage *= 7.5;
}
spell.tipeSpell = pilihSpellMusuh;
spell.onEnterFrame = enterSpellMusuh;
++dalamSpell;
if (dalamSpell >= 301000) {
dalamSpell = 300000;
}
}
}
function cekSpellMusuh() {
if (siapaYangNyerang == 0) {
if (xday >= 1000) {
rand = random(2);
} else {
rand = 0;
}
} else {
rand = random(2);
}
if (rand == 0) {
i = maximumJagoan;
while (i >= 1) {
if (_root['jagoan_mc' + i]._x != undefined) {
indiX = _root['jagoan_mc' + i]._x + 50;
indiY = _root['jagoan_mc' + i]._y;
i = 1;
}
--i;
}
if (xday >= 1000) {
pilihSpellMusuh = random(4) + 11;
} else {
if (xday >= 500) {
pilihSpellMusuh = random(2) + 11;
}
}
} else {
i = 50;
while (i <= 65) {
if (_root['musuh_mc' + i].special != true) {
indiX = _root['musuh_mc' + i]._x;
indiY = _root['musuh_mc' + i]._y;
i = 80;
}
++i;
}
pilihSpellMusuh = random(2) + 15;
}
if (pilihSpellMusuh == 14) {
spell = attachMovie('efek' + (pilihSpellMusuh - 10) + 'x', 'spell_mc' + dalamSpell, dalamSpell - 270000);
} else {
spell = attachMovie('efek' + (pilihSpellMusuh - 10), 'spell_mc' + dalamSpell, dalamSpell);
}
if (pilihSpellMusuh == 11) {
spell._x = indiX;
spell._y = indiY - 1000;
spell.speedY = 5;
spell.damage = 0.3;
spell.batasBawah = indiY + 50;
} else {
if (pilihSpellMusuh == 12) {
backComet();
spell._x = indiX;
spell._y = indiY - 1000;
spell.speedY = 5;
spell.damage = 0.4;
spell.batasBawah = indiY + 50;
} else {
if (pilihSpellMusuh == 13) {
spell._x = indiX;
spell._y = indiY - 1000;
spell.speedY = 5;
spell.damage = 0.5;
spell.batasBawah = indiY + 50;
} else {
if (pilihSpellMusuh == 14) {
backGempa();
spell._x = indiX;
spell._y = indiY;
spell.damage = 0.1;
spell.awalGempa = 0;
spell.akhirGempa = 25;
spell.getarKe = 1;
} else {
if (pilihSpellMusuh == 15) {
backSpell1();
spell._x = indiX;
spell._y = indiY;
} else {
if (pilihSpellMusuh == 16) {
backSpell2();
spell._x = indiX;
spell._y = indiY;
}
}
}
}
}
}
if (siapaYangNyerang == 2) {
spell.damage *= 15;
} else {
spell.damage *= 7.5;
}
spell.tipeSpell = pilihSpellMusuh;
spell.onEnterFrame = enterSpellMusuh;
++dalamSpell;
if (dalamSpell >= 301000) {
dalamSpell = 300000;
}
}
function enterSpellMusuh() {
if (sedangPause == false) {
this._x += geserKiri;
if (this.tipeSpell == 11) {
if (this._y >= this.batasBawah) {
this.gotoAndStop(2);
} else {
this._y += this.speedY;
this.speedY += 2;
}
i = 1;
while (i <= maximumJagoan) {
if (this.hitTest(_root['jagoan_mc' + i].anim)) {
if (_root['jagoan_mc' + i].nyawa > 0) {
_root['jagoan_mc' + i].nyawa -= this.damage;
if (_root['jagoan_mc' + i].jenis == 1) {
xpindahBareman += this.damage;
} else {
if (_root['jagoan_mc' + i].jenis == 2) {
xpindahSwordman += this.damage;
} else {
if (_root['jagoan_mc' + i].jenis == 3) {
xpindahArrowman += this.damage;
} else {
if (_root['jagoan_mc' + i].jenis == 4) {
xpindahSpearman += this.damage;
}
}
}
}
}
}
++i;
}
} else {
if (this.tipeSpell == 12) {
if (this._y >= this.batasBawah) {
this.gotoAndStop(2);
} else {
this._y += this.speedY;
this.speedY += 2;
}
i = 1;
while (i <= maximumJagoan) {
if (this.hitTest(_root['jagoan_mc' + i].anim)) {
if (_root['jagoan_mc' + i].nyawa > 0) {
_root['jagoan_mc' + i].nyawa -= this.damage;
if (_root['jagoan_mc' + i].jenis == 1) {
xpindahBareman += this.damage;
} else {
if (_root['jagoan_mc' + i].jenis == 2) {
xpindahSwordman += this.damage;
} else {
if (_root['jagoan_mc' + i].jenis == 3) {
xpindahArrowman += this.damage;
} else {
if (_root['jagoan_mc' + i].jenis == 4) {
xpindahSpearman += this.damage;
}
}
}
}
}
}
++i;
}
} else {
if (this.tipeSpell == 13) {
if (this._y >= this.batasBawah) {
this.gotoAndStop(2);
} else {
this._y += this.speedY;
this.speedY += 2;
}
i = 1;
while (i <= maximumJagoan) {
if (this.hitTest(_root['jagoan_mc' + i].anim)) {
if (_root['jagoan_mc' + i].nyawa > 0) {
_root['jagoan_mc' + i].nyawa -= this.damage;
if (_root['jagoan_mc' + i].jenis == 1) {
xpindahBareman += this.damage;
} else {
if (_root['jagoan_mc' + i].jenis == 2) {
xpindahSwordman += this.damage;
} else {
if (_root['jagoan_mc' + i].jenis == 3) {
xpindahArrowman += this.damage;
} else {
if (_root['jagoan_mc' + i].jenis == 4) {
xpindahSpearman += this.damage;
}
}
}
}
}
}
++i;
}
} else {
if (this.tipeSpell == 14) {
this._xscale += 1;
this._yscale += 1;
if (this.awalGempa >= this.akhirGempa && this.getarKe == 1) {
cekNormalY('akhir');
getarBumi2 = false;
removeMovieClip(this);
} else {
++this.awalGempa;
if (this.getarKe == 1) {
cekGeserX2(5);
cekGeserY2(5);
++this.getarKe;
} else {
if (this.getarKe == 2) {
cekGeserX2(-10);
cekGeserY2(-10);
++this.getarKe;
} else {
if (this.getarKe == 3) {
cekGeserX2(5);
cekGeserY2(-5);
++this.getarKe;
} else {
if (this.getarKe == 4) {
cekGeserX2(-5);
cekGeserY2(5);
++this.getarKe;
} else {
if (this.getarKe == 5) {
cekGeserX2(7);
cekGeserY2(7);
++this.getarKe;
} else {
if (this.getarKe == 6) {
cekGeserX2(10);
cekGeserY2(-10);
++this.getarKe;
} else {
if (this.getarKe == 7) {
cekGeserX2(-12);
cekGeserY2(7);
++this.getarKe;
} else {
this.getarKe = 1;
}
}
}
}
}
}
}
i = 1;
while (i <= maximumJagoan) {
if (this.hitTest(_root['jagoan_mc' + i].anim)) {
if (_root['jagoan_mc' + i].nyawa > 0) {
_root['jagoan_mc' + i].nyawa -= this.damage;
if (_root['jagoan_mc' + i].jenis == 1) {
xpindahBareman += this.damage;
} else {
if (_root['jagoan_mc' + i].jenis == 2) {
xpindahSwordman += this.damage;
} else {
if (_root['jagoan_mc' + i].jenis == 3) {
xpindahArrowman += this.damage;
} else {
if (_root['jagoan_mc' + i].jenis == 4) {
xpindahSpearman += this.damage;
}
}
}
}
}
}
++i;
}
}
} else {
if (this.tipeSpell == 15) {
i = 50;
while (i <= 65) {
if (this.hitTest(_root['musuh_mc' + i].anim)) {
_root['musuh_mc' + i].awalSpecial = 0;
_root['musuh_mc' + i].akhirSpecial = 500;
_root['musuh_mc' + i].special = true;
_root['musuh_mc' + i].attachMovie('efek7', 'efekSpecial' + dalamEfekJagoan, dalamEfekJagoan);
_root['musuh_mc' + i]['efekSpecial' + dalamEfekJagoan]._x = 0;
_root['musuh_mc' + i]['efekSpecial' + dalamEfekJagoan]._y = -35;
++dalamEfekJagoan;
if (dalamEfekJagoan >= 110) {
dalamEfekJagoan = 100;
}
}
++i;
}
removeMovieClip(this);
} else {
if (this.tipeSpell == 16) {
zz = 50;
while (zz <= 80) {
if (this.hitTest(_root['musuh_mc' + zz].anim)) {
if (_root['musuh_mc' + zz]._x != undefined && _root['musuh_mc' + zz].nyawa > 0) {
cekDuplicate(_root['musuh_mc' + zz]);
_root['musuh_mc' + zz].attachMovie('efek8', 'efekSpecial' + dalamEfekJagoan, dalamEfekJagoan);
_root['musuh_mc' + zz]['efekSpecial' + dalamEfekJagoan]._x = 0;
_root['musuh_mc' + zz]['efekSpecial' + dalamEfekJagoan]._y = -35;
++dalamEfekJagoan;
if (dalamEfekJagoan >= 110) {
dalamEfekJagoan = 100;
}
}
}
++zz;
}
removeMovieClip(this);
}
}
}
}
}
}
}
}
function cekNormalY(indi) {
if (indi == 'awal') {
i = 50;
while (i <= 85) {
_root['musuh_mc' + i].awalGempaY = _root['musuh_mc' + i]._y;
++i;
}
i = 1;
while (i <= maximumJagoan) {
_root['jagoan_mc' + i].awalGempaY = _root['jagoan_mc' + i]._y;
++i;
}
} else {
if (indi == 'akhir') {
background_mc._y = posAwalBackgroundY;
benteng_mc._y = posAwalBentengY;
i = 50;
while (i <= 85) {
_root['musuh_mc' + i]._y = _root['musuh_mc' + i].awalGempaY;
++i;
}
i = 1;
while (i <= maximumJagoan) {
_root['jagoan_mc' + i]._y = _root['jagoan_mc' + i].awalGempaY;
++i;
}
}
}
}
function cekGeserX(indi) {
background_mc._x += indi;
i = 50;
while (i <= 65) {
_root['musuh_mc' + i]._x += indi;
_root['musuh_mc' + i].nyawa -= 1;
++i;
}
i = 1;
while (i <= maximumJagoan) {
_root['jagoan_mc' + i]._x += indi;
++i;
}
benteng_mc._x += indi;
}
function cekGeserY(indi) {
background_mc._y += indi;
i = 50;
while (i <= 65) {
_root['musuh_mc' + i]._y += indi;
++i;
}
i = 1;
while (i <= maximumJagoan) {
_root['jagoan_mc' + i]._y += indi;
++i;
}
benteng_mc._y += indi;
}
function cekPasukanBuat() {
battle_mc.all_btn._visible = false;
if (battle_mc.pasukan_mc._currentframe == 1) {
i = 1;
while (i <= 4) {
battle_mc.pasukan_mc['unit' + i].onRelease = klikSoldier;
battle_mc.pasukan_mc['unit' + i].onRollOver = overSoldier;
battle_mc.pasukan_mc['unit' + i].onRollOut = outSoldier;
battle_mc.pasukan_mc['unit' + i].enabled = true;
battle_mc.pasukan_mc['unit' + i]._alpha = 100;
battle_mc.pasukan_mc.jumlah1 = wpindahBareman;
battle_mc.pasukan_mc.jumlah2 = wpindahSwordman;
battle_mc.pasukan_mc.jumlah3 = wpindahArrowman;
battle_mc.pasukan_mc.jumlah4 = wpindahSpearman;
++i;
}
battle_mc.soldier_mc.gotoAndStop(2);
battle_mc.vehicle_mc.gotoAndStop(1);
battle_mc.weapon_mc.gotoAndStop(1);
battle_mc.spell_mc.gotoAndStop(1);
battle_mc.defense_mc.gotoAndStop(1);
} else {
if (battle_mc.pasukan_mc._currentframe == 2) {
i = 5;
while (i <= 7) {
battle_mc.pasukan_mc['unit' + i].onRelease = klikSoldier;
battle_mc.pasukan_mc['unit' + i].onRollOver = overSoldier;
battle_mc.pasukan_mc['unit' + i].onRollOut = outSoldier;
battle_mc.pasukan_mc['unit' + i].enabled = true;
battle_mc.pasukan_mc['unit' + i]._alpha = 100;
battle_mc.pasukan_mc.jumlah5 = wpindahTank;
battle_mc.pasukan_mc.jumlah6 = wpindahCopter;
battle_mc.pasukan_mc.jumlah7 = wpindahMonbot;
++i;
}
battle_mc.soldier_mc.gotoAndStop(1);
battle_mc.vehicle_mc.gotoAndStop(2);
battle_mc.weapon_mc.gotoAndStop(1);
battle_mc.spell_mc.gotoAndStop(1);
battle_mc.defense_mc.gotoAndStop(1);
} else {
if (battle_mc.pasukan_mc._currentframe == 3) {
i = 8;
while (i <= 10) {
battle_mc.pasukan_mc['unit' + i].onRelease = klikWeapon;
battle_mc.pasukan_mc['unit' + i].onRollOver = overWeapon;
battle_mc.pasukan_mc['unit' + i].onRollOut = outWeapon;
battle_mc.pasukan_mc['unit' + i].enabled = true;
battle_mc.pasukan_mc['unit' + i]._alpha = 100;
battle_mc.pasukan_mc.jumlah8 = wpindahArrowTrap;
battle_mc.pasukan_mc.jumlah9 = wpindahCatapult;
battle_mc.pasukan_mc.jumlah10 = wpindahFireTrap;
++i;
}
battle_mc.soldier_mc.gotoAndStop(1);
battle_mc.vehicle_mc.gotoAndStop(1);
battle_mc.weapon_mc.gotoAndStop(2);
battle_mc.spell_mc.gotoAndStop(1);
battle_mc.defense_mc.gotoAndStop(1);
} else {
if (battle_mc.pasukan_mc._currentframe == 4) {
battle_mc.all_btn._visible = true;
battle_mc.all_btn.onRelease = klikSpell2;
i = 11;
while (i <= 18) {
battle_mc.pasukan_mc['unit' + i].onRelease = klikSpell;
battle_mc.pasukan_mc['unit' + i].onRollOver = overSpell;
battle_mc.pasukan_mc['unit' + i].onRollOut = outSpell;
battle_mc.pasukan_mc['unit' + i].enabled = true;
battle_mc.pasukan_mc['unit' + i]._alpha = 100;
battle_mc.pasukan_mc.jumlah11 = wpindahArrowRain;
battle_mc.pasukan_mc.jumlah12 = wpindahMeteorid;
battle_mc.pasukan_mc.jumlah13 = wpindahAcidRain;
battle_mc.pasukan_mc.jumlah14 = wpindahEarthquake;
battle_mc.pasukan_mc.jumlah15 = wpindahImmune;
battle_mc.pasukan_mc.jumlah16 = wpindahInvisible;
battle_mc.pasukan_mc.jumlah17 = wpindahSpecialAttack;
battle_mc.pasukan_mc.jumlah18 = wpindahDuplicate;
++i;
}
battle_mc.soldier_mc.gotoAndStop(1);
battle_mc.vehicle_mc.gotoAndStop(1);
battle_mc.weapon_mc.gotoAndStop(1);
battle_mc.spell_mc.gotoAndStop(2);
battle_mc.defense_mc.gotoAndStop(1);
} else {
if (battle_mc.pasukan_mc._currentframe == 5) {
i = 19;
while (i <= 23) {
battle_mc.pasukan_mc['unit' + i].onRelease = klikDefense;
battle_mc.pasukan_mc['unit' + i].onRollOver = overDefense;
battle_mc.pasukan_mc['unit' + i].onRollOut = outDefense;
battle_mc.pasukan_mc['unit' + i].enabled = true;
battle_mc.pasukan_mc['unit' + i]._alpha = 100;
battle_mc.pasukan_mc.jumlah19 = wpindahWall;
battle_mc.pasukan_mc.jumlah20 = wpindahSpike;
battle_mc.pasukan_mc.jumlah21 = wpindahSpiderWeb;
battle_mc.pasukan_mc.jumlah22 = wpindahTowerGuard;
battle_mc.pasukan_mc.jumlah23 = wpindahZombieTrap;
++i;
}
battle_mc.soldier_mc.gotoAndStop(1);
battle_mc.vehicle_mc.gotoAndStop(1);
battle_mc.weapon_mc.gotoAndStop(1);
battle_mc.spell_mc.gotoAndStop(1);
battle_mc.defense_mc.gotoAndStop(2);
}
}
}
}
}
buatKotak(false);
battle_mc.defense_mc._visible = false;
}
function overSoldier() {
info_mc2._visible = true;
znamaSoldier = new Array('', 'Barehands', 'Swordman', 'Arrowman', 'Spearman', 'Tank', 'Copter', 'Monbot');
myStr = new String(this);
if (isNaN(myStr.substr(myStr.length - 2, 2))) {
indi = myStr.substr(myStr.length - 1, 1);
} else {
indi = myStr.substr(myStr.length - 2, 2);
}
info_mc2.gotoAndStop(2);
info_mc2.xinfo = znamaSoldier[indi];
}
function outSoldier() {
info_mc2._visible = false;
}
function overWeapon() {
info_mc2._visible = true;
znamaWeapon = new Array('', 'Bow Launcher', 'Stone Thrower', 'Fire Thrower');
myStr = new String(this);
if (isNaN(myStr.substr(myStr.length - 2, 2))) {
indi = Number(myStr.substr(myStr.length - 1, 1));
} else {
indi = Number(myStr.substr(myStr.length - 2, 2));
}
info_mc2.gotoAndStop(2);
info_mc2.xinfo = znamaWeapon[indi - 7];
}
function outWeapon() {
info_mc2._visible = false;
}
function overSpell() {
info_mc2._visible = true;
znamaSpell = new Array('', 'Arrow Rain', 'Meteorid', 'Acid Rain', 'Eeathquake', 'Immune', 'Invisible', 'Special Attack', 'Duplicate');
myStr = new String(this);
if (isNaN(myStr.substr(myStr.length - 2, 2))) {
indi = Number(myStr.substr(myStr.length - 1, 1));
} else {
indi = Number(myStr.substr(myStr.length - 2, 2));
}
info_mc2.gotoAndStop(2);
if (indi - 10 <= 4) {
info_mc2.xinfo = znamaSpell[indi - 10] + ', Give to Enemy';
} else {
info_mc2.xinfo = znamaSpell[indi - 10] + ', Give to Monster';
}
}
function outSpell() {
info_mc2._visible = false;
}
function overDefense() {
info_mc2._visible = true;
znamaDefense = new Array('', 'Wall', 'Spike', 'Spider Web', 'Tower Guard', 'Zombie Trap');
myStr = new String(this);
if (isNaN(myStr.substr(myStr.length - 2, 2))) {
indi = Number(myStr.substr(myStr.length - 1, 1));
} else {
indi = Number(myStr.substr(myStr.length - 2, 2));
}
info_mc2.gotoAndStop(2);
info_mc2.xinfo = znamaDefense[indi - 18];
}
function outDefense() {
info_mc2._visible = false;
}
function buatSpell(indiX, indiY) {
if (pilihSpell >= 15) {
spell = attachMovie('spellTarget', 'spell_mc' + dalamSpell, dalamSpell);
spell._xscale = 150;
spell._yscale = 150;
} else {
if (pilihSpell == 14) {
spell = attachMovie('efek' + (pilihSpell - 10) + 'x', 'spell_mc' + dalamSpell, dalamSpell - 270000);
} else {
spell = attachMovie('efek' + (pilihSpell - 10), 'spell_mc' + dalamSpell, dalamSpell);
}
}
if (pilihSpell == 11) {
++xpindahArrowRain;
--wpindahArrowRain;
spell._x = indiX;
spell._y = indiY - 1000;
spell.speedY = 5;
spell.damage = 0.3;
spell.batasBawah = indiY + 50;
} else {
if (pilihSpell == 12) {
backComet();
++xpindahMeteorid;
--wpindahMeteorid;
spell._x = indiX;
spell._y = indiY - 1000;
spell.speedY = 5;
spell.damage = 0.4;
spell.batasBawah = indiY + 50;
} else {
if (pilihSpell == 13) {
++xpindahAcidRain;
--wpindahAcidRain;
spell._x = indiX;
spell._y = indiY - 1000;
spell.speedY = 5;
spell.damage = 0.5;
spell.batasBawah = indiY + 50;
} else {
if (pilihSpell == 14) {
backGempa();
++xpindahEarthquake;
--wpindahEarthquake;
spell._x = indiX;
spell._y = indiY;
spell.damage = 0.1;
spell.awalGempa = 0;
spell.akhirGempa = 25;
} else {
if (pilihSpell == 15) {
backSpell3();
++xpindahImmune;
--wpindahImmune;
spell._x = indiX;
spell._y = indiY;
} else {
if (pilihSpell == 16) {
backSpell4();
++xpindahInvisible;
--wpindahInvisible;
spell._x = indiX;
spell._y = indiY;
} else {
if (pilihSpell == 17) {
backSpell1();
++xpindahSpecialAttack;
--wpindahSpecialAttack;
spell._x = indiX;
spell._y = indiY;
} else {
if (pilihSpell == 18) {
backSpell2();
++xpindahDuplicate;
--wpindahDuplicate;
spell._x = indiX;
spell._y = indiY;
}
}
}
}
}
}
}
}
spell.damage *= 10;
battle_mc.pasukan_mc.jumlah11 = wpindahArrowRain;
battle_mc.pasukan_mc.jumlah12 = wpindahMeteorid;
battle_mc.pasukan_mc.jumlah13 = wpindahAcidRain;
battle_mc.pasukan_mc.jumlah14 = wpindahEarthquake;
battle_mc.pasukan_mc.jumlah15 = wpindahImmune;
battle_mc.pasukan_mc.jumlah16 = wpindahInvisible;
battle_mc.pasukan_mc.jumlah17 = wpindahSpecialAttack;
battle_mc.pasukan_mc.jumlah18 = wpindahDuplicate;
spell.tipeSpell = pilihSpell;
spell.onEnterFrame = enterSpell;
++dalamSpell;
if (dalamSpell >= 301000) {
dalamSpell = 300000;
}
}
function buatSpell2(indiX, indiY) {
zi = 11;
while (zi <= 18) {
gagalBuat = false;
if (zi == 11 && wpindahArrowRain <= 0) {
gagalBuat = true;
} else {
if (zi == 12 && wpindahMeteorid <= 0) {
gagalBuat = true;
} else {
if (zi == 13 && wpindahAcidRain <= 0) {
gagalBuat = true;
} else {
if (zi == 14 && wpindahEarthquake <= 0) {
gagalBuat = true;
} else {
if (zi == 15 && wpindahImmune <= 0) {
gagalBuat = true;
} else {
if (zi == 16 && wpindahInvisible <= 0) {
gagalBuat = true;
} else {
if (zi == 17 && wpindahSpecialAttack <= 0) {
gagalBuat = true;
} else {
if (zi == 18 && wpindahDuplicate <= 0) {
gagalBuat = true;
}
}
}
}
}
}
}
}
if (gagalBuat == false) {
if (zi >= 15) {
spell = attachMovie('spellTarget', 'spell_mc' + dalamSpell, dalamSpell);
spell._xscale = 150;
spell._yscale = 150;
} else {
if (zi == 14) {
spell = attachMovie('efek' + (zi - 10) + 'x', 'spell_mc' + dalamSpell, dalamSpell - 270000);
} else {
spell = attachMovie('efek' + (zi - 10), 'spell_mc' + dalamSpell, dalamSpell);
}
}
if (zi == 11) {
++xpindahArrowRain;
--wpindahArrowRain;
spell._x = indiX;
spell._y = indiY - 1000;
spell.speedY = 5;
spell.damage = 0.3;
spell.batasBawah = indiY + 50;
} else {
if (zi == 12) {
backComet();
++xpindahMeteorid;
--wpindahMeteorid;
spell._x = indiX;
spell._y = indiY - 1500;
spell.speedY = 5;
spell.damage = 0.4;
spell.batasBawah = indiY + 50;
} else {
if (zi == 13) {
++xpindahAcidRain;
--wpindahAcidRain;
spell._x = indiX;
spell._y = indiY - 2000;
spell.speedY = 5;
spell.damage = 0.5;
spell.batasBawah = indiY + 50;
} else {
if (zi == 14) {
backGempa();
++xpindahEarthquake;
--wpindahEarthquake;
spell._x = indiX;
spell._y = indiY;
spell.damage = 0.1;
spell.awalGempa = 0;
spell.akhirGempa = 25;
spell.getarKe = 1;
cekNormalY('awal');
} else {
if (zi == 15) {
backSpell3();
++xpindahImmune;
--wpindahImmune;
spell._x = indiX;
spell._y = indiY;
} else {
if (zi == 16) {
backSpell4();
++xpindahInvisible;
--wpindahInvisible;
spell._x = indiX;
spell._y = indiY;
} else {
if (zi == 17) {
backSpell1();
++xpindahSpecialAttack;
--wpindahSpecialAttack;
spell._x = indiX;
spell._y = indiY;
} else {
if (zi == 18) {
backSpell2();
++xpindahDuplicate;
--wpindahDuplicate;
spell._x = indiX;
spell._y = indiY;
}
}
}
}
}
}
}
}
battle_mc.pasukan_mc.jumlah11 = wpindahArrowRain;
battle_mc.pasukan_mc.jumlah12 = wpindahMeteorid;
battle_mc.pasukan_mc.jumlah13 = wpindahAcidRain;
battle_mc.pasukan_mc.jumlah14 = wpindahEarthquake;
battle_mc.pasukan_mc.jumlah15 = wpindahImmune;
battle_mc.pasukan_mc.jumlah16 = wpindahInvisible;
battle_mc.pasukan_mc.jumlah17 = wpindahSpecialAttack;
battle_mc.pasukan_mc.jumlah18 = wpindahDuplicate;
spell.tipeSpell = zi;
spell.onEnterFrame = enterSpell;
++dalamSpell;
if (dalamSpell >= 301000) {
dalamSpell = 300000;
}
}
++zi;
}
}
function enterSpell() {
if (sedangPause == false) {
this._x += geserKiri;
if (this.tipeSpell == 11) {
if (this._y >= this.batasBawah) {
this.gotoAndStop(2);
} else {
this._y += this.speedY;
this.speedY += 2;
}
i = 50;
while (i <= 65) {
if (this.hitTest(_root['musuh_mc' + i].anim)) {
_root['musuh_mc' + i].nyawa -= this.damage;
}
++i;
}
} else {
if (this.tipeSpell == 12) {
if (this._y >= this.batasBawah) {
this.gotoAndStop(2);
} else {
this._y += this.speedY;
this.speedY += 2;
}
i = 50;
while (i <= 65) {
if (this.hitTest(_root['musuh_mc' + i].anim)) {
_root['musuh_mc' + i].nyawa -= this.damage;
}
++i;
}
} else {
if (this.tipeSpell == 13) {
if (this._y >= this.batasBawah) {
this.gotoAndStop(2);
} else {
this._y += this.speedY;
this.speedY += 2;
}
i = 50;
while (i <= 65) {
if (this.hitTest(_root['musuh_mc' + i].anim)) {
_root['musuh_mc' + i].nyawa -= this.damage;
}
++i;
}
} else {
if (this.tipeSpell == 14) {
this._xscale += 1;
this._yscale += 1;
if (this.awalGempa >= this.akhirGempa && this.getarKe == 1) {
cekNormalY('akhir');
getarBumi2 = false;
removeMovieClip(this);
} else {
++this.awalGempa;
if (this.getarKe == 1) {
cekGeserX2(5);
cekGeserY2(5);
++this.getarKe;
} else {
if (this.getarKe == 2) {
cekGeserX2(-10);
cekGeserY2(-10);
++this.getarKe;
} else {
if (this.getarKe == 3) {
cekGeserX2(5);
cekGeserY2(-5);
++this.getarKe;
} else {
if (this.getarKe == 4) {
cekGeserX2(-5);
cekGeserY2(5);
++this.getarKe;
} else {
if (this.getarKe == 5) {
cekGeserX2(7);
cekGeserY2(7);
++this.getarKe;
} else {
if (this.getarKe == 6) {
cekGeserX2(10);
cekGeserY2(-10);
++this.getarKe;
} else {
if (this.getarKe == 7) {
cekGeserX2(-12);
cekGeserY2(7);
++this.getarKe;
} else {
this.getarKe = 1;
}
}
}
}
}
}
}
i = 50;
while (i <= 65) {
if (this.hitTest(_root['musuh_mc' + i].anim)) {
_root['musuh_mc' + i].nyawa -= this.damage;
}
++i;
}
}
} else {
if (this.tipeSpell == 15) {
i = 1;
while (i <= maximumJagoan) {
if (this.hitTest(_root['jagoan_mc' + i].anim)) {
_root['jagoan_mc' + i].awalKebal = 0;
_root['jagoan_mc' + i].akhirKebal = 500;
_root['jagoan_mc' + i].kebal = true;
_root['jagoan_mc' + i].attachMovie('efek5', 'efekKebal' + dalamEfekJagoan, dalamEfekJagoan);
_root['jagoan_mc' + i]['efekKebal' + dalamEfekJagoan]._x = 0;
_root['jagoan_mc' + i]['efekKebal' + dalamEfekJagoan]._y = -35;
++dalamEfekJagoan;
if (dalamEfekJagoan >= 110) {
dalamEfekJagoan = 100;
}
}
++i;
}
removeMovieClip(this);
} else {
if (this.tipeSpell == 16) {
i = 1;
while (i <= maximumJagoan) {
if (this.hitTest(_root['jagoan_mc' + i].anim)) {
_root['jagoan_mc' + i].awalInvis = 0;
_root['jagoan_mc' + i].akhirInvis = 500;
_root['jagoan_mc' + i].invis = true;
_root['jagoan_mc' + i].attachMovie('efek6', 'efekInvis' + dalamEfekJagoan, dalamEfekJagoan);
_root['jagoan_mc' + i]['efekInvis' + dalamEfekJagoan]._x = 0;
_root['jagoan_mc' + i]['efekInvis' + dalamEfekJagoan]._y = -35;
++dalamEfekJagoan;
if (dalamEfekJagoan >= 110) {
dalamEfekJagoan = 100;
}
}
++i;
}
removeMovieClip(this);
} else {
if (this.tipeSpell == 17) {
i = 1;
while (i <= maximumJagoan) {
if (this.hitTest(_root['jagoan_mc' + i].anim)) {
_root['jagoan_mc' + i].awalSpecial = 0;
_root['jagoan_mc' + i].akhirSpecial = 500;
_root['jagoan_mc' + i].special = true;
_root['jagoan_mc' + i].attachMovie('efek7', 'efekSpecial' + dalamEfekJagoan, dalamEfekJagoan);
_root['jagoan_mc' + i]['efekSpecial' + dalamEfekJagoan]._x = 0;
_root['jagoan_mc' + i]['efekSpecial' + dalamEfekJagoan]._y = -35;
++dalamEfekJagoan;
if (dalamEfekJagoan >= 110) {
dalamEfekJagoan = 100;
}
}
++i;
}
removeMovieClip(this);
} else {
if (this.tipeSpell == 18) {
zz = 1;
while (zz <= maximumJagoan) {
if (this.hitTest(_root['jagoan_mc' + zz].anim)) {
if (_root['jagoan_mc' + zz]._x != undefined && _root['jagoan_mc' + zz].nyawa > 0) {
cekDuplicate(_root['jagoan_mc' + zz]);
}
}
++zz;
}
removeMovieClip(this);
}
}
}
}
}
}
}
}
}
}
function cekDuplicate(indi) {
if (indi.duplikasi == false) {
indi.duplikasi = true;
indi.nyawa *= 2;
indi.damage *= 2;
indi.range *= 2;
indi.speed *= 2;
}
}
function cekGeserX2(indi) {
background_mc._x += indi;
i = 50;
while (i <= 65) {
_root['musuh_mc' + i]._x += indi;
++i;
}
i = 1;
while (i <= maximumJagoan) {
_root['jagoan_mc' + i]._x += indi;
++i;
}
benteng_mc._x += indi;
}
function cekGeserY2(indi) {
background_mc._y += indi;
i = 50;
while (i <= 65) {
_root['musuh_mc' + i]._y += indi;
++i;
}
i = 1;
while (i <= maximumJagoan) {
_root['jagoan_mc' + i]._y += indi;
++i;
}
benteng_mc._y += indi;
}
function buatWeapon(indi) {
bisaBuatSoldier = false;
i = 1;
while (i <= maximumJagoan) {
if (_root['jagoan_mc' + i].nyawa == undefined) {
xdalamSoldier = i;
i = maximumJagoan;
bisaBuatSoldier = true;
}
++i;
}
if (bisaBuatSoldier == true) {
if (pilihWeapon == 8) {
--wpindahArrowTrap;
} else {
if (pilihWeapon == 9) {
--wpindahCatapult;
} else {
if (pilihWeapon == 10) {
--wpindahFireTrap;
}
}
}
battle_mc.pasukan_mc.jumlah8 = wpindahArrowTrap;
battle_mc.pasukan_mc.jumlah9 = wpindahCatapult;
battle_mc.pasukan_mc.jumlah10 = wpindahFireTrap;
weapon = attachMovie('weapon' + (pilihWeapon - 7), 'jagoan_mc' + xdalamSoldier, xdalamSoldier + 100);
weapon._x = background_mc._x - 100;
weapon._y = indi + 25;
weapon.speed = 1.5;
if (pilihWeapon == 8) {
weapon.damage = 5;
} else {
if (pilihWeapon == 9) {
weapon.damage = 10;
} else {
if (pilihWeapon == 10) {
weapon.damage = 10;
}
}
}
if (pilihWeapon == 8) {
weapon.ammo = 15;
weapon.range = 875;
} else {
if (pilihWeapon == 9) {
weapon.ammo = 20;
weapon.range = 900;
} else {
if (pilihWeapon == 10) {
weapon.ammo = 25;
weapon.range = 925;
}
}
}
weapon.nyawa = weapon.ammo;
weapon.tipeApa = 'weapon';
weapon.jenisWeapon = pilihWeapon;
weapon.batasKanan = background_mc._x + 40 + random(15);
weapon.onEnterFrame = enterWeapon;
} else {
cekInfo('Can\'t unleash another weapons, maximum weapons on the field reached');
}
}
function enterWeapon() {
if (sedangPause == false) {
this._x += geserKiri;
this.batasKanan += geserKiri;
if (this._x <= this.batasKanan) {
this.gotoAndStop(2);
this._x += this.speed;
} else {
this.bisaSerang = false;
this.xtarget = undefined;
i = 50;
while (i <= 65) {
if (_root['musuh_mc' + i]._x != undefined && _root['musuh_mc' + i].nyawa > 0) {
this.jarak = Math.sqrt(Math.pow(this._x - _root['musuh_mc' + i]._x, 2) + Math.pow(this._y - _root['musuh_mc' + i]._y, 2));
if (this.jarak <= this.range) {
this.xtarget = _root['musuh_mc' + i];
this.bisaSerang = true;
}
}
++i;
}
if (this.ammo <= 0) {
this.ammo = 0;
this.gotoAndStop(1);
} else {
if (this.bisaSerang == true) {
this.gotoAndStop(3);
} else {
this.gotoAndStop(1);
}
}
}
}
this.jumlah = this.ammo;
this.swapDepths(100 + this._x + this._y * 100);
}
function cekSerangWeapon(indi) {
if (indi.jenisWeapon == 8) {
--indi.ammo;
peluru = attachMovie('panah_mc2', 'peluru_mc' + dalamPeluru, dalamPeluru);
peluru._x = indi._x;
peluru._y = indi._y - 25;
peluru._yscale = 100;
peluru._xscale = 100;
peluru.speedX = 20;
peluru.speedY = 10;
peluru.damage = indi.damage;
peluru.xtarget = indi.xtarget;
peluru.batasBawah = indi._y;
peluru.randBawah = random(50);
peluru.indi = indi;
peluru.onEnterFrame = enterWeapon2;
++dalamPeluru;
if (dalamPeluru >= 200) {
dalamPeluru = 100;
}
} else {
if (indi.jenisWeapon == 9) {
--indi.ammo;
peluru = attachMovie('batu_mc', 'peluru_mc' + dalamPeluru, dalamPeluru);
peluru._x = indi._x;
peluru._y = indi._y - 75;
peluru._yscale = 100;
peluru._xscale = 100;
if (indi.jenisWeapon == 9) {
peluru.jarak = Math.sqrt(Math.pow(indi._x - indi.xtarget._x, 2) + Math.pow(indi._y - indi.xtarget._y, 2));
if (peluru.jarak >= 850) {
peluru.speedX = 15;
} else {
if (peluru.jarak >= 800) {
peluru.speedX = 14;
} else {
if (peluru.jarak >= 750) {
peluru.speedX = 13;
} else {
if (peluru.jarak >= 700) {
peluru.speedX = 12;
} else {
if (peluru.jarak >= 650) {
peluru.speedX = 11;
} else {
if (peluru.jarak >= 600) {
peluru.speedX = 10;
} else {
if (peluru.jarak >= 550) {
peluru.speedX = 9;
} else {
if (peluru.jarak >= 500) {
peluru.speedX = 8;
} else {
if (peluru.jarak >= 450) {
peluru.speedX = 7;
} else {
if (peluru.jarak >= 400) {
peluru.speedX = 6;
} else {
if (peluru.jarak >= 300) {
peluru.speedX = 5;
} else {
if (peluru.jarak >= 200) {
peluru.speedX = 4;
} else {
if (peluru.jarak >= 100) {
peluru.speedX = 3;
} else {
peluru.speedX = 2;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
peluru.speedY = 15;
peluru.damage = indi.damage;
peluru.xtarget = indi.xtarget;
peluru.batasBawah = indi._y;
peluru.randBawah = random(50);
peluru.indi = indi;
peluru.onEnterFrame = enterWeapon3;
++dalamPeluru;
if (dalamPeluru >= 200) {
dalamPeluru = 100;
}
} else {
if (indi.jenisWeapon == 10) {
--indi.ammo;
peluru = attachMovie('bolaApi_mc', 'peluru_mc' + dalamPeluru, dalamPeluru);
peluru._x = indi._x + 25;
peluru._y = indi._y - 35;
peluru._yscale = 100;
peluru._xscale = 100;
if (indi.jenisWeapon == 10) {
peluru.jarak = Math.sqrt(Math.pow(indi._x - indi.xtarget._x, 2) + Math.pow(indi._y - indi.xtarget._y, 2));
if (peluru.jarak >= 900) {
peluru.speedX = 20;
} else {
if (peluru.jarak >= 850) {
peluru.speedX = 19;
} else {
if (peluru.jarak >= 800) {
peluru.speedX = 18;
} else {
if (peluru.jarak >= 750) {
peluru.speedX = 17;
} else {
if (peluru.jarak >= 700) {
peluru.speedX = 16;
} else {
if (peluru.jarak >= 650) {
peluru.speedX = 15;
} else {
if (peluru.jarak >= 600) {
peluru.speedX = 14;
} else {
if (peluru.jarak >= 550) {
peluru.speedX = 13;
} else {
if (peluru.jarak >= 500) {
peluru.speedX = 12;
} else {
if (peluru.jarak >= 450) {
peluru.speedX = 11;
} else {
if (peluru.jarak >= 400) {
peluru.speedX = 10;
} else {
peluru.speedX = 9;
}
}
}
}
}
}
}
}
}
}
}
}
peluru.speedY = 10;
peluru.damage = indi.damage;
peluru.xtarget = indi.xtarget;
peluru.batasBawah = indi._y;
peluru.randBawah = random(50);
peluru.indi = indi;
peluru.onEnterFrame = enterWeapon4;
++dalamPeluru;
if (dalamPeluru >= 200) {
dalamPeluru = 100;
}
} else {
if (indi.jenisWeapon == 11) {
peluru = attachMovie('batu_mc2', 'peluru_mc' + dalamPeluru, dalamPeluru);
peluru._x = indi._x;
peluru._y = indi._y - 75;
peluru._yscale = 100;
peluru._xscale = 100;
if (indi.jenisWeapon == 11) {
peluru.jarak = Math.sqrt(Math.pow(indi._x - indi.xtarget._x, 2) + Math.pow(indi._y - indi.xtarget._y, 2));
if (peluru.jarak >= 850) {
peluru.speedX = 15;
} else {
if (peluru.jarak >= 800) {
peluru.speedX = 14;
} else {
if (peluru.jarak >= 750) {
peluru.speedX = 13;
} else {
if (peluru.jarak >= 700) {
peluru.speedX = 12;
} else {
if (peluru.jarak >= 650) {
peluru.speedX = 11;
} else {
if (peluru.jarak >= 600) {
peluru.speedX = 10;
} else {
if (peluru.jarak >= 550) {
peluru.speedX = 9;
} else {
if (peluru.jarak >= 500) {
peluru.speedX = 8;
} else {
if (peluru.jarak >= 450) {
peluru.speedX = 7;
} else {
if (peluru.jarak >= 400) {
peluru.speedX = 6;
} else {
if (peluru.jarak >= 300) {
peluru.speedX = 3;
} else {
if (peluru.jarak >= 200) {
peluru.speedX = 2;
} else {
if (peluru.jarak >= 100) {
peluru.speedX = 1.5;
} else {
peluru.speedX = 1;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
peluru.speedY = 15;
peluru.damage = indi.damage;
peluru.xtarget = indi.xtarget;
peluru.batasBawah = indi._y;
peluru.randBawah = random(50);
peluru.indi = indi;
peluru.onEnterFrame = enterWeapon3;
++dalamPeluru;
if (dalamPeluru >= 200) {
dalamPeluru = 100;
}
}
}
}
}
}
function enterWeapon2() {
if (sedangPause == false) {
this._x += geserKiri;
this._x += this.speedX;
this._y -= this.speedY;
this.speedY -= 0.5;
this._rotation += 1.5;
i = 50;
while (i <= 65) {
if (this.hitTest(_root['musuh_mc' + i].anim)) {
if (_root['musuh_mc' + i].nyawa > 0) {
_root['musuh_mc' + i].nyawa -= this.damage;
_root['musuh_mc' + i].attachMovie('panah_mc2', 'panah_mc' + dalamPeluru, dalamPeluru);
_root['musuh_mc' + i]['panah_mc' + dalamPeluru].gotoAndStop(2);
_root['musuh_mc' + i]['panah_mc' + dalamPeluru]._x = -35 + random(15) + 7;
_root['musuh_mc' + i]['panah_mc' + dalamPeluru]._y = -35 + random(15) + 7;
_root['musuh_mc' + i]['panah_mc' + dalamPeluru]._rotation = 45 + random(15);
_root['musuh_mc' + i]['panah_mc' + dalamPeluru]._xscale = this._xscale;
_root['musuh_mc' + i]['panah_mc' + dalamPeluru]._yscale = this._yscale;
++dalamPeluru;
if (dalamPeluru >= 200) {
dalamPeluru = 100;
}
removeMovieClip(this);
}
}
++i;
}
if (this.speedY <= 0) {
if (this._y >= this.batasBawah + this.randBawah) {
delete this.onEnterFrame;
this.onEnterFrame = enterWeaponx;
}
}
}
}
function enterWeapon3() {
if (sedangPause == false) {
this._x += geserKiri;
this._x += this.speedX;
this._y -= this.speedY;
this.speedY -= 0.5;
this._rotation += 1.5;
i = 50;
while (i <= 65) {
if (this.hitTest(_root['musuh_mc' + i].anim)) {
if (_root['musuh_mc' + i].nyawa > 0) {
_root['musuh_mc' + i].nyawa -= this.damage;
removeMovieClip(this);
}
}
++i;
}
if (this.speedY <= 0) {
if (this._y >= this.batasBawah + this.randBawah) {
delete this.onEnterFrame;
this.onEnterFrame = enterWeaponx;
}
}
}
}
function enterWeapon4() {
if (sedangPause == false) {
this._x += geserKiri;
this._x += this.speedX;
this._y -= this.speedY;
this.speedY -= 0.5;
this._rotation += 1.5;
this.lewatSini = false;
i = 50;
while (i <= 65) {
if (this.hitTest(_root['musuh_mc' + i].anim)) {
if (_root['musuh_mc' + i].nyawa > 0) {
_root['musuh_mc' + i].nyawa -= this.damage;
_root['musuh_mc' + i].kenaApi = true;
_root['musuh_mc' + i].batasApi = 0;
_root['musuh_mc' + i].maxApi = 100;
z = 1;
while (z <= 5) {
_root['musuh_mc' + i].attachMovie('efekApi', 'api_mc' + dalamPeluru, dalamPeluru);
_root['musuh_mc' + i]['api_mc' + dalamPeluru]._x = -random(30) + 15;
_root['musuh_mc' + i]['api_mc' + dalamPeluru]._y = -35 - random(30) + 15;
_root['musuh_mc' + i]['api_mc' + dalamPeluru]._xscale = 25 + random(25);
_root['musuh_mc' + i]['api_mc' + dalamPeluru]._yscale = 25 + random(25);
++dalamPeluru;
if (dalamPeluru >= 200) {
dalamPeluru = 100;
}
++z;
}
this.lewatSini = true;
removeMovieClip(this);
}
}
++i;
}
if (this.lewatSini == false) {
if (this.speedY <= 0) {
if (this._y >= this.batasBawah + this.randBawah) {
efek = attachMovie('efekApi2', 'api_mc' + dalamPeluru, dalamPeluru);
efek._x = this._x;
efek._y = this._y;
efek._xscale = 25 + random(25);
efek._yscale = 25 + random(25);
efek.onEnterFrame = enterEfekApi;
++dalamPeluru;
if (dalamPeluru >= 200) {
dalamPeluru = 100;
}
removeMovieClip(this);
}
}
}
}
}
function enterEfekApi() {
if (sedangPause == false) {
this._x += geserKiri;
i = 50;
while (i <= 65) {
if (this.hitTest(_root['musuh_mc' + i].anim)) {
_root['musuh_mc' + i].nyawa -= 0.5;
}
++i;
}
}
this.swapDepths(100 + this._x + this._y * 100);
}
function enterWeaponx() {
if (sedangPause == false) {
this._x += geserKiri;
this._alpha -= 0.5;
}
}
function klikSoldier(zindi, zindi2) {
bisaBuatSoldier = false;
i = 1;
while (i <= maximumJagoan) {
if (_root['jagoan_mc' + i].nyawa == undefined) {
xdalamSoldier = i;
i = maximumJagoan;
bisaBuatSoldier = true;
}
++i;
}
if (bisaBuatSoldier == true) {
bisaBuatSoldier2 = true;
if (pilihSoldier >= 5) {
if (kiniVehicle >= 10) {
bisaBuatSoldier2 = false;
} else {
bisaBuatSoldier2 = true;
}
} else {
bisaBuatSoldier2 = true;
}
if (bisaBuatSoldier2 == true) {
myStr = new String(this);
indi = myStr.substr(myStr.length - 1, 1);
if (battle_mc.pasukan_mc['jumlah' + indi] > 0 || zindi2 == 'duplikat') {
if (zindi2 != 'duplikat') {
pilihSoldier = indi;
}
randKeluarJagoan = random(4) + 1;
++defenseKita;
soldier = attachMovie('soldier' + pilihSoldier, 'jagoan_mc' + xdalamSoldier, xdalamSoldier + 100);
soldier.cacheAsBitmap = true;
if (zindi2 != 'duplikat') {
soldier._x = background_mc._x + 475;
if (pilihSoldier == 6) {
soldier._y = 210 + 40 * randKeluarJagoan;
} else {
soldier._y = 310 + 40 * randKeluarJagoan;
}
} else {
soldier._x = zindi._x + random(50) - 25;
soldier._y = zindi._y + random(50) - 25;
}
if (pilihSoldier >= 5) {
++kiniVehicle;
if (pilihSoldier == 5) {
soldier.nyawa = 500;
} else {
if (pilihSoldier == 6) {
soldier.nyawa = 1000;
} else {
if (pilihSoldier == 7) {
soldier.nyawa = 2000;
}
}
}
} else {
if (zindi2 == 'duplikat') {
soldier.nyawa = zindi.nyawa;
} else {
if (battle_mc.pasukan_mc['jumlah' + pilihSoldier] >= nilaiSoldier) {
soldier.nyawa = nilaiSoldier;
} else {
soldier.nyawa = battle_mc.pasukan_mc['jumlah' + pilihSoldier];
}
}
}
if (pilihSoldier == 5) {
soldier.scaleAwal = 75;
} else {
if (pilihSoldier == 6) {
soldier.scaleAwal = 75;
} else {
soldier.scaleAwal = 100;
}
}
if (pilihSoldier == 1) {
wpindahBareman -= nilaiSoldier;
if (wpindahBareman <= 0) {
wpindahBareman = 0;
}
soldier.damage = _root['xbaremanPower' + keKota] * 2;
soldier.range = 50;
soldier.speed = 3;
soldier.tipeSenjata = 'melee';
} else {
if (pilihSoldier == 2) {
wpindahSwordman -= nilaiSoldier;
if (wpindahSwordman <= 0) {
wpindahSwordman = 0;
}
soldier.damage = _root['xswordmanPower' + keKota] * 2;
soldier.range = 75;
soldier.speed = 2;
soldier.tipeSenjata = 'melee';
} else {
if (pilihSoldier == 3) {
wpindahArrowman -= nilaiSoldier;
if (wpindahArrowman <= 0) {
wpindahArrowman = 0;
}
soldier.damage = _root['xarrowmanPower' + keKota] * 2;
soldier.range = 450;
soldier.speed = 1.5;
soldier.tipeSenjata = 'range';
} else {
if (pilihSoldier == 4) {
wpindahSpearman -= nilaiSoldier;
if (wpindahSpearman <= 0) {
wpindahSpearman = 0;
}
soldier.damage = _root['xspearmanPower' + keKota] * 2;
soldier.range = 100;
soldier.speed = 2.5;
soldier.tipeSenjata = 'melee';
} else {
if (pilihSoldier == 5) {
--wpindahTank;
if (wpindahTank <= 0) {
wpindahTank = 0;
}
soldier.damage = 10;
soldier.range = 550;
soldier.speed = 1;
soldier.tipeSenjata = 'range';
} else {
if (pilihSoldier == 6) {
--wpindahCopter;
if (wpindahCopter <= 0) {
wpindahCopter = 0;
}
soldier.damage = 10;
soldier.range = 600;
soldier.speed = 1.5;
soldier.tipeSenjata = 'range';
soldier.heli = true;
} else {
if (pilihSoldier == 7) {
--wpindahMonbot;
if (wpindahMonbot <= 0) {
wpindahMonbot = 0;
}
soldier.damage = 50;
soldier.range = 100;
soldier.speed = 1.25;
soldier.tipeSenjata = 'range';
}
}
}
}
}
}
}
soldier.speed *= 1.25;
if (_root['rangerAktif' + keKota] == true) {
soldier.range *= 2;
}
if (_root['tirelessAktif' + keKota] == true) {
soldier.damage *= 2;
}
if (_root['armorPlusAktif' + keKota] == true) {
soldier.nyawa *= 2;
}
if (_root['speedPlusAktif' + keKota] == true) {
soldier.speed *= 2;
}
_root['pasukan' + xdalamSoldier]._visible = true;
_root['pasukan' + xdalamSoldier].gotoAndStop(pilihSoldier);
_root['pasukan' + xdalamSoldier].jumlah = soldier.nyawa;
soldier.range2 = 400;
soldier.speed2 = soldier.speed * 4;
if (zindi2 == 'duplikat') {
soldier.speed += 1;
}
soldier.kebal = false;
soldier.invis = false;
soldier.special = false;
if (zindi2 == 'duplikat') {
soldier.iniDuplikasi = true;
soldier.duplikasi = true;
} else {
soldier.iniDuplikasi = false;
soldier.duplikasi = false;
}
soldier.serangBase = false;
soldier.nomorJagoan = xdalamSoldier;
soldier.jenis = pilihSoldier;
if (pilihSoldier <= 4) {
soldier.damage *= 0.02;
}
pilihTargetMusuh(soldier);
soldier.onEnterFrame = enterSoldier;
if (pilihSoldier >= 5) {
--battle_mc.pasukan_mc['jumlah' + pilihSoldier];
} else {
battle_mc.pasukan_mc['jumlah' + pilihSoldier] -= nilaiSoldier;
if (battle_mc.pasukan_mc['jumlah' + pilihSoldier] <= 0) {
battle_mc.pasukan_mc['jumlah' + pilihSoldier] = 0;
}
}
}
} else {
cekInfo('Can\'t unleash another vehicle units, maximum vehicle on the field reached');
}
} else {
cekInfo('Can\'t unleash another units, maximum soldiers on the field reached');
}
}
function enterSoldier() {
if (sedangPause == false) {
this._x += geserKiri;
if (sudahSelesai == false) {
if (this.nyawa <= 0) {
this.nyawa = 0;
if (this._currentframe != 4) {
if (this.jenis >= 5) {
--kiniVehicle;
}
--defenseKita;
if (defenseKita <= 0) {
cekKalah();
}
if (this.iniDuplikasi == false) {
if (this.jenis == 5) {
++xpindahTank;
} else {
if (this.jenis == 6) {
++xpindahCopter;
} else {
if (this.jenis == 7) {
++xpindahMonbot;
}
}
}
}
i = 100;
while (i <= 200) {
this['panah_mc' + i]._visible = false;
++i;
}
this.gotoAndStop(4);
}
} else {
if (this.kebal == true) {
i = 100;
while (i <= 110) {
this['efekKebal' + i]._visible = true;
++i;
}
if (this.awalKebal >= this.akhirKebal) {
this.kebal = false;
} else {
++this.awalKebal;
}
} else {
i = 100;
while (i <= 110) {
this['efekKebal' + i]._visible = false;
++i;
}
}
if (this.invis == true) {
this._alpha = 30;
i = 100;
while (i <= 110) {
this['efekInvis' + i]._visible = true;
++i;
}
if (this.awalInvis >= this.akhirInvis) {
this.invis = false;
} else {
++this.awalInvis;
}
} else {
this._alpha = 100;
i = 100;
while (i <= 110) {
this['efekInvis' + i]._visible = false;
++i;
}
}
if (this.special == true) {
i = 100;
while (i <= 110) {
this['efekSpecial' + i]._visible = true;
++i;
}
if (this.awalSpecial >= this.akhirSpecial) {
this.special = false;
} else {
++this.awalSpecial;
}
} else {
i = 100;
while (i <= 110) {
this['efekSpecial' + i]._visible = false;
++i;
}
}
if (this.xtarget.nyawa <= 0 || this.xtarget.nyawa == undefined) {
this.xtarget = undefined;
}
if (this.xtarget == undefined || this.xtarget.nyawa <= 0) {
i = 80;
while (i >= 50) {
if (_root['musuh_mc' + i].nyawa != undefined) {
this.jarak = Math.sqrt(Math.pow(this._x - _root['musuh_mc' + i]._x, 2) + Math.pow(this._y - _root['musuh_mc' + i]._y, 2));
if (this.jarak <= this.range2) {
if (this.tipeSenjata == 'melee' && _root['musuh_mc' + i].heli == true) {
} else {
this.xtarget = _root['musuh_mc' + i];
i = 50;
}
}
}
--i;
}
} else {
this.jarak = Math.sqrt(Math.pow(this._x - this.xtarget._x, 2) + Math.pow(this._y - this.xtarget._y, 2));
if (this.jarak > this.range2) {
}
}
if (this.xtarget != undefined) {
if (this._x >= this.xtarget._x) {
this.anim._xscale = -this.scaleAwal;
} else {
this.anim._xscale = this.scaleAwal;
}
this.jarak = Math.sqrt(Math.pow(this._x - this.xtarget._x, 2) + Math.pow(this._y - this.xtarget._y, 2));
if (this.jarak <= this.range) {
if (this.guard == true) {
} else {
this.xtarget.serangBalik = true;
this.xtarget.xtarget = this;
}
this.gotoAndStop(3);
} else {
this.gotoAndStop(2);
deltaX = this._x - this.xtarget._x;
deltaY = this._y - this.xtarget._y;
angle = -Math.atan2(deltaX, deltaY) / 0.0174532925199433;
if (Math.sqrt(deltaX * deltaX + deltaY * deltaY) > this.speed2 * speedBattle) {
this._y -= this.speed2 * speedBattle * Math.cos(angle * 0.0174532925199433);
this._x += this.speed2 * speedBattle * Math.sin(angle * 0.0174532925199433);
}
}
} else {
if (this._x >= background_mc._x - 150 + 3000) {
this.anim._xscale = this.scaleAwal;
this.gotoAndStop(1);
} else {
this.anim._xscale = this.scaleAwal;
this._x += this.speed * speedBattle;
this.gotoAndStop(2);
}
}
}
}
}
this.jumlah = Math.ceil(this.nyawa);
if (this.guard == true) {
} else {
if (this.jenis == 6) {
this.swapDepths(100 + this._x + this._y * 200);
} else {
this.swapDepths(100 + this._x + this._y * 100);
}
}
}
function cekSerangJagoan(indi) {
if (indi.special == true) {
efekSpecialJagoan(indi.xtarget);
}
if (indi.jenis == 7) {
cekGetarBumi();
} else {
if (indi.jenis == 5 || indi.jenis == 6) {
cekEfekLedakan(indi.xtarget);
}
}
if (indi.jenis == 3) {
buatPanah(indi);
} else {
indi.xtarget.nyawa -= indi.damage;
}
}
function efekSpecialJagoan(indi) {
i = 1;
while (i <= 2) {
if (indi != undefined) {
efek = attachMovie('efekApi2', 'api_mc' + dalamSpell, dalamSpell);
efek._x = indi._x + random(150) - 75;
efek._y = indi._y - 50 + random(150) - 75;
efek._xscale = 25 + random(25);
efek._yscale = 25 + random(25);
efek.gotoAndPlay(random(5) + 1);
efek.onEnterFrame = enterEfekApi;
++dalamSpell;
if (dalamSpell >= 301000) {
dalamSpell = 300000;
}
}
++i;
}
if (indi != undefined) {
efek = attachMovie('efekLedakan', 'spell_mc' + dalamSpell, dalamSpell);
efek._x = indi._x;
efek._y = indi._y - 50;
efek._xscale = 75;
efek._yscale = 75;
efek.onEnterFrame = enterEfekApi;
++dalamSpell;
if (dalamSpell >= 301000) {
dalamSpell = 300000;
}
}
}
function efekSpecialMusuh(indi) {
i = 1;
while (i <= 2) {
if (indi != undefined) {
efek = attachMovie('efekApi2', 'api_mc' + dalamSpell, dalamSpell);
efek._x = indi._x + random(150) - 75;
efek._y = indi._y - 50 + random(150) - 75;
efek._xscale = 25 + random(25);
efek._yscale = 25 + random(25);
efek.gotoAndPlay(random(5) + 1);
efek.onEnterFrame = enterEfekApi2;
++dalamSpell;
if (dalamSpell >= 301000) {
dalamSpell = 300000;
}
}
++i;
}
if (indi != undefined) {
efek = attachMovie('efekLedakan', 'spell_mc' + dalamSpell, dalamSpell);
efek._x = indi._x;
efek._y = indi._y - 50;
efek._xscale = 75;
efek._yscale = 75;
efek.onEnterFrame = enterEfekApi2;
++dalamSpell;
if (dalamSpell >= 301000) {
dalamSpell = 300000;
}
}
}
function cekGetarBumi() {
if (getarBumi == false) {
cekNormalY('awal');
getarKe = 1;
getarBumi = true;
}
}
function cekEfekLedakan(indi, indi2) {
efek = attachMovie('efekLedakan', 'spell_mc' + dalamSpell, dalamSpell);
efek._x = indi._x;
if (indi2 == 'benteng') {
efek._y = indi._y - 175;
} else {
efek._y = indi._y - 50;
}
efek._xscale = 75;
efek._yscale = 75;
efek.onEnterFrame = enterEfekApi;
++dalamSpell;
if (dalamSpell >= 301000) {
dalamSpell = 300000;
}
if (efek._x == 0 || efek._x == undefined) {
removeMovieClip(efek);
}
}
function enterEfekApi() {
if (sedangPause == false) {
this._x += geserKiri;
i = 50;
while (i <= 65) {
if (this.hitTest(_root['musuh_mc' + i].anim)) {
_root['musuh_mc' + i].nyawa -= 0.5;
}
++i;
}
}
}
function buatPanah(indi) {
if (indi.guard == true) {
peluru = attachMovie('panah_mc4', 'peluru_mc' + dalamPeluru, dalamPeluru);
peluru.xefekApi = true;
} else {
peluru = attachMovie('panah_mc', 'peluru_mc' + dalamPeluru, dalamPeluru);
peluru.xefekApi = false;
}
peluru._x = indi._x;
peluru._y = indi._y - 25;
peluru._yscale = 80;
peluru._xscale = 80;
peluru.speed = 25;
peluru.arahTembak = 35;
peluru.xtarget = indi.xtarget;
peluru.tujuanX = indi.xtarget._x;
peluru.tujuanY = indi.xtarget._y;
peluru.indi = indi;
peluru.onEnterFrame = enterPanah;
++dalamPeluru;
if (dalamPeluru >= 200) {
dalamPeluru = 100;
}
}
function enterPanah() {
if (sedangPause == false) {
this._x += geserKiri;
if (this.xtarget.nyawa == undefined) {
deltaX = this._x - this.tujuanX;
deltaY = this._y - this.tujuanY;
angle = -Math.atan2(deltaX, deltaY) / 0.0174532925199433;
this._rotation = angle;
if (Math.sqrt(deltaX * deltaX + deltaY * deltaY) > this.speed) {
this.speed += 0.5;
this._y -= this.speed * Math.cos(angle * 0.0174532925199433);
this._x += this.speed * Math.sin(angle * 0.0174532925199433);
} else {
removeMovieClip(this);
}
} else {
deltaX = this._x - this.xtarget._x;
deltaY = this._y - this.xtarget._y + this.arahTembak;
angle = -Math.atan2(deltaX, deltaY) / 0.0174532925199433;
this._rotation = angle;
if (Math.sqrt(deltaX * deltaX + deltaY * deltaY) > this.speed) {
this.speed += 0.5;
this._y -= this.speed * Math.cos(angle * 0.0174532925199433);
this._x += this.speed * Math.sin(angle * 0.0174532925199433);
} else {
this.xtarget.nyawa -= this.indi.damage;
if (this.xtarget.nyawa > 0) {
this.xtarget.attachMovie('panah_mc', 'panah_mc' + dalamPeluru, dalamPeluru);
this.xtarget['panah_mc' + dalamPeluru].gotoAndStop(2);
this.xtarget['panah_mc' + dalamPeluru]._x = -75 + random(15) + 7;
this.xtarget['panah_mc' + dalamPeluru]._y = -35 + random(15) + 7;
this.xtarget['panah_mc' + dalamPeluru]._rotation = this._rotation - random(15) + 7;
this.xtarget['panah_mc' + dalamPeluru]._xscale = this._xscale;
this.xtarget['panah_mc' + dalamPeluru]._yscale = this._yscale;
++dalamPeluru;
if (dalamPeluru >= 200) {
dalamPeluru = 100;
}
}
if (this.xefekApi == true) {
if (this != undefined) {
efek = attachMovie('efekApi2', 'api_mc' + dalamPeluru, dalamPeluru);
efek._x = this._x;
efek._y = this._y;
efek._xscale = 25 + random(25);
efek._yscale = 25 + random(25);
efek.onEnterFrame = enterEfekApi;
++dalamPeluru;
if (dalamPeluru >= 200) {
dalamPeluru = 100;
}
removeMovieClip(this);
}
}
removeMovieClip(this);
}
}
}
this.swapDepths(100 + this._x + this._y * 100);
}
function buatPanah2(indi) {
peluru = attachMovie('panah_mc', 'peluru_mc' + dalamPeluru, dalamPeluru);
peluru._x = indi._x;
peluru._y = indi._y - 25;
peluru._yscale = 80;
peluru._xscale = 80;
peluru.speed = 25;
peluru.randX = random(50) - 25;
peluru.randY = random(50) - 25;
peluru.xtarget = benteng_mc;
peluru.indi = indi;
peluru.onEnterFrame = enterPanah2;
++dalamPeluru;
if (dalamPeluru >= 200) {
dalamPeluru = 100;
}
}
function enterPanah2() {
if (sedangPause == false) {
this._x += geserKiri;
deltaX = this._x - this.xtarget._x + this.randX;
deltaY = this._y - (this.xtarget._y - 100) + this.randY;
angle = -Math.atan2(deltaX, deltaY) / 0.0174532925199433;
this._rotation = angle;
if (Math.sqrt(deltaX * deltaX + deltaY * deltaY) > this.speed) {
this.speed += 0.5;
this._y -= this.speed * Math.cos(angle * 0.0174532925199433);
this._x += this.speed * Math.sin(angle * 0.0174532925199433);
} else {
nyawaBenteng -= this.indi.damage;
this.xtarget.attachMovie('panah_mc', 'panah_mc' + dalamPeluru, dalamPeluru);
this.xtarget['panah_mc' + dalamPeluru].gotoAndStop(2);
this.xtarget['panah_mc' + dalamPeluru]._x = -15 + random(50) - 25 + random(15) + 7;
this.xtarget['panah_mc' + dalamPeluru]._y = -115 - this.randY + random(10) - 5;
this.xtarget['panah_mc' + dalamPeluru]._rotation = this._rotation - random(15) + 7;
this.xtarget['panah_mc' + dalamPeluru]._xscale = this._xscale;
this.xtarget['panah_mc' + dalamPeluru]._yscale = this._yscale;
++dalamPeluru;
if (dalamPeluru >= 200) {
dalamPeluru = 100;
}
removeMovieClip(this);
}
}
this.swapDepths(100 + this._x + this._y * 100);
}
function klikSpell() {
if (mulaiBattle == true) {
myStr = new String(this);
if (isNaN(myStr.substr(myStr.length - 2, 2))) {
indi = myStr.substr(myStr.length - 1, 1);
} else {
indi = myStr.substr(myStr.length - 2, 2);
}
if (battle_mc.pasukan_mc['jumlah' + indi] > 0) {
pilihSpell = indi;
spell = attachMovie('spellTarget', 'drag_mc2', dalamDrag);
spell.bisa._visible = true;
spell._x = _root._xmouse;
spell._y = _root._ymouse + spell._height / 10;
if (pilihSpell >= 15) {
spell._yscale = 150;
spell._xscale = 150;
} else {
spell._yscale = 75;
spell._xscale = 75;
}
spell.startDrag();
sedangDragSpell = true;
sedangDragSpell2 = false;
battle_mc.remove_mc._visible = true;
}
}
}
function klikSpell2() {
if (mulaiBattle == true) {
myStr = new String(this);
bisaBuatSpell2 = false;
i = 11;
while (i <= 18) {
if (battle_mc.pasukan_mc['jumlah' + i] > 0) {
bisaBuatSpell2 = true;
}
++i;
}
if (bisaBuatSpell2 == true) {
spell = attachMovie('spellTarget2', 'drag_mc2', dalamDrag);
spell.bisa._visible = true;
spell._x = _root._xmouse;
spell._y = _root._ymouse + spell._height / 10;
if (pilihSpell >= 15) {
spell._yscale = 150;
spell._xscale = 150;
} else {
spell._yscale = 75;
spell._xscale = 75;
}
spell.startDrag();
sedangDragSpell = false;
sedangDragSpell2 = true;
battle_mc.remove_mc._visible = true;
}
}
}
function klikWeapon() {
myStr = new String(this);
if (isNaN(myStr.substr(myStr.length - 2, 2))) {
indi = myStr.substr(myStr.length - 1, 1);
} else {
indi = myStr.substr(myStr.length - 2, 2);
}
if (battle_mc.pasukan_mc['jumlah' + indi] > 0) {
pilihWeapon = indi;
weapon2 = attachMovie('panahWeapon', 'drag_mc2', dalamDrag);
weapon2.bisa._visible = true;
weapon2._x = _root._xmouse;
weapon2._y = _root._ymouse + weapon2._height / 10;
if (pilihWeapon == 8) {
weapon2.jumlah = 25;
weapon2.gotoAndStop(1);
} else {
if (pilihWeapon == 9) {
weapon2.jumlah = 50;
weapon2.gotoAndStop(2);
} else {
if (pilihWeapon == 10) {
weapon2.jumlah = 75;
weapon2.gotoAndStop(3);
}
}
}
weapon2.anim.stop();
weapon2.startDrag();
sedangDragWeapon = true;
battle_mc.remove_mc._visible = true;
}
}
function cekPause(indi) {
if (indi == true) {
sedangDragWeapon = false;
sedangDragSpell = false;
sedangDragSpell2 = false;
removeMovieClip(drag_mc2);
buatKotak(false);
}
if (indi == true) {
battle_mc.soldier_mc.enabled = false;
battle_mc.vehicle_mc.enabled = false;
battle_mc.weapon_mc.enabled = false;
battle_mc.spell_mc.enabled = false;
battle_mc.retreat_btn.enabled = false;
battle_mc.defense_mc.enabled = false;
battle_mc.all_btn.enabled = false;
i = 1;
while (i <= 23) {
battle_mc.pasukan_mc['unit' + i].enabled = false;
++i;
}
i = 50;
while (i <= 85) {
_root['musuh_mc' + i].anim.stop();
++i;
}
i = 1;
while (i <= maximumJagoan) {
_root['jagoan_mc' + i].anim.stop();
++i;
}
} else {
if (indi == false) {
battle_mc.soldier_mc.enabled = true;
battle_mc.vehicle_mc.enabled = true;
battle_mc.weapon_mc.enabled = true;
battle_mc.spell_mc.enabled = true;
battle_mc.retreat_btn.enabled = true;
battle_mc.defense_mc.enabled = true;
battle_mc.all_btn.enabled = true;
i = 1;
while (i <= 23) {
battle_mc.pasukan_mc['unit' + i].enabled = true;
++i;
}
i = 50;
while (i <= 85) {
_root['musuh_mc' + i].anim.play();
++i;
}
i = 1;
while (i <= maximumJagoan) {
_root['jagoan_mc' + i].anim.play();
++i;
}
}
}
}
function jagoanLari() {
this._x += geserKiri;
this._x -= this.speed * 4;
this.gotoAndStop(2);
this.anim._xscale = -this.scaleAwal;
this.swapDepths(100 + this._x + this._y * 100);
}
function clearSemua2() {
delete myListener.onKeyDown;
delete myListener.onKeyUp;
Key.removeListener(myListener);
delete _root.onEnterFrame;
delete _root.onMouseDown;
delete _root.onMouseMove;
removeMovieClip(benteng_mc);
removeMovieClip(drag_mc);
removeMovieClip(drag_mc2);
removeMovieClip(pause_mc);
i = 50;
while (i <= 65) {
removeMovieClip(_root['musuh_mc' + i]);
++i;
}
i = 1;
while (i <= maximumJagoan) {
removeMovieClip(_root['jagoan_mc' + i]);
++i;
}
i = 1;
while (i <= maximumJagoan) {
removeMovieClip(_root['xjagoan_mc' + i]);
++i;
}
i = 100;
while (i <= 200) {
removeMovieClip(_root['peluru_mc' + i]);
++i;
}
i = 200;
while (i <= 300) {
removeMovieClip(_root['weapon_mc' + i]);
++i;
}
i = 300000;
while (i <= 301000) {
removeMovieClip(_root['spell_mc' + i]);
++i;
}
}
function cekKalah() {
if (sudahSelesai == false) {
sudahSelesai = true;
benteng_mc.gotoAndStop(2);
i = 100;
while (i <= 200) {
benteng_mc['panah_mc' + i]._visible = false;
++i;
}
i = 50;
while (i <= 65) {
_root['musuh_mc' + i].gotoAndStop(1);
++i;
}
i = 1;
while (i <= maximumJagoan) {
_root['jagoan_mc' + i].gotoAndStop(4);
++i;
}
menangBattle = false;
idLanjut = setInterval(lanjutMain, 2000);
}
}
function cekMenang() {
if (sudahSelesai == false) {
sudahSelesai = true;
i = 1;
while (i <= maximumJagoan) {
_root['jagoan_mc' + i].gotoAndStop(1);
++i;
}
i = 50;
while (i <= 65) {
_root['musuh_mc' + i].onEnterFrame = musuhLari;
++i;
}
menangBattle = true;
idLanjut = setInterval(lanjutMain, 2000);
}
}
function musuhLari() {
this._x += geserKiri;
this._x += this.speed * 4;
this.gotoAndStop(2);
this.anim._xscale = -this.scaleAwal;
this.swapDepths(100 + this._x + this._y * 100);
}
function lanjutMain() {
clearSemua2();
clearInterval(idLanjut);
if (xpindahBareman >= pindahBareman) {
xpindahBareman = pindahBareman;
}
if (xpindahSwordman >= pindahSwordman) {
xpindahSwordman = pindahSwordman;
}
if (xpindahArrowman >= pindahArrowman) {
xpindahArrowman = pindahArrowman;
}
if (xpindahSpearman >= pindahSpearman) {
xpindahSpearman = pindahSpearman;
}
if (xpindahTank >= pindahTank) {
xpindahTank = pindahTank;
}
if (xpindahCopter >= pindahCopter) {
xpindahCopter = pindahCopter;
}
if (xpindahMonbot >= pindahMonbot) {
xpindahMonbot = pindahMonbot;
}
xpindahBareman = Math.floor(xpindahBareman);
xpindahSwordman = Math.floor(xpindahSwordman);
xpindahArrowman = Math.floor(xpindahArrowman);
xpindahSpearman = Math.floor(xpindahSpearman);
xpindahTank = Math.floor(xpindahTank);
xpindahCopter = Math.floor(xpindahCopter);
xpindahMonbot = Math.floor(xpindahMonbot);
kondisiPreview = 'akhir';
gotoAndStop(840);
}
function cekSpeed() {
if (speedBattle == 1) {
battle_mc.speed_mc.gotoAndStop(1);
} else {
if (speedBattle == 2) {
battle_mc.speed_mc.gotoAndStop(2);
}
}
}
stop();
tipeAttackMusuh = 'defense';
frameKota.namaKota = xnamaKota[keKota];
backBattle2();
initBattle();
buatBenteng();
buatBackground();
buatGuard();
cekJumlahTankMusuh();
_root.onEnterFrame = function () {
if (sedangPause == false) {
if (siapaYangNyerang == 2) {
if (musuhSpell >= maxMusuhSpell) {
musuhSpell = 0;
if (kotaSerang == 21) {
cekSpellMusuh2();
} else {
cekSpellMusuh();
}
} else {
++musuhSpell;
}
} else {
if (xday >= 500) {
if (musuhSpell >= maxMusuhSpell) {
musuhSpell = 0;
cekSpellMusuh();
} else {
++musuhSpell;
}
}
}
if (adaSerangBase == true) {
if (delayMusuhKeluar >= maxMusuhKeluar2) {
buatMusuh();
adaSerangBase = false;
delayMusuhKeluar = 0;
} else {
++delayMusuhKeluar;
}
} else {
if (delayMusuhKeluar >= maxMusuhKeluar) {
buatMusuh();
delayMusuhKeluar = 0;
} else {
++delayMusuhKeluar;
}
}
if (_root._xmouse <= 10 || geserKeKiri == true) {
if (background_mc._x <= -20) {
geserKiri = 10 * speedBattle * 3;
} else {
geserKiri = 0;
}
} else {
if (_root._xmouse >= 790 || geserKeKanan == true) {
if (background_mc._x >= -2350) {
geserKiri = -10 * speedBattle * 3;
} else {
geserKiri = 0;
}
} else {
geserKiri = 0;
}
}
background_mc._x += geserKiri;
if (getarBumi == true) {
if (getarKe == 1) {
cekGeserX(5);
cekGeserY(5);
++getarKe;
} else {
if (getarKe == 2) {
cekGeserX(-10);
cekGeserY(-10);
++getarKe;
} else {
if (getarKe == 3) {
cekGeserX(5);
cekGeserY(-5);
++getarKe;
} else {
if (getarKe == 4) {
cekGeserX(-5);
cekGeserY(5);
++getarKe;
} else {
if (getarKe == 5) {
cekGeserX(7);
cekGeserY(7);
++getarKe;
} else {
if (getarKe == 6) {
cekGeserX(10);
cekGeserY(-10);
++getarKe;
} else {
if (getarKe == 7) {
cekGeserX(-12);
cekGeserY(7);
++getarKe;
} else {
if (getarKe == 8) {
cekGeserX(5);
cekGeserY(5);
++getarKe;
} else {
if (getarKe == 9) {
cekGeserX(-10);
cekGeserY(-10);
++getarKe;
} else {
if (getarKe == 10) {
cekGeserX(5);
cekGeserY(-5);
++getarKe;
} else {
if (getarKe == 11) {
cekGeserX(-5);
cekGeserY(5);
++getarKe;
} else {
if (getarKe == 12) {
cekGeserX(7);
cekGeserY(7);
++getarKe;
} else {
if (getarKe == 13) {
cekGeserX(10);
cekGeserY(-10);
++getarKe;
} else {
if (getarKe == 14) {
cekGeserX(-12);
cekGeserY(7);
++getarKe;
} else {
cekNormalY('akhir');
getarBumi = false;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
if (defenseKita <= 0) {
defenseKita = 0;
}
if (totalMusuh <= 0) {
totalMusuh = 0;
}
ourDefense.jumlah = defenseKita;
enemyLeft.jumlah = totalMusuh;
ourBase.jumlah = Math.ceil(nyawaBenteng);
}
if (battle_mc.pasukan_mc.jumlah11 <= 0) {
battle_mc.pasukan_mc.jumlah11 = 0;
}
if (battle_mc.pasukan_mc.jumlah12 <= 0) {
battle_mc.pasukan_mc.jumlah12 = 0;
}
if (battle_mc.pasukan_mc.jumlah13 <= 0) {
battle_mc.pasukan_mc.jumlah13 = 0;
}
if (battle_mc.pasukan_mc.jumlah14 <= 0) {
battle_mc.pasukan_mc.jumlah14 = 0;
}
if (battle_mc.pasukan_mc.jumlah15 <= 0) {
battle_mc.pasukan_mc.jumlah15 = 0;
}
if (battle_mc.pasukan_mc.jumlah16 <= 0) {
battle_mc.pasukan_mc.jumlah16 = 0;
}
if (battle_mc.pasukan_mc.jumlah17 <= 0) {
battle_mc.pasukan_mc.jumlah17 = 0;
}
if (battle_mc.pasukan_mc.jumlah18 <= 0) {
battle_mc.pasukan_mc.jumlah18 = 0;
}
};
ourDefense.onRollOver = function () {
this.gotoAndStop(2);
};
ourDefense.onRollOut = function () {
this.gotoAndStop(1);
};
ourBase.onRollOver = function () {
this.gotoAndStop(2);
};
ourBase.onRollOut = function () {
this.gotoAndStop(1);
};
enemyLeft.onRollOver = function () {
this.gotoAndStop(2);
};
enemyLeft.onRollOut = function () {
this.gotoAndStop(1);
};
battle_mc.soldier_mc.onRelease = function () {
sedangDragWeapon = false;
sedangDragSpell = false;
sedangDragSpell2 = false;
removeMovieClip(drag_mc2);
buatKotak(false);
battle_mc.pasukan_mc.gotoAndStop(1);
cekPasukanBuat();
};
battle_mc.vehicle_mc.onRelease = function () {
sedangDragWeapon = false;
sedangDragSpell = false;
sedangDragSpell2 = false;
removeMovieClip(drag_mc2);
buatKotak(false);
battle_mc.pasukan_mc.gotoAndStop(2);
cekPasukanBuat();
};
battle_mc.weapon_mc.onRelease = function () {
sedangDragWeapon = false;
sedangDragSpell = false;
sedangDragSpell2 = false;
removeMovieClip(drag_mc2);
buatKotak(false);
battle_mc.pasukan_mc.gotoAndStop(3);
cekPasukanBuat();
};
battle_mc.spell_mc.onRelease = function () {
sedangDragWeapon = false;
sedangDragSpell = false;
sedangDragSpell2 = false;
removeMovieClip(drag_mc2);
buatKotak(false);
battle_mc.pasukan_mc.gotoAndStop(4);
cekPasukanBuat();
};
battle_mc.defense_mc.onRelease = function () {
sedangDragWeapon = false;
sedangDragSpell = false;
sedangDragSpell2 = false;
removeMovieClip(drag_mc2);
buatKotak(false);
battle_mc.pasukan_mc.gotoAndStop(5);
cekPasukanBuat();
};
battle_mc.remove_mc._visible = false;
battle_mc.remove_mc.onRelease = function () {
sedangDragWeapon = false;
sedangDragSpell = false;
sedangDragSpell2 = false;
removeMovieClip(drag_mc2);
buatKotak(false);
};
battle_mc.pasukan_mc.gotoAndStop(1);
cekPasukanBuat();
_root.onMouseDown = function () {
if (sedangPause == false) {
if (sedangDragWeapon == true) {
if (_root._ymouse >= 225 && _root._ymouse <= 475) {
buatWeapon(_root._ymouse);
sedangDragWeapon = false;
stopDrag();
removeMovieClip(drag_mc2);
}
} else {
if (sedangDragSpell == true) {
if (pilihSpell == 14) {
if (_root._ymouse >= 275 && _root._ymouse <= 475) {
if (getarBumi2 == false) {
getarBumi2 = true;
buatSpell(_root._xmouse, _root._ymouse);
sedangDragSpell = false;
stopDrag();
removeMovieClip(drag_mc2);
}
}
} else {
if (_root._ymouse >= 125 && _root._ymouse <= 475) {
buatSpell(_root._xmouse, _root._ymouse);
sedangDragSpell = false;
stopDrag();
removeMovieClip(drag_mc2);
}
}
} else {
if (sedangDragSpell2 == true) {
if (_root._ymouse >= 125 && _root._ymouse <= 475) {
buatSpell2(_root._xmouse, _root._ymouse);
sedangDragSpell = false;
stopDrag();
removeMovieClip(drag_mc2);
}
}
}
}
}
};
_root.onMouseMove = function () {
if (sedangDragWeapon == true) {
if (_root._ymouse >= 225 && _root._ymouse <= 475) {
drag_mc2.bisa._visible = false;
} else {
drag_mc2.bisa._visible = true;
}
} else {
if (sedangDragSpell == true) {
if (pilihSpell == 14) {
if (getarBumi2 == true) {
drag_mc2.bisa._visible = true;
} else {
if (_root._ymouse >= 275 && _root._ymouse <= 475) {
drag_mc2.bisa._visible = false;
} else {
drag_mc2.bisa._visible = true;
}
}
} else {
if (_root._ymouse >= 125 && _root._ymouse <= 475) {
drag_mc2.bisa._visible = false;
} else {
drag_mc2.bisa._visible = true;
}
}
} else {
if (sedangDragSpell2 == true) {
if (_root._ymouse >= 125 && _root._ymouse <= 475) {
drag_mc2.bisa._visible = false;
} else {
drag_mc2.bisa._visible = true;
}
}
}
}
};
battle_mc.retreat_btn.onRelease = function () {
battle_mc.retreat_btn._visible = false;
i = 1;
while (i <= maximumJagoan) {
_root['jagoan_mc' + i].onEnterFrame = jagoanLari;
++i;
}
cekKalah();
};
battle_mc.pause_btn.onRelease = function () {
if (sedangPause == false) {
pause_mc = attachMovie('pause_mc', 'pause_mc', 1199905);
pause_mc._x = 400;
pause_mc._y = 300;
sedangPause = true;
} else {
removeMovieClip(pause_mc);
sedangPause = false;
}
cekPause(sedangPause);
};
cekSpeed();
battle_mc.speed_mc.onRelease = function () {
if (speedBattle == 1) {
speedBattle = 2;
} else {
if (speedBattle == 2) {
speedBattle = 1;
}
}
cekSpeed();
};
geserKeKiri = false;
geserKeKanan = false;
myListener = new Object();
myListener.onKeyDown = function () {
if (Key.getCode() == 65 || Key.getCode() == 37) {
geserKeKiri = true;
}
if (Key.getCode() == 68 || Key.getCode() == 39) {
geserKeKanan = true;
}
};
myListener.onKeyUp = function () {
if (Key.getCode() == 65 || Key.getCode() == 37) {
geserKeKiri = false;
}
if (Key.getCode() == 68 || Key.getCode() == 39) {
geserKeKanan = false;
}
};
Key.addListener(myListener);
}
movieClip 2957 {
}
movieClip 2959 {
frame 1 {
stop();
}
}
movieClip 2962 {
frame 1 {
stop();
}
}
frame 904 {
stop();
quit_btn.onRelease = function () {
backBuilding2();
gotoAndStop(216);
};
}
movieClip 2964 {
}
frame 905 {
stop();
backTerompet();
quit_btn.onRelease = function () {
backBuilding2();
gotoAndStop(216);
};
++menangGame;
if (menangGame == 1) {
_root.dapatMedal15 = true;
last_mc._visible = true;
last_mc.gotoAndStop(1);
} else {
if (menangGame == 3) {
_root.dapatMedal30 = true;
last_mc._visible = true;
last_mc.gotoAndStop(2);
} else {
last_mc._visible = false;
}
}
simpanMedal();
}
movieClip 2977 {
frame 1 {
stop();
}
}