Section 1
//CumulativeBomb (fai.bomb.CumulativeBomb)
package fai.bomb {
import fai.*;
import flash.events.*;
import flash.display.*;
import flash.utils.*;
public class CumulativeBomb extends Sprite {
private var droppoint:Position;// = null
public var bombtimer:Timer;// = null
private var curscale:Number;// = 0
private var groundLeft:Boolean;// = true
private var engine:Engine;// = null
private var esprite:AnimatedBitmap;// = null
private var frame:int;// = 0
private var step:Number;// = 3
private var pause:int;// = 0
private static const startScale:Number = 3;
private static const endScale:Number = 0.1;
public function CumulativeBomb(_arg1:Position=null, _arg2:Engine=null):void{
var _local3:BitmapData;
engine = null;
bombtimer = null;
curscale = 0;
step = 3;
frame = 0;
pause = 0;
droppoint = null;
esprite = null;
groundLeft = true;
super();
if (!_arg2){
return;
};
engine = _arg2;
x = (_arg1.x * Consts.cell_size);
y = (_arg1.y * Consts.cell_size);
scaleY = (scaleX = startScale);
_local3 = engine.sloader.specials[UnitTypes.cumulative_bomb];
esprite = new AnimatedBitmap(_local3, _local3.height, _local3.height);
droppoint = _arg1;
}
private function makeDamage():void{
var _local1:int;
var _local2:Unit;
var _local3:Number;
_local1 = 0;
_local2 = null;
while (_local1 < engine.game_board.my_camp.units.length) {
_local2 = engine.game_board.my_camp.units[_local1];
_local3 = Camp.distanceFrom(droppoint, _local2);
calculateDamage(_local2, _local3);
if (_local2.isAlive()){
_local1++;
};
};
_local1 = 0;
while (_local1 < engine.game_board.enemy_camp.units.length) {
_local2 = engine.game_board.enemy_camp.units[_local1];
_local3 = Camp.distanceFrom(droppoint, _local2);
calculateDamage(_local2, _local3);
if (_local2.isAlive()){
_local1++;
};
};
}
public function clean():void{
if (bombtimer){
bombtimer.stop();
bombtimer.removeEventListener(TimerEvent.TIMER, timerfunc);
bombtimer = null;
};
engine.game_board.positionLayers();
if (!frame){
engine.game_board.bulletlayer.removeChild(this);
} else {
if (((esprite) && ((frame >= esprite.nframes)))){
engine.game_board.bulletlayer.removeChild(esprite);
esprite = null;
};
};
}
public function start():void{
curscale = startScale;
bombtimer = new Timer(50);
bombtimer.addEventListener(TimerEvent.TIMER, timerfunc);
bombtimer.start();
}
private function calculateDamage(_arg1:Unit, _arg2:Number):void{
if (_arg2 <= 2){
engine.game_process.hitUnit(1000, _arg1);
} else {
if (_arg2 <= 3){
engine.game_process.hitUnit(200, _arg1);
} else {
if (_arg2 <= 5){
engine.game_process.hitUnit(50, _arg1);
};
};
};
}
private function timerfunc(_arg1:TimerEvent):void{
if (engine.paused){
return;
};
if (curscale > endScale){
curscale = (curscale - (3 / (step * step)));
step = (step + 0.31);
scaleY = (scaleX = curscale);
} else {
if (!frame){
esprite.x = x;
esprite.y = y;
esprite.x = (esprite.x - (esprite.width / 2));
esprite.y = (esprite.y - (esprite.height / 2));
engine.game_board.bulletlayer.addChild(esprite);
engine.game_board.bulletlayer.removeChild(this);
makeDamage();
engine.playSound(Sounds.explosion1);
engine.playSound(Sounds.explosion1);
} else {
if (frame >= esprite.nframes){
bombtimer.stop();
bombtimer.removeEventListener(TimerEvent.TIMER, timerfunc);
bombtimer = null;
engine.game_board.bulletlayer.removeChild(esprite);
esprite = null;
engine.game_board.positionLayers();
return;
};
};
if (groundLeft){
engine.game_board.backgr.x = ((-(Consts.cell_size) / 2) - 2);
engine.game_board.unitlayer.x = ((Consts.cell_size / 2) - 2);
} else {
engine.game_board.backgr.x = (-(Consts.cell_size) / 2);
engine.game_board.unitlayer.x = (Consts.cell_size / 2);
};
groundLeft = !(groundLeft);
if (pause > 0){
pause--;
return;
};
esprite.setFrame(frame);
frame++;
pause = 2;
};
}
}
}//package fai.bomb
Section 2
//NitroBomb (fai.bomb.NitroBomb)
package fai.bomb {
import fai.*;
import flash.events.*;
import flash.display.*;
import flash.utils.*;
public class NitroBomb extends Sprite {
private var droppoint:Position;// = null
public var bombtimer:Timer;// = null
private var curscale:Number;// = 0
private var engine:Engine;// = null
private var esprite:AnimatedBitmap;// = null
private var frame:int;// = 0
private var step:Number;// = 3
private var pause:int;// = 0
private static const startScale:Number = 3;
private static const endScale:Number = 0.1;
public function NitroBomb(_arg1:Position=null, _arg2:Engine=null):void{
var _local3:BitmapData;
engine = null;
bombtimer = null;
curscale = 0;
step = 3;
frame = 0;
pause = 0;
droppoint = null;
esprite = null;
super();
if (!_arg2){
return;
};
engine = _arg2;
x = (_arg1.x * Consts.cell_size);
y = (_arg1.y * Consts.cell_size);
scaleY = (scaleX = startScale);
_local3 = engine.sloader.specials[UnitTypes.nitro_bomb];
esprite = new AnimatedBitmap(_local3, _local3.height, _local3.height);
droppoint = _arg1;
}
private function makeDamage():void{
var _local1:int;
var _local2:Unit;
var _local3:Number;
_local1 = 0;
_local2 = null;
while (_local1 < engine.game_board.my_camp.units.length) {
_local2 = engine.game_board.my_camp.units[_local1];
_local3 = Camp.distanceFrom(droppoint, _local2);
calculateDamage(_local2, _local3);
if (_local2.isAlive()){
_local1++;
};
};
_local1 = 0;
while (_local1 < engine.game_board.enemy_camp.units.length) {
_local2 = engine.game_board.enemy_camp.units[_local1];
_local3 = Camp.distanceFrom(droppoint, _local2);
calculateDamage(_local2, _local3);
if (_local2.isAlive()){
_local1++;
};
};
}
public function clean():void{
if (bombtimer){
bombtimer.stop();
bombtimer.removeEventListener(TimerEvent.TIMER, timerfunc);
bombtimer = null;
};
if (!frame){
engine.game_board.bulletlayer.removeChild(this);
} else {
if (((esprite) && ((frame >= esprite.nframes)))){
engine.game_board.bulletlayer.removeChild(esprite);
esprite = null;
};
};
}
public function start():void{
curscale = startScale;
bombtimer = new Timer(50);
bombtimer.addEventListener(TimerEvent.TIMER, timerfunc);
bombtimer.start();
}
private function calculateDamage(_arg1:Unit, _arg2:Number):void{
if (_arg2 <= 1){
engine.game_process.hitUnit(250, _arg1);
} else {
if (_arg2 <= 2){
engine.game_process.hitUnit(100, _arg1);
} else {
if (_arg2 <= 4){
engine.game_process.hitUnit(50, _arg1);
};
};
};
}
private function timerfunc(_arg1:TimerEvent):void{
if (engine.paused){
return;
};
if (curscale > endScale){
curscale = (curscale - (3 / (step * step)));
step = (step + 0.2);
scaleY = (scaleX = curscale);
} else {
if (!frame){
esprite.x = x;
esprite.y = y;
esprite.x = (esprite.x - (esprite.width / 2));
esprite.y = (esprite.y - (esprite.height / 2));
engine.game_board.bulletlayer.addChild(esprite);
engine.game_board.bulletlayer.removeChild(this);
makeDamage();
engine.playSound(Sounds.explosion1);
} else {
if (frame >= esprite.nframes){
bombtimer.stop();
bombtimer.removeEventListener(TimerEvent.TIMER, timerfunc);
bombtimer = null;
engine.game_board.bulletlayer.removeChild(esprite);
esprite = null;
return;
};
};
if (pause > 0){
pause--;
return;
};
esprite.setFrame(frame);
frame++;
pause = 1;
};
}
}
}//package fai.bomb
Section 3
//NuclearMissile (fai.bomb.NuclearMissile)
package fai.bomb {
import fai.*;
import flash.events.*;
import flash.display.*;
import flash.utils.*;
public class NuclearMissile extends Sprite {
private var droppoint:Position;// = null
public var bombtimer:Timer;// = null
private var curscale:Number;// = 0
private var groundLeft:Boolean;// = true
private var engine:Engine;// = null
private var esprite:AnimatedBitmap;// = null
private var frame:int;// = 0
private var step:Number;// = 3
private var pause:int;// = 0
private static const startScale:Number = 3;
private static const endScale:Number = 0.1;
public function NuclearMissile(_arg1:Position=null, _arg2:Engine=null):void{
var _local3:BitmapData;
engine = null;
bombtimer = null;
curscale = 0;
step = 3;
frame = 0;
pause = 0;
droppoint = null;
esprite = null;
groundLeft = true;
super();
if (!_arg2){
return;
};
engine = _arg2;
x = (_arg1.x * Consts.cell_size);
y = (_arg1.y * Consts.cell_size);
scaleY = (scaleX = startScale);
_local3 = engine.sloader.specials[UnitTypes.nuclear_missile];
esprite = new AnimatedBitmap(_local3, _local3.height, _local3.height);
esprite.scaleX = (esprite.scaleY = 2);
droppoint = _arg1;
}
private function makeDamage():void{
var _local1:int;
var _local2:Unit;
var _local3:Number;
_local1 = 0;
_local2 = null;
while (_local1 < engine.game_board.my_camp.units.length) {
_local2 = engine.game_board.my_camp.units[_local1];
_local3 = Camp.distanceFrom(droppoint, _local2);
calculateDamage(_local2, _local3);
if (_local2.isAlive()){
_local1++;
};
};
_local1 = 0;
while (_local1 < engine.game_board.enemy_camp.units.length) {
_local2 = engine.game_board.enemy_camp.units[_local1];
_local3 = Camp.distanceFrom(droppoint, _local2);
calculateDamage(_local2, _local3);
if (_local2.isAlive()){
_local1++;
};
};
}
public function clean():void{
if (bombtimer){
bombtimer.stop();
bombtimer.removeEventListener(TimerEvent.TIMER, timerfunc);
bombtimer = null;
};
engine.game_board.positionLayers();
if (!frame){
engine.game_board.bulletlayer.removeChild(this);
} else {
if (((esprite) && ((frame >= esprite.nframes)))){
engine.game_board.bulletlayer.removeChild(esprite);
esprite = null;
};
};
}
public function start():void{
curscale = startScale;
bombtimer = new Timer(50);
bombtimer.addEventListener(TimerEvent.TIMER, timerfunc);
bombtimer.start();
}
private function calculateDamage(_arg1:Unit, _arg2:Number):void{
if (_arg2 <= 2){
engine.game_process.hitUnit(5000, _arg1);
} else {
if (_arg2 <= 3){
engine.game_process.hitUnit(500, _arg1);
} else {
if (_arg2 <= 4){
engine.game_process.hitUnit(100, _arg1);
} else {
if (_arg2 <= 6){
engine.game_process.hitUnit(50, _arg1);
} else {
if (_arg2 <= 8){
engine.game_process.hitUnit(35, _arg1);
};
};
};
};
};
}
private function timerfunc(_arg1:TimerEvent):void{
if (engine.paused){
return;
};
if (curscale > endScale){
curscale = (curscale - (3 / (step * step)));
step = (step + 0.35);
scaleY = (scaleX = curscale);
} else {
if (!frame){
esprite.x = x;
esprite.y = y;
esprite.x = (esprite.x - (esprite.width / 2));
esprite.y = (esprite.y - (esprite.height / 2));
engine.game_board.bulletlayer.addChild(esprite);
engine.game_board.bulletlayer.removeChild(this);
makeDamage();
engine.playSound(Sounds.explosion1);
engine.playSound(Sounds.explosion1);
engine.playSound(Sounds.explosion1);
} else {
if (frame >= esprite.nframes){
bombtimer.stop();
bombtimer.removeEventListener(TimerEvent.TIMER, timerfunc);
bombtimer = null;
esprite.visible = false;
engine.game_board.bulletlayer.removeChild(esprite);
esprite = null;
engine.game_board.positionLayers();
return;
};
};
if (groundLeft){
engine.game_board.backgr.x = ((-(Consts.cell_size) / 2) - 2);
engine.game_board.unitlayer.x = ((Consts.cell_size / 2) - 2);
} else {
engine.game_board.backgr.x = (-(Consts.cell_size) / 2);
engine.game_board.unitlayer.x = (Consts.cell_size / 2);
};
groundLeft = !(groundLeft);
if (pause > 0){
pause--;
return;
};
esprite.setFrame(frame);
frame++;
pause = 1;
};
}
}
}//package fai.bomb
Section 4
//AnimatedBitmap (fai.AnimatedBitmap)
package fai {
import flash.display.*;
import flash.geom.*;
public class AnimatedBitmap extends Bitmap {
private var point:Point;// = null
private var rect:Rectangle;// = null
public var curbuffer:BitmapData;// = null
public var nframes:uint;// = 0
public var framen:uint;// = 0
public function AnimatedBitmap(_arg1:BitmapData, _arg2:int, _arg3:int):void{
nframes = 0;
curbuffer = null;
framen = 0;
point = null;
rect = null;
super(new BitmapData(_arg2, _arg3, true, 0), "auto", true);
point = new Point(0, 0);
setBuffer(_arg1);
}
public function setBuffer(_arg1:BitmapData):void{
if (((_arg1) && (!((curbuffer == _arg1))))){
curbuffer = _arg1;
nframes = (curbuffer.width / width);
framen = 0;
draw();
};
}
public function setFrame(_arg1:uint):void{
if (_arg1 == framen){
return;
};
framen = _arg1;
draw();
}
private function draw():void{
var _local1:BitmapData;
_local1 = bitmapData;
rect = new Rectangle((framen * width), 0, width, height);
_local1.copyPixels(curbuffer, rect, point);
bitmapData = _local1;
smoothing = true;
}
}
}//package fai
Section 5
//Astar (fai.Astar)
package fai {
public class Astar {
private var maxf:uint;// = 0
public var ns:Array;
public var checkxy:Function;// = null
public var destination:Position;
private var tempg:uint;// = 0
private var temph:uint;// = 0
public var tid:uint;// = 0
private var node:AstarNode;// = null
public var map:MapMatrix;// = null
private var nextbestpos:Position;// = null
private var startnode:AstarNode;// = null
private var cnode:AstarNode;// = null
private var opened:AstarMap;// = null
private var closed:AstarMap;// = null
private var onode:AstarNode;// = null
private var openedMap:AstarMap;// = null
private var curf:int;// = 0
public static var npasses:int = 0;
public function Astar(_arg1:MapMatrix, _arg2:int):void{
checkxy = null;
map = null;
ns = new Array();
opened = null;
closed = null;
openedMap = null;
nextbestpos = null;
tid = 0;
tempg = 0;
temph = 0;
maxf = 0;
curf = 0;
onode = null;
cnode = null;
startnode = null;
node = null;
destination = new Position();
super();
checkxy = checkwallid;
map = _arg1;
tid = _arg2;
}
public function allgood(_arg1:uint, _arg2:uint):Boolean{
return (true);
}
public function findNearPlace(_arg1:Position, _arg2:int=0):void{
var _local3:int;
var _local4:int;
var _local5:int;
_local3 = _arg2;
while (true) {
_local4 = (_arg1.x - _local3);
while (_local4 <= (_arg1.x + _local3)) {
_local5 = (_arg1.y - _local3);
while (_local5 <= (_arg1.y + _local3)) {
if ((((((((_local4 >= 0)) && ((_local5 >= 0)))) && ((_local4 < map.h)))) && ((_local5 < map.v)))){
if (checkxy(_local4, _local5)){
destination.set(_local4, _local5);
return;
};
};
_local5++;
};
_local4++;
};
_local3++;
if (((((((((_arg1.x - _local3) < 0)) && (((_arg1.x + _local3) >= map.h)))) && (((_arg1.y - _local3) < 0)))) && (((_arg1.y + _local3) >= map.v)))){
destination = null;
return;
};
};
}
public function hestimate(_arg1:Position, _arg2:Position):uint{
return ((Math.abs((_arg1.x - _arg2.x)) + Math.abs((_arg1.y - _arg2.y))));
}
public function checknotempty(_arg1:uint, _arg2:uint):Boolean{
return (!(map.getxy(_arg1, _arg2)));
}
public function startDirectSearch(_arg1:Position, _arg2:Position):Boolean{
nextbestpos = null;
ns.length = 0;
opened = new AstarMap();
openedMap = new AstarMap();
closed = new AstarMap();
tempg = 0;
temph = 0;
maxf = 0;
curf = 0;
onode = null;
cnode = null;
destination = new Position();
destination.copy(_arg2);
if (!destination){
return (false);
};
startnode = new AstarNode();
node = null;
startnode.pos = _arg1;
startnode.f = (startnode.h = hestimate(_arg1, destination));
addToOpened(startnode);
return (true);
}
public function checkwall(_arg1:uint, _arg2:uint):Boolean{
return (!((Consts.Wall == map.getxy(_arg1, _arg2))));
}
private function addToOpened(_arg1:AstarNode):void{
opened.add(_arg1.key(), _arg1);
openedMap.add(_arg1.h, _arg1);
}
public function startSearch(_arg1:Position, _arg2:Position):Boolean{
nextbestpos = null;
ns.length = 0;
opened = new AstarMap();
openedMap = new AstarMap();
closed = new AstarMap();
tempg = 0;
temph = 0;
maxf = 0;
curf = 0;
onode = null;
cnode = null;
findNearPlace(_arg2);
if (!destination){
return (false);
};
startnode = new AstarNode();
node = null;
startnode.pos = _arg1;
startnode.f = (startnode.h = hestimate(_arg1, destination));
addToOpened(startnode);
return (true);
}
public function search(_arg1:Array):Boolean{
var _local2:Position;
var _local3:AstarNode;
var _local4:AstarNode;
while (!(opened.empty())) {
npasses--;
if (npasses <= 0){
return (true);
};
node = getBestNode();
if (node.pos.isequal(destination)){
_local3 = node;
while (_local3 != startnode) {
_arg1.unshift(_local3.pos);
_local3 = _local3.parent;
};
return (true);
};
neighbours(node.pos);
for each (_local2 in ns) {
tempg = (node.g + hestimate(node.pos, _local2));
temph = hestimate(_local2, destination);
curf = (tempg + temph);
onode = opened.get(((_local2.x * 1000) + _local2.y));
if (((onode) && ((onode.f <= curf)))){
} else {
cnode = closed.get(((_local2.x * 1000) + _local2.y));
if (((cnode) && ((cnode.f <= curf)))){
} else {
if (onode){
opened.remove(onode.key());
openedMap.removeNode(onode.h, onode);
};
if (cnode){
closed.remove(cnode.key());
};
_local4 = new AstarNode();
_local4.pos = _local2;
_local4.g = tempg;
_local4.h = temph;
_local4.f = curf;
_local4.parent = node;
addToOpened(_local4);
};
};
};
closed.add(node.key(), node);
};
return (false);
}
public function checkwallid(_arg1:uint, _arg2:uint):Boolean{
var _local3:uint;
_local3 = map.getxy(_arg1, _arg2);
return (((((!((_local3 == Consts.Wall))) && (!((_local3 == Consts.crystalsId))))) && (!((_local3 == tid)))));
}
public function neighbours(_arg1:Position):void{
ns.length = 0;
if (_arg1.x > 0){
if (checkxy((_arg1.x - 1), _arg1.y)){
ns.push(new Position((_arg1.x - 1), _arg1.y));
};
if ((((_arg1.y < (map.v - 1))) && (checkxy((_arg1.x - 1), (_arg1.y + 1))))){
ns.push(new Position((_arg1.x - 1), (_arg1.y + 1)));
};
if ((((_arg1.y > 0)) && (checkxy((_arg1.x - 1), (_arg1.y - 1))))){
ns.push(new Position((_arg1.x - 1), (_arg1.y - 1)));
};
};
if ((((_arg1.y > 0)) && (checkxy(_arg1.x, (_arg1.y - 1))))){
ns.push(new Position(_arg1.x, (_arg1.y - 1)));
};
if (_arg1.x < (map.h - 1)){
if (checkxy((_arg1.x + 1), _arg1.y)){
ns.push(new Position((_arg1.x + 1), _arg1.y));
};
if ((((_arg1.y < (map.v - 1))) && (checkxy((_arg1.x + 1), (_arg1.y + 1))))){
ns.push(new Position((_arg1.x + 1), (_arg1.y + 1)));
};
if ((((_arg1.y > 0)) && (checkxy((_arg1.x + 1), (_arg1.y - 1))))){
ns.push(new Position((_arg1.x + 1), (_arg1.y - 1)));
};
};
if ((((_arg1.y < (map.v - 1))) && (checkxy(_arg1.x, (_arg1.y + 1))))){
ns.push(new Position(_arg1.x, (_arg1.y + 1)));
};
}
private function getBestNode():AstarNode{
var _local1:AstarNode;
_local1 = openedMap.shift();
opened.remove(_local1.key());
return (_local1);
}
}
}//package fai
class AstarNode {
public var f:uint;// = 0
public var g:uint;// = 0
public var h:uint;// = 0
public var parent:AstarNode;// = null
public var pos:Position;// = null
private function AstarNode(){
f = 0;
g = 0;
h = 0;
parent = null;
pos = null;
super();
}
public function key():uint{
return (((pos.x * 1000) + pos.y));
}
}
class AstarMap extends Map {
private function AstarMap(){
}
public function removeNode(_arg1:int, _arg2:AstarNode):void{
var _local3:int;
if (find(_arg1)){
if (!values[index_].pos.isequal(_arg2.pos)){
_local3 = (index_ - 1);
while ((((_local3 >= 0)) && ((keys[_local3] == _arg1)))) {
if (values[_local3].pos.isequal(_arg2.pos)){
keys.splice(_local3, 1);
values.splice(_local3, 1);
return;
};
_local3--;
};
_local3 = (index_ + 1);
while ((((_local3 < keys.length)) && ((keys[_local3] == _arg1)))) {
if (values[_local3].pos.isequal(_arg2.pos)){
keys.splice(_local3, 1);
values.splice(_local3, 1);
return;
};
_local3++;
};
} else {
keys.splice(index_, 1);
values.splice(index_, 1);
};
};
}
}
Section 6
//AttackGoal (fai.AttackGoal)
package fai {
public class AttackGoal extends Goal {
public var preciseTarget:Unit;// = null
public var attacktarget:Unit;// = null
private var onlyFlying:Boolean;// = false
private var recharging:int;// = 0
public var paused:Boolean;// = false
private var onlyLand:Boolean;// = false
private var precisePos:Position;// = null
public var hostilecamp:Camp;// = null
public function AttackGoal(_arg1:Unit, _arg2:Camp):void{
hostilecamp = null;
attacktarget = null;
onlyFlying = false;
onlyLand = false;
recharging = 0;
paused = false;
preciseTarget = null;
precisePos = null;
super();
owner = _arg1;
hostilecamp = _arg2;
if (!owner.flag(UnitFlags.Antiaircraft)){
onlyLand = true;
};
if (!owner.flag(UnitFlags.Antilandforces)){
onlyFlying = true;
};
}
public function advance():void{
var _local1:Unit;
_local1 = null;
if (Consts.ATTACK == owner.cstate){
if (recharging > 0){
recharging--;
if (((((!(recharging)) && (!(paused)))) && (!(preciseAttack())))){
_local1 = hostilecamp.getNearestUnit(owner.pos, owner.eyerange, onlyFlying, onlyLand);
if (_local1 != null){
owner.startattack(_local1);
} else {
owner.reset();
owner.sprite.setMoveSprite();
return;
};
};
} else {
owner.attack();
};
if ((((Consts.IDLE == owner.cstate)) && (!(paused)))){
if (preciseAttack()){
recharging = owner.rechargetime;
} else {
_local1 = hostilecamp.getNearestUnit(owner.pos, owner.eyerange, onlyFlying, onlyLand);
if (_local1 != null){
recharging = owner.rechargetime;
owner.startattack(_local1);
} else {
owner.sprite.setMoveSprite();
};
};
};
} else {
if ((((((Consts.IDLE == owner.cstate)) && (!(paused)))) && (!(preciseAttack())))){
_local1 = hostilecamp.getNearestUnit(owner.pos, owner.eyerange, onlyFlying, onlyLand);
if (_local1 != null){
owner.startattack(_local1);
};
};
};
}
public function preciseAttack():Boolean{
var _local1:int;
var _local2:int;
var _local3:Boolean;
if (!preciseTarget){
return (false);
};
if (!preciseTarget.isAlive()){
clearPreciseTarget();
return (false);
};
if (((((preciseTarget.flag(UnitFlags.Flying)) && (!(owner.flag(UnitFlags.Antiaircraft))))) || (((!(preciseTarget.flag(UnitFlags.Flying))) && (!(owner.flag(UnitFlags.Antilandforces))))))){
clearPreciseTarget();
return (false);
};
_local1 = (owner.pos.x - preciseTarget.pos.x);
_local2 = (owner.pos.y - preciseTarget.pos.y);
_local3 = (Math.sqrt(((_local1 * _local1) + (_local2 * _local2))) <= owner.eyerange);
if (!_local3){
if (owner.flag(UnitFlags.Building)){
clearPreciseTarget();
return (false);
};
if (((!(precisePos)) || (!(precisePos.isequal(preciseTarget.pos))))){
owner.life.move(preciseTarget.pos);
precisePos = preciseTarget.pos;
};
return (true);
};
owner.startattack(preciseTarget);
return (true);
}
public function clearPreciseTarget():void{
precisePos = null;
preciseTarget = null;
}
}
}//package fai
Section 7
//Background (fai.Background)
package fai {
import flash.display.*;
import flash.geom.*;
public class Background extends Bitmap {
private var engine:Engine;// = null
public function Background(_arg1:Engine):void{
engine = null;
engine = _arg1;
super(new BitmapData((engine.game_board.map_width * Consts.cell_size), (engine.game_board.map_height * Consts.cell_size), false, 0), "auto", false);
}
public function setTileType(_arg1:String):void{
var _local2:BitmapData;
var _local3:int;
var _local4:int;
var _local5:Rectangle;
var _local6:Point;
var _local7:BitmapData;
var _local8:int;
var _local9:int;
_local2 = engine.sloader.grounds[_arg1];
_local3 = ((engine.game_board.maplayer.width / _local2.width) + 1);
_local4 = ((engine.game_board.maplayer.height / _local2.height) + 1);
_local5 = new Rectangle(0, 0, _local2.width, _local2.height);
_local6 = null;
_local7 = bitmapData;
_local8 = 0;
_local9 = 0;
_local8 = 0;
while (_local8 < _local4) {
_local9 = 0;
while (_local9 < _local3) {
_local6 = new Point((_local9 * _local2.width), (_local8 * _local2.height));
_local7.copyPixels(_local2, _local5, _local6);
_local9++;
};
_local8++;
};
bitmapData = _local7;
}
public function addWall(_arg1:String, _arg2:int, _arg3:int):void{
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:int;
var _local8:BitmapData;
var _local9:Rectangle;
var _local10:Point;
var _local11:BitmapData;
_local4 = 0;
_local5 = 0;
_local6 = 0;
_local7 = 0;
_local8 = engine.sloader.grounds[_arg1];
_local9 = new Rectangle(0, 0, _local8.width, _local8.height);
_local10 = new Point((_arg2 * Consts.cell_size), (_arg3 * Consts.cell_size));
_local11 = bitmapData;
_local11.copyPixels(_local8, _local9, _local10);
_local4 = ((_local8.width / Consts.cell_size) + 1);
_local5 = ((_local8.height / Consts.cell_size) + 1);
_local6 = 0;
while (_local6 < _local5) {
_local7 = 0;
while (_local7 < _local4) {
if (((((_arg2 + _local7) < engine.game_board.world.h)) && (((_arg3 + _local6) < engine.game_board.world.v)))){
engine.game_board.world.setxy((_arg2 + _local7), (_arg3 + _local6), Consts.Wall);
};
_local7++;
};
_local6++;
};
}
}
}//package fai
Section 8
//BombGoal (fai.BombGoal)
package fai {
public class BombGoal extends Goal {
private var engine:Engine;// = null
private var bomb;// = null
public function BombGoal(_arg1:Engine, _arg2):void{
engine = null;
bomb = null;
super();
engine = _arg1;
bomb = _arg2;
}
public function advance():void{
if (!bomb.bombtimer){
deactivate();
};
}
override public function deactivate():void{
super.deactivate();
bomb.clean();
bomb = null;
}
}
}//package fai
Section 9
//BuildCursor (fai.BuildCursor)
package fai {
import flash.display.*;
import flash.text.*;
public class BuildCursor extends Sprite {
private var goodshape:Shape;// = null
public var bitmap:AnimatedBitmap;// = null
public var cost_crystals:uint;// = 0
public var type:String;// = null
public var spritewidth:int;// = 0
private var msg:TextField;// = null
private var badshape:Shape;// = null
public function BuildCursor(_arg1:String, _arg2:AnimatedBitmap, _arg3:uint, _arg4:uint, _arg5:int):void{
bitmap = null;
type = null;
badshape = null;
goodshape = null;
cost_crystals = 0;
msg = null;
spritewidth = 0;
super();
type = _arg1;
cost_crystals = _arg4;
bitmap = new AnimatedBitmap(_arg2.curbuffer, _arg2.width, _arg2.height);
spritewidth = _arg5;
addChild(bitmap);
bitmap.x = (bitmap.x - (_arg2.width / 2));
bitmap.y = (bitmap.y - (_arg2.height / 2));
if (!_arg3){
_arg3 = 1;
};
goodshape = new Shape();
drawEyeRange(0xEAEAEA, goodshape, _arg3);
addChild(goodshape);
badshape = new Shape();
badshape.visible = false;
drawEyeRange(0xFF0000, badshape, _arg3);
addChild(badshape);
msg = Utils.createTextField(0xD8D8D8, 10);
msg.text = "Select place for building";
msg.y = (msg.height * 2);
msg.x = (msg.x - (msg.width / 2));
addChild(msg);
}
public function isGood():Boolean{
return (goodshape.visible);
}
public function setGood(_arg1:Boolean):void{
goodshape.visible = _arg1;
badshape.visible = !(_arg1);
}
public function drawEyeRange(_arg1:uint, _arg2:Shape, _arg3:uint):void{
var _local4:uint;
var _local5:uint;
_local4 = 0x666666;
_local5 = 0;
_arg2.graphics.lineStyle(_local5, _local4);
_arg2.graphics.beginFill(_arg1);
_arg2.graphics.drawCircle(0, 0, (_arg3 * Consts.cell_size));
_arg2.graphics.endFill();
_arg2.alpha = 0.1;
}
public function destroy():void{
removeChild(bitmap);
removeChild(goodshape);
removeChild(badshape);
}
}
}//package fai
Section 10
//BulletGoal (fai.BulletGoal)
package fai {
import flash.display.*;
public class BulletGoal extends Goal {
private var engine:Engine;// = null
private var sprite:AnimatedBitmap;// = null
private var gip:int;// = 0
public var bullet:Sprite;
private var hitpos:Position;// = null
private var framen:int;// = 0
private var assaulter:Unit;// = null
private var subject:Unit;// = null
private var expl:AnimatedBitmap;// = null
public function BulletGoal(_arg1:Unit, _arg2:Unit, _arg3:Position, _arg4:Engine):void{
var _local5:int;
var _local6:int;
assaulter = null;
subject = null;
sprite = null;
expl = null;
engine = null;
gip = 0;
hitpos = null;
bullet = new Sprite();
framen = 0;
super();
engine = _arg4;
assaulter = _arg1;
subject = _arg2;
sprite = new AnimatedBitmap(assaulter.sprite.bullet, assaulter.sprite.bullet.width, assaulter.sprite.bullet.height);
expl = new AnimatedBitmap(assaulter.sprite.bulletexp, assaulter.sprite.bulletexp.height, assaulter.sprite.bulletexp.height);
bullet.addChild(sprite);
expl.visible = false;
bullet.addChild(expl);
sprite.x = (sprite.x - (sprite.width / 2));
sprite.y = (sprite.y - (sprite.height / 2));
expl.y = (expl.y + (sprite.height - (expl.height / 2)));
hitpos = subject.pos;
bullet.x = _arg1.sprite.x;
bullet.y = _arg1.sprite.y;
bullet.rotation = (((Math.atan2((_arg3.y - _arg1.sprite.y), (_arg3.x - _arg1.sprite.x)) / Math.PI) * 180) - 90);
_local5 = (subject.pos.x - assaulter.pos.x);
_local6 = (subject.pos.y - assaulter.pos.y);
gip = (Math.sqrt(((_local5 * _local5) + (_local6 * _local6))) * Consts.cell_size);
}
public function advance():void{
if (gip <= 0){
if (framen < expl.nframes){
expl.setFrame(framen);
framen++;
return;
};
deactivate();
} else {
gip = (gip - assaulter.bulletspeed);
if (gip <= 0){
sprite.y = (sprite.y + (assaulter.bulletspeed + gip));
sprite.visible = false;
expl.x = sprite.x;
expl.y = sprite.y;
expl.visible = true;
engine.game_process.hitUnit(assaulter.damage, subject);
if (UnitTypes.stunner == assaulter.type){
subject.life.froze();
};
if (!subject.isAlive()){
if (engine.game_process.isSelectedUnit(assaulter)){
engine.play_window.updateInfo();
};
};
} else {
sprite.y = (sprite.y + assaulter.bulletspeed);
};
};
}
override public function deactivate():void{
super.deactivate();
if (bullet){
bullet.removeChild(sprite);
bullet.removeChild(expl);
engine.game_board.bulletlayer.removeChild(bullet);
sprite = null;
assaulter = (subject = null);
bullet = null;
};
}
}
}//package fai
Section 11
//ButtonSprite (fai.ButtonSprite)
package fai {
import fai.*;
import flash.display.*;
import flash.text.*;
class ButtonSprite extends Sprite {
private var shaped:Shape;
public var type:String;// = null
private var shapes:Shape;
function ButtonSprite(_arg1:String, _arg2:AnimatedBitmap):void{
type = null;
shaped = new Shape();
shapes = new Shape();
super();
Utils.drawRect(shaped, 2, 0, 4548515, _arg2.width, _arg2.height, true);
shaped.alpha = 0.5;
addChild(shaped);
shapes.visible = false;
Utils.drawRect(shapes, 2, 0, 0xD1D1D1, _arg2.width, _arg2.height, true);
shapes.alpha = 0.5;
addChild(shapes);
type = _arg1;
addChild(_arg2);
}
public function select(_arg1:Boolean):void{
shaped.visible = !(_arg1);
shapes.visible = _arg1;
}
public function makeHotKey(_arg1:String):void{
var _local2:TextField;
_local2 = Utils.createTextField(0xFFFFFF, 10);
_local2.text = _arg1;
addChild(_local2);
}
}
}//package fai
Section 12
//Camp (fai.Camp)
package fai {
public class Camp {
public var units:Array;
public function Camp(){
units = new Array();
super();
}
public function getUnder(_arg1:Position):Unit{
var _local2:Unit;
var _local3:int;
_local2 = null;
_local3 = 0;
while (_local3 < units.length) {
_local2 = units[_local3];
if (((((((((_local2.sprite.x - (_local2.sprite_width / 2)) <= _arg1.x)) && ((_arg1.x < (_local2.sprite.x + (_local2.sprite_width / 2)))))) && (((_local2.sprite.y - (_local2.sprite.height / 2)) <= _arg1.y)))) && ((_arg1.y < (_local2.sprite.y + (_local2.sprite.height / 2)))))){
return (_local2);
};
_local3++;
};
return (null);
}
public function remove(_arg1:Unit):void{
var _local2:uint;
_local2 = 0;
while (_local2 < units.length) {
if (units[_local2] == _arg1){
delete units[_local2];
units.splice(_local2, 1);
break;
};
_local2++;
};
}
public function add(_arg1:Unit):void{
units[units.length] = _arg1;
}
public function getUnderSelection(_arg1:int, _arg2:int, _arg3:int, _arg4:int, _arg5:Array):void{
var _local6:Unit;
var _local7:int;
_arg5.length = 0;
_local6 = null;
_local7 = 0;
while (_local7 < units.length) {
_local6 = units[_local7];
if ((((((((((_local6.pos.x >= _arg1)) && ((_local6.pos.x <= (_arg1 + _arg3))))) && ((_local6.pos.y >= _arg2)))) && ((_local6.pos.y <= (_arg2 + _arg4))))) && (!(((_local6.flag(UnitFlags.Building)) && (_local6.flag(UnitFlags.Peaceful))))))){
_arg5.push(_local6);
};
_local7++;
};
}
public function getNearestUnit(_arg1:Position, _arg2:int, _arg3:Boolean, _arg4:Boolean):Unit{
var _local5:Unit;
var _local6:int;
var _local7:Unit;
var _local8:int;
var _local9:int;
_local5 = null;
_local6 = 9999999;
_local7 = null;
_local8 = 0;
while (_local8 < units.length) {
_local7 = units[_local8];
if (((((_arg3) && (!(_local7.flag(UnitFlags.Flying))))) || (((_arg4) && (_local7.flag(UnitFlags.Flying)))))){
} else {
_local9 = distanceFrom(_arg1, _local7);
if (_local9 <= _arg2){
if (_local9 < _local6){
_local6 = _local9;
_local5 = _local7;
};
};
};
_local8++;
};
return (_local5);
}
public function size():uint{
return (units.length);
}
public function getNearUnitById(_arg1:Position, _arg2:int, _arg3:int):Unit{
var _local4:Unit;
var _local5:int;
var _local6:int;
var _local7:int;
var _local8:int;
_local4 = null;
_local5 = 0;
while (_local5 < units.length) {
_local4 = units[_local5];
if (_local4.mapid != _arg3){
} else {
_local6 = (_local4.pos.x - _arg1.x);
_local7 = (_local4.pos.y - _arg1.y);
_local8 = Math.sqrt(((_local6 * _local6) + (_local7 * _local7)));
if (_local8 <= _arg2){
return (_local4);
};
};
_local5++;
};
return (null);
}
public function isUnitNear(_arg1:Position, _arg2:int):Boolean{
var _local3:Unit;
var _local4:int;
var _local5:int;
_local3 = null;
_local4 = 0;
while (_local4 < units.length) {
_local3 = units[_local4];
_local5 = distanceFrom(_arg1, _local3);
if (_local5 <= _arg2){
return (true);
};
_local4++;
};
return (false);
}
public function getInMapUnder(_arg1:Position):Unit{
var _local2:Unit;
var _local3:int;
_local2 = null;
_local3 = 0;
while (_local3 < units.length) {
_local2 = units[_local3];
if ((((_local2.pos.x == _arg1.x)) && ((_local2.pos.y == _arg1.y)))){
return (_local2);
};
_local3++;
};
return (null);
}
public function getNearestByType(_arg1:String, _arg2:Position):Unit{
var _local3:Unit;
var _local4:Unit;
var _local5:int;
var _local6:int;
var _local7:int;
var _local8:int;
var _local9:int;
_local3 = null;
_local4 = null;
_local5 = 9999999;
_local6 = 0;
while (_local6 < units.length) {
_local3 = units[_local6];
if (((_local3.isAlive()) && ((_local3.type == _arg1)))){
_local7 = (_local3.pos.x - _arg2.x);
_local8 = (_local3.pos.y - _arg2.y);
_local9 = Math.sqrt(((_local7 * _local7) + (_local8 * _local8)));
if (_local9 < _local5){
_local4 = _local3;
_local5 = _local9;
};
};
_local6++;
};
return (_local4);
}
public static function distanceFrom(_arg1:Position, _arg2:Unit):Number{
var _local3:int;
var _local4:int;
_local3 = (_arg2.pos.x - _arg1.x);
_local4 = (_arg2.pos.y - _arg1.y);
return (Math.sqrt(((_local3 * _local3) + (_local4 * _local4))));
}
}
}//package fai
Section 13
//Consts (fai.Consts)
package fai {
public class Consts {
public static const PICKING:uint = 10;
public static const PathfindingsPerTick:int = 1;
public static const cumulative_bomb_cost:int = 250;
public static const ATTACK:uint = 1;
public static const CrystalsPortion:int = 8;
public static const UNIT_LEAVE_COUNT:int = 100;
public static const PowerStationAdd:int = 5;
public static const ScreenHeight:int = 600;
public static const MOVING:uint = 2;
public static const DEATH:uint = 3;
public static const nitro_bomb_cost:int = 50;
public static const IDLE:uint = 0;
public static const myId:uint = 3;
public static const ScreenWidth:int = 800;
public static const GOALSCLEANPAUSE:uint = 10;
public static const Wall:uint = 1;
public static const CrystalsLoad:int = 24;
public static const MaxEnergy:int = 50;
public static const hostileId:uint = 4;
public static const crystalsId:int = 10;
public static const FrozeDelay:int = 100;
public static const cell_size:uint = 32;
public static const nuclear_missile_cost:int = 500;
}
}//package fai
Section 14
//CustomCursor (fai.CustomCursor)
package fai {
import flash.display.*;
import flash.ui.*;
public class CustomCursor extends Sprite {
private var size:uint;// = 20
public var enabled:Boolean;// = false
private var engine:Engine;// = null
private var effect:Shape;// = null
public function CustomCursor(_arg1:Engine):void{
engine = null;
size = 20;
enabled = false;
effect = null;
super();
engine = _arg1;
visible = false;
draw();
}
public function enableEffect(_arg1:String):void{
var radius:int;
var action = _arg1;
if (effect){
effect.graphics.clear();
removeChild(effect);
effect = null;
};
radius = 0;
switch (action){
case UnitTypes.nitro_bomb:
radius = 4;
break;
case UnitTypes.cumulative_bomb:
radius = 5;
break;
case UnitTypes.nuclear_missile:
radius = 8;
break;
};
effect = new Shape();
var _local3 = effect.graphics;
with (_local3) {
clear();
lineStyle(1, 0xFF3300);
beginFill(0xFFCC00, 0.5);
drawCircle(0, 0, (Consts.cell_size * radius));
endFill();
};
effect.alpha = 0.8;
addChild(effect);
}
private function draw():void{
graphics.clear();
graphics.lineStyle(2, 0xFF00);
graphics.drawCircle(0, 0, (size / 3));
}
public function hide():void{
visible = false;
Mouse.show();
}
public function enable(_arg1:Boolean):void{
if (effect){
effect.graphics.clear();
removeChild(effect);
effect = null;
};
if (_arg1){
x = engine.global_stage.stage.mouseX;
y = engine.global_stage.stage.mouseY;
show();
} else {
hide();
};
enabled = _arg1;
}
public function destroy():void{
if (effect){
effect.graphics.clear();
removeChild(effect);
effect = null;
};
}
public function show():void{
Mouse.hide();
visible = true;
}
}
}//package fai
Section 15
//DieGoal (fai.DieGoal)
package fai {
import flash.display.*;
import flash.media.*;
public class DieGoal extends Goal {
public var engine:Engine;// = null
private var spriteScale:Number;// = 1
public var unit:Unit;// = null
private var lifegoal:LifeGoal;// = null
private var framen:int;// = 0
private var esprite:Sprite;// = null
private var expl:AnimatedBitmap;// = null
private var pause:int;// = 0
private var leave:int;// = 100
private var debris:AnimatedBitmap;// = null
public function DieGoal(_arg1:Unit, _arg2:Engine, _arg3:LifeGoal):void{
unit = null;
engine = null;
leave = Consts.UNIT_LEAVE_COUNT;
lifegoal = null;
expl = null;
debris = null;
pause = 0;
spriteScale = 1;
esprite = null;
framen = 0;
super();
unit = _arg1;
engine = _arg2;
lifegoal = _arg3;
unit.destroy();
expl = new AnimatedBitmap(engine.sloader.specials[UnitTypes.sp_death1], 48, 48);
if (!unit.flag(UnitFlags.Flying)){
debris = new AnimatedBitmap(engine.sloader.specials[UnitTypes.sp_debris], 48, 48);
debris.visible = false;
};
esprite = new Sprite();
expl.x = (expl.x - (unit.sprite_width / 2));
expl.y = (expl.y - (unit.sprite.sprite.height / 2));
expl.x = (expl.x + ((unit.sprite_width - expl.width) / 2));
expl.y = (expl.y + ((unit.sprite.sprite.height - expl.height) / 2));
esprite.scaleX = (esprite.scaleY = ((_arg1.sprite_width + 10) / 48));
esprite.addChild(expl);
unit.sprite.body.addChild(esprite);
if (_arg1.mapid == Consts.crystalsId){
expl.visible = false;
};
_arg1.sprite.orders.visible = false;
engine.playSoundPos(Sound(engine.sloader.getSound(Sounds.explosion1)), unit.pos);
}
public function advance():void{
if (pause > 0){
pause--;
return;
};
if (expl.framen < expl.nframes){
spriteScale = (spriteScale - 0.2);
unit.sprite.sprite.alpha = spriteScale;
framen++;
expl.setFrame(framen);
return;
};
if (leave > 0){
if (leave == Consts.UNIT_LEAVE_COUNT){
expl.visible = false;
if (!unit.flag(UnitFlags.Flying)){
engine.game_board.resourcelayer.addChild(debris);
debris.x = unit.sprite.x;
debris.y = unit.sprite.y;
debris.scaleX = (debris.scaleY = (unit.sprite_width / 48));
debris.x = (debris.x - (debris.width / 2));
debris.y = (debris.y - (debris.height / 2));
debris.visible = true;
};
unit.sprite.sprite.visible = false;
};
leave--;
return;
};
deactivate();
}
override public function deactivate():void{
if (((debris) && (debris.visible))){
engine.game_board.resourcelayer.removeChild(debris);
debris = null;
};
super.deactivate();
lifegoal.destroy(true);
}
}
}//package fai
Section 16
//EffectGoal (fai.EffectGoal)
package fai {
public class EffectGoal extends Goal {
public var engine:Engine;// = null
public var sprite:AnimatedBitmap;// = null
private var pause:int;// = 0
private var frame:int;// = 0
public function EffectGoal(_arg1:AnimatedBitmap, _arg2:Engine):void{
sprite = null;
engine = null;
pause = 0;
frame = 0;
super();
engine = _arg2;
sprite = _arg1;
}
public function advance():void{
if (pause > 0){
pause--;
return;
};
if (frame >= sprite.nframes){
deactivate();
} else {
sprite.setFrame(frame);
frame++;
pause = 1;
return;
};
}
override public function deactivate():void{
super.deactivate();
if (sprite){
engine.game_board.bulletlayer.removeChild(sprite);
sprite = null;
};
}
}
}//package fai
Section 17
//Engine (fai.Engine)
package fai {
import flash.events.*;
import flash.display.*;
import flash.media.*;
import flash.utils.*;
import flash.geom.*;
public class Engine extends MovieClip {
public var last_loaded_level:LevelMap;// = null
public var actions:PlayerActions;// = null
public var volumeOff:Boolean;// = false
public var volume:Number;// = 1
public var game_process:GameProcess;// = null
public var harvs:Map;// = null
public var paused:Boolean;// = false
public var events:GameEvents;// = null
public var utypes:UnitTypes;// = null
public var mycolor:uint;// = 0xFF
public var play_window:PlayWindow;// = null
public var global_stage:GameStage;// = null
public var game_board:GameBoard;// = null
private var vd_timer:Timer;// = null
public var sloader:SmartLoader;// = null
public var scenario:Scenario;// = null
public var energy:int;// = 0
public var score:int;// = 0
public var hostilecolor:uint;// = 0xFF0000
var showingAds;// = false
public var command_center:Unit;// = null
public var energy_fill:int;// = 0
public var goal_system:GoalSystem;// = null
public var crystals:int;// = 0
public static var stageRadius = 0;
public function Engine(_arg1):void{
global_stage = null;
crystals = 0;
score = 0;
energy = 0;
energy_fill = 0;
mycolor = 0xFF;
hostilecolor = 0xFF0000;
paused = false;
goal_system = null;
sloader = null;
utypes = null;
events = null;
play_window = null;
game_process = null;
actions = null;
game_board = null;
scenario = null;
harvs = null;
command_center = null;
last_loaded_level = null;
volume = 1;
volumeOff = false;
vd_timer = null;
showingAds = false;
super();
global_stage = _arg1;
sloader = new SmartLoader(this);
utypes = new UnitTypes(this);
actions = new PlayerActions(this);
KeyboardKeys.init(global_stage);
}
public function pause():void{
game_board.removeBuildCursor();
if (!paused){
play_window.pause_mc.visible = true;
play_window.pause_mc.gotoAndPlay("pause");
events.unregister();
if (scenario){
scenario.stop();
};
} else {
play_window.pause_mc.stop();
play_window.pause_mc.visible = false;
events.register();
if (scenario){
scenario.run();
};
};
paused = !(paused);
}
public function victory():void{
if (showingAds){
return;
};
showingAds = true;
scenario.stop();
MochiAd.showInterLevelAd({id:"701c9f8f42284a14", res:"800x600", clip:global_stage, ad_finished:function (){
showingAds = false;
victory2();
}});
}
public function clearAll():void{
if (!game_board){
return;
};
events.unregister();
events = null;
scenario.destroy();
scenario = null;
actions.clear();
play_window.destroy();
GameStage.main_holder.removeChild(play_window);
play_window = null;
game_board.destroy();
game_board = null;
game_process.destroy();
game_process = null;
goal_system = null;
harvs = null;
command_center = null;
paused = false;
}
private function victoryHandler(_arg1:TimerEvent):void{
vd_timer.stop();
vd_timer.removeEventListener(TimerEvent.TIMER, victoryHandler);
vd_timer = null;
if (!paused){
pause();
};
if (global_stage.main_menu.planets.current_level >= 11){
finalVictory();
} else {
if (global_stage.main_menu.planets.current_level == last_loaded_level.number){
global_stage.main_menu.planets.current_level++;
};
global_stage.main_menu.planets.saveLocally();
};
play_window.custom_cursor.enable(false);
play_window.stats.victory();
play_window.stats.start();
play_window.stats.visible = true;
playSound(Sounds.menu_appear);
playSound(Sounds.tada);
}
public function playSoundPos(_arg1:Sound, _arg2:Position):void{
var _local3:SoundTransform;
var _local4:int;
var _local5:int;
var _local6:Number;
if (((((!(volume)) || (volumeOff))) || (paused))){
return;
};
_local3 = new SoundTransform();
_local4 = ((Consts.ScreenWidth / 2) - ((_arg2.x + 2) * Consts.cell_size));
_local5 = ((Consts.ScreenHeight / 2) - ((_arg2.y + 3) * Consts.cell_size));
_local6 = Math.sqrt(((_local4 * _local4) + (_local5 * _local5)));
_local3.volume = (volume / (1 + (_local6 / stageRadius)));
_local3.pan = -((1 - (Math.abs(((Math.atan2(_local5, _local4) / Math.PI) * 180)) / 90)));
_arg1.play(0, 0, _local3);
}
public function log(_arg1:String):void{
play_window.message_mc.msg.message_txt.text = _arg1;
play_window.message_mc.visible = true;
play_window.message_mc.play();
}
public function addResources(_arg1:int):void{
crystals = (crystals + _arg1);
play_window.stats.crystals = (play_window.stats.crystals + _arg1);
}
public function playSoundData(_arg1:Sound):void{
var _local2:SoundTransform;
if (volumeOff){
return;
};
_local2 = new SoundTransform();
_local2.volume = volume;
_arg1.play(0, 0, _local2);
}
public function getColor(_arg1:int):uint{
if (_arg1 == Consts.myId){
return (mycolor);
};
return (hostilecolor);
}
public function isCrystalsEnough(_arg1:String):Boolean{
return ((utypes.params(_arg1).cost_crystals <= crystals));
}
public function playLevel(_arg1:LevelMap):void{
clearAll();
global_stage.main_menu.initGame(null);
crystals = 0;
score = 0;
energy = 0;
energy_fill = 0;
goal_system = new GoalSystem();
events = new GameEvents(this);
game_board = new GameBoard(this);
play_window = new PlayWindow(this, game_board);
play_window.initialize();
GameStage.main_holder.addChild(play_window);
game_process = new GameProcess(this);
harvs = new Map();
game_board.load(_arg1);
play_window.createCustomCursor();
game_process.updatePower();
play_window.updateResources();
game_process.selected_units.push(command_center);
play_window.updateInfo();
scenario = new Scenario(this, int(_arg1.data.scenario.nwaves.@value), int(_arg1.data.@number));
last_loaded_level = _arg1;
stageRadius = Math.sqrt(((Consts.ScreenWidth * Consts.ScreenWidth) + (Consts.ScreenHeight * Consts.ScreenHeight)));
if (_arg1.number == 0){
play_window.showTutorial();
} else {
scenario.start();
events.register();
};
}
public function victory2():void{
vd_timer = new Timer(2000, 1);
vd_timer.addEventListener(TimerEvent.TIMER, victoryHandler);
vd_timer.start();
}
public function upgradeUnit(_arg1:Unit):void{
var _local2:Unit;
var _local3:Number;
var _local4:int;
var _local5:AnimatedBitmap;
if (_arg1.upgradeLevel >= 5){
return;
};
_local2 = utypes.params(_arg1.type);
_local3 = Utils.upgradeCost(_arg1.type, (_arg1.upgradeLevel + 1));
if (_arg1.mapid == Consts.hostileId){
_local3 = 0.85;
};
_local4 = (_local3 * _arg1.cost_crystals);
if (_arg1.mapid != Consts.hostileId){
if (crystals < _local4){
log("Not enough crystals");
return;
};
crystals = (crystals - _local4);
};
_arg1.upgradeLevel++;
_arg1.full_health = (_arg1.full_health + (_arg1.full_health * _local3));
_arg1.health = (_arg1.health + (_arg1.health * _local3));
_arg1.damage = (_arg1.damage + (_arg1.damage * _local3));
_arg1.armor++;
_arg1.cost_crystals = (_arg1.cost_crystals + (_arg1.cost_crystals * _local3));
_local5 = sloader.getSpecial(((_arg1.mapid == Consts.myId)) ? UnitTypes.sp_my_order : UnitTypes.sp_hostile_order);
_arg1.sprite.addOrder(_local5, _arg1.upgradeLevel);
if (((_arg1.life.repair_goal) && (_arg1.life.repair_goal.active))){
_arg1.life.repair();
_arg1.life.repair();
};
if (game_process.isUnitInSelection(_arg1)){
play_window.updateInfo();
};
play_window.updateResources();
}
private function defeatHandler(_arg1:TimerEvent):void{
vd_timer.stop();
vd_timer.removeEventListener(TimerEvent.TIMER, defeatHandler);
vd_timer = null;
if (!paused){
pause();
};
play_window.custom_cursor.enable(false);
play_window.stats.defeat();
play_window.stats.start();
play_window.stats.visible = true;
playSound(Sounds.defeat);
}
public function playSound(_arg1:int):void{
switch (_arg1){
case Sounds.upgrade:
playSoundData(new Sound_upgrade());
break;
case Sounds.click:
playSoundData(new Sound_click());
break;
case Sounds.click1:
playSoundData(new Sound_click1());
break;
case Sounds.unpause:
playSoundData(new Sound_unpause());
break;
case Sounds.build:
playSoundData(new Sound_build());
break;
case Sounds.menu_appear:
playSoundData(new Sound_stat_appear());
break;
case Sounds.defeat:
playSoundData(new Sound_defeat());
break;
case Sounds.explosion1:
playSoundData(new Sound_explosion1());
break;
case Sounds.new_wave:
playSoundData(new Sound_new_wave());
break;
case Sounds.tada:
playSoundData(new Sound_tada());
break;
};
}
public function finalVictory():void{
play_window.stats.final_victory.visible = true;
play_window.stats.play_again_button.visible = false;
play_window.stats.main_menu_button.visible = false;
}
public function gameOver():void{
scenario.stop();
vd_timer = new Timer(2000, 1);
vd_timer.addEventListener(TimerEvent.TIMER, defeatHandler);
vd_timer.start();
}
public function upgradeUnitToLevel(_arg1:Unit, _arg2:int):void{
var _local3:int;
_local3 = 0;
while (_local3 < _arg2) {
upgradeUnit(_arg1);
_local3++;
};
}
}
}//package fai
Section 18
//FastButtons (fai.FastButtons)
package fai {
import flash.events.*;
import flash.display.*;
import flash.text.*;
import flash.utils.*;
public class FastButtons extends Sprite {
private var powersOpened:Boolean;// = true
private var engine:Engine;// = null
private var buttons:Array;
private var switch_button:SwitchButton;// = null
private var powersTimer:Timer;// = null
private var fpb:Sprite;// = null
public function FastButtons(_arg1:Engine):void{
var _local2:TextFormat;
var _local3:int;
var _local4:ButtonSprite;
engine = null;
fpb = null;
powersOpened = true;
powersTimer = null;
buttons = [];
switch_button = null;
super();
engine = _arg1;
switch_button = new SwitchButton();
_local2 = switch_button.buttonLabel.defaultTextFormat;
_local2.bold = true;
switch_button.buttonLabel.defaultTextFormat = _local2;
switch_button.buttonLabel.text = "Powers";
addChild(switch_button);
switch_button.addEventListener(MouseEvent.MOUSE_DOWN, onpowers);
switch_button.gotoAndStop("opened");
switch_button.buttonMode = true;
switch_button.mouseChildren = false;
_local3 = 45;
_local4 = null;
fpb = new Sprite();
addChild(fpb);
_local4 = createButton(UnitTypes.nitro_bomb, "B");
fpb.addChild(_local4);
_local4 = createButton(UnitTypes.cumulative_bomb, "C");
fpb.addChild(_local4);
_local4.y = (_local3 + 1);
_local4 = createButton(UnitTypes.nuclear_missile, "N");
fpb.addChild(_local4);
_local4.y = ((_local3 + 1) * 2);
fpb.x = 0;
fpb.y = ((switch_button.y + switch_button.height) - 10);
powersTimer = new Timer(50, 0);
powersTimer.addEventListener(TimerEvent.TIMER, powersTimeHandler);
powersTimer.stop();
}
public function destroy():void{
var _local1:int;
switch_button.stop();
switch_button.removeEventListener(MouseEvent.MOUSE_DOWN, onpowers);
removeChild(switch_button);
switch_button = null;
if (powersTimer){
powersTimer.stop();
powersTimer.removeEventListener(TimerEvent.TIMER, powersTimeHandler);
powersTimer = null;
};
_local1 = 0;
_local1 = 0;
while (_local1 < buttons.length) {
buttons[_local1].removeEventListener(MouseEvent.CLICK, engine.play_window.buttons.onclick);
buttons[_local1].removeEventListener(MouseEvent.MOUSE_OVER, engine.play_window.buttons.onoverbutton);
buttons[_local1].removeEventListener(MouseEvent.MOUSE_OUT, engine.play_window.buttons.onoutbutton);
_local1++;
};
buttons.length = 0;
}
private function createButton(_arg1:String, _arg2:String=""):ButtonSprite{
var _local3:AnimatedBitmap;
var _local4:ButtonSprite;
_local3 = engine.sloader.getButton(_arg1);
_local4 = new ButtonSprite(_arg1, _local3);
if (_arg2 != ""){
_local4.makeHotKey(_arg2);
};
_local4.buttonMode = true;
_local4.mouseChildren = false;
_local4.addEventListener(MouseEvent.CLICK, engine.play_window.buttons.onclick);
_local4.addEventListener(MouseEvent.MOUSE_OVER, engine.play_window.buttons.onoverbutton);
_local4.addEventListener(MouseEvent.MOUSE_OUT, engine.play_window.buttons.onoutbutton);
buttons.push(_local4);
return (_local4);
}
private function onpowers(_arg1:MouseEvent):void{
if (powersOpened){
_arg1.currentTarget.gotoAndPlay("opened");
powersOpened = false;
powersTimer.start();
} else {
_arg1.currentTarget.gotoAndPlay("start");
powersOpened = true;
fpb.visible = true;
powersTimer.start();
};
}
private function powersTimeHandler(_arg1:TimerEvent):void{
var _local2:Number;
_local2 = (powersOpened) ? 0.2 : -0.2;
if (((((powersOpened) && ((fpb.scaleX < 1)))) || (((!(powersOpened)) && ((fpb.scaleY > 0.2)))))){
fpb.scaleX = (fpb.scaleX + _local2);
fpb.scaleY = (fpb.scaleY + _local2);
} else {
fpb.visible = powersOpened;
powersTimer.stop();
};
}
}
}//package fai
Section 19
//FrozeGoal (fai.FrozeGoal)
package fai {
public class FrozeGoal extends Goal {
private var goals:Array;
private var engine:Engine;// = null
private var frozen_unit:Unit;// = null
public var delay:int;// = 100
public function FrozeGoal(_arg1:Engine, _arg2:Unit):void{
var _local3:int;
var _local4:*;
engine = null;
frozen_unit = null;
goals = [];
delay = Consts.FrozeDelay;
super();
engine = _arg1;
frozen_unit = _arg2;
_local3 = 0;
_local3 = 0;
while (_local3 < engine.goal_system.goals.length) {
_local4 = engine.goal_system.goals[_local3];
if (_local4.owner == frozen_unit){
goals.push(_local4);
engine.goal_system.goals[_local3] = new Goal();
engine.goal_system.goals[_local3].deactivate();
};
_local3++;
};
}
public function advance():void{
if (delay > 0){
delay--;
return;
};
deactivate();
}
override public function deactivate():void{
var _local1:int;
super.deactivate();
_local1 = 0;
_local1 = 0;
while (_local1 < goals.length) {
engine.goal_system.add(goals[_local1]);
_local1++;
};
goals = null;
frozen_unit.life.froze_goal = null;
}
}
}//package fai
Section 20
//GameBoard (fai.GameBoard)
package fai {
import flash.display.*;
public class GameBoard extends Sprite {
public var backgr:Background;// = null
public var resourcelayer:Sprite;// = null
public var map_width:int;// = 0
public var resources:Camp;// = null
public var groundlayer:Sprite;// = null
public var my_camp:Camp;// = null
private var engine:Engine;// = null
public var build_cursor:BuildCursor;// = null
public var airlayer:Sprite;// = null
public var map_height:int;// = 0
public var maplayer:Sprite;// = null
public var selshape:Shape;// = null
public var bulletlayer:Sprite;// = null
public var airworld:MapMatrix;// = null
public var world:MapMatrix;// = null
public var unitlayer:Sprite;// = null
public var enemy_camp:Camp;// = null
public function GameBoard(_arg1:Engine):void{
engine = null;
world = null;
airworld = null;
map_width = 0;
map_height = 0;
my_camp = null;
enemy_camp = null;
resources = null;
build_cursor = null;
maplayer = null;
backgr = null;
resourcelayer = null;
unitlayer = null;
groundlayer = null;
airlayer = null;
bulletlayer = null;
selshape = null;
super();
engine = _arg1;
}
public function destroy():void{
var _local1:Unit;
var _local2:int;
_local1 = null;
_local2 = 0;
if (my_camp){
_local2 = 0;
while (_local2 < my_camp.units.length) {
_local1 = my_camp.units[_local2];
_local1.life.destroy(true);
_local2++;
};
};
if (enemy_camp){
_local2 = 0;
while (_local2 < enemy_camp.units.length) {
_local1 = enemy_camp.units[_local2];
_local1.life.destroy(true);
_local2++;
};
};
if (resources){
_local2 = 0;
while (_local2 < resources.units.length) {
_local1 = resources.units[_local2];
_local1.life.destroy(true);
_local2++;
};
};
_local2 = 0;
while (_local2 < engine.goal_system.goals.length) {
if ((engine.goal_system.goals[_local2] is LifeGoal)){
engine.goal_system.goals[_local2].destroy(true);
} else {
if (engine.goal_system.goals[_local2].active){
engine.goal_system.goals[_local2].deactivate();
};
};
_local2++;
};
engine.goal_system.goals.length = 0;
world = null;
airworld = null;
removeBuildCursor();
if (my_camp){
my_camp.units.length = 0;
};
if (enemy_camp){
enemy_camp.units.length = 0;
};
if (resources){
resources.units.length = 0;
};
map_width = 0;
map_height = 0;
removeChild(maplayer);
backgr.bitmapData.dispose();
unitlayer.removeChild(backgr);
backgr = null;
unitlayer.removeChild(resourcelayer);
resourcelayer = null;
unitlayer.removeChild(groundlayer);
groundlayer = null;
unitlayer.removeChild(airlayer);
airlayer = null;
unitlayer.removeChild(bulletlayer);
bulletlayer = null;
unitlayer.removeChild(selshape);
selshape = null;
maplayer.removeChild(unitlayer);
unitlayer = null;
maplayer = null;
}
public function buildUnit(_arg1:String, _arg2:int, _arg3:int, _arg4:int, _arg5:Boolean):Unit{
var _local6:Unit;
var _local7:Camp;
_local6 = engine.utypes.createUnit(_arg1, _arg2);
_local6.pos.set(_arg3, _arg4);
addUnit(_local6);
if (_arg5){
if (!_local6.flag(UnitFlags.Peaceful)){
_local7 = ((_local6.mapid == Consts.myId)) ? enemy_camp : my_camp;
_local6.life.attack(_local7);
} else {
if (UnitTypes.refinery == _arg1){
engine.game_process.endBuilding(_local6, UnitTypes.harvester, true);
};
};
};
return (_local6);
}
private function removeUnit(_arg1:Unit):void{
var _local2:Camp;
_local2 = null;
if (_arg1.mapid == Consts.myId){
_local2 = my_camp;
} else {
if (_arg1.mapid == Consts.hostileId){
_local2 = enemy_camp;
} else {
_local2 = resources;
};
};
_local2.remove(_arg1);
if (_arg1.flag(UnitFlags.Flying)){
airworld.setpos(_arg1.pos, 0);
} else {
if (_arg1.sprite_width > Consts.cell_size){
setUnitPos(_arg1, 0);
} else {
world.setpos(_arg1.pos, 0);
};
};
}
private function setUnitPos(_arg1:Unit, _arg2:int):void{
var _local3:MapMatrix;
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:int;
_local3 = (_arg1.flag(UnitFlags.Flying)) ? airworld : world;
if (_arg1.type == UnitTypes.command_center){
_local4 = Math.floor(((_arg1.sprite_width / Consts.cell_size) + 0.5));
_local5 = Math.floor(((_arg1.sprite.height / Consts.cell_size) + 0.5));
_local6 = (_arg1.pos.x - (_local4 / 2));
while (_local6 < ((_arg1.pos.x + (_local4 / 2)) + 1)) {
_local7 = (_arg1.pos.y - (_local5 / 2));
while (_local7 < ((_arg1.pos.y + (_local5 / 2)) + 1)) {
if ((((((((_local6 < _local3.h)) && ((_local6 >= 0)))) && ((_local7 >= 0)))) && ((_local7 < _local3.v)))){
_local3.setxy(_local6, _local7, _arg2);
};
_local7++;
};
_local6++;
};
} else {
_local3.setpos(_arg1.pos, _arg2);
};
}
private function createLayers():void{
maplayer = new Sprite();
addChildAt(maplayer, 0);
unitlayer = new Sprite();
maplayer.addChildAt(unitlayer, 0);
backgr = new Background(engine);
unitlayer.addChildAt(backgr, 0);
resourcelayer = new Sprite();
unitlayer.addChildAt(resourcelayer, 1);
groundlayer = new Sprite();
unitlayer.addChildAt(groundlayer, 2);
airlayer = new Sprite();
unitlayer.addChildAt(airlayer, 3);
bulletlayer = new Sprite();
unitlayer.addChildAt(bulletlayer, 4);
selshape = new Shape();
unitlayer.addChildAt(selshape, 5);
positionLayers();
}
public function createBuildingCursor(_arg1:String):void{
var _local2:Unit;
var _local3:BitmapData;
var _local4:AnimatedBitmap;
removeBuildCursor();
_local2 = engine.utypes.params(_arg1);
_local3 = UnitSprite.setColor(engine.sloader.getBody(_arg1), engine.mycolor);
_local4 = new AnimatedBitmap(_local3, _local2.sprite_width, _local3.height);
build_cursor = new BuildCursor(_arg1, _local4, _local2.eyerange, _local2.cost_crystals, _local2.sprite_width);
build_cursor.visible = engine.events.mouseWithinMap;
unitlayer.addChild(build_cursor);
}
public function destroyUnit(_arg1:Unit):void{
var _local2:Unit;
var _local3:Unit;
_arg1.health = 0;
if (UnitTypes.refinery == _arg1.type){
_local2 = engine.harvs.get(Utils.unitId(_arg1));
if (((_local2) && (_local2.isAlive()))){
engine.harvs.remove(Utils.unitId(_arg1));
destroyUnit(_local2);
};
} else {
if (UnitTypes.harvester == _arg1.type){
_local3 = findRefinery(_arg1);
if (((_local3) && (_local3.isAlive()))){
engine.harvs.remove(Utils.unitId(_local3));
engine.game_process.builder.addTask(_local3, UnitTypes.refinery);
};
};
};
removeUnit(_arg1);
_arg1.sprite.stopBuilding();
if (_arg1.mapid == Consts.myId){
engine.play_window.stats.lost++;
} else {
engine.crystals = (engine.crystals + (_arg1.death_cost + (_arg1.death_cost * _arg1.upgradeLevel)));
engine.play_window.stats.killed++;
engine.score = (engine.score + (_arg1.cost_crystals / 3));
};
if (engine.game_process.isUnitInSelection(_arg1)){
engine.game_process.deselectUnit(_arg1);
};
checkCursor();
engine.goal_system.removeOwner(_arg1);
engine.game_process.updatePower();
engine.play_window.updateResources();
}
public function removeBuildCursor():void{
if (build_cursor){
build_cursor.destroy();
unitlayer.removeChild(build_cursor);
build_cursor = null;
};
}
public function checkCursor():void{
var _local1:uint;
var _local2:uint;
var _local3:Boolean;
if (build_cursor != null){
build_cursor.visible = true;
_local1 = Math.floor(((unitlayer.mouseX / Consts.cell_size) + 0.5));
_local2 = Math.floor(((unitlayer.mouseY / Consts.cell_size) + 0.5));
_local3 = true;
build_cursor.x = (_local1 * Consts.cell_size);
build_cursor.y = (_local2 * Consts.cell_size);
if ((((((_local1 >= map_width)) || ((_local2 >= map_height)))) || ((_local2 < 7)))){
_local3 = false;
} else {
if (world.getxy(_local1, _local2) != 0){
_local3 = false;
};
};
build_cursor.setGood(_local3);
};
}
private function addUnit(_arg1:Unit):void{
if (_arg1.flag(UnitFlags.Flying)){
airworld.setpos(_arg1.pos, _arg1.mapid);
} else {
if (_arg1.sprite_width > Consts.cell_size){
setUnitPos(_arg1, _arg1.mapid);
} else {
world.setpos(_arg1.pos, _arg1.mapid);
};
};
_arg1.activate(engine);
_arg1.sprite.x = (_arg1.pos.x * Consts.cell_size);
_arg1.sprite.y = (_arg1.pos.y * Consts.cell_size);
_arg1.sprite.visible = true;
if (_arg1.mapid == Consts.myId){
my_camp.add(_arg1);
} else {
if (_arg1.mapid == Consts.hostileId){
enemy_camp.add(_arg1);
} else {
resources.add(_arg1);
};
};
}
private function findRefinery(_arg1:Unit):Unit{
return (_arg1.life.ore_goal.refinery);
}
public function positionLayers():void{
unitlayer.x = (Consts.cell_size / 2);
unitlayer.y = (Consts.cell_size / 2);
backgr.x = (-(Consts.cell_size) / 2);
backgr.y = (-(Consts.cell_size) / 2);
}
public function moveMap(_arg1:int, _arg2:int):void{
var _local3:int;
var _local4:int;
_local3 = (maplayer.x + _arg1);
_local4 = (maplayer.y + _arg2);
if (_local3 > 0){
maplayer.x = 0;
} else {
if ((Math.abs(_local3) + Consts.ScreenWidth) > (map_width * Consts.cell_size)){
maplayer.x = ((-(map_width) * Consts.cell_size) + Consts.ScreenWidth);
} else {
maplayer.x = _local3;
};
};
if (_local4 > 0){
maplayer.y = 0;
} else {
if ((Math.abs(_local4) + Consts.ScreenHeight) > (map_height * Consts.cell_size)){
maplayer.y = ((-(map_height) * Consts.cell_size) + Consts.ScreenHeight);
} else {
maplayer.y = _local4;
};
};
}
public function load(_arg1:LevelMap):void{
var _local2:XMLList;
var _local3:XML;
var _local4:Unit;
var _local5:XMLList;
var _local6:XML;
var _local7:XMLList;
var _local8:XML;
var _local9:XMLList;
var _local10:XML;
var _local11:Unit;
map_width = _arg1.data.size.@width;
map_height = _arg1.data.size.@height;
world = new MapMatrix(map_width, map_height);
airworld = new MapMatrix(map_width, map_height);
my_camp = new Camp();
enemy_camp = new Camp();
resources = new Camp();
createLayers();
backgr.setTileType(_arg1.data.background.@type);
_local2 = _arg1.data.wall;
for each (_local3 in _local2) {
backgr.addWall(_local3.@type, _local3.@x, _local3.@y);
};
_local4 = null;
_local5 = _arg1.data.crystals;
for each (_local6 in _local5) {
buildUnit(UnitTypes.sp_crystals, 0, _local6.@x, _local6.@y, false);
};
_local7 = _arg1.data.unit;
for each (_local8 in _local7) {
_local11 = buildUnit(_local8.@type, Consts.myId, _local8.@x, _local8.@y, true);
if (UnitTypes.command_center == _local11.type){
engine.command_center = _local11;
};
};
_local9 = _arg1.data.enemy;
for each (_local10 in _local9) {
buildUnit(_local10.@type, Consts.hostileId, _local10.@x, _local10.@y, true);
};
engine.crystals = _arg1.data.scenario.crystals.@value;
moveMap(0, (-(Consts.cell_size) * map_height));
}
}
}//package fai
Section 21
//GameButtons (fai.GameButtons)
package fai {
import flash.events.*;
import flash.display.*;
public class GameButtons extends Sprite {
public var engine:Engine;// = null
private var other_buttons:Array;
private var bomb_tooltip:BombTooltipMC;// = null
public var buttons:Map;// = null
private var container:Sprite;// = null
public var selected_unit:Unit;// = null
public function GameButtons(_arg1:Engine):void{
engine = null;
buttons = null;
container = null;
bomb_tooltip = null;
other_buttons = [];
selected_unit = null;
super();
engine = _arg1;
buttons = new Map();
create();
}
public function onoutbutton(_arg1:MouseEvent):void{
bomb_tooltip.visible = false;
if ((_arg1.currentTarget is ButtonSprite)){
_arg1.currentTarget.select(false);
if (selected_unit){
selected_unit = null;
engine.play_window.updateInfo();
};
};
}
public function create():void{
var _local1:int;
var _local2:ButtonSprite;
var _local3:int;
container = new Sprite();
addChild(container);
container.y = 2;
_local1 = 45;
_local2 = null;
_local2 = createButton(UnitTypes.laser_cannon, false, "1");
_local2 = createButton(UnitTypes.artillery, false, "2");
_local2.x = (_local1 + 4);
_local2 = createButton(UnitTypes.missile_turret, false, "3");
_local2.x = ((_local1 + 4) * 2);
_local2 = createButton(UnitTypes.plasma_mortar, false, "4");
_local2.x = ((_local1 + 4) * 3);
_local2 = createButton(UnitTypes.stunner, false, "5");
_local2.y = (_local1 + 4);
_local2 = createButton(UnitTypes.refinery, false, "6");
_local2.y = (_local1 + 4);
_local2.x = (_local1 + 4);
_local2 = createButton(UnitTypes.power_station, false, "7");
_local2.y = (_local1 + 4);
_local2.x = ((_local1 + 4) * 2);
_local3 = 447;
_local2 = createButton(UnitTypes.b_attack, true, "A");
_local2.x = (_local1 + 4);
_local2.y = ((_local1 + 4) * 2);
_local2 = createButton(UnitTypes.b_stop, true, "Space");
_local2.x = ((_local1 + 4) * 2);
_local2.y = ((_local1 + 4) * 2);
_local2 = createButton(UnitTypes.b_cancel, true, "Esc");
_local2.x = ((_local1 + 4) * 3);
_local2.y = ((_local1 + 4) * 2);
bomb_tooltip = new BombTooltipMC();
bomb_tooltip.visible = false;
engine.play_window.addChild(bomb_tooltip);
}
public function onclick(_arg1:MouseEvent):void{
if (engine.paused){
return;
};
engine.playSound(Sounds.click1);
if ((_arg1.currentTarget is ButtonSprite)){
engine.actions.buttonPressed(_arg1.currentTarget.type);
};
}
public function onoverbutton(_arg1:MouseEvent):void{
if ((_arg1.currentTarget is ButtonSprite)){
_arg1.currentTarget.select(true);
showTooltip(_arg1.target.type, _arg1.currentTarget.y);
selected_unit = engine.utypes.units[_arg1.currentTarget.type];
if (selected_unit){
engine.play_window.updateInfo();
};
};
}
public function action():void{
hideButtons();
buttons.get(UnitTypes.b_cancel).visible = true;
}
private function createButton(_arg1:String, _arg2:Boolean=false, _arg3:String=""):ButtonSprite{
var _local4:AnimatedBitmap;
var _local5:ButtonSprite;
_local4 = engine.sloader.getButton(_arg1);
_local5 = new ButtonSprite(_arg1, _local4);
_local5.addEventListener(MouseEvent.MOUSE_DOWN, onclick);
_local5.addEventListener(MouseEvent.MOUSE_OVER, onoverbutton);
_local5.addEventListener(MouseEvent.MOUSE_OUT, onoutbutton);
container.addChild(_local5);
if (_arg3 != ""){
_local5.makeHotKey(_arg3);
};
if (_arg2){
_local5.visible = false;
buttons.add(_arg1, _local5);
} else {
other_buttons.push(_local5);
};
_local5.buttonMode = true;
_local5.mouseChildren = false;
return (_local5);
}
public function showTooltip(_arg1:String, _arg2:int):void{
bomb_tooltip.x = 390;
bomb_tooltip.y = (_arg2 + 60);
switch (_arg1){
case UnitTypes.nitro_bomb:
bomb_tooltip.title.text = "Nitro Bomb (B)";
bomb_tooltip.crystals.text = Consts.nitro_bomb_cost.toString();
bomb_tooltip.epicenter.text = "250";
bomb_tooltip.visible = true;
break;
case UnitTypes.cumulative_bomb:
bomb_tooltip.title.text = "Cumulative Bomb (C)";
bomb_tooltip.crystals.text = Consts.cumulative_bomb_cost.toString();
bomb_tooltip.epicenter.text = "1000";
bomb_tooltip.visible = true;
break;
case UnitTypes.nuclear_missile:
bomb_tooltip.title.text = "Nuclear Missile (N)";
bomb_tooltip.crystals.text = Consts.nuclear_missile_cost.toString();
bomb_tooltip.epicenter.text = "5000";
bomb_tooltip.visible = true;
break;
};
}
public function showButtons(_arg1:String):void{
hideButtons();
if (!engine.utypes.params(_arg1).flag(UnitFlags.Peaceful)){
buttons.get(UnitTypes.b_attack).visible = true;
buttons.get(UnitTypes.b_stop).visible = true;
};
}
public function hideButtons():void{
var _local1:ButtonSprite;
for each (_local1 in buttons.values) {
_local1.visible = false;
};
}
public function destroy():void{
var _local1:int;
engine.play_window.removeChild(bomb_tooltip);
bomb_tooltip = null;
_local1 = 0;
_local1 = 0;
while (_local1 < other_buttons.length) {
other_buttons[_local1].removeEventListener(MouseEvent.MOUSE_DOWN, onclick);
other_buttons[_local1].removeEventListener(MouseEvent.MOUSE_OVER, onoverbutton);
other_buttons[_local1].removeEventListener(MouseEvent.MOUSE_OUT, onoutbutton);
container.removeChild(other_buttons[_local1]);
_local1++;
};
_local1 = 0;
while (_local1 < buttons.values.length) {
buttons.values[_local1].removeEventListener(MouseEvent.MOUSE_DOWN, onclick);
buttons.values[_local1].removeEventListener(MouseEvent.MOUSE_OVER, onoverbutton);
buttons.values[_local1].removeEventListener(MouseEvent.MOUSE_OUT, onoutbutton);
container.removeChild(buttons.values[_local1]);
_local1++;
};
other_buttons.length = 0;
buttons.values.length = 0;
removeChild(container);
container = null;
}
}
}//package fai
Section 22
//GameEvents (fai.GameEvents)
package fai {
import flash.events.*;
import flash.utils.*;
import flash.ui.*;
public class GameEvents {
private var engine:Engine;// = null
public var cursorpos:Position;
public var downPoint:Position;
public var mouseWithinMap:Boolean;// = false
private var radarTimer:Timer;// = null
public var selecting:Boolean;// = false
public function GameEvents(_arg1:Engine):void{
engine = null;
mouseWithinMap = false;
selecting = false;
downPoint = new Position();
cursorpos = new Position();
radarTimer = null;
super();
engine = _arg1;
}
public function unregister():void{
GameStage.main_stage.removeEventListener(Event.ENTER_FRAME, tick);
GameStage.main_stage.removeEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);
GameStage.main_stage.removeEventListener(MouseEvent.MOUSE_MOVE, onmoving);
engine.game_board.unitlayer.removeEventListener(MouseEvent.MOUSE_DOWN, onmousedown);
engine.game_board.unitlayer.removeEventListener(MouseEvent.MOUSE_UP, onmouseup);
engine.game_board.unitlayer.removeEventListener(MouseEvent.MOUSE_OUT, onmapmouseout);
engine.game_board.unitlayer.removeEventListener(MouseEvent.MOUSE_OVER, onmapmouseover);
if (radarTimer){
radarTimer.stop();
radarTimer.removeEventListener(TimerEvent.TIMER, radarTimerHander);
radarTimer = null;
};
}
public function onmousedown(_arg1:MouseEvent):void{
var _local2:uint;
var _local3:uint;
var _local4:BuildCursor;
var _local5:Unit;
var _local6:Unit;
downPoint.x = engine.game_board.unitlayer.mouseX;
downPoint.y = engine.game_board.unitlayer.mouseY;
_local2 = Math.floor(((engine.game_board.unitlayer.mouseX / Consts.cell_size) + 0.5));
_local3 = Math.floor(((engine.game_board.unitlayer.mouseY / Consts.cell_size) + 0.5));
_local4 = engine.game_board.build_cursor;
if (_local4 != null){
if (engine.paused){
return;
};
if (_local4.isGood()){
if (!engine.isCrystalsEnough(_local4.type)){
engine.log("Not enough crystals");
return;
};
if (((!((_local4.type == UnitTypes.power_station))) && ((engine.energy_fill >= engine.energy)))){
engine.log("Not enough energy. Build more power stations.");
return;
};
engine.crystals = (engine.crystals - _local4.cost_crystals);
engine.playSound(Sounds.build);
_local5 = engine.game_board.buildUnit(_local4.type, Consts.myId, _local2, _local3, false);
_local5.sprite.startBuilding();
engine.game_process.builder.addTask(_local5, _local4.type);
engine.actions.clear();
engine.game_board.removeBuildCursor();
engine.game_process.updatePower();
engine.play_window.updateResources();
engine.play_window.stats.built++;
engine.game_process.deselectUnits();
engine.game_process.selected_units.push(_local5);
engine.play_window.updateInfo();
};
return;
};
if (engine.actions.hasDoAction()){
engine.actions.doAction();
} else {
_local6 = engine.game_board.my_camp.getUnder(downPoint);
if (!_local6){
_local6 = engine.game_board.enemy_camp.getUnder(downPoint);
if (!_local6){
_local6 = engine.game_board.resources.getUnder(downPoint);
};
};
if (_local6){
if (((((!(_arg1.shiftKey)) || (!((_local6.mapid == Consts.myId))))) || ((((engine.game_process.selected_units.length > 0)) && (!((engine.game_process.selected_units[0].mapid == Consts.myId))))))){
engine.game_process.deselectUnits();
} else {
if (((_arg1.shiftKey) && (engine.game_process.isUnitInSelection(_local6)))){
engine.game_process.deselectUnit(_local6);
return;
};
};
if (engine.game_process.selected_units.length < 8){
engine.game_process.selected_units.push(_local6);
};
engine.play_window.updateInfo();
} else {
selecting = true;
};
};
}
private function onKeyDown(_arg1:KeyboardEvent):void{
if (Keyboard.ESCAPE == _arg1.keyCode){
engine.game_board.removeBuildCursor();
engine.actions.endAction();
} else {
if (Keyboard.SPACE == _arg1.keyCode){
engine.game_process.stopUnits();
} else {
if (Keyboard.F12 == _arg1.keyCode){
engine.play_window.menuPressed(null);
} else {
switch (_arg1.charCode){
case 49:
engine.actions.buttonPressed(UnitTypes.laser_cannon);
break;
case 50:
engine.actions.buttonPressed(UnitTypes.artillery);
break;
case 51:
engine.actions.buttonPressed(UnitTypes.missile_turret);
break;
case 52:
engine.actions.buttonPressed(UnitTypes.plasma_mortar);
break;
case 53:
engine.actions.buttonPressed(UnitTypes.stunner);
break;
case 54:
engine.actions.buttonPressed(UnitTypes.refinery);
break;
case 55:
engine.actions.buttonPressed(UnitTypes.power_station);
break;
case 66:
case 98:
engine.actions.buttonPressed(UnitTypes.nitro_bomb);
break;
case 67:
case 99:
engine.actions.buttonPressed(UnitTypes.cumulative_bomb);
break;
case 78:
case 110:
engine.actions.buttonPressed(UnitTypes.nuclear_missile);
break;
case 65:
case 97:
engine.actions.buttonPressed(UnitTypes.b_attack);
break;
case 85:
case 117:
engine.play_window.upgradePressed(null);
break;
case 83:
case 115:
if (engine.volumeOff){
engine.volumeOff = false;
engine.play_window.right_menu.sound_off_button.visible = true;
engine.play_window.right_menu.sound_on_button.visible = false;
} else {
engine.volumeOff = true;
engine.play_window.right_menu.sound_off_button.visible = false;
engine.play_window.right_menu.sound_on_button.visible = true;
};
break;
};
};
};
};
}
private function onmapmouseover(_arg1:MouseEvent):void{
mouseWithinMap = true;
if (engine.game_board.build_cursor){
engine.game_board.build_cursor.visible = true;
} else {
if (engine.play_window.custom_cursor.enabled){
engine.play_window.custom_cursor.show();
};
};
}
private function onmouseup(_arg1:MouseEvent):void{
if (selecting){
engine.game_process.endSelection();
};
}
private function radarTimerHander(_arg1:TimerEvent):void{
engine.play_window.radar.update();
}
public function tick(_arg1:Event):void{
engine.game_process.builder.buildTick();
Astar.npasses = 300;
engine.goal_system.tick();
}
public function register():void{
GameStage.main_stage.addEventListener(Event.ENTER_FRAME, tick);
GameStage.main_stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);
GameStage.main_stage.addEventListener(MouseEvent.MOUSE_MOVE, onmoving);
engine.game_board.unitlayer.addEventListener(MouseEvent.MOUSE_DOWN, onmousedown);
engine.game_board.unitlayer.addEventListener(MouseEvent.MOUSE_UP, onmouseup);
engine.game_board.unitlayer.addEventListener(MouseEvent.MOUSE_OUT, onmapmouseout);
engine.game_board.unitlayer.addEventListener(MouseEvent.MOUSE_OVER, onmapmouseover);
radarTimer = new Timer(1200, 0);
radarTimer.addEventListener(TimerEvent.TIMER, radarTimerHander);
radarTimer.start();
engine.play_window.radar.update();
}
private function onmoving(_arg1:MouseEvent):void{
var evt = _arg1;
cursorpos.x = evt.stageX;
cursorpos.y = evt.stageY;
engine.game_board.checkCursor();
if (engine.play_window.custom_cursor.enabled){
engine.play_window.custom_cursor.x = engine.game_board.unitlayer.mouseX;
engine.play_window.custom_cursor.y = engine.game_board.unitlayer.mouseY;
};
if (selecting){
if (!evt.buttonDown){
engine.game_process.endSelection();
return;
};
var _local3 = engine.game_board.selshape.graphics;
with (_local3) {
clear();
lineStyle(1, 1804218);
beginFill(6077415, 0.3);
drawRect(downPoint.x, downPoint.y, -((downPoint.x - engine.game_board.unitlayer.mouseX)), -((downPoint.y - engine.game_board.unitlayer.mouseY)));
endFill();
};
};
}
private function onmapmouseout(_arg1:MouseEvent):void{
mouseWithinMap = false;
if (engine.game_board.build_cursor){
engine.game_board.build_cursor.visible = false;
} else {
if (engine.play_window.custom_cursor.enabled){
engine.play_window.custom_cursor.hide();
};
};
}
}
}//package fai
Section 23
//GameProcess (fai.GameProcess)
package fai {
import flash.display.*;
public class GameProcess {
private var engine:Engine;// = null
public var selected_units:Array;
private var game_board:GameBoard;// = null
public var builder:UnitBuilder;// = null
public function GameProcess(_arg1:Engine):void{
engine = null;
builder = null;
selected_units = [];
game_board = null;
super();
engine = _arg1;
builder = new UnitBuilder(engine);
game_board = engine.game_board;
}
public function attackTarget(_arg1:Position):void{
var _local2:Unit;
var _local3:Unit;
_local2 = getUnitUnder(_arg1);
if (_local2){
for each (_local3 in selected_units) {
if (!_local3.flag(UnitFlags.Peaceful)){
_local3.life.setAttackTarget(_local2);
};
};
};
}
public function isSelectedUnit(_arg1:Unit):Boolean{
if ((((selected_units.length == 1)) && ((selected_units[0] == _arg1)))){
return (true);
};
return (false);
}
public function stopUnits():void{
var _local1:Unit;
for each (_local1 in selected_units) {
_local1.life.stop();
};
}
public function effect(_arg1:int, _arg2:int, _arg3:String):void{
var _local4:BitmapData;
var _local5:AnimatedBitmap;
var _local6:EffectGoal;
_local4 = engine.sloader.specials[_arg3][0].content.bitmapData;
_local5 = new AnimatedBitmap(_local4, 32, _local4.height);
_local5.x = _arg1;
_local5.y = _arg2;
game_board.bulletlayer.addChild(_local5);
_local6 = new EffectGoal(_local5, engine);
engine.goal_system.add(_local6);
}
public function deselectUnit(_arg1:Unit):void{
var _local2:int;
if (selected_units.length > 0){
if (isSelectedUnit(_arg1)){
_arg1.sprite.select(false);
selected_units.length = 0;
engine.actions.clear();
} else {
_local2 = 0;
while (_local2 < selected_units.length) {
if (selected_units[_local2] == _arg1){
_arg1.sprite.select(false);
selected_units.splice(_local2, 1);
break;
} else {
_local2++;
};
};
};
engine.play_window.updateInfo();
};
}
public function runBullet(_arg1:Unit, _arg2:Unit, _arg3:Position):void{
var _local4:BulletGoal;
_local4 = new BulletGoal(_arg1, _arg2, _arg3, engine);
game_board.bulletlayer.addChild(_local4.bullet);
engine.goal_system.add(_local4);
}
public function endBuilding(_arg1:Unit, _arg2:String, _arg3:Boolean):void{
var _local4:Astar;
var _local5:Position;
var _local6:Boolean;
var _local7:int;
var _local8:int;
var _local9:Unit;
var _local10:Camp;
if (((_arg3) && (isSelectedUnit(_arg1)))){
engine.actions.clear();
};
if (!engine.utypes.params(_arg2).flag(UnitFlags.Building)){
_local4 = null;
if (engine.utypes.params(_arg2).flag(UnitFlags.Flying)){
_local4 = new Astar(game_board.airworld, 0);
} else {
_local4 = new Astar(game_board.world, 0);
};
_local4.checkxy = _local4.checknotempty;
_local5 = new Position(_arg1.pos.x, _arg1.pos.y);
_local6 = false;
_local7 = (_arg1.pos.x - 1);
while (_local7 <= (_arg1.pos.x + 1)) {
_local8 = (_arg1.pos.y - 1);
while (_local8 <= (_arg1.pos.y + 1)) {
_local5.set(_local7, _local8);
if (!_local5.isequal(_arg1.pos)){
_local4.neighbours(_local5);
if (_local4.ns.length > 0){
_local9 = game_board.buildUnit(_arg2, _arg1.mapid, _local4.ns[0].x, _local4.ns[0].y, true);
if (UnitTypes.harvester == _local9.type){
engine.harvs.add(Utils.unitId(_arg1), _local9);
_local9.life.pick(_arg1);
};
_local6 = true;
break;
};
};
_local8++;
};
if (_local6){
break;
};
_local7++;
};
} else {
if (!_arg1.isAlive()){
return;
};
_arg1.sprite.stopBuilding();
if (!_arg1.flag(UnitFlags.Peaceful)){
_local10 = ((_arg1.mapid == Consts.myId)) ? game_board.enemy_camp : game_board.my_camp;
_arg1.life.attack(_local10);
} else {
if (_arg1.type == UnitTypes.refinery){
endBuilding(_arg1, UnitTypes.harvester, true);
};
};
};
updatePower();
engine.play_window.updateInfo();
engine.play_window.updateResources();
}
public function endSelection():void{
var _local1:int;
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:Array;
engine.events.selecting = false;
engine.game_board.selshape.graphics.clear();
_local1 = (engine.events.downPoint.x - game_board.unitlayer.mouseX);
_local2 = (engine.events.downPoint.y - game_board.unitlayer.mouseY);
if ((((_local1 == 0)) || ((_local2 == 0)))){
return;
};
_local3 = engine.events.downPoint.x;
_local4 = engine.events.downPoint.y;
if (_local2 > 0){
_local4 = game_board.unitlayer.mouseY;
};
if (_local1 > 0){
_local3 = game_board.unitlayer.mouseX;
};
_local5 = new Array();
game_board.my_camp.getUnderSelection(Math.floor(((_local3 / Consts.cell_size) + 0.5)), Math.floor(((_local4 / Consts.cell_size) + 0.5)), Math.floor(((Math.abs(_local1) / Consts.cell_size) + 0.5)), Math.floor(((Math.abs(_local2) / Consts.cell_size) + 0.5)), _local5);
if (_local5.length > 0){
if (_local5.length > 8){
_local5.length = 8;
};
deselectUnits();
selected_units = _local5;
engine.play_window.updateInfo();
};
}
public function deselectUnits():void{
var _local1:Unit;
if (selected_units.length > 0){
for each (_local1 in selected_units) {
_local1.sprite.select(false);
};
selected_units.length = 0;
engine.actions.clear();
};
}
public function hitUnit(_arg1:int, _arg2:Unit):void{
var _local3:int;
var _local4:int;
var _local5:Number;
if (!_arg2.isAlive()){
return;
};
if (_arg2.mapid == Consts.myId){
if (_arg2.life.auto_repair){
if (((((!(_arg2.life.repair_goal)) || (!(_arg2.life.repair_goal.active)))) && ((engine.crystals > 0)))){
_arg2.life.repair();
};
};
};
_local3 = (_arg1 - _arg2.armor);
if (_local3 <= 0){
_local3 = 1;
};
_arg2.health = (_arg2.health - _local3);
if (((_arg2.sprite.selection) && (_arg2.sprite.selection.visible))){
_arg2.updateHealth();
};
if (!_arg2.isAlive()){
if (_arg2.life.froze_goal != null){
_arg2.life.unfroze();
};
engine.game_board.destroyUnit(_arg2);
if (UnitTypes.power_station == _arg2.type){
updatePower();
};
engine.play_window.updateResources();
} else {
if (_arg2.mapid == Consts.crystalsId){
_local4 = engine.utypes.params(_arg2.type).health;
_local5 = (_arg2.health / _local4);
_arg2.sprite.sprite.setFrame(((4 - (5 * _local5)) + 1));
};
};
if (isUnitInSelection(_arg2)){
engine.play_window.updateInfo();
};
}
public function isUnitInSelection(_arg1:Unit):Boolean{
var _local2:Unit;
for each (_local2 in selected_units) {
if (_local2 == _arg1){
return (true);
};
};
return (false);
}
public function destroy():void{
builder.clear();
builder = null;
}
public function updatePower():void{
var _local1:int;
var _local2:Unit;
engine.energy = 10;
engine.energy_fill = 0;
_local1 = 0;
_local1 = 0;
while (_local1 < game_board.my_camp.units.length) {
_local2 = game_board.my_camp.units[_local1];
if (UnitTypes.power_station == _local2.type){
if (((_local2.isAlive()) && ((engine.game_process.builder.inBuilding(_local2) == null)))){
engine.energy = (engine.energy + Consts.PowerStationAdd);
};
} else {
engine.energy_fill = (engine.energy_fill + 1);
};
_local1++;
};
}
public function getUnitUnder(_arg1:Position):Unit{
var _local2:Unit;
_local2 = game_board.enemy_camp.getInMapUnder(_arg1);
if (!_local2){
_local2 = game_board.my_camp.getInMapUnder(_arg1);
};
return (_local2);
}
private function isSelectedType(_arg1:String):Boolean{
var _local2:Unit;
for each (_local2 in selected_units) {
if (_arg1 == _local2.type){
return (true);
};
};
return (false);
}
}
}//package fai
Section 24
//Goal (fai.Goal)
package fai {
public class Goal {
public var owner:Unit;// = null
public var active:Boolean;// = true
public function Goal(){
active = true;
owner = null;
super();
}
public function deactivate():void{
active = false;
}
}
}//package fai
Section 25
//GoalSystem (fai.GoalSystem)
package fai {
public class GoalSystem {
public var goals:Array;
private var active_count:int;// = 0
private var counter:int;// = 0
public function GoalSystem(){
goals = [];
counter = 0;
active_count = 0;
super();
}
public function add(_arg1):void{
goals.push(_arg1);
}
public function activeCount():int{
return (active_count);
}
private function cleanGoals():void{
var _local1:int;
_local1 = 0;
while (_local1 < goals.length) {
if (!goals[_local1].active){
delete goals[_local1];
goals.splice(_local1, 1);
} else {
_local1++;
};
};
}
public function tick():void{
var _local1:uint;
_local1 = 0;
active_count = 0;
while (_local1 < goals.length) {
if (goals[_local1].active){
goals[_local1].advance();
active_count++;
};
_local1++;
};
if (!counter){
cleanGoals();
counter = Consts.GOALSCLEANPAUSE;
} else {
counter--;
};
}
public function removeOwner(_arg1:Unit):void{
var _local2:uint;
_local2 = 0;
while (_local2 < goals.length) {
if (goals[_local2].owner == _arg1){
goals[_local2].deactivate();
};
_local2++;
};
}
}
}//package fai
Section 26
//KeyboardKeys (fai.KeyboardKeys)
package fai {
import flash.events.*;
public class KeyboardKeys {
private static var initialized:Boolean = false;
private static var keys:Object = new Object();
public static function init(_arg1):void{
GameStage.main_stage.addEventListener(KeyboardEvent.KEY_DOWN, keyPressed);
GameStage.main_stage.addEventListener(KeyboardEvent.KEY_UP, keyReleased);
initialized = true;
}
private static function keyPressed(_arg1:KeyboardEvent):void{
keys[_arg1.keyCode] = true;
}
public static function isDown(_arg1:uint):Boolean{
if (!initialized){
return (false);
};
if (Boolean((_arg1 in keys))){
return (keys[_arg1]);
};
return (false);
}
private static function keyReleased(_arg1:KeyboardEvent):void{
keys[_arg1.keyCode] = false;
}
}
}//package fai
Section 27
//LevelMap (fai.LevelMap)
package fai {
public class LevelMap {
public var number:int;// = 0
public var data:XML;// = null
public var desc:String;// = null
public var title:String;// = null
public function LevelMap(_arg1:XML):void{
data = null;
title = null;
desc = null;
number = 0;
super();
data = _arg1;
title = data.title.toString();
desc = data.description.toString();
number = int(data.@number);
}
}
}//package fai
Section 28
//LevelParams (fai.LevelParams)
package fai {
public final class LevelParams {
public static var enemy_count:Array = [4, 3, 5, 4, 3, 3, 2, 2, 2, 8, 6, 8, 6, 5, 5, 4, 4, 4, 9, 8, 9, 8, 7, 6, 5, 5, 6, 11, 9, 11, 9, 8, 8, 7, 7, 8, 14, 10, 12, 6, 5, 5, 6, 7, 8, 12, 9, 10, 6, 5, 5, 6, 6, 6, 14, 10, 12, 7, 6, 6, 7, 7, 7, 15, 11, 15, 8, 6, 6, 6, 7, 7, 16, 11, 15, 9, 7, 7, 7, 8, 8, 17, 12, 16, 10, 8, 8, 8, 9, 9, 18, 14, 17, 11, 9, 9, 9, 10, 10];
public static var bosses:Array = [[[UnitTypes.interceptor, 0]], [[UnitTypes.executor, 0]], [[UnitTypes.interceptor, 0], [UnitTypes.interceptor, 1]], [[UnitTypes.star_conqueror, 1]], [[UnitTypes.executor, 1], [UnitTypes.executor, 1]], [[UnitTypes.star_conqueror, 2]], [[UnitTypes.interceptor, 4]], [[UnitTypes.executor, 4]], [[UnitTypes.star_conqueror, 3]], [[UnitTypes.executor, 4], [UnitTypes.interceptor, 4]], [[UnitTypes.executor, 5], [UnitTypes.interceptor, 5]], [[UnitTypes.star_conqueror, 5]]];
public static var special_cases:Array = [[((0 * 10000) + 0), 8], [((0 * 10000) + 7), 1], [((1 * 10000) + 0), 25]];
}
}//package fai
Section 29
//LifeGoal (fai.LifeGoal)
package fai {
public class LifeGoal extends Goal {
private var engine:Engine;// = null
public var repair_goal:RepairGoal;// = null
public var ore_goal:OreGoal;// = null
public var goal_system:GoalSystem;// = null
public var auto_repair:Boolean;// = false
public var froze_goal:FrozeGoal;// = null
private var attack_goal:AttackGoal;// = null
public function LifeGoal(_arg1:Engine, _arg2:Unit):void{
attack_goal = null;
repair_goal = null;
ore_goal = null;
engine = null;
goal_system = null;
froze_goal = null;
auto_repair = false;
super();
owner = _arg2;
engine = _arg1;
goal_system = new GoalSystem();
}
public function advance():void{
if (repair_goal){
if (repair_goal.active){
repair_goal.advance();
} else {
repair_goal = null;
};
};
if (attack_goal){
attack_goal.advance();
};
goal_system.tick();
}
public function repair():void{
if (repair_goal){
repair_goal.deactivate();
repair_goal = null;
return;
};
repair_goal = new RepairGoal(owner, engine);
}
public function froze():void{
if (!owner.isAlive()){
return;
};
if (froze_goal != null){
froze_goal.delay = Consts.FrozeDelay;
return;
};
froze_goal = new FrozeGoal(engine, owner);
if (UnitTypes.isBoss(owner.type)){
froze_goal.delay = 50;
};
engine.goal_system.add(froze_goal);
}
public function move(_arg1:Position, _arg2:Boolean=false):void{
var _local3:*;
var _local4:MoveGoal;
for each (_local3 in goal_system.goals) {
if ((_local3 is MoveGoal)){
_local3.deactivate();
};
};
_local4 = new MoveGoal(owner, engine);
_local4.setMoveTarget(_arg1, _arg2);
goal_system.add(_local4);
if (_arg2){
if (attack_goal){
attack_goal.clearPreciseTarget();
attack_goal.paused = true;
};
} else {
if (attack_goal){
attack_goal.paused = false;
};
};
}
public function unfroze():void{
if (froze_goal){
froze_goal.deactivate();
froze_goal = null;
};
}
public function attack(_arg1:Camp):void{
if (attack_goal){
attack_goal.deactivate();
attack_goal = null;
};
attack_goal = new AttackGoal(owner, _arg1);
}
public function stop():void{
var _local1:*;
for each (_local1 in goal_system.goals) {
if ((_local1 is MoveGoal)){
_local1.deactivate();
};
};
if (attack_goal){
attack_goal.clearPreciseTarget();
};
}
public function destroy(_arg1:Boolean=false):void{
var _local2:int;
unfroze();
_local2 = 0;
while (_local2 < goal_system.goals.length) {
if (goal_system.goals[_local2].active){
goal_system.goals[_local2].deactivate();
};
_local2++;
};
goal_system.goals.length = 0;
if (repair_goal){
repair_goal.deactivate();
repair_goal = null;
};
if (attack_goal){
attack_goal.deactivate();
attack_goal = null;
};
if (ore_goal){
ore_goal.deactivate();
ore_goal = null;
};
if (((_arg1) && (owner))){
if (owner.mapid == Consts.crystalsId){
engine.game_board.resourcelayer.removeChild(owner.sprite);
} else {
if (owner.flag(UnitFlags.Flying)){
engine.game_board.airlayer.removeChild(owner.sprite);
} else {
engine.game_board.groundlayer.removeChild(owner.sprite);
};
};
owner.destroy();
owner = null;
active = false;
};
}
public function pick(_arg1:Unit):void{
if (ore_goal){
ore_goal.deactivate();
};
ore_goal = new OreGoal(owner, _arg1, engine);
goal_system.add(ore_goal);
}
override public function deactivate():void{
if (owner){
destroy();
goal_system.add(new DieGoal(owner, engine, this));
};
}
public function setAttackTarget(_arg1:Unit):void{
if (_arg1 == owner){
engine.log("I can't attack myself.");
return;
};
if (attack_goal){
attack_goal.clearPreciseTarget();
attack_goal.preciseTarget = _arg1;
};
}
}
}//package fai
Section 30
//MainMenuMC (fai.MainMenuMC)
package fai {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import mochi.*;
import flash.net.*;
public dynamic class MainMenuMC extends MovieClip {
private var link1Timer:Timer;// = null
private var linkTimer:Timer;// = null
public var engine:Engine;// = null
public var play_all_levels_button:SimpleButton;
public var start_game_button:SimpleButton;
public var onSiteBt:SimpleButton;
public var planets:PlanetsMC;// = null
public var hs_button:SimpleButton;
public var playMoreBt:SimpleButton;
public function MainMenuMC():void{
engine = null;
planets = null;
link1Timer = null;
linkTimer = null;
super();
start_game_button.addEventListener(MouseEvent.MOUSE_DOWN, startGame);
hs_button.addEventListener(MouseEvent.MOUSE_DOWN, highscores);
playMoreBt.addEventListener(MouseEvent.MOUSE_DOWN, moreGames);
onSiteBt.addEventListener(MouseEvent.MOUSE_DOWN, onSite);
play_all_levels_button.visible = false;
}
public function showPlanets():void{
planets.visible = true;
planets.show();
}
public function initGame(_arg1):void{
if (engine){
return;
};
GameStage.main_holder = new Sprite();
addChild(GameStage.main_holder);
engine = new Engine(_arg1);
planets = new PlanetsMC();
planets.init(engine);
planets.visible = false;
GameStage.main_holder.addChild(planets);
}
private function highscores(_arg1:MouseEvent):void{
var evt = _arg1;
engine.playSound(Sounds.click);
MochiScores.showLeaderboard({boardID:"eb79342347b90226", onClose:function (){
}});
}
private function linkTimerHandler(_arg1:TimerEvent):void{
var _local2:URLRequest;
linkTimer.stop();
linkTimer.removeEventListener(TimerEvent.TIMER, linkTimerHandler);
linkTimer = null;
_local2 = new URLRequest("http://www.dragongamez.com/");
}
private function link1TimerHandler(_arg1:TimerEvent):void{
var req:URLRequest;
var evt = _arg1;
link1Timer.stop();
link1Timer.addEventListener(TimerEvent.TIMER, link1TimerHandler);
link1Timer = null;
linkTimer = new Timer(3000, 1);
linkTimer.addEventListener(TimerEvent.TIMER, linkTimerHandler);
linkTimer.start();
try {
req = new URLRequest("http://www.dragongamez.com/");
} finally {
};
}
public function allLevels(_arg1:MouseEvent):void{
engine.playSound(Sounds.click);
link1Timer = new Timer(2000, 1);
link1Timer.addEventListener(TimerEvent.TIMER, link1TimerHandler);
link1Timer.start();
planets.onlyatdg.visible = true;
}
private function startGame(_arg1:MouseEvent):void{
showPlanets();
}
function onSite(_arg1:MouseEvent){
var _local2:URLRequest;
_local2 = new URLRequest("http://www.yougame.com/putonyourwebsite/");
navigateToURL(_local2, "_top");
}
function moreGames(_arg1:MouseEvent){
var _local2:URLRequest;
_local2 = new URLRequest("http://www.yougame.com/");
navigateToURL(_local2, "_top");
}
}
}//package fai
Section 31
//Map (fai.Map)
package fai {
public class Map {
public var values:Array;
protected var index_:int;// = 0
public var keys:Array;
public function Map(){
keys = new Array();
values = new Array();
index_ = 0;
super();
}
public function add(_arg1:Object, _arg2):void{
index_ = 0;
find(_arg1);
keys.splice(index_, 0, _arg1);
values.splice(index_, 0, _arg2);
}
public function empty():Boolean{
return ((keys.length == 0));
}
public function shift(){
var _local1:*;
_local1 = values.shift();
keys.shift();
return (_local1);
}
public function remove(_arg1:Object):void{
if (find(_arg1)){
keys.splice(index_, 1);
values.splice(index_, 1);
};
}
public function size():int{
return (keys.length);
}
public function pop(){
var _local1:*;
_local1 = values.pop();
keys.pop();
return (_local1);
}
public function get(_arg1:Object){
if (!find(_arg1)){
return (null);
};
return (values[index_]);
}
public function getout(_arg1:Object){
var _local2:*;
if (!find(_arg1)){
return (null);
};
_local2 = values[index_];
values.splice(index_, 1);
keys.splice(index_, 1);
return (_local2);
}
public function find(_arg1:Object):Boolean{
var _local2:int;
var _local3:int;
_local2 = 0;
_local3 = (keys.length - 1);
while (_local2 <= _local3) {
index_ = ((_local2 + _local3) >> 1);
if (_arg1 < keys[index_]){
_local3 = (index_ - 1);
} else {
if (_arg1 > keys[index_]){
_local2 = (index_ + 1);
} else {
return (true);
};
};
};
index_ = _local2;
return (false);
}
public function clear():void{
keys.length = 0;
values.length = 0;
index_ = 0;
}
}
}//package fai
Section 32
//MapMatrix (fai.MapMatrix)
package fai {
public class MapMatrix {
public var matrix:Array;
public var v:uint;// = 0
public var h:uint;// = 0
public function MapMatrix(_arg1:uint, _arg2:uint):void{
var _local3:int;
var _local4:int;
matrix = new Array();
h = 0;
v = 0;
super();
h = _arg1;
v = _arg2;
_local3 = 0;
while (_local3 < v) {
matrix.push(new Array(h));
_local4 = 0;
while (_local4 < h) {
matrix[(matrix.length - 1)][_local4] = 0;
_local4++;
};
_local3++;
};
}
public function setxy(_arg1:uint, _arg2:uint, _arg3:uint):void{
matrix[_arg2][_arg1] = _arg3;
}
public function getxy(_arg1:uint, _arg2:uint):uint{
return (matrix[_arg2][_arg1]);
}
public function clear():void{
var _local1:int;
var _local2:int;
_local1 = 0;
while (_local1 < v) {
_local2 = 0;
while (_local2 < h) {
matrix[_local1][_local2] = 0;
_local2++;
};
_local1++;
};
}
public function setpos(_arg1:Position, _arg2:uint):void{
matrix[_arg1.y][_arg1.x] = _arg2;
}
public function getpos(_arg1:Position):uint{
return (matrix[_arg1.y][_arg1.x]);
}
}
}//package fai
Section 33
//Maps (fai.Maps)
package fai {
public class Maps {
public static const maps:XML = <maps>
<level number='0'>
<title>At the periphery</title>
<description>With the Old Republic gone, an outcry of resistance begins to spread across the galaxy in protest to the new Empire's tyranny. We must make the first strike to capture distant Empire's station and use it as the general camp for our forces.</description>
<size width='25' height='23'/>
<background type='platform.jpg'/>
<unit type='Laser Cannon' x='7' y='16'/>
<unit type='Laser Cannon' x='9' y='16'/>
<unit type='Missile Turret' x='8' y='10'/>
<wall type='station_picket.png' x='3' y='9'/>
<wall type='station_picket.png' x='7' y='8'/>
<wall type='station_picket.png' x='11' y='9'/>
<wall type='station_picket.png' x='2' y='12'/>
<wall type='platformtube.png' x='16' y='14'/>
<wall type='platformtube.png' x='16' y='15'/>
<wall type='platformtube.png' x='0' y='21'/>
<unit type='Command Center' x='8' y='20'/>
<unit type='Refinery' x='15' y='18'/>
<crystals x='0' y='20'/>
<crystals x='2' y='20'/>
<crystals x='1' y='18'/>
<crystals x='1' y='16'/>
<crystals x='0' y='16'/>
<crystals x='1' y='19'/>
<crystals x='0' y='19'/>
<crystals x='0' y='17'/>
<crystals x='0' y='15'/>
<crystals x='3' y='19'/>
<crystals x='2' y='18'/>
<crystals x='14' y='22'/>
<crystals x='16' y='22'/>
<crystals x='15' y='22'/>
<crystals x='17' y='22'/>
<crystals x='18' y='22'/>
<crystals x='17' y='21'/>
<crystals x='15' y='21'/>
<crystals x='18' y='21'/>
<crystals x='18' y='20'/>
<crystals x='18' y='19'/>
<crystals x='17' y='20'/>
<crystals x='16' y='21'/>
<scenario>
<crystals value='250'/>
<nwaves value='10'/>
</scenario>
</level>
<level number='1'>
<title>Tarentin</title>
<description>We must withstand against Empire's forces and release this green world from the tyranny. This world has rich deposit of crystals and is very important for forthcoming battles.</description>
<size width='25' height='23'/>
<background type='grass.jpg'/>
<unit type='Command Center' x='2' y='21'/>
<unit type='Laser Cannon' x='2' y='17'/>
<unit type='Laser Cannon' x='5' y='18'/>
<unit type='Missile Turret' x='3' y='12'/>
<unit type='Missile Turret' x='6' y='12'/>
<unit type='Laser Cannon' x='9' y='12'/>
<unit type='Missile Turret' x='10' y='12'/>
<unit type='Refinery' x='8' y='20'/>
<crystals x='11' y='21'/>
<crystals x='12' y='21'/>
<crystals x='13' y='21'/>
<crystals x='14' y='21'/>
<crystals x='14' y='19'/>
<crystals x='14' y='20'/>
<crystals x='13' y='20'/>
<crystals x='15' y='21'/>
<crystals x='14' y='18'/>
<crystals x='14' y='15'/>
<crystals x='15' y='15'/>
<crystals x='14' y='13'/>
<crystals x='13' y='17'/>
<crystals x='14' y='16'/>
<wall type='driedtree.png' x='0' y='13'/>
<wall type='driedtree.png' x='0' y='13'/>
<wall type='driedtree.png' x='0' y='12'/>
<wall type='driedtree.png' x='7' y='17'/>
<wall type='driedtree.png' x='6' y='14'/>
<wall type='driedtree.png' x='4' y='6'/>
<wall type='driedtree.png' x='10' y='9'/>
<wall type='tree.png' x='15' y='6'/>
<wall type='tree.png' x='16' y='7'/>
<wall type='tree.png' x='16' y='10'/>
<wall type='tree.png' x='17' y='12'/>
<wall type='tree.png' x='16' y='14'/>
<wall type='tree.png' x='16' y='16'/>
<wall type='tree.png' x='16' y='17'/>
<wall type='tree.png' x='17' y='18'/>
<wall type='tree.png' x='16' y='18'/>
<wall type='tree.png' x='15' y='18'/>
<wall type='tree.png' x='16' y='15'/>
<wall type='tree.png' x='16' y='13'/>
<wall type='tree.png' x='15' y='16'/>
<wall type='tree.png' x='15' y='13'/>
<wall type='tree.png' x='16' y='11'/>
<wall type='tree.png' x='15' y='9'/>
<wall type='tree.png' x='16' y='9'/>
<wall type='tree.png' x='17' y='9'/>
<wall type='tree.png' x='16' y='19'/>
<wall type='tree.png' x='12' y='10'/>
<wall type='tree.png' x='12' y='9'/>
<wall type='tree.png' x='11' y='9'/>
<wall type='tree.png' x='3' y='7'/>
<wall type='tree.png' x='5' y='8'/>
<wall type='tree.png' x='0' y='11'/>
<wall type='tree.png' x='8' y='16'/>
<wall type='tree2.png' x='16' y='12'/>
<wall type='tree2.png' x='15' y='17'/>
<wall type='wall2.png' x='4' y='8'/>
<crystals x='12' y='22'/>
<crystals x='14' y='22'/>
<crystals x='15' y='22'/>
<crystals x='17' y='22'/>
<crystals x='16' y='22'/>
<wall type='tree.png' x='17' y='20'/>
<wall type='tree.png' x='16' y='20'/>
<wall type='tree.png' x='15' y='19'/>
<wall type='tree.png' x='16' y='18'/>
<wall type='tree.png' x='17' y='19'/>
<scenario>
<crystals value='250'/>
<nwaves value='20'/>
</scenario>
</level>
<level number='2'>
<title>Tatuim</title>
<description>Many soldiers of the Old Republic were sent into exile to this desert world. Release of this planet will bring us big forces for the Rebel.</description>
<size width='25' height='23'/>
<background type='desert.jpg'/>
<unit type='Refinery' x='5' y='19'/>
<unit type='Command Center' x='13' y='21'/>
<unit type='Artillery' x='12' y='15'/>
<unit type='Artillery' x='9' y='16'/>
<unit type='Missile Turret' x='11' y='17'/>
<crystals x='0' y='22'/>
<crystals x='0' y='20'/>
<crystals x='0' y='21'/>
<crystals x='1' y='22'/>
<crystals x='3' y='22'/>
<crystals x='4' y='22'/>
<crystals x='2' y='22'/>
<crystals x='1' y='21'/>
<crystals x='0' y='19'/>
<crystals x='1' y='19'/>
<crystals x='0' y='18'/>
<crystals x='1' y='18'/>
<crystals x='0' y='17'/>
<crystals x='1' y='17'/>
<crystals x='0' y='16'/>
<crystals x='1' y='16'/>
<crystals x='0' y='15'/>
<wall type='wall2.png' x='16' y='17'/>
<wall type='wall2.png' x='16' y='16'/>
<wall type='wall2.png' x='4' y='13'/>
<wall type='wall2.png' x='5' y='12'/>
<wall type='wall2.png' x='2' y='12'/>
<wall type='wall2.png' x='1' y='14'/>
<wall type='wall2.png' x='9' y='8'/>
<wall type='wall2.png' x='12' y='9'/>
<wall type='wall2.png' x='11' y='10'/>
<wall type='wall2.png' x='9' y='9'/>
<wall type='wall2.png' x='16' y='9'/>
<wall type='wall2.png' x='17' y='11'/>
<wall type='wall1.png' x='12' y='8'/>
<wall type='wall1.png' x='10' y='8'/>
<wall type='wall1.png' x='2' y='14'/>
<wall type='wall1.png' x='15' y='10'/>
<wall type='tree2.png' x='16' y='20'/>
<wall type='tree.png' x='16' y='18'/>
<wall type='tree.png' x='16' y='14'/>
<wall type='tree.png' x='16' y='8'/>
<wall type='tree.png' x='15' y='9'/>
<wall type='tree2.png' x='16' y='19'/>
<wall type='tree2.png' x='15' y='17'/>
<wall type='tree2.png' x='15' y='14'/>
<wall type='tree2.png' x='16' y='12'/>
<wall type='tree2.png' x='15' y='8'/>
<wall type='driedtree.png' x='5' y='12'/>
<wall type='driedtree.png' x='10' y='8'/>
<wall type='tree2.png' x='7' y='9'/>
<wall type='tree2.png' x='2' y='13'/>
<wall type='tree2.png' x='3' y='13'/>
<wall type='tree2.png' x='3' y='12'/>
<wall type='tree.png' x='17' y='19'/>
<wall type='tree.png' x='17' y='17'/>
<wall type='tree.png' x='17' y='15'/>
<wall type='tree.png' x='17' y='13'/>
<wall type='tree.png' x='17' y='11'/>
<wall type='tree.png' x='17' y='14'/>
<wall type='tree.png' x='17' y='9'/>
<wall type='tree.png' x='17' y='8'/>
<wall type='tree.png' x='17' y='6'/>
<wall type='tree.png' x='17' y='21'/>
<wall type='tree2.png' x='17' y='18'/>
<wall type='tree2.png' x='17' y='12'/>
<wall type='tree2.png' x='17' y='10'/>
<wall type='driedtree.png' x='17' y='15'/>
<scenario>
<crystals value='300'/>
<nwaves value='25'/>
</scenario>
</level>
<level number='3'>
<title>Moon of Omderoon</title>
<description>General military base of the Empire at this galaxy sector is located on the moon of the Omderoon. We must withstand strong imperial forces to destroy this base.</description>
<size width='25' height='23'/>
<background type='moon.jpg'/>
<unit type='Command Center' x='11' y='21'/>
<unit type='Power Station' x='4' y='19'/>
<unit type='Power Station' x='5' y='19'/>
<unit type='Refinery' x='16' y='18'/>
<unit type='Laser Cannon' x='10' y='16'/>
<unit type='Laser Cannon' x='11' y='16'/>
<crystals x='1' y='21'/>
<crystals x='2' y='21'/>
<crystals x='0' y='20'/>
<crystals x='0' y='21'/>
<crystals x='1' y='19'/>
<crystals x='1' y='20'/>
<crystals x='0' y='18'/>
<crystals x='0' y='16'/>
<crystals x='3' y='21'/>
<crystals x='0' y='17'/>
<crystals x='2' y='10'/>
<crystals x='1' y='11'/>
<crystals x='0' y='12'/>
<crystals x='1' y='10'/>
<crystals x='18' y='21'/>
<crystals x='17' y='22'/>
<crystals x='18' y='22'/>
<crystals x='17' y='21'/>
<crystals x='16' y='22'/>
<crystals x='19' y='21'/>
<crystals x='19' y='20'/>
<crystals x='19' y='18'/>
<crystals x='19' y='19'/>
<crystals x='18' y='20'/>
<crystals x='15' y='22'/>
<crystals x='19' y='17'/>
<wall type='moon_picket.png' x='3' y='11'/>
<wall type='moon_picket.png' x='8' y='11'/>
<wall type='moon_picket.png' x='13' y='11'/>
<wall type='station_picket.png' x='3' y='16'/>
<wall type='station_picket.png' x='5' y='16'/>
<scenario>
<crystals value='350'/>
<nwaves value='30'/>
</scenario>
</level>
<level number='4'>
<title>Kalarbik</title>
<description>First planet in center sector of the Galactic Empire. Emperor sent serious army to stop our advance.</description>
<size width='25' height='23'/>
<background type='desert.jpg'/>
<unit type='Command Center' x='11' y='20'/>
<unit type='Refinery' x='10' y='17'/>
<unit type='Power Station' x='9' y='17'/>
<unit type='Missile Turret' x='10' y='15'/>
<crystals x='5' y='16'/>
<crystals x='7' y='15'/>
<crystals x='6' y='14'/>
<crystals x='10' y='14'/>
<crystals x='12' y='14'/>
<crystals x='13' y='15'/>
<crystals x='14' y='16'/>
<crystals x='14' y='17'/>
<crystals x='11' y='14'/>
<crystals x='11' y='13'/>
<crystals x='9' y='13'/>
<crystals x='9' y='14'/>
<crystals x='10' y='13'/>
<crystals x='8' y='13'/>
<crystals x='7' y='14'/>
<crystals x='6' y='15'/>
<crystals x='6' y='16'/>
<crystals x='4' y='17'/>
<crystals x='4' y='16'/>
<crystals x='5' y='15'/>
<crystals x='6' y='14'/>
<crystals x='14' y='15'/>
<crystals x='15' y='16'/>
<crystals x='13' y='14'/>
<crystals x='12' y='15'/>
<crystals x='15' y='17'/>
<wall type='tree2.png' x='6' y='12'/>
<wall type='tree2.png' x='8' y='11'/>
<wall type='tree2.png' x='11' y='11'/>
<wall type='tree2.png' x='12' y='12'/>
<wall type='tree2.png' x='15' y='14'/>
<wall type='tree2.png' x='3' y='14'/>
<wall type='wall1.png' x='4' y='13'/>
<wall type='wall1.png' x='10' y='11'/>
<wall type='wall1.png' x='14' y='14'/>
<wall type='wall1.png' x='12' y='11'/>
<wall type='wall1.png' x='7' y='11'/>
<wall type='wall1.png' x='5' y='13'/>
<wall type='wall1.png' x='7' y='12'/>
<wall type='wall1.png' x='3' y='15'/>
<wall type='wall2.png' x='3' y='6'/>
<wall type='wall2.png' x='2' y='8'/>
<wall type='wall2.png' x='0' y='9'/>
<wall type='wall2.png' x='17' y='8'/>
<wall type='wall2.png' x='12' y='8'/>
<wall type='wall2.png' x='2' y='12'/>
<wall type='wall2.png' x='0' y='20'/>
<wall type='wall2.png' x='2' y='21'/>
<wall type='wall2.png' x='17' y='21'/>
<wall type='wall2.png' x='3' y='7'/>
<wall type='wall2.png' x='5' y='7'/>
<wall type='driedtree.png' x='0' y='20'/>
<wall type='driedtree.png' x='2' y='21'/>
<wall type='driedtree.png' x='1' y='21'/>
<wall type='driedtree.png' x='0' y='21'/>
<wall type='driedtree.png' x='16' y='21'/>
<wall type='driedtree.png' x='17' y='20'/>
<wall type='driedtree.png' x='16' y='7'/>
<wall type='driedtree.png' x='17' y='5'/>
<wall type='driedtree.png' x='17' y='8'/>
<wall type='driedtree.png' x='17' y='6'/>
<scenario>
<crystals value='300'/>
<nwaves value='35'/>
</scenario>
</level>
<level number='5'>
<title>Mantuim</title>
<description>People of Mantuim revolted against the authoritarian regime of the Galactic Empire. We must help them to destroy imperial fortifications.</description>
<size width='25' height='23'/>
<background type='grass.jpg'/>
<unit type='Command Center' x='9' y='19'/>
<unit type='Laser Cannon' x='9' y='15'/>
<unit type='Refinery' x='6' y='20'/>
<crystals x='4' y='15'/>
<crystals x='5' y='10'/>
<crystals x='4' y='19'/>
<crystals x='5' y='11'/>
<crystals x='5' y='13'/>
<crystals x='5' y='14'/>
<crystals x='6' y='9'/>
<crystals x='5' y='18'/>
<crystals x='12' y='16'/>
<crystals x='12' y='14'/>
<crystals x='12' y='15'/>
<crystals x='11' y='13'/>
<crystals x='13' y='20'/>
<crystals x='6' y='22'/>
<crystals x='7' y='22'/>
<crystals x='8' y='22'/>
<crystals x='9' y='22'/>
<crystals x='10' y='22'/>
<crystals x='11' y='22'/>
<wall type='tree.png' x='0' y='7'/>
<wall type='tree.png' x='2' y='7'/>
<wall type='tree.png' x='4' y='8'/>
<wall type='tree.png' x='2' y='9'/>
<wall type='tree.png' x='1' y='10'/>
<wall type='tree.png' x='3' y='12'/>
<wall type='tree.png' x='1' y='13'/>
<wall type='tree.png' x='2' y='15'/>
<wall type='tree.png' x='3' y='16'/>
<wall type='tree.png' x='2' y='17'/>
<wall type='tree.png' x='0' y='17'/>
<wall type='tree.png' x='0' y='15'/>
<wall type='tree.png' x='0' y='12'/>
<wall type='tree.png' x='0' y='9'/>
<wall type='tree.png' x='2' y='10'/>
<wall type='tree.png' x='3' y='13'/>
<wall type='tree.png' x='2' y='12'/>
<wall type='tree.png' x='1' y='8'/>
<wall type='tree.png' x='1' y='14'/>
<wall type='tree.png' x='1' y='16'/>
<wall type='tree.png' x='0' y='11'/>
<wall type='tree.png' x='3' y='10'/>
<wall type='tree.png' x='0' y='6'/>
<wall type='tree.png' x='2' y='6'/>
<wall type='tree.png' x='3' y='8'/>
<wall type='tree.png' x='1' y='20'/>
<wall type='tree.png' x='1' y='18'/>
<wall type='tree.png' x='0' y='19'/>
<wall type='tree.png' x='2' y='19'/>
<wall type='tree.png' x='3' y='20'/>
<wall type='tree.png' x='11' y='7'/>
<wall type='tree.png' x='12' y='9'/>
<wall type='tree.png' x='14' y='10'/>
<wall type='tree.png' x='14' y='12'/>
<wall type='tree.png' x='13' y='13'/>
<wall type='tree.png' x='14' y='15'/>
<wall type='tree.png' x='15' y='16'/>
<wall type='tree.png' x='15' y='17'/>
<wall type='tree.png' x='13' y='18'/>
<wall type='tree.png' x='14' y='19'/>
<wall type='tree.png' x='15' y='20'/>
<wall type='tree.png' x='17' y='18'/>
<wall type='tree.png' x='17' y='17'/>
<wall type='tree.png' x='16' y='15'/>
<wall type='tree.png' x='16' y='14'/>
<wall type='tree.png' x='17' y='13'/>
<wall type='tree.png' x='16' y='10'/>
<wall type='tree.png' x='16' y='9'/>
<wall type='tree.png' x='14' y='8'/>
<wall type='tree.png' x='14' y='8'/>
<wall type='tree.png' x='16' y='10'/>
<wall type='tree.png' x='16' y='12'/>
<wall type='tree.png' x='15' y='14'/>
<wall type='tree.png' x='14' y='13'/>
<wall type='tree.png' x='14' y='11'/>
<wall type='tree.png' x='14' y='9'/>
<wall type='tree.png' x='16' y='8'/>
<wall type='tree.png' x='13' y='7'/>
<wall type='tree.png' x='12' y='12'/>
<wall type='tree.png' x='16' y='12'/>
<wall type='tree.png' x='18' y='11'/>
<wall type='tree.png' x='17' y='9'/>
<wall type='tree.png' x='15' y='7'/>
<wall type='tree.png' x='15' y='11'/>
<wall type='tree.png' x='13' y='16'/>
<wall type='tree.png' x='13' y='14'/>
<wall type='tree.png' x='11' y='11'/>
<wall type='tree.png' x='13' y='11'/>
<wall type='tree.png' x='17' y='20'/>
<wall type='tree2.png' x='16' y='19'/>
<wall type='tree2.png' x='15' y='18'/>
<wall type='tree2.png' x='14' y='17'/>
<wall type='tree2.png' x='17' y='16'/>
<wall type='tree2.png' x='15' y='13'/>
<wall type='tree2.png' x='16' y='11'/>
<wall type='tree2.png' x='15' y='9'/>
<wall type='tree2.png' x='13' y='10'/>
<wall type='tree2.png' x='2' y='14'/>
<wall type='tree2.png' x='1' y='11'/>
<wall type='tree2.png' x='0' y='10'/>
<wall type='tree2.png' x='0' y='8'/>
<wall type='tree2.png' x='0' y='18'/>
<wall type='tree2.png' x='0' y='13'/>
<wall type='tree2.png' x='0' y='14'/>
<wall type='tree2.png' x='16' y='17'/>
<wall type='station_picket.png' x='0' y='21'/>
<wall type='station_picket.png' x='2' y='21'/>
<wall type='station_picket.png' x='14' y='21'/>
<wall type='station_picket.png' x='16' y='21'/>
<scenario>
<crystals value='350'/>
<nwaves value='40'/>
</scenario>
</level>
<level number='6'>
<title>Battlestation</title>
<description>We must withstand against forces of the biggest battle station of the Empire. The station is ready to attack!</description>
<size width='25' height='23'/>
<background type='platform.jpg'/>
<unit type='Command Center' x='11' y='20'/>
<unit type='Refinery' x='15' y='21'/>
<unit type='Power Station' x='17' y='21'/>
<crystals x='1' y='22'/>
<crystals x='2' y='22'/>
<crystals x='4' y='22'/>
<crystals x='0' y='22'/>
<crystals x='1' y='20'/>
<crystals x='1' y='18'/>
<crystals x='2' y='16'/>
<crystals x='3' y='19'/>
<crystals x='0' y='19'/>
<crystals x='0' y='15'/>
<crystals x='1' y='16'/>
<crystals x='2' y='20'/>
<crystals x='3' y='21'/>
<crystals x='0' y='17'/>
<crystals x='1' y='21'/>
<wall type='platformtube.png' x='5' y='20'/>
<wall type='platformtube.png' x='5' y='19'/>
<wall type='platformtube.png' x='5' y='18'/>
<wall type='platformtube.png' x='5' y='17'/>
<wall type='platformtube.png' x='5' y='16'/>
<wall type='station_picket.png' x='6' y='12'/>
<wall type='station_picket.png' x='8' y='11'/>
<wall type='station_picket.png' x='11' y='11'/>
<wall type='station_picket.png' x='14' y='11'/>
<wall type='station_picket.png' x='16' y='12'/>
<wall type='moon_picket.png' x='16' y='16'/>
<scenario>
<crystals value='350'/>
<nwaves value='45'/>
</scenario>
</level>
<level number='7'>
<title>Antiock</title>
<description>Antiock is the first of the three great galaxy planets. We must withstand against huge military forces in this region.</description>
<size width='25' height='23'/>
<background type='stone.jpg'/>
<unit type='Command Center' x='9' y='20'/>
<unit type='Missile Turret' x='9' y='16'/>
<unit type='Refinery' x='14' y='19'/>
<crystals x='1' y='21'/>
<crystals x='2' y='22'/>
<crystals x='3' y='22'/>
<crystals x='5' y='22'/>
<crystals x='1' y='22'/>
<crystals x='0' y='20'/>
<crystals x='2' y='21'/>
<crystals x='4' y='22'/>
<crystals x='2' y='20'/>
<crystals x='1' y='19'/>
<crystals x='0' y='17'/>
<crystals x='3' y='21'/>
<crystals x='2' y='18'/>
<crystals x='1' y='18'/>
<crystals x='15' y='21'/>
<crystals x='17' y='22'/>
<crystals x='17' y='20'/>
<crystals x='18' y='20'/>
<crystals x='18' y='21'/>
<crystals x='16' y='21'/>
<crystals x='15' y='22'/>
<crystals x='16' y='20'/>
<crystals x='17' y='19'/>
<crystals x='17' y='18'/>
<crystals x='19' y='19'/>
<crystals x='19' y='22'/>
<wall type='hatch.png' x='5' y='9'/>
<wall type='hatch.png' x='5' y='12'/>
<wall type='hatch.png' x='5' y='15'/>
<wall type='hatch.png' x='9' y='12'/>
<wall type='hatch.png' x='13' y='12'/>
<wall type='hatch.png' x='13' y='9'/>
<wall type='hatch.png' x='13' y='15'/>
<wall type='hatch.png' x='13' y='15'/>
<wall type='tree.png' x='3' y='15'/>
<wall type='tree.png' x='3' y='13'/>
<wall type='tree.png' x='3' y='11'/>
<wall type='tree.png' x='3' y='9'/>
<wall type='tree.png' x='3' y='7'/>
<wall type='tree.png' x='3' y='17'/>
<wall type='tree.png' x='15' y='7'/>
<wall type='tree.png' x='15' y='9'/>
<wall type='tree.png' x='15' y='11'/>
<wall type='tree.png' x='15' y='13'/>
<wall type='tree.png' x='15' y='15'/>
<wall type='tree.png' x='15' y='17'/>
<wall type='station_picket.png' x='1' y='14'/>
<wall type='station_picket.png' x='1' y='11'/>
<wall type='station_picket.png' x='17' y='10'/>
<wall type='station_picket.png' x='17' y='13'/>
<wall type='station_picket.png' x='17' y='16'/>
<scenario>
<crystals value='300'/>
<nwaves value='50'/>
</scenario>
</level>
<level number='8'>
<title>Antiock Counter Strike</title>
<description>We destroyed first wave of the great imperial forces. Now we must withstand against second great wave on Antiock!</description>
<size width='25' height='23'/>
<background type='stone.jpg'/>
<unit type='Command Center' x='9' y='20'/>
<unit type='Laser Cannon' x='9' y='16'/>
<crystals x='1' y='21'/>
<crystals x='2' y='22'/>
<crystals x='3' y='22'/>
<crystals x='1' y='22'/>
<crystals x='0' y='20'/>
<crystals x='2' y='21'/>
<crystals x='4' y='22'/>
<crystals x='2' y='20'/>
<crystals x='3' y='21'/>
<crystals x='1' y='18'/>
<crystals x='15' y='21'/>
<crystals x='17' y='22'/>
<crystals x='17' y='20'/>
<crystals x='15' y='22'/>
<crystals x='16' y='20'/>
<crystals x='19' y='22'/>
<crystals x='10' y='22'/>
<crystals x='11' y='22'/>
<crystals x='12' y='22'/>
<wall type='hatch.png' x='5' y='9'/>
<wall type='wall2.png' x='5' y='12'/>
<wall type='hatch.png' x='5' y='15'/>
<wall type='moon_picket.png' x='8' y='12'/>
<wall type='moon_picket.png' x='10' y='12'/>
<wall type='hatch.png' x='13' y='12'/>
<wall type='wall2.png' x='13' y='9'/>
<wall type='hatch.png' x='13' y='15'/>
<wall type='hatch.png' x='13' y='15'/>
<wall type='driedtree.png' x='3' y='15'/>
<wall type='driedtree.png' x='3' y='13'/>
<wall type='driedtree.png' x='3' y='11'/>
<wall type='driedtree.png' x='3' y='9'/>
<wall type='driedtree.png' x='3' y='7'/>
<wall type='driedtree.png' x='3' y='17'/>
<wall type='driedtree.png' x='15' y='7'/>
<wall type='driedtree.png' x='15' y='9'/>
<wall type='driedtree.png' x='15' y='11'/>
<wall type='driedtree.png' x='15' y='13'/>
<wall type='driedtree.png' x='15' y='15'/>
<wall type='driedtree.png' x='15' y='17'/>
<wall type='station_picket.png' x='1' y='14'/>
<wall type='station_picket.png' x='1' y='11'/>
<wall type='station_picket.png' x='17' y='10'/>
<wall type='station_picket.png' x='17' y='13'/>
<wall type='station_picket.png' x='17' y='16'/>
<scenario>
<crystals value='300'/>
<nwaves value='60'/>
</scenario>
</level>
<level number='9'>
<title>Forests of Priah</title>
<description>Forests of Priah contain many imperial soldiers. We must destroy them all to approach Galactic Capitol planet.</description>
<size width='25' height='23'/>
<background type='grass.jpg'/>
<unit type='Command Center' x='12' y='16'/>
<unit type='Missile Turret' x='12' y='14'/>
<unit type='Laser Cannon' x='9' y='20'/>
<unit type='Refinery' x='12' y='18'/>
<crystals x='16' y='11'/>
<crystals x='16' y='12'/>
<crystals x='17' y='15'/>
<crystals x='18' y='15'/>
<crystals x='16' y='13'/>
<crystals x='17' y='14'/>
<crystals x='14' y='12'/>
<crystals x='15' y='12'/>
<crystals x='15' y='13'/>
<crystals x='18' y='17'/>
<crystals x='18' y='16'/>
<crystals x='17' y='18'/>
<crystals x='16' y='19'/>
<crystals x='17' y='17'/>
<crystals x='10' y='14'/>
<crystals x='10' y='13'/>
<crystals x='15' y='21'/>
<crystals x='16' y='22'/>
<crystals x='15' y='20'/>
<wall type='tree.png' x='9' y='7'/>
<wall type='tree.png' x='13' y='7'/>
<wall type='tree.png' x='10' y='9'/>
<wall type='tree.png' x='7' y='11'/>
<wall type='tree.png' x='5' y='9'/>
<wall type='tree.png' x='6' y='8'/>
<wall type='tree.png' x='8' y='8'/>
<wall type='tree.png' x='8' y='10'/>
<wall type='tree.png' x='10' y='7'/>
<wall type='tree.png' x='11' y='7'/>
<wall type='tree.png' x='12' y='9'/>
<wall type='tree.png' x='12' y='8'/>
<wall type='tree.png' x='14' y='8'/>
<wall type='tree.png' x='16' y='7'/>
<wall type='tree.png' x='13' y='10'/>
<wall type='tree.png' x='16' y='9'/>
<wall type='tree.png' x='17' y='12'/>
<wall type='tree.png' x='18' y='13'/>
<wall type='tree.png' x='19' y='15'/>
<wall type='tree.png' x='19' y='17'/>
<wall type='tree.png' x='18' y='19'/>
<wall type='tree.png' x='17' y='19'/>
<wall type='tree.png' x='18' y='18'/>
<wall type='tree.png' x='19' y='11'/>
<wall type='tree.png' x='17' y='10'/>
<wall type='tree.png' x='17' y='8'/>
<wall type='tree.png' x='15' y='8'/>
<wall type='tree.png' x='18' y='11'/>
<wall type='tree.png' x='13' y='9'/>
<wall type='tree.png' x='9' y='9'/>
<wall type='tree.png' x='7' y='9'/>
<wall type='tree.png' x='8' y='12'/>
<wall type='tree.png' x='7' y='13'/>
<wall type='tree.png' x='7' y='15'/>
<wall type='tree.png' x='7' y='16'/>
<wall type='tree.png' x='2' y='15'/>
<wall type='tree.png' x='3' y='16'/>
<wall type='tree.png' x='4' y='15'/>
<wall type='tree.png' x='5' y='16'/>
<wall type='tree.png' x='6' y='14'/>
<wall type='tree.png' x='6' y='13'/>
<wall type='tree.png' x='6' y='11'/>
<wall type='tree.png' x='4' y='12'/>
<wall type='tree.png' x='5' y='14'/>
<wall type='tree.png' x='4' y='13'/>
<wall type='tree.png' x='3' y='14'/>
<wall type='tree.png' x='3' y='13'/>
<wall type='tree.png' x='3' y='11'/>
<wall type='tree.png' x='4' y='10'/>
<wall type='tree.png' x='5' y='11'/>
<wall type='tree.png' x='6' y='10'/>
<wall type='tree.png' x='6' y='12'/>
<wall type='tree.png' x='8' y='14'/>
<wall type='tree.png' x='2' y='17'/>
<wall type='tree.png' x='9' y='11'/>
<wall type='tree.png' x='18' y='21'/>
<wall type='tree.png' x='17' y='21'/>
<wall type='tree.png' x='16' y='20'/>
<wall type='tree.png' x='18' y='20'/>
<wall type='tree2.png' x='10' y='8'/>
<wall type='tree2.png' x='7' y='10'/>
<wall type='tree2.png' x='5' y='13'/>
<wall type='tree2.png' x='4' y='16'/>
<wall type='tree2.png' x='19' y='13'/>
<wall type='tree2.png' x='19' y='12'/>
<wall type='tree2.png' x='15' y='9'/>
<wall type='tree2.png' x='17' y='9'/>
<wall type='tree.png' x='19' y='10'/>
<wall type='tree.png' x='19' y='8'/>
<wall type='tree.png' x='18' y='9'/>
<wall type='tree.png' x='19' y='7'/>
<wall type='tree.png' x='18' y='6'/>
<wall type='tree.png' x='15' y='6'/>
<wall type='tree.png' x='4' y='8'/>
<wall type='tree.png' x='4' y='6'/>
<wall type='tree.png' x='6' y='7'/>
<wall type='tree.png' x='6' y='6'/>
<wall type='tree.png' x='8' y='7'/>
<wall type='tree.png' x='9' y='6'/>
<wall type='tree.png' x='13' y='6'/>
<wall type='tree.png' x='11' y='6'/>
<wall type='tree.png' x='3' y='8'/>
<wall type='tree2.png' x='19' y='19'/>
<wall type='tree2.png' x='4' y='9'/>
<wall type='tree2.png' x='3' y='7'/>
<wall type='tree2.png' x='17' y='7'/>
<scenario>
<crystals value='300'/>
<nwaves value='70'/>
</scenario>
</level>
<level number='10'>
<title>Moon of the Capitol</title>
<description>After bloody operation we have established base on the general defensive outpost of the Capitol. Now we have to withstand all waves to destroy the base.</description>
<size width='25' height='23'/>
<background type='moon.jpg'/>
<unit type='Command Center' x='10' y='19'/>
<unit type='Refinery' x='14' y='18'/>
<crystals x='5' y='22'/>
<crystals x='1' y='22'/>
<crystals x='2' y='22'/>
<crystals x='3' y='21'/>
<crystals x='4' y='22'/>
<crystals x='1' y='19'/>
<crystals x='0' y='17'/>
<crystals x='1' y='16'/>
<crystals x='2' y='19'/>
<crystals x='1' y='21'/>
<crystals x='5' y='21'/>
<crystals x='3' y='19'/>
<crystals x='2' y='18'/>
<crystals x='1' y='18'/>
<crystals x='1' y='15'/>
<crystals x='0' y='13'/>
<crystals x='0' y='16'/>
<crystals x='0' y='18'/>
<crystals x='0' y='19'/>
<crystals x='0' y='21'/>
<crystals x='2' y='20'/>
<crystals x='3' y='22'/>
<crystals x='6' y='22'/>
<crystals x='14' y='22'/>
<crystals x='16' y='22'/>
<crystals x='17' y='22'/>
<crystals x='18' y='21'/>
<crystals x='18' y='20'/>
<crystals x='18' y='22'/>
<crystals x='19' y='20'/>
<crystals x='18' y='18'/>
<crystals x='19' y='16'/>
<crystals x='18' y='14'/>
<crystals x='18' y='17'/>
<crystals x='17' y='19'/>
<crystals x='16' y='20'/>
<crystals x='16' y='21'/>
<crystals x='17' y='21'/>
<crystals x='18' y='19'/>
<crystals x='18' y='16'/>
<crystals x='18' y='15'/>
<crystals x='12' y='22'/>
<crystals x='15' y='21'/>
<wall type='station_picket.png' x='5' y='9'/>
<wall type='station_picket.png' x='10' y='9'/>
<wall type='station_picket.png' x='15' y='9'/>
<wall type='moon_picket.png' x='5' y='14'/>
<wall type='moon_picket.png' x='15' y='14'/>
<wall type='moon_picket.png' x='1' y='6'/>
<scenario>
<crystals value='350'/>
<nwaves value='80'/>
</scenario>
</level>
<level number='11'>
<title>The Capitol</title>
<description>General city and capital of the Galactic Empire. Capitol government assembled military forces from all the Empire to destroy us.</description>
<size width='25' height='23'/>
<background type='stone.jpg'/>
<unit type='Command Center' x='10' y='19'/>
<unit type='Refinery' x='7' y='19'/>
<unit type='Laser Cannon' x='10' y='16'/>
<crystals x='5' y='22'/>
<crystals x='7' y='22'/>
<crystals x='6' y='22'/>
<crystals x='8' y='22'/>
<crystals x='9' y='22'/>
<crystals x='4' y='22'/>
<crystals x='3' y='22'/>
<crystals x='3' y='20'/>
<crystals x='4' y='20'/>
<crystals x='3' y='21'/>
<crystals x='2' y='21'/>
<crystals x='2' y='20'/>
<crystals x='2' y='18'/>
<crystals x='4' y='21'/>
<crystals x='12' y='22'/>
<crystals x='13' y='22'/>
<crystals x='16' y='20'/>
<crystals x='16' y='18'/>
<crystals x='14' y='21'/>
<crystals x='15' y='20'/>
<crystals x='16' y='19'/>
<crystals x='5' y='21'/>
<crystals x='3' y='19'/>
<crystals x='2' y='17'/>
<crystals x='3' y='14'/>
<crystals x='13' y='21'/>
<crystals x='14' y='19'/>
<wall type='station_picket.png' x='4' y='7'/>
<wall type='station_picket.png' x='9' y='7'/>
<wall type='station_picket.png' x='14' y='7'/>
<wall type='tree.png' x='0' y='6'/>
<wall type='tree.png' x='0' y='7'/>
<wall type='tree.png' x='0' y='9'/>
<wall type='tree.png' x='0' y='10'/>
<wall type='tree.png' x='0' y='12'/>
<wall type='tree.png' x='0' y='14'/>
<wall type='tree.png' x='0' y='16'/>
<wall type='tree.png' x='0' y='20'/>
<wall type='tree.png' x='1' y='21'/>
<wall type='tree.png' x='0' y='21'/>
<wall type='tree.png' x='0' y='19'/>
<wall type='tree.png' x='0' y='17'/>
<wall type='tree.png' x='0' y='15'/>
<wall type='tree.png' x='0' y='12'/>
<wall type='tree.png' x='1' y='10'/>
<wall type='tree.png' x='1' y='14'/>
<wall type='tree.png' x='1' y='12'/>
<wall type='tree.png' x='1' y='8'/>
<wall type='tree.png' x='17' y='8'/>
<wall type='tree.png' x='17' y='11'/>
<wall type='tree.png' x='17' y='12'/>
<wall type='tree.png' x='17' y='13'/>
<wall type='tree.png' x='17' y='16'/>
<wall type='tree.png' x='18' y='17'/>
<wall type='tree.png' x='17' y='19'/>
<wall type='tree.png' x='17' y='21'/>
<wall type='tree.png' x='16' y='22'/>
<wall type='tree.png' x='15' y='22'/>
<wall type='tree.png' x='16' y='21'/>
<wall type='tree.png' x='15' y='21'/>
<wall type='tree.png' x='18' y='22'/>
<wall type='tree.png' x='18' y='19'/>
<wall type='tree.png' x='17' y='18'/>
<wall type='tree.png' x='18' y='14'/>
<wall type='tree.png' x='18' y='15'/>
<wall type='tree.png' x='18' y='12'/>
<wall type='tree.png' x='17' y='10'/>
<wall type='tree.png' x='16' y='11'/>
<wall type='tree.png' x='15' y='10'/>
<wall type='tree.png' x='16' y='8'/>
<wall type='tree.png' x='18' y='10'/>
<wall type='tree.png' x='3' y='17'/>
<wall type='tree.png' x='3' y='15'/>
<wall type='tree.png' x='2' y='15'/>
<wall type='tree.png' x='2' y='12'/>
<wall type='tree.png' x='1' y='7'/>
<wall type='tree.png' x='1' y='5'/>
<wall type='tree.png' x='0' y='5'/>
<wall type='hatch.png' x='7' y='15'/>
<wall type='hatch.png' x='7' y='12'/>
<wall type='hatch.png' x='12' y='12'/>
<wall type='hatch.png' x='12' y='15'/>
<scenario>
<crystals value='350'/>
<nwaves value='90'/>
</scenario>
</level>
</maps>
;
}
}//package fai
Section 34
//MoveGoal (fai.MoveGoal)
package fai {
public class MoveGoal extends Goal {
private var engine:Engine;// = null
public var pathindex:uint;// = 0
public var target:Position;
public var world:MapMatrix;// = null
private var nchecks:int;// = 0
public var path:Array;
private var ntries:int;// = 0
private var searchRange:uint;// = 0
private var pause:uint;// = 0
public var astar:Astar;// = null
private var forcemove:Boolean;// = false
public static const FindNearPlaceTries:uint = 10;
public static const PAUSE:uint = 5;
public static const MaxSearchTries:uint = 3000;
public static const MaxChecks:uint = 3;
public function MoveGoal(_arg1:Unit, _arg2:Engine):void{
target = new Position();
path = new Array();
pathindex = 0;
world = null;
pause = 0;
ntries = 0;
nchecks = 0;
astar = null;
forcemove = false;
searchRange = 0;
engine = null;
super();
engine = _arg2;
owner = _arg1;
if (owner.flag(UnitFlags.Flying)){
world = engine.game_board.airworld;
} else {
world = engine.game_board.world;
};
astar = new Astar(world, owner.mapid);
}
public function advance():void{
var _local1:uint;
if (Consts.MOVING == owner.cstate){
owner.move();
} else {
if (Consts.IDLE == owner.cstate){
if (target.isequal(owner.pos)){
deactivate();
} else {
if (pause > 0){
pause--;
if (!pause){
if (((path.length) && (world.getpos(path[pathindex])))){
nchecks++;
if (nchecks >= MaxChecks){
setMoveTarget(target, false);
nchecks = 0;
};
} else {
nchecks = 0;
};
};
} else {
if (path.length > 0){
_local1 = world.getpos(path[pathindex]);
if (((!(owner.pos.isequal(path[pathindex]))) && (!((_local1 == 0))))){
if (Consts.Wall == _local1){
setMoveTarget(target, false);
} else {
pause = PAUSE;
return;
};
} else {
owner.startmove(path[pathindex]);
world.setpos(path[pathindex], owner.mapid);
pathindex++;
owner.move();
};
} else {
keepSearching();
};
};
};
};
};
}
public function setMoveTarget(_arg1:Position, _arg2:Boolean):void{
path.length = 0;
pathindex = 0;
target.copy(_arg1);
if (((forcemove) || (_arg2))){
astar.checkxy = astar.checknotempty;
forcemove = _arg2;
};
if (!astar.startDirectSearch(owner.pos, target)){
pause = PAUSE;
};
}
private function keepSearching():void{
var _local1:int;
var _local2:int;
var _local3:Number;
var _local4:Number;
if (!astar.search(path)){
ntries++;
setMoveTarget(target, false);
pause = PAUSE;
} else {
if (path.length > 0){
nchecks = (ntries = 0);
_local1 = Math.floor(((owner.sprite.x / Consts.cell_size) + 0.5));
_local2 = Math.floor(((owner.sprite.y / Consts.cell_size) + 0.5));
if (((!((_local1 == owner.pos.x))) || (!((_local2 == owner.pos.y))))){
_local3 = Math.sqrt((((target.x - _local1) * (target.x - _local1)) + ((target.y - _local2) * (target.y - _local2))));
_local4 = Math.sqrt((((target.x - owner.pos.x) * (target.x - owner.pos.x)) + ((target.y - owner.pos.y) * (target.y - owner.pos.y))));
if (_local4 < _local3){
path.unshift(new Position(owner.pos.x, owner.pos.y));
};
};
};
};
}
private function cleanup():void{
if (owner){
astar = null;
if ((((((pathindex > 0)) && (path.length))) && (!(owner.pos.isequal(path[(pathindex - 1)]))))){
world.setpos(path[(pathindex - 1)], 0);
};
if (owner.cstate == Consts.MOVING){
owner.cstate = Consts.IDLE;
};
owner = null;
path.length = 0;
};
}
override public function deactivate():void{
super.deactivate();
cleanup();
}
}
}//package fai
Section 35
//OreGoal (fai.OreGoal)
package fai {
public class OreGoal extends Goal {
private var engine:Engine;// = null
public var harvested:int;// = 0
public var goto_ore:Position;// = null
private var move_goal:OreMoveGoal;// = null
public var goto_refinery:Position;// = null
private var pick:int;// = 0
public var ore:Unit;// = null
public var refinery:Unit;// = null
public var pause:int;// = 0
private static const picktime:int = 50;
public function OreGoal(_arg1:Unit, _arg2:Unit, _arg3:Engine):void{
engine = null;
pick = 0;
ore = null;
move_goal = null;
goto_ore = null;
goto_refinery = null;
pause = 0;
harvested = 0;
refinery = null;
super();
engine = _arg3;
owner = _arg1;
refinery = _arg2;
gotoOre();
}
private function isNearRefinery():Boolean{
return ((((Math.abs((owner.pos.x - goto_refinery.x)) <= 1)) && ((Math.abs((owner.pos.y - goto_refinery.y)) <= 1))));
}
public function advance():void{
var _local1:int;
var _local2:int;
var _local3:int;
if (pause > 0){
pause--;
if (!pause){
gotoRefinery();
};
return;
};
if (Consts.PICKING == owner.cstate){
if (pick > 0){
if (owner.rotating){
owner.rotate();
return;
};
pick--;
} else {
_local1 = ((ore.health > Consts.CrystalsPortion)) ? Consts.CrystalsPortion : ore.health;
harvested = (harvested + _local1);
engine.game_process.hitUnit(_local1, ore);
if (((engine.game_process.isSelectedUnit(owner)) || (engine.game_process.isSelectedUnit(ore)))){
engine.play_window.updateInfo();
};
if (!ore.isAlive()){
owner.cstate = Consts.IDLE;
gotoOre();
if (!ore){
owner.cstate = Consts.IDLE;
gotoRefinery();
};
return;
};
if (harvested >= Consts.CrystalsLoad){
owner.cstate = Consts.IDLE;
gotoRefinery();
return;
};
pick = picktime;
};
} else {
if (Consts.IDLE == owner.cstate){
if (goto_ore){
if (owner.pos.isequal(goto_ore)){
if (harvested >= Consts.CrystalsLoad){
gotoRefinery();
return;
};
owner.cstate = Consts.PICKING;
pick = picktime;
_local2 = (ore.pos.x - owner.pos.x);
_local3 = (ore.pos.y - owner.pos.y);
owner.startrotate((((Math.atan2(_local3, _local2) / Math.PI) * 180) - 90));
return;
} else {
if (((move_goal) && (!(move_goal.active)))){
gotoOre();
};
};
} else {
if (goto_refinery){
if (((owner.pos.isequal(goto_refinery)) || (isNearRefinery()))){
if (owner.mapid == Consts.myId){
engine.addResources(harvested);
engine.play_window.updateResources();
};
harvested = 0;
if (engine.game_process.isSelectedUnit(owner)){
engine.play_window.updateInfo();
};
gotoOre();
return;
} else {
if (((move_goal) && (!(move_goal.active)))){
gotoRefinery();
};
};
};
};
};
};
}
public function gotoRefinery():void{
goto_ore = (goto_refinery = null);
if (!refinery){
owner.life.stop();
return;
};
if (((move_goal) && (move_goal.active))){
move_goal.deactivate();
move_goal = null;
};
owner.life.stop();
move_goal = new OreMoveGoal(owner, engine);
goto_refinery = refinery.pos;
move_goal.setMoveTarget(goto_refinery, true);
owner.life.goal_system.add(move_goal);
}
public function gotoOre():void{
if (((!(ore)) || (!(ore.isAlive())))){
ore = engine.game_board.resources.getNearestByType(UnitTypes.sp_crystals, refinery.pos);
if (!ore){
deactivate();
return;
};
};
goto_ore = (goto_refinery = null);
owner.life.stop();
if (((move_goal) && (move_goal.active))){
move_goal.deactivate();
move_goal = null;
};
move_goal = new OreMoveGoal(owner, engine);
move_goal.astar.neighbours(ore.pos);
if (move_goal.astar.ns.length > 0){
goto_ore = move_goal.astar.ns[0];
move_goal.setMoveTarget(goto_ore, true);
owner.life.goal_system.add(move_goal);
} else {
pause = 10;
};
}
}
}//package fai
Section 36
//OreMoveGoal (fai.OreMoveGoal)
package fai {
public class OreMoveGoal extends Goal {
private var engine:Engine;// = null
public var pathindex:uint;// = 0
public var target:Position;
public var world:MapMatrix;// = null
private var nchecks:int;// = 0
public var path:Array;
private var ntries:int;// = 0
private var searchRange:uint;// = 0
private var pause:uint;// = 0
public var astar:Astar;// = null
private var forcemove:Boolean;// = false
public static const FindNearPlaceTries:uint = 8;
public static const PAUSE:uint = 5;
public static const MaxSearchTries:uint = 30;
public static const MaxChecks:uint = 3;
public function OreMoveGoal(_arg1:Unit, _arg2:Engine):void{
target = new Position();
path = new Array();
pathindex = 0;
world = null;
pause = 0;
ntries = 0;
nchecks = 0;
astar = null;
forcemove = false;
searchRange = 0;
engine = null;
super();
engine = _arg2;
owner = _arg1;
if (owner.flag(UnitFlags.Flying)){
world = engine.game_board.airworld;
} else {
world = engine.game_board.world;
};
astar = new Astar(world, owner.mapid);
}
public function advance():void{
var _local1:uint;
if (Consts.MOVING == owner.cstate){
owner.move();
} else {
if (Consts.IDLE == owner.cstate){
if (target.isequal(owner.pos)){
deactivate();
} else {
if (path.length > 0){
_local1 = world.getpos(path[pathindex]);
if (((!(owner.pos.isequal(path[pathindex]))) && (!((_local1 == 0))))){
if (owner.life.ore_goal.goto_refinery){
owner.life.ore_goal.gotoRefinery();
} else {
owner.life.ore_goal.gotoOre();
};
deactivate();
return;
} else {
owner.startmove(path[pathindex]);
world.setpos(path[pathindex], owner.mapid);
pathindex++;
owner.move();
};
} else {
keepSearching();
};
};
};
};
}
public function setMoveTarget(_arg1:Position, _arg2:Boolean):void{
path.length = 0;
pathindex = 0;
target.copy(_arg1);
if (((forcemove) || (_arg2))){
astar.checkxy = astar.checknotempty;
forcemove = _arg2;
};
if (!astar.startSearch(owner.pos, target)){
deactivate();
} else {
target.copy(astar.destination);
};
}
private function keepSearching():void{
var _local1:int;
var _local2:int;
var _local3:Number;
var _local4:Number;
if (!astar.search(path)){
ntries++;
if (ntries >= MaxSearchTries){
deactivate();
} else {
if (ntries >= FindNearPlaceTries){
searchRange++;
astar.destination = new Position();
astar.findNearPlace(target, searchRange);
if (astar.destination){
target.copy(astar.destination);
};
};
setMoveTarget(target, false);
pause = PAUSE;
};
} else {
if (path.length > 0){
nchecks = (ntries = 0);
_local1 = Math.floor(((owner.sprite.x / Consts.cell_size) + 0.5));
_local2 = Math.floor(((owner.sprite.y / Consts.cell_size) + 0.5));
if (((!((_local1 == owner.pos.x))) || (!((_local2 == owner.pos.y))))){
_local3 = Math.sqrt((((target.x - _local1) * (target.x - _local1)) + ((target.y - _local2) * (target.y - _local2))));
_local4 = Math.sqrt((((target.x - owner.pos.x) * (target.x - owner.pos.x)) + ((target.y - owner.pos.y) * (target.y - owner.pos.y))));
if (_local4 < _local3){
path.unshift(new Position(owner.pos.x, owner.pos.y));
};
};
};
};
}
private function cleanup():void{
if (owner){
astar = null;
if ((((((pathindex > 0)) && (path.length))) && (!(owner.pos.isequal(path[(pathindex - 1)]))))){
world.setpos(path[(pathindex - 1)], 0);
};
if (owner.cstate == Consts.MOVING){
owner.cstate = Consts.IDLE;
};
owner = null;
path.length = 0;
};
}
override public function deactivate():void{
super.deactivate();
cleanup();
}
}
}//package fai
Section 37
//PlanetsMC (fai.PlanetsMC)
package fai {
import flash.events.*;
import flash.display.*;
import flash.text.*;
import flash.media.*;
import flash.utils.*;
import flash.net.*;
public class PlanetsMC extends Sprite {
public var space:MovieClip;
private var final_pos:int;// = 0
private var level_msg_timer:Timer;// = null
public var sound_control:MovieClip;
public var current_level:int;// = 0
private var engine:Engine;// = null
private var empires:Array;// = null
private var music_sound:Sound;// = null
public var level_msg:MovieClip;
public var level_info:MovieClip;
private var anim_timer:Timer;// = null
public var onlyatdg:MovieClip;
private var rebels:Array;// = null
public var music_channel:SoundChannel;// = null
public function PlanetsMC():void{
current_level = 0;
anim_timer = null;
final_pos = 0;
engine = null;
rebels = null;
empires = null;
level_msg_timer = null;
music_sound = null;
music_channel = null;
super();
}
private function updateArms():void{
hideRebels();
hideEmpires();
}
private function level12Click(_arg1:MouseEvent):void{
engine.playSound(Sounds.click);
playLevel(11);
}
public function stop():void{
if (anim_timer){
anim_timer.stop();
anim_timer.removeEventListener(TimerEvent.TIMER, timerFunc);
anim_timer = null;
};
}
public function init(_arg1:Engine):void{
engine = _arg1;
level_info.play_button.addEventListener(MouseEvent.MOUSE_DOWN, playNextClick);
level_info.resume_game_button.addEventListener(MouseEvent.MOUSE_DOWN, resumeGameClick);
rebels = new Array(space.rebel1, space.rebel2, space.rebel3, space.rebel4, space.rebel5, space.rebel6, space.rebel7, space.rebel8, space.rebel9, space.rebel10, space.rebel11, space.rebel12);
empires = new Array(space.empire2, space.empire3, space.empire4, space.empire5, space.empire6, space.empire7, space.empire8, space.empire9, space.empire10, space.empire11, space.empire12);
space.level1.addEventListener(MouseEvent.MOUSE_DOWN, level1Click);
space.level2.addEventListener(MouseEvent.MOUSE_DOWN, level2Click);
space.level3.addEventListener(MouseEvent.MOUSE_DOWN, level3Click);
space.level4.addEventListener(MouseEvent.MOUSE_DOWN, level4Click);
space.level5.addEventListener(MouseEvent.MOUSE_DOWN, level5Click);
space.level6.addEventListener(MouseEvent.MOUSE_DOWN, level6Click);
space.level7.addEventListener(MouseEvent.MOUSE_DOWN, level7Click);
space.level8.addEventListener(MouseEvent.MOUSE_DOWN, level8Click);
space.level9.addEventListener(MouseEvent.MOUSE_DOWN, level9Click);
space.level10.addEventListener(MouseEvent.MOUSE_DOWN, level10Click);
space.level11.addEventListener(MouseEvent.MOUSE_DOWN, level11Click);
space.level12.addEventListener(MouseEvent.MOUSE_DOWN, level12Click);
level_msg_timer = new Timer(1000, 0);
level_msg_timer.addEventListener(TimerEvent.TIMER, levelMsgTimer);
level_msg_timer.stop();
level_msg.visible = false;
level_msg.stop();
onlyatdg.visible = false;
sound_control.setEngine(engine);
music_sound = new Sound_planets();
loadLocally();
}
private function level7Click(_arg1:MouseEvent):void{
engine.playSound(Sounds.click);
playLevel(6);
}
private function resumeGameClick(_arg1:MouseEvent):void{
engine.playSound(Sounds.click);
stop();
hidePlanets();
engine.play_window.visible = true;
engine.pause();
}
public function saveLocally():void{
var _local1:String;
var _local2:*;
_local1 = "F";
_local2 = SharedObject.getLocal(("Star_Rebellion_v124" + _local1), "/");
_local2.data.current_level = current_level;
_local2.flush();
}
private function level4Click(_arg1:MouseEvent):void{
engine.playSound(Sounds.click);
playLevel(3);
}
private function hidePlanets():void{
visible = false;
if (music_channel){
music_channel.stop();
music_channel = null;
};
}
private function level1Click(_arg1:MouseEvent):void{
engine.playSound(Sounds.click);
playLevel(0);
}
private function level9Click(_arg1:MouseEvent):void{
engine.playSound(Sounds.click);
playLevel(8);
}
private function level11Click(_arg1:MouseEvent):void{
engine.playSound(Sounds.click);
playLevel(10);
}
private function level6Click(_arg1:MouseEvent):void{
engine.playSound(Sounds.click);
playLevel(5);
}
private function showLevelMessage():void{
level_msg_timer.stop();
level_msg.msg.text = (("Level " + (current_level + 1).toString()) + " wasn't completed");
level_msg.visible = true;
level_msg_timer.start();
}
public function loadLocally():void{
var _local1:String;
var _local2:*;
_local1 = "F";
_local2 = SharedObject.getLocal(("Star_Rebellion_v124" + _local1), "/");
current_level = _local2.data.current_level;
}
private function playNextClick(_arg1:MouseEvent):void{
engine.playSound(Sounds.click);
playLevel(current_level);
}
private function hideRebels():void{
var _local1:int;
_local1 = 0;
_local1 = 0;
while (_local1 < rebels.length) {
if (_local1 < current_level){
rebels[_local1].gotoAndStop("frozen");
rebels[_local1].visible = true;
} else {
if (_local1 == current_level){
rebels[current_level].visible = true;
rebels[current_level].gotoAndPlay("glow");
} else {
rebels[_local1].stop();
rebels[_local1].visible = false;
};
};
_local1++;
};
}
private function level3Click(_arg1:MouseEvent):void{
engine.playSound(Sounds.click);
playLevel(2);
}
private function level10Click(_arg1:MouseEvent):void{
engine.playSound(Sounds.click);
playLevel(9);
}
private function timerFunc(_arg1:TimerEvent):void{
var _local2:Number;
if (space.x < final_pos){
_local2 = ((final_pos - space.x) * 0.05);
space.x = (space.x + _local2);
} else {
space.x = final_pos;
stop();
};
}
private function playLevel(_arg1:int):void{
if (current_level < _arg1){
showLevelMessage();
return;
};
stop();
hidePlanets();
engine.playLevel(engine.sloader.maps.get(_arg1));
}
private function level8Click(_arg1:MouseEvent):void{
engine.playSound(Sounds.click);
playLevel(7);
}
private function hideEmpires():void{
var _local1:int;
_local1 = 0;
_local1 = 0;
while (_local1 < empires.length) {
if (_local1 < current_level){
empires[_local1].visible = false;
} else {
empires[_local1].visible = true;
};
_local1++;
};
}
private function playMusic():void{
var _local1:SoundTransform;
if (music_channel){
music_channel.stop();
music_channel = null;
};
if (!engine.volumeOff){
_local1 = new SoundTransform();
_local1.volume = engine.volume;
music_channel = music_sound.play(0, 3, _local1);
};
}
private function level5Click(_arg1:MouseEvent):void{
engine.playSound(Sounds.click);
playLevel(4);
}
private function levelMsgTimer(_arg1:TimerEvent):void{
level_msg.visible = false;
}
private function level2Click(_arg1:MouseEvent):void{
engine.playSound(Sounds.click);
playLevel(1);
}
public function show():void{
var _local1:LevelMap;
engine.playSound(Sounds.menu_appear);
switch (current_level){
case 0:
case 1:
case 2:
case 3:
case 4:
final_pos = 0;
break;
case 5:
final_pos = -500;
break;
case 6:
case 7:
case 8:
case 9:
case 10:
case 11:
case 12:
final_pos = -800;
break;
};
if (engine.game_board != null){
level_info.play_button.visible = false;
level_info.resume_game_button.visible = true;
} else {
level_info.play_button.visible = true;
level_info.resume_game_button.visible = false;
};
updateArms();
_local1 = engine.sloader.maps.get(current_level);
level_info.title.text = ((("Level " + (current_level + 1).toString()) + ": ") + _local1.title);
level_info.desc.text = _local1.desc;
level_info.waves.text = int(_local1.data.scenario.nwaves.@value);
space.x = -800;
space.cacheAsBitmap = true;
cacheAsBitmap = true;
anim_timer = new Timer(50, 0);
anim_timer.addEventListener(TimerEvent.TIMER, timerFunc);
anim_timer.start();
onlyatdg.visible = false;
playMusic();
}
}
}//package fai
Section 38
//PlayerActions (fai.PlayerActions)
package fai {
import fai.bomb.*;
public class PlayerActions {
private var engine:Engine;// = null
public var current_action:String;// = ""
public function PlayerActions(_arg1:Engine):void{
engine = null;
current_action = "";
super();
engine = _arg1;
}
private function cancelBuildingConstruction(_arg1:String):void{
if (engine.game_board.build_cursor){
engine.game_board.removeBuildCursor();
} else {
if (engine.game_process.builder.cancelTask(engine.game_process.selected_units[0], _arg1)){
engine.game_board.destroyUnit(engine.game_process.selected_units[0]);
engine.crystals = (engine.crystals + engine.utypes.params(_arg1).cost_crystals);
engine.play_window.updateResources();
};
};
clear();
}
public function doAction():void{
var _local1:Position;
var _local2:Unit;
var _local3:*;
_local1 = new Position(Math.floor(((engine.game_board.unitlayer.mouseX / Consts.cell_size) + 0.5)), Math.floor(((engine.game_board.unitlayer.mouseY / Consts.cell_size) + 0.5)));
_local2 = engine.game_process.getUnitUnder(_local1);
_local3 = null;
switch (current_action){
case UnitTypes.b_attack:
engine.game_process.attackTarget(_local1);
engine.play_window.buttons.showButtons(engine.game_process.selected_units[0].type);
break;
case UnitTypes.nitro_bomb:
if (engine.crystals < Consts.nitro_bomb_cost){
engine.log("Not enough crystals");
return;
};
engine.playSound(Sounds.menu_appear);
engine.play_window.stats.bombs++;
engine.crystals = (engine.crystals - Consts.nitro_bomb_cost);
_local3 = new NitroBomb(_local1, engine);
engine.game_board.bulletlayer.addChild(_local3);
_local3.start();
engine.goal_system.add(new BombGoal(engine, _local3));
engine.score = (engine.score + Consts.nitro_bomb_cost);
engine.play_window.updateResources();
break;
case UnitTypes.cumulative_bomb:
if (engine.crystals < Consts.cumulative_bomb_cost){
engine.log("Not enough crystals");
return;
};
engine.playSound(Sounds.menu_appear);
engine.play_window.stats.bombs++;
engine.crystals = (engine.crystals - Consts.cumulative_bomb_cost);
_local3 = new CumulativeBomb(_local1, engine);
engine.game_board.bulletlayer.addChild(_local3);
_local3.start();
engine.goal_system.add(new BombGoal(engine, _local3));
engine.score = (engine.score + Consts.cumulative_bomb_cost);
engine.play_window.updateResources();
break;
case UnitTypes.nuclear_missile:
if (engine.crystals < Consts.nuclear_missile_cost){
engine.log("Not enough crystals");
return;
};
engine.playSound(Sounds.menu_appear);
engine.play_window.stats.bombs++;
engine.crystals = (engine.crystals - Consts.nuclear_missile_cost);
_local3 = new NuclearMissile(_local1, engine);
engine.game_board.bulletlayer.addChild(_local3);
_local3.start();
engine.goal_system.add(new BombGoal(engine, _local3));
engine.score = (engine.score + Consts.nuclear_missile_cost);
engine.play_window.updateResources();
break;
};
clear();
engine.play_window.updateInfo();
}
public function clear():void{
current_action = "";
engine.play_window.custom_cursor.enable(false);
}
private function effectAction(_arg1:int, _arg2:String):void{
if (engine.crystals < _arg1){
engine.log("Not enough crystals");
return;
};
clear();
engine.game_board.removeBuildCursor();
engine.game_process.deselectUnits();
engine.play_window.buttons.action();
current_action = _arg2;
engine.play_window.custom_cursor.enable(true);
engine.play_window.custom_cursor.enableEffect(_arg2);
engine.play_window.updateInfo();
}
public function buttonPressed(_arg1:String):void{
var _local2:Unit;
engine.play_window.custom_cursor.enable(false);
_local2 = engine.utypes.units[_arg1];
if (_local2 != null){
if (_local2.flag(UnitFlags.Building)){
buildConstruction(_arg1);
return;
};
};
switch (_arg1){
case UnitTypes.nitro_bomb:
effectAction(Consts.nitro_bomb_cost, _arg1);
break;
case UnitTypes.cumulative_bomb:
effectAction(Consts.cumulative_bomb_cost, _arg1);
break;
case UnitTypes.nuclear_missile:
effectAction(Consts.nuclear_missile_cost, _arg1);
break;
case UnitTypes.b_attack:
current_action = UnitTypes.b_attack;
engine.play_window.custom_cursor.enable(true);
engine.play_window.buttons.action();
break;
case UnitTypes.b_stop:
engine.game_process.stopUnits();
break;
case UnitTypes.b_cancel:
endAction();
break;
};
}
public function endAction():void{
var _local1:Unit;
_local1 = engine.utypes.units[current_action];
if (_local1 != null){
if (_local1.flag(UnitFlags.Building)){
cancelBuildingConstruction(current_action);
};
} else {
clear();
};
engine.play_window.updateInfo();
}
public function hasDoAction():Boolean{
return (((!((current_action == ""))) && ((((((((current_action == UnitTypes.nitro_bomb)) || ((current_action == UnitTypes.cumulative_bomb)))) || ((current_action == UnitTypes.nuclear_missile)))) || ((current_action == UnitTypes.b_attack))))));
}
private function buildConstruction(_arg1:String):void{
if (!engine.isCrystalsEnough(_arg1)){
engine.log("Not enough crystals");
return;
};
if (((!((_arg1 == UnitTypes.power_station))) && ((engine.energy_fill >= engine.energy)))){
engine.log("Not enough energy. Build more power stations.");
return;
};
engine.game_board.createBuildingCursor(_arg1);
current_action = _arg1;
engine.game_board.checkCursor();
}
}
}//package fai
Section 39
//PlayWindow (fai.PlayWindow)
package fai {
import flash.events.*;
import flash.display.*;
public class PlayWindow extends Sprite {
public var radar:Radar;// = null
private var powers:FastButtons;// = null
public var resources:UpHeader;// = null
private var engine:Engine;// = null
private var game_board:GameBoard;// = null
private var tutorial:TutorialMC;// = null
public var pause_mc:PauseMC;// = null
public var buttons:GameButtons;// = null
public var stats:Statistics;// = null
public var right_menu:RightSideMenu;// = null
public var sstooltip:SelectedSpriteTooltip;// = null
public var message_mc:GameMessageMotion;// = null
public var custom_cursor:CustomCursor;// = null
public function PlayWindow(_arg1:Engine, _arg2:GameBoard):void{
engine = null;
custom_cursor = null;
game_board = null;
right_menu = null;
buttons = null;
radar = null;
resources = null;
powers = null;
pause_mc = null;
sstooltip = null;
stats = null;
message_mc = null;
tutorial = null;
super();
engine = _arg1;
game_board = _arg2;
}
private function stopRepairPressed(_arg1:MouseEvent):void{
var _local2:int;
var _local3:Unit;
if (engine.paused){
return;
};
_local2 = 0;
_local2 = 0;
while (_local2 < engine.game_process.selected_units.length) {
_local3 = engine.game_process.selected_units[_local2];
_local3.life.auto_repair = true;
if (((!(_local3.life.repair_goal)) || (!(_local3.life.repair_goal.active)))){
_local3.life.repair();
};
_local2++;
};
updateInfo();
}
public function updateInfo():void{
var _local1:Unit;
var _local2:String;
for each (_local1 in engine.game_process.selected_units) {
if (_local1.isAlive()){
_local1.updateHealth();
};
};
if (!buttons.selected_unit){
if (engine.game_process.selected_units.length > 0){
right_menu.unit_info.visible = true;
if (engine.game_process.selected_units.length == 1){
_local2 = engine.game_process.builder.inBuilding(engine.game_process.selected_units[0]);
right_menu.unit_info.update(engine.game_process.selected_units[0]);
if (_local2 != null){
buttons.action();
engine.actions.current_action = _local2;
return;
};
} else {
right_menu.unit_info.updateGroup(engine.game_process.selected_units);
};
if (((game_board.build_cursor) || (!((engine.actions.current_action == ""))))){
buttons.action();
} else {
if (engine.game_process.selected_units[0].mapid != Consts.hostileId){
buttons.showButtons(engine.game_process.selected_units[0].type);
} else {
buttons.hideButtons();
};
};
} else {
right_menu.unit_info.visible = false;
if (((game_board.build_cursor) || (!((engine.actions.current_action == ""))))){
buttons.action();
} else {
buttons.hideButtons();
};
};
} else {
right_menu.unit_info.visible = true;
right_menu.unit_info.update(buttons.selected_unit);
buttons.hideButtons();
};
}
private function soundOffPressed(_arg1:MouseEvent):void{
engine.volumeOff = true;
right_menu.sound_off_button.visible = false;
right_menu.sound_on_button.visible = true;
}
private function sendNextPressed(_arg1:MouseEvent):void{
if (engine.paused){
return;
};
engine.scenario.sendNext();
}
private function soundOnPressed(_arg1:MouseEvent):void{
engine.volumeOff = false;
right_menu.sound_off_button.visible = true;
right_menu.sound_on_button.visible = false;
engine.playSound(Sounds.click);
}
public function createCustomCursor():void{
custom_cursor = new CustomCursor(engine);
engine.game_board.unitlayer.addChild(custom_cursor);
}
private function pausePressed(_arg1:MouseEvent):void{
engine.playSound(Sounds.upgrade);
engine.pause();
}
public function updateResources():void{
resources.score.text = engine.score.toString();
resources.crystals.text = engine.crystals.toString();
resources.energy.text = ((engine.energy_fill.toString() + "/") + engine.energy.toString());
}
public function upgradePressed(_arg1:MouseEvent):void{
var _local2:int;
var _local3:Unit;
if (engine.paused){
return;
};
engine.playSound(Sounds.upgrade);
_local2 = 0;
_local2 = 0;
while (_local2 < engine.game_process.selected_units.length) {
_local3 = engine.game_process.selected_units[_local2];
if (_local3.mapid == Consts.myId){
engine.upgradeUnit(_local3);
};
_local2++;
};
updateResources();
}
private function sellPressed(_arg1:MouseEvent):void{
var _local2:Unit;
if (engine.paused){
return;
};
while (engine.game_process.selected_units.length > 0) {
_local2 = engine.game_process.selected_units[0];
if (_local2.type != UnitTypes.harvester){
engine.crystals = (engine.crystals + int(((_local2.cost_crystals * _local2.health) / _local2.full_health)));
engine.game_board.destroyUnit(_local2);
} else {
engine.game_process.deselectUnit(engine.game_process.selected_units[0]);
};
};
updateResources();
}
private function unpausePressed(_arg1:MouseEvent):void{
engine.playSound(Sounds.unpause);
if (!engine.paused){
return;
};
engine.pause();
}
public function showTutorial():void{
tutorial = new TutorialMC();
tutorial.init(engine);
addChild(tutorial);
}
public function initialize():void{
addChild(game_board);
right_menu = new RightSideMenu();
right_menu.init(engine);
right_menu.x = 600;
addChild(right_menu);
buttons = new GameButtons(engine);
buttons.y = 35;
buttons.x = 5;
right_menu.addChild(buttons);
radar = new Radar();
radar.init(engine, 140, 90);
radar.y = ((right_menu.unit_info.y + right_menu.unit_info.height) + 5);
radar.x = 5;
right_menu.addChild(radar);
resources = new UpHeader();
addChild(resources);
powers = new FastButtons(engine);
addChild(powers);
powers.x = 545;
powers.y = 45;
sstooltip = new SelectedSpriteTooltip();
sstooltip.visible = false;
addChild(sstooltip);
pause_mc = new PauseMC();
pause_mc.visible = false;
pause_mc.stop();
addChild(pause_mc);
message_mc = new GameMessageMotion();
message_mc.y = resources.height;
message_mc.stop();
message_mc.visible = false;
addChild(message_mc);
stats = new Statistics();
stats.init(engine);
stats.visible = false;
stats.firework1.stop();
stats.firework2.stop();
stats.final_victory.visible = false;
addChild(stats);
right_menu.unit_info.repair_button.addEventListener(MouseEvent.MOUSE_DOWN, repairPressed);
right_menu.unit_info.stop_repair_button.addEventListener(MouseEvent.MOUSE_DOWN, stopRepairPressed);
right_menu.unit_info.sell_button.addEventListener(MouseEvent.MOUSE_DOWN, sellPressed);
right_menu.unit_info.upgrade_button.addEventListener(MouseEvent.MOUSE_DOWN, upgradePressed);
right_menu.sound_off_button.addEventListener(MouseEvent.MOUSE_DOWN, soundOffPressed);
right_menu.sound_on_button.addEventListener(MouseEvent.MOUSE_DOWN, soundOnPressed);
right_menu.pause_button.addEventListener(MouseEvent.MOUSE_DOWN, pausePressed);
right_menu.menu_button.addEventListener(MouseEvent.MOUSE_DOWN, menuPressed);
resources.send_next_button.addEventListener(MouseEvent.MOUSE_DOWN, sendNextPressed);
pause_mc.addEventListener(MouseEvent.MOUSE_DOWN, unpausePressed);
if (engine.volumeOff){
right_menu.sound_off_button.visible = false;
right_menu.sound_on_button.visible = true;
} else {
right_menu.sound_off_button.visible = true;
right_menu.sound_on_button.visible = false;
};
GameStage.main_stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);
}
private function onKeyDown(_arg1:KeyboardEvent):void{
if ((((80 == _arg1.charCode)) || ((112 == _arg1.charCode)))){
if (visible){
engine.pause();
};
};
}
public function hideTutorial():void{
removeChild(tutorial);
tutorial = null;
engine.scenario.start();
engine.events.register();
}
public function menuPressed(_arg1:MouseEvent):void{
engine.playSound(Sounds.click);
engine.pause();
engine.play_window.visible = false;
engine.global_stage.showMainMenu();
}
private function repairPressed(_arg1:MouseEvent):void{
var _local2:int;
var _local3:Unit;
if (engine.paused){
return;
};
_local2 = 0;
_local2 = 0;
while (_local2 < engine.game_process.selected_units.length) {
_local3 = engine.game_process.selected_units[_local2];
_local3.life.auto_repair = false;
if (((_local3.life.repair_goal) && (_local3.life.repair_goal.active))){
_local3.life.repair();
};
_local2++;
};
updateInfo();
}
public function destroy():void{
right_menu.unit_info.repair_button.removeEventListener(MouseEvent.MOUSE_DOWN, repairPressed);
right_menu.unit_info.stop_repair_button.removeEventListener(MouseEvent.MOUSE_DOWN, stopRepairPressed);
right_menu.unit_info.sell_button.removeEventListener(MouseEvent.MOUSE_DOWN, sellPressed);
right_menu.unit_info.upgrade_button.removeEventListener(MouseEvent.MOUSE_DOWN, upgradePressed);
right_menu.sound_off_button.removeEventListener(MouseEvent.MOUSE_DOWN, soundOffPressed);
right_menu.sound_on_button.removeEventListener(MouseEvent.MOUSE_DOWN, soundOnPressed);
right_menu.pause_button.removeEventListener(MouseEvent.MOUSE_DOWN, pausePressed);
right_menu.menu_button.removeEventListener(MouseEvent.MOUSE_DOWN, menuPressed);
resources.send_next_button.removeEventListener(MouseEvent.MOUSE_DOWN, sendNextPressed);
pause_mc.removeEventListener(MouseEvent.MOUSE_DOWN, unpausePressed);
GameStage.main_stage.removeEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);
right_menu.removeChild(radar);
radar = null;
powers.destroy();
removeChild(powers);
powers = null;
buttons.destroy();
right_menu.removeChild(buttons);
buttons = null;
removeChild(right_menu);
right_menu = null;
stats.destroy();
removeChild(stats);
stats = null;
removeChild(game_board);
game_board = null;
custom_cursor.destroy();
engine.game_board.unitlayer.removeChild(custom_cursor);
custom_cursor = null;
removeChild(resources);
resources = null;
removeChild(sstooltip);
sstooltip = null;
removeChild(pause_mc);
pause_mc = null;
removeChild(message_mc);
message_mc = null;
}
}
}//package fai
Section 40
//Position (fai.Position)
package fai {
public class Position {
public var x:int;// = 0
public var y:int;// = 0
public function Position(_arg1:int=0, _arg2:int=0):void{
x = 0;
y = 0;
super();
set(_arg1, _arg2);
}
public function copy(_arg1:Position):void{
x = _arg1.x;
y = _arg1.y;
}
public function set(_arg1:int, _arg2:int):void{
x = _arg1;
y = _arg2;
}
public function isequal(_arg1:Position):Boolean{
return ((((x == _arg1.x)) && ((y == _arg1.y))));
}
}
}//package fai
Section 41
//Radar (fai.Radar)
package fai {
import flash.display.*;
import flash.text.*;
public class Radar extends Sprite {
private var radar:Shape;
private var engine:Engine;// = null
private var mwidth:int;// = 0
public var enemy_count:TextField;
private var mheight:int;// = 0
public var current_wave:TextField;
private static const HeaderHeight:int = 22;
public function Radar():void{
radar = new Shape();
engine = null;
mwidth = 0;
mheight = 0;
super();
}
public function init(_arg1:Engine, _arg2:int, _arg3:int):void{
engine = _arg1;
addChild(radar);
mwidth = _arg2;
mheight = _arg3;
}
public function update():void{
var unit:Unit;
var rx:int;
var ry:int;
var rw:int;
var rh:int;
if (!engine.game_board){
return;
};
radar.graphics.clear();
unit = null;
rx = 0;
ry = 0;
rw = 0;
rh = 0;
for each (unit in engine.game_board.my_camp.units) {
rx = ((unit.pos.x * mwidth) / engine.game_board.map_width);
ry = (((unit.pos.y * mheight) / engine.game_board.map_height) + HeaderHeight);
if (((unit.flag(UnitFlags.Building)) && (unit.flag(UnitFlags.Peaceful)))){
var _local4 = 5;
rw = _local4;
rh = _local4;
} else {
_local4 = 2;
rw = _local4;
rh = _local4;
};
_local4 = radar.graphics;
with (_local4) {
beginFill(0xFF00);
if (unit.type == UnitTypes.command_center){
drawCircle((rx + (rw / 2)), (ry + (rh / 2)), rw);
} else {
drawRect(rx, ry, rw, rh);
};
endFill();
};
};
for each (unit in engine.game_board.enemy_camp.units) {
rx = ((unit.pos.x * mwidth) / engine.game_board.map_width);
ry = (((unit.pos.y * mheight) / engine.game_board.map_height) + HeaderHeight);
if (UnitTypes.isBoss(unit.type)){
_local4 = 5;
rw = _local4;
rh = _local4;
} else {
_local4 = 2;
rw = _local4;
rh = _local4;
};
_local4 = radar.graphics;
with (_local4) {
beginFill(0xFF0000);
drawRect(rx, ry, rw, rh);
endFill();
};
};
var _local2 = 3;
rw = _local2;
rh = _local2;
for each (unit in engine.game_board.resources.units) {
rx = ((unit.pos.x * mwidth) / engine.game_board.map_width);
ry = (((unit.pos.y * mheight) / engine.game_board.map_height) + HeaderHeight);
_local4 = radar.graphics;
with (_local4) {
beginFill(0xFCFF00);
drawRect(rx, ry, rw, rh);
endFill();
};
};
}
}
}//package fai
Section 42
//RepairGoal (fai.RepairGoal)
package fai {
public class RepairGoal extends Goal {
private var engine:Engine;// = null
private var orebeacon:Number;// = 0
private var orecost:Number;// = 0
private var life:int;// = 0
private var pause:int;// = 0
private static const PAUSE:int = 8;
public function RepairGoal(_arg1:Unit, _arg2:Engine):void{
orecost = 0;
orebeacon = 0;
life = 0;
engine = null;
pause = 0;
super();
owner = _arg1;
engine = _arg2;
life = _arg1.full_health;
orecost = ((owner.cost_crystals / life) / 2);
}
public function advance():void{
var _local1:int;
if (pause > 0){
pause--;
return;
};
if ((((engine.crystals <= 0)) && ((orecost > 0)))){
engine.log("Not enough resources for repair");
deactivate();
return;
};
if (owner.health < life){
owner.health++;
orebeacon = (orebeacon + orecost);
if (orebeacon > 1){
_local1 = Math.floor(orebeacon);
if (engine.crystals < _local1){
engine.log("Not enough resources for repair");
deactivate();
} else {
engine.crystals = (engine.crystals - _local1);
orebeacon = (orebeacon - _local1);
engine.play_window.updateResources();
};
};
if (engine.game_process.isUnitInSelection(owner)){
engine.play_window.updateInfo();
};
pause = PAUSE;
return;
};
deactivate();
if (engine.game_process.isUnitInSelection(owner)){
engine.play_window.updateInfo();
};
}
}
}//package fai
Section 43
//RightSideMenu (fai.RightSideMenu)
package fai {
import flash.display.*;
public class RightSideMenu extends Sprite {
public var menu_button:SimpleButton;
public var sound_off_button:SimpleButton;
private var engine:Engine;// = null
public var sound_on_button:SimpleButton;
public var unit_info:UnitInfo;// = null
public var pause_button:SimpleButton;
public function RightSideMenu():void{
engine = null;
unit_info = null;
super();
}
public function init(_arg1:Engine):void{
engine = _arg1;
unit_info = new UnitInfo();
unit_info.init(engine);
unit_info.y = 185;
unit_info.x = 5;
addChild(unit_info);
}
public function destroy():void{
if (unit_info){
unit_info.destroy();
removeChild(unit_info);
unit_info = null;
};
}
}
}//package fai
Section 44
//Scenario (fai.Scenario)
package fai {
import flash.events.*;
import flash.utils.*;
public class Scenario {
private var engine:Engine;// = null
private var thinktimer:Timer;// = null
private var enemy_queue:Array;
private var level_number:int;// = 0
private var nwaves:int;// = 0
public var pause:int;// = 0
private var special_cases:Map;// = null
private var current_wave:int;// = 0
private static const MaxCountOnTheBattleField:int = 40;
private static const PAUSE:int = 30;
public function Scenario(_arg1:Engine, _arg2:int, _arg3:int):void{
var _local4:int;
engine = null;
thinktimer = null;
pause = 0;
current_wave = 0;
nwaves = 0;
level_number = 0;
special_cases = null;
enemy_queue = [];
super();
engine = _arg1;
nwaves = _arg2;
level_number = _arg3;
special_cases = new Map();
_local4 = 0;
while (_local4 < LevelParams.special_cases.length) {
special_cases.add(LevelParams.special_cases[_local4][0], LevelParams.special_cases[_local4][1]);
_local4++;
};
}
private function liveCount():int{
var _local1:int;
var _local2:int;
var _local3:Unit;
_local1 = 0;
_local2 = 0;
while (_local2 < engine.game_board.enemy_camp.units.length) {
_local3 = engine.game_board.enemy_camp.units[_local2];
if ((((_local3.mapid == Consts.hostileId)) && (_local3.isAlive()))){
_local1++;
};
_local2++;
};
return (_local1);
}
public function stop():void{
thinktimer.stop();
}
public function run():void{
thinktimer.start();
}
private function setSeconds():void{
var _local1:String;
_local1 = pause.toString();
if (pause < 10){
_local1 = ("0" + _local1);
};
engine.play_window.resources.wave_time.text = ("00:" + _local1);
}
private function placeEnemy(_arg1:String, _arg2:int):Boolean{
var _local3:MapMatrix;
var _local4:int;
var _local5:int;
var _local6:Unit;
_local3 = (engine.utypes.params(_arg1).flag(UnitFlags.Flying)) ? engine.game_board.airworld : engine.game_board.world;
_local4 = 0;
while (_local4 < engine.game_board.map_height) {
_local5 = 3;
while (_local5 < engine.game_board.map_width) {
if (!_local3.getxy(_local5, _local4)){
_local6 = engine.game_board.buildUnit(_arg1, Consts.hostileId, _local5, _local4, true);
engine.upgradeUnitToLevel(_local6, _arg2);
_local6.life.move(engine.command_center.pos, false);
return (true);
};
_local5++;
};
_local4++;
};
return (false);
}
public function destroy():void{
if (thinktimer){
thinktimer.stop();
thinktimer.removeEventListener(TimerEvent.TIMER, thinkHandler);
thinktimer = null;
};
}
public function sendNext():void{
if (((!(thinktimer)) || (engine.paused))){
return;
};
if (liveCount() > MaxCountOnTheBattleField){
engine.log("Too many invaders on the battle field");
return;
};
if (current_wave < nwaves){
pause = 1;
thinkHandler(null);
} else {
engine.log("All waves are on the battle field.");
};
}
private function makeEnemies():void{
var _local1:int;
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:String;
var _local6:int;
engine.playSound(Sounds.new_wave);
_local1 = (current_wave - 1);
_local2 = (_local1 / UnitTypes.enemies.length);
if (_local2 > 5){
_local2 = 5;
};
_local3 = LevelParams.enemy_count[_local1];
_local4 = 0;
_local5 = "";
if (special_cases.find(((level_number * 10000) + _local1))){
_local3 = special_cases.get(((level_number * 10000) + _local1));
};
if (current_wave == nwaves){
makeBosses();
return;
};
_local5 = UnitTypes.enemies[(_local1 % UnitTypes.enemies.length)];
_local6 = liveCount();
while (_local4 < _local3) {
if (_local6 > MaxCountOnTheBattleField){
enemy_queue.push([_local5, _local2]);
} else {
placeEnemy(_local5, _local2);
_local6++;
};
_local4++;
};
}
public function start():void{
pause = 1;
thinktimer = new Timer(1000, 0);
thinktimer.addEventListener(TimerEvent.TIMER, thinkHandler);
thinktimer.start();
engine.play_window.radar.current_wave.text = (((current_wave + 1).toString() + "/") + nwaves.toString());
engine.log("Enemy is near. Prepare for battle!");
}
private function makeBosses():void{
var _local1:Array;
var _local2:int;
_local1 = LevelParams.bosses[level_number];
_local2 = 0;
_local2 = 0;
while (_local2 < _local1.length) {
placeEnemy(_local1[_local2][0], _local1[_local2][1]);
_local2++;
};
}
public function isRunning():Boolean{
return (!((thinktimer == null)));
}
private function thinkHandler(_arg1:TimerEvent):void{
var _local2:int;
if (!engine.command_center.isAlive()){
engine.gameOver();
return;
};
_local2 = liveCount();
engine.play_window.radar.enemy_count.text = _local2.toString();
if (!_local2){
if (current_wave >= nwaves){
engine.victory();
return;
};
} else {
while ((((_local2 < MaxCountOnTheBattleField)) && ((enemy_queue.length > 0)))) {
placeEnemy(enemy_queue[0][0], enemy_queue[0][1]);
enemy_queue.shift();
_local2++;
};
};
if (current_wave < nwaves){
if (pause > 0){
pause--;
setSeconds();
if (pause <= 0){
if (enemy_queue.length > 0){
pause = 10;
return;
};
current_wave++;
if (current_wave == nwaves){
engine.log("Boss attack started!");
};
engine.play_window.radar.current_wave.text = ((current_wave.toString() + "/") + nwaves.toString());
makeEnemies();
} else {
return;
};
};
pause = PAUSE;
if (current_wave == (nwaves - 1)){
pause = (pause + 15);
};
};
}
}
}//package fai
Section 45
//SelectedSprite (fai.SelectedSprite)
package fai {
import flash.events.*;
import flash.display.*;
public class SelectedSprite extends Sprite {
private var sshape:Shape;// = null
private var engine:Engine;// = null
private var unit:Unit;// = null
private var sstooltip;// = null
public static const wsize:int = 45;
public static const hsize:int = 45;
public function SelectedSprite(_arg1:Engine, _arg2:Unit):void{
var _local3:AnimatedBitmap;
var _local4:Number;
var _local5:RepairSign;
sshape = null;
sstooltip = null;
unit = null;
engine = null;
super();
engine = _arg1;
sstooltip = engine.play_window.sstooltip;
unit = _arg2;
Utils.drawRect(this, 2, 1469357, 0, wsize, hsize, true, 10, 10);
sshape = new Shape();
Utils.drawRect(sshape, 5, 4891623, 0, wsize, hsize, true, 10, 10);
sshape.visible = false;
addChild(sshape);
_local3 = engine.sloader.getStatusSprite(_arg2.type);
_local4 = (_arg2.health / _arg2.full_health);
_local3.setFrame(((4 - (5 * _local4)) + 1));
_local3.scaleX = (wsize / _local3.width);
_local3.scaleY = (hsize / _local3.height);
_local3.x = (((wsize / 2) - (_local3.width / 2)) + 10);
_local3.y = (((hsize / 2) - (_local3.height / 2)) + 10);
addChild(_local3);
addEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
addEventListener(MouseEvent.MOUSE_OUT, onMouseOut);
addEventListener(MouseEvent.MOUSE_DOWN, onMouseClick);
if (((_arg2.life.repair_goal) && (_arg2.life.repair_goal.active))){
_local5 = new RepairSign();
_local5.x = 10;
_local5.y = 10;
addChild(_local5);
};
}
private function onMouseOver(_arg1:MouseEvent):void{
sshape.visible = true;
sstooltip.visible = true;
sstooltip.x = (((engine.play_window.right_menu.x + engine.play_window.right_menu.unit_info.x) + x) - sstooltip.width);
sstooltip.y = ((engine.play_window.right_menu.y + engine.play_window.right_menu.unit_info.y) + y);
}
private function onMouseClick(_arg1:MouseEvent):void{
var _local2:int;
var _local3:Unit;
if (_arg1.ctrlKey){
_local2 = 0;
while (_local2 < engine.game_process.selected_units.length) {
_local3 = engine.game_process.selected_units[_local2];
if (_local3.type != unit.type){
engine.game_process.deselectUnit(_local3);
} else {
_local2++;
};
};
} else {
if (_arg1.shiftKey){
engine.game_process.deselectUnit(unit);
} else {
engine.game_process.deselectUnits();
engine.game_process.selected_units.push(unit);
};
};
engine.play_window.updateInfo();
}
private function onMouseOut(_arg1:MouseEvent):void{
sshape.visible = false;
sstooltip.visible = false;
}
public function destroy():void{
removeChild(sshape);
sshape = null;
removeEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
removeEventListener(MouseEvent.MOUSE_OUT, onMouseOut);
removeEventListener(MouseEvent.MOUSE_DOWN, onMouseClick);
}
}
}//package fai
Section 46
//SmartLoader (fai.SmartLoader)
package fai {
import flash.display.*;
import flash.media.*;
import flash.utils.*;
public class SmartLoader {
public var buttons:Dictionary;
public var sounds:Dictionary;
public var engine:Engine;// = null
public var grounds:Dictionary;
public var specials:Dictionary;
public var maps:Map;
public var statuses:Dictionary;
public var mimages:Dictionary;
public var suites:Dictionary;
public function SmartLoader(_arg1:Engine):void{
var _local2:XML;
var _local3:XMLList;
var _local4:XML;
var _local5:LevelMap;
suites = new Dictionary();
buttons = new Dictionary();
sounds = new Dictionary();
grounds = new Dictionary();
mimages = new Dictionary();
specials = new Dictionary();
statuses = new Dictionary();
maps = new Map();
engine = null;
super();
engine = _arg1;
_local2 = Maps.maps;
_local3 = _local2.level;
for each (_local4 in _local3) {
_local5 = new LevelMap(new XML(_local4.toString()));
maps.add(_local5.number, _local5);
};
initArtwork();
}
public function getSpecial(_arg1:String):AnimatedBitmap{
var _local2:BitmapData;
_local2 = specials[_arg1];
return (new AnimatedBitmap(_local2, _local2.width, _local2.height));
}
public function getStatusSprite(_arg1:String):AnimatedBitmap{
var _local2:BitmapData;
_local2 = statuses[_arg1];
return (new AnimatedBitmap(_local2, 60, 60));
}
public function dressPeacefulUnit(_arg1:Unit, _arg2:String, _arg3:Engine):void{
var _local4:Array;
_local4 = suites[_arg2];
_arg1.sprite.setAppearence(_local4[0], null, null, null, _arg1.sprite_width, _arg3.getColor(_arg1.mapid));
if (_arg1.flag(UnitFlags.Flying)){
_arg3.game_board.airlayer.addChildAt(_arg1.sprite, 0);
} else {
_arg3.game_board.groundlayer.addChildAt(_arg1.sprite, 0);
};
}
public function initArtwork():void{
suites[UnitTypes.artillery] = new Array(4);
suites[UnitTypes.artillery][0] = new Image_artillery_body(0, 0);
suites[UnitTypes.artillery][1] = new Image_artillery_attack(0, 0);
suites[UnitTypes.artillery][2] = new Image_artillery_bullet(0, 0);
suites[UnitTypes.artillery][3] = new Image_artillery_be(0, 0);
suites[UnitTypes.command_center] = new Array(4);
suites[UnitTypes.command_center][0] = new Image_command_center_body(0, 0);
suites[UnitTypes.harvester] = new Array(4);
suites[UnitTypes.harvester][0] = new Image_harvester_body(0, 0);
suites[UnitTypes.laser_cannon] = new Array(4);
suites[UnitTypes.laser_cannon][0] = new Image_laser_cannon_body(0, 0);
suites[UnitTypes.laser_cannon][1] = new Image_laser_cannon_attack(0, 0);
suites[UnitTypes.laser_cannon][2] = new Image_laser_cannon_bullet(0, 0);
suites[UnitTypes.laser_cannon][3] = new Image_laser_cannon_be(0, 0);
suites[UnitTypes.missile_turret] = new Array(4);
suites[UnitTypes.missile_turret][0] = new Image_missile_turret_body(0, 0);
suites[UnitTypes.missile_turret][1] = new Image_missile_turret_attack(0, 0);
suites[UnitTypes.missile_turret][2] = new Image_missile_turret_bullet(0, 0);
suites[UnitTypes.missile_turret][3] = new Image_missile_turret_be(0, 0);
suites[UnitTypes.plasma_mortar] = new Array(4);
suites[UnitTypes.plasma_mortar][0] = new Image_plasma_mortar_body(0, 0);
suites[UnitTypes.plasma_mortar][1] = new Image_plasma_mortar_attack(0, 0);
suites[UnitTypes.plasma_mortar][2] = new Image_plasma_mortar_bullet(0, 0);
suites[UnitTypes.plasma_mortar][3] = new Image_plasma_mortar_be(0, 0);
suites[UnitTypes.power_station] = new Array(4);
suites[UnitTypes.power_station][0] = new Image_power_station_body(0, 0);
suites[UnitTypes.refinery] = new Array(4);
suites[UnitTypes.refinery][0] = new Image_refinery_body(0, 0);
suites[UnitTypes.stunner] = new Array(4);
suites[UnitTypes.stunner][0] = new Image_stunner_body(0, 0);
suites[UnitTypes.stunner][1] = new Image_stunner_attack(0, 0);
suites[UnitTypes.stunner][2] = new Image_stunner_bullet(0, 0);
suites[UnitTypes.stunner][3] = new Image_stunner_be(0, 0);
suites[UnitTypes.battle_shuttle] = new Array(4);
suites[UnitTypes.battle_shuttle][0] = new Image_battle_shuttle_body(0, 0);
suites[UnitTypes.battle_shuttle][1] = new Image_battle_shuttle_attack(0, 0);
suites[UnitTypes.battle_shuttle][2] = new Image_battle_shuttle_bullet(0, 0);
suites[UnitTypes.battle_shuttle][3] = new Image_battle_shuttle_be(0, 0);
suites[UnitTypes.destroyer] = new Array(4);
suites[UnitTypes.destroyer][0] = new Image_destroyer_body(0, 0);
suites[UnitTypes.destroyer][1] = new Image_destroyer_attack(0, 0);
suites[UnitTypes.destroyer][2] = new Image_destroyer_bullet(0, 0);
suites[UnitTypes.destroyer][3] = new Image_destroyer_be(0, 0);
suites[UnitTypes.executor] = new Array(4);
suites[UnitTypes.executor][0] = new Image_executor_body(0, 0);
suites[UnitTypes.executor][1] = new Image_executor_attack(0, 0);
suites[UnitTypes.executor][2] = new Image_executor_bullet(0, 0);
suites[UnitTypes.executor][3] = new Image_executor_be(0, 0);
suites[UnitTypes.fighter_t1] = new Array(4);
suites[UnitTypes.fighter_t1][0] = new Image_fighter_t1_body(0, 0);
suites[UnitTypes.fighter_t1][1] = new Image_fighter_t1_attack(0, 0);
suites[UnitTypes.fighter_t1][2] = new Image_fighter_t1_bullet(0, 0);
suites[UnitTypes.fighter_t1][3] = new Image_fighter_t1_be(0, 0);
suites[UnitTypes.fighter_t2] = new Array(4);
suites[UnitTypes.fighter_t2][0] = new Image_fighter_t2_body(0, 0);
suites[UnitTypes.fighter_t2][1] = new Image_fighter_t2_attack(0, 0);
suites[UnitTypes.fighter_t2][2] = new Image_fighter_t2_bullet(0, 0);
suites[UnitTypes.fighter_t2][3] = new Image_fighter_t2_be(0, 0);
suites[UnitTypes.fighter_t3] = new Array(4);
suites[UnitTypes.fighter_t3][0] = new Image_fighter_t3_body(0, 0);
suites[UnitTypes.fighter_t3][1] = new Image_fighter_t3_attack(0, 0);
suites[UnitTypes.fighter_t3][2] = new Image_fighter_t3_bullet(0, 0);
suites[UnitTypes.fighter_t3][3] = new Image_fighter_t3_be(0, 0);
suites[UnitTypes.gunship] = new Array(4);
suites[UnitTypes.gunship][0] = new Image_gunship_body(0, 0);
suites[UnitTypes.gunship][1] = new Image_gunship_attack(0, 0);
suites[UnitTypes.gunship][2] = new Image_gunship_bullet(0, 0);
suites[UnitTypes.gunship][3] = new Image_gunship_be(0, 0);
suites[UnitTypes.interceptor] = new Array(4);
suites[UnitTypes.interceptor][0] = new Image_interceptor_body(0, 0);
suites[UnitTypes.interceptor][1] = new Image_interceptor_attack(0, 0);
suites[UnitTypes.interceptor][2] = new Image_interceptor_bullet(0, 0);
suites[UnitTypes.interceptor][3] = new Image_interceptor_be(0, 0);
suites[UnitTypes.jackal] = new Array(4);
suites[UnitTypes.jackal][0] = new Image_jackal_body(0, 0);
suites[UnitTypes.jackal][1] = new Image_jackal_attack(0, 0);
suites[UnitTypes.jackal][2] = new Image_jackal_bullet(0, 0);
suites[UnitTypes.jackal][3] = new Image_jackal_be(0, 0);
suites[UnitTypes.rock] = new Array(4);
suites[UnitTypes.rock][0] = new Image_rock_body(0, 0);
suites[UnitTypes.rock][1] = new Image_rock_attack(0, 0);
suites[UnitTypes.rock][2] = new Image_rock_bullet(0, 0);
suites[UnitTypes.rock][3] = new Image_rock_be(0, 0);
suites[UnitTypes.star_conqueror] = new Array(4);
suites[UnitTypes.star_conqueror][0] = new Image_star_conqueror_body(0, 0);
suites[UnitTypes.star_conqueror][1] = new Image_star_conqueror_attack(0, 0);
suites[UnitTypes.star_conqueror][2] = new Image_star_conqueror_bullet(0, 0);
suites[UnitTypes.star_conqueror][3] = new Image_star_conqueror_be(0, 0);
suites[UnitTypes.war_bird] = new Array(4);
suites[UnitTypes.war_bird][0] = new Image_war_bird_body(0, 0);
suites[UnitTypes.war_bird][1] = new Image_war_bird_attack(0, 0);
suites[UnitTypes.war_bird][2] = new Image_war_bird_bullet(0, 0);
suites[UnitTypes.war_bird][3] = new Image_war_bird_be(0, 0);
grounds["desert.jpg"] = new Image_ground_desert(0, 0);
grounds["driedtree.png"] = new Image_ground_driedtree(0, 0);
grounds["grass.jpg"] = new Image_ground_grass(0, 0);
grounds["moon.jpg"] = new Image_ground_moon(0, 0);
grounds["platform.jpg"] = new Image_ground_platform(0, 0);
grounds["platformtube.png"] = new Image_ground_platformtube(0, 0);
grounds["stone.jpg"] = new Image_ground_stone(0, 0);
grounds["tree.png"] = new Image_ground_tree(0, 0);
grounds["tree2.png"] = new Image_ground_tree2(0, 0);
grounds["wall1.png"] = new Image_ground_wall1(0, 0);
grounds["wall2.png"] = new Image_ground_wall2(0, 0);
grounds["station_picket.png"] = new Image_station_picket(0, 0);
grounds["moon_picket.png"] = new Image_moon_picket(0, 0);
grounds["hatch.png"] = new Image_hatch(0, 0);
sounds[Sounds.missile_turret_launch] = new Sound_missile_turret_launch();
sounds[Sounds.laser1] = new Sound_laser1();
sounds[Sounds.laser2] = new Sound_laser2();
sounds[Sounds.explosion1] = new Sound_explosion1();
buttons[UnitTypes.b_attack] = new Image_b_attack(0, 0);
buttons[UnitTypes.b_stop] = new Image_b_stop(0, 0);
buttons[UnitTypes.b_cancel] = new Image_b_cancel(0, 0);
buttons[UnitTypes.artillery] = new Image_b_artillery(0, 0);
buttons[UnitTypes.laser_cannon] = new Image_b_laser_cannon(0, 0);
buttons[UnitTypes.missile_turret] = new Image_b_missile_turret(0, 0);
buttons[UnitTypes.plasma_mortar] = new Image_b_plasma_mortar(0, 0);
buttons[UnitTypes.power_station] = new Image_b_power_station(0, 0);
buttons[UnitTypes.refinery] = new Image_b_refinery(0, 0);
buttons[UnitTypes.stunner] = new Image_b_stunner(0, 0);
buttons[UnitTypes.cumulative_bomb] = new Image_b_cumulative_bomb(0, 0);
buttons[UnitTypes.nitro_bomb] = new Image_b_nitro_bomb(0, 0);
buttons[UnitTypes.nuclear_missile] = new Image_b_nuclear_missile(0, 0);
mimages[UnitTypes.m_crystals] = new Image_m_crystals(0, 0);
mimages[UnitTypes.m_attack] = new Image_m_attack(0, 0);
mimages[UnitTypes.m_range] = new Image_m_range(0, 0);
mimages[UnitTypes.m_armor] = new Image_m_shield(0, 0);
mimages[UnitTypes.m_energy] = new Image_m_energy(0, 0);
statuses[UnitTypes.artillery] = new Image_artillery_status_sprite(0, 0);
statuses[UnitTypes.laser_cannon] = new Image_laser_cannon_status_sprite(0, 0);
statuses[UnitTypes.missile_turret] = new Image_missile_turret_status_sprite(0, 0);
statuses[UnitTypes.plasma_mortar] = new Image_plasma_mortar_status_sprite(0, 0);
statuses[UnitTypes.harvester] = new Image_harvester_status_sprite(0, 0);
statuses[UnitTypes.stunner] = new Image_stunner_status_sprite(0, 0);
statuses[UnitTypes.command_center] = new Image_command_center_status_sprite(0, 0);
statuses[UnitTypes.refinery] = new Image_refinery_status_sprite(0, 0);
statuses[UnitTypes.power_station] = new Image_power_station_status_sprite(0, 0);
statuses[UnitTypes.battle_shuttle] = new Image_battle_shuttle_status_sprite(0, 0);
statuses[UnitTypes.destroyer] = new Image_destroyer_status_sprite(0, 0);
statuses[UnitTypes.executor] = new Image_executor_status_sprite(0, 0);
statuses[UnitTypes.fighter_t1] = new Image_fighter_t1_status_sprite(0, 0);
statuses[UnitTypes.fighter_t2] = new Image_fighter_t2_status_sprite(0, 0);
statuses[UnitTypes.fighter_t3] = new Image_fighter_t3_status_sprite(0, 0);
statuses[UnitTypes.gunship] = new Image_gunship_status_sprite(0, 0);
statuses[UnitTypes.interceptor] = new Image_interceptor_status_sprite(0, 0);
statuses[UnitTypes.jackal] = new Image_jackal_status_sprite(0, 0);
statuses[UnitTypes.rock] = new Image_rock_status_sprite(0, 0);
statuses[UnitTypes.star_conqueror] = new Image_star_conqueror_status_sprite(0, 0);
statuses[UnitTypes.war_bird] = new Image_war_bird_status_sprite(0, 0);
statuses[UnitTypes.sp_crystals] = new Image_crystals_status(0, 0);
specials[UnitTypes.sp_crystals] = new Image_sp_crystals(0, 0);
specials[UnitTypes.nitro_bomb] = new Image_sp_nitro_bomb(0, 0);
specials[UnitTypes.cumulative_bomb] = new Image_sp_cumulative_bomb(0, 0);
specials[UnitTypes.nuclear_missile] = new Image_sp_nuclear_bomb(0, 0);
specials[UnitTypes.sp_death1] = new Image_sp_death1(0, 0);
specials[UnitTypes.sp_debris] = new Image_sp_debris(0, 0);
specials[UnitTypes.sp_my_order] = new Image_my_order(0, 0);
specials[UnitTypes.sp_hostile_order] = new Image_hostile_order(0, 0);
}
public function getMenuItem(_arg1:String):AnimatedBitmap{
var _local2:BitmapData;
_local2 = mimages[_arg1];
return (new AnimatedBitmap(_local2, _local2.width, _local2.height));
}
public function getSound(_arg1:int):Sound{
return (sounds[_arg1]);
}
public function dressUnit(_arg1:Unit, _arg2:String, _arg3:Engine):void{
var _local4:Array;
_local4 = suites[_arg2];
_arg1.sprite.setAppearence(_local4[0], _local4[1], _local4[2], _local4[3], _arg1.sprite_width, _arg3.getColor(_arg1.mapid));
if (!_arg1.attacksound){
_arg1.attacksound = Sound(getSound(Sounds.laser1));
};
if (_arg1.flag(UnitFlags.Flying)){
_arg3.game_board.airlayer.addChildAt(_arg1.sprite, 0);
} else {
_arg3.game_board.groundlayer.addChildAt(_arg1.sprite, 0);
};
}
public function getBody(_arg1:String):BitmapData{
var _local2:Array;
_local2 = suites[_arg1];
return (_local2[0]);
}
public function getButton(_arg1:String):AnimatedBitmap{
var _local2:BitmapData;
_local2 = buttons[_arg1];
return (new AnimatedBitmap(_local2, _local2.width, _local2.height));
}
public function dressResource(_arg1:Unit, _arg2:String, _arg3:Engine):void{
var _local4:BitmapData;
_local4 = specials[_arg2];
_arg1.sprite.setAppearence(_local4, null, null, null, _arg1.sprite_width, 0, false);
_arg3.game_board.resourcelayer.addChildAt(_arg1.sprite, 0);
}
public function getGround(_arg1:String):AnimatedBitmap{
var _local2:BitmapData;
_local2 = grounds[_arg1];
return (new AnimatedBitmap(_local2, _local2.width, _local2.height));
}
}
}//package fai
Section 47
//SoundControlMC (fai.SoundControlMC)
package fai {
import flash.events.*;
import fl.controls.*;
import flash.display.*;
import flash.text.*;
import flash.media.*;
import fl.events.*;
public class SoundControlMC extends MovieClip {
private var sound_slider:Slider;// = null
public var engine:Engine;// = null
public function SoundControlMC():void{
engine = null;
sound_slider = null;
super();
sound_slider = new Slider();
sound_slider.liveDragging = true;
sound_slider.setSize(100, 0);
sound_slider.maximum = 100;
sound_slider.minimum = 0;
sound_slider.tickInterval = 5;
sound_slider.addEventListener(SliderEvent.CHANGE, musicChange);
sound_slider.x = 60;
sound_slider.y = -10;
addChild(sound_slider);
sound_slider.value = 100;
}
public function destroy():void{
sound_slider.removeEventListener(SliderEvent.CHANGE, musicChange);
removeChild(sound_slider);
sound_slider = null;
}
private function musicChange(_arg1:Event):void{
var _local2:SoundTransform;
engine.volume = (sound_slider.value / 100);
if (engine.global_stage.main_menu.planets.music_channel){
_local2 = engine.global_stage.main_menu.planets.music_channel.soundTransform;
_local2.volume = engine.volume;
engine.global_stage.main_menu.planets.music_channel.soundTransform = _local2;
};
}
public function setEngine(_arg1:Engine):void{
engine = _arg1;
sound_slider.value = (engine.volume * 100);
}
}
}//package fai
Section 48
//Sounds (fai.Sounds)
package fai {
public final class Sounds {
public static var laser1:int = 9;
public static var new_wave:int = 11;
public static var click:int = 2;
public static var missile_turret_launch:int = 8;
public static var laser2:int = 10;
public static var upgrade:int = 1;
public static var click1:int = 3;
public static var tada:int = 0;
public static var build:int = 5;
public static var defeat:int = 7;
public static var menu_appear:int = 6;
public static var explosion1:int = 12;
public static var unpause:int = 4;
}
}//package fai
Section 49
//Statistics (fai.Statistics)
package fai {
import flash.events.*;
import flash.display.*;
import flash.text.*;
import flash.utils.*;
import mochi.*;
public class Statistics extends Sprite {
public var play_again_button:SimpleButton;
public var bombs:int;// = 0
public var lost:int;// = 0
public var crystals_txt:TextField;
public var built_txt:TextField;
public var score_txt:TextField;
private var engine:Engine;// = null
public var final_victory:MovieClip;
public var bombs_txt:TextField;
public var submit_score_button:SimpleButton;
public var killed:int;// = 0
public var built:int;// = 0
private var score:int;// = 0
public var main_menu_button:SimpleButton;
private var counterTimer:Timer;// = null
public var stat_title:TextField;
public var killed_txt:TextField;
public var continue_button:SimpleButton;
public var firework1:MovieClip;
public var firework2:MovieClip;
public var lost_txt:TextField;
public var crystals:int;// = 0
public function Statistics():void{
killed = 0;
lost = 0;
built = 0;
crystals = 0;
bombs = 0;
score = 0;
engine = null;
counterTimer = null;
super();
}
public function destroy():void{
if (counterTimer){
counterTimer.stop();
counterTimer.removeEventListener(TimerEvent.TIMER, counterTick);
counterTimer = null;
};
play_again_button.removeEventListener(MouseEvent.MOUSE_DOWN, playAgain);
main_menu_button.removeEventListener(MouseEvent.MOUSE_DOWN, mainMenu);
continue_button.removeEventListener(MouseEvent.MOUSE_DOWN, mainMenu);
}
public function init(_arg1:Engine):void{
engine = _arg1;
play_again_button.addEventListener(MouseEvent.MOUSE_DOWN, playAgain);
main_menu_button.addEventListener(MouseEvent.MOUSE_DOWN, mainMenu);
continue_button.addEventListener(MouseEvent.MOUSE_DOWN, planets);
submit_score_button.addEventListener(MouseEvent.MOUSE_DOWN, submitScore);
}
public function victory():void{
firework1.play();
firework2.play();
stat_title.text = "Well Done!";
continue_button.visible = true;
}
private function counter(_arg1, _arg2:int):int{
var _local3:int;
if (_arg2 > 0){
_local3 = ((_arg2 > 10)) ? 10 : _arg2;
_arg1.text = (int(_arg1.text) + _local3).toString();
return (_local3);
};
return (0);
}
public function start():void{
killed_txt.text = "0";
lost_txt.text = "0";
built_txt.text = "0";
crystals_txt.text = "0";
bombs_txt.text = "0";
score_txt.text = "0";
score = engine.score;
counterTimer = new Timer(30, 0);
counterTimer.addEventListener(TimerEvent.TIMER, counterTick);
counterTimer.start();
}
private function submitScore(_arg1:MouseEvent):void{
var evt = _arg1;
MochiScores.showLeaderboard({boardID:"eb79342347b90226", score:engine.score, onClose:function (){
visible = false;
engine.playSound(Sounds.click);
engine.clearAll();
if (engine.global_stage.main_menu.planets.current_level >= 11){
engine.global_stage.main_menu.planets.current_level = 0;
};
engine.global_stage.main_menu.visible = true;
}});
engine.score = 0;
}
public function defeat():void{
stat_title.text = "DEFEAT";
continue_button.visible = false;
}
private function playAgain(_arg1:MouseEvent):void{
visible = false;
engine.playSound(Sounds.click);
engine.playLevel(engine.last_loaded_level);
}
private function mainMenu(_arg1:MouseEvent):void{
visible = false;
engine.playSound(Sounds.click);
engine.clearAll();
if (engine.global_stage.main_menu.planets.current_level >= 11){
engine.global_stage.main_menu.planets.current_level = 0;
};
engine.global_stage.main_menu.visible = true;
}
private function counterTick(_arg1:TimerEvent):void{
killed = (killed - counter(killed_txt, killed));
lost = (lost - counter(lost_txt, lost));
built = (built - counter(built_txt, built));
crystals = (crystals - counter(crystals_txt, crystals));
bombs = (bombs - counter(bombs_txt, bombs));
score = (score - counter(score_txt, score));
if ((((((killed + lost) + built) + crystals) + bombs) + score) == 0){
counterTimer.stop();
counterTimer.removeEventListener(TimerEvent.TIMER, counterTick);
counterTimer = null;
};
}
private function planets(_arg1:MouseEvent):void{
visible = false;
engine.playSound(Sounds.click);
engine.clearAll();
if (engine.global_stage.main_menu.planets.current_level >= 11){
engine.global_stage.main_menu.planets.current_level = 0;
engine.global_stage.main_menu.visible = true;
} else {
engine.global_stage.main_menu.showPlanets();
};
}
}
}//package fai
Section 50
//TutorialMC (fai.TutorialMC)
package fai {
import flash.events.*;
import flash.display.*;
public class TutorialMC extends MovieClip {
private var engine:Engine;// = null
public var current_page:String;// = "page1"
public var continue_button:SimpleButton;
public var skip_button:SimpleButton;
public function TutorialMC():void{
engine = null;
current_page = "page1";
super();
addFrameScript(0, frame1);
}
public function init(_arg1:Engine):void{
engine = _arg1;
continue_button.addEventListener(MouseEvent.MOUSE_DOWN, continueClick);
skip_button.addEventListener(MouseEvent.MOUSE_DOWN, skipClick);
}
private function continueClick(_arg1:MouseEvent):void{
engine.playSound(Sounds.click);
switch (current_page){
case "page1":
gotoPage("page2");
break;
case "page2":
gotoPage("page3");
break;
case "page3":
gotoPage("page4");
break;
case "page4":
gotoPage("page5");
break;
case "page5":
engine.play_window.hideTutorial();
break;
};
}
private function skipClick(_arg1:MouseEvent):void{
engine.playSound(Sounds.click);
engine.play_window.hideTutorial();
}
function frame1(){
stop();
}
public function gotoPage(_arg1:String):void{
current_page = _arg1;
gotoAndStop(_arg1);
}
}
}//package fai
Section 51
//Unit (fai.Unit)
package fai {
import flash.events.*;
import flash.media.*;
public final class Unit {
public var bulletspeed:uint;// = 40
public var full_health:int;// = 0
public var cstate:uint;// = 0
private var attackpos:Position;// = null
public var flags:uint;// = 0
public var desc:String;// = "Assaulter. Defend Command Center
against this unit."
public var rotstep:int;// = 10
private var destangel:int;// = 0
private var movetarget:Position;// = null
public var eyerange:uint;// = 5
public var cost_crystals:uint;// = 20
public var deathsteps:uint;// = 12
public var type:String;// = null
public var death_cost:int;// = 1
public var engine:Engine;// = null
public var sprite:UnitSprite;// = null
public var attacksound:Sound;// = null
public var upgradeLevel:int;// = 0
private var xstep:Number;// = 0
public var sprite_width:int;// = 32
public var armor:uint;// = 1
private var step:uint;// = 0
public var pos:Position;
private var attacktarget:Unit;// = null
public var health:int;// = 50
private var ystep:Number;// = 0
public var rotating:Boolean;// = false
public var attackssteps:uint;// = 3
public var damage:uint;// = 0
public var movesteps:uint;// = 10
public var mapid:uint;// = 0
public var rechargetime:uint;// = 25
public var life:LifeGoal;// = null
public function Unit(_arg1:Engine, _arg2:uint, _arg3:String):void{
rotstep = 10;
movesteps = 10;
attackssteps = 3;
deathsteps = 12;
type = null;
sprite_width = 32;
pos = new Position();
sprite = null;
cstate = 0;
eyerange = 5;
damage = 0;
armor = 1;
health = 50;
bulletspeed = 40;
rechargetime = 25;
upgradeLevel = 0;
full_health = 0;
death_cost = 1;
cost_crystals = 20;
flags = 0;
attacksound = null;
desc = "Assaulter. Defend Command Center\nagainst this unit.";
movetarget = null;
attacktarget = null;
attackpos = null;
engine = null;
mapid = 0;
xstep = 0;
ystep = 0;
step = 0;
rotating = false;
destangel = 0;
life = null;
super();
engine = _arg1;
mapid = _arg2;
type = _arg3;
sprite = new UnitSprite(this);
if (engine){
sprite.addEventListener(MouseEvent.MOUSE_OVER, onmouseover);
sprite.addEventListener(MouseEvent.MOUSE_OUT, onmouseout);
};
}
public function die():void{
}
private function onmouseover(_arg1:MouseEvent):void{
updateHealth();
}
public function updateHealth():void{
sprite.select(true);
}
public function copyProperties(_arg1:Unit):void{
eyerange = _arg1.eyerange;
damage = _arg1.damage;
armor = _arg1.armor;
health = _arg1.health;
bulletspeed = _arg1.bulletspeed;
rechargetime = _arg1.rechargetime;
}
private function onmouseout(_arg1:MouseEvent):void{
if (((!(isAlive())) || (!(engine.game_process.isUnitInSelection(this))))){
sprite.select(false);
};
}
public function flag(_arg1:uint):Boolean{
return ((flags & _arg1));
}
public function startattack(_arg1:Unit):void{
reset();
attacktarget = _arg1;
cstate = Consts.ATTACK;
attackpos = new Position();
attackpos.set(attacktarget.sprite.x, attacktarget.sprite.y);
startrotate((((Math.atan2((attacktarget.sprite.y - sprite.y), (attacktarget.sprite.x - sprite.x)) / Math.PI) * 180) - 90));
}
public function startrotate(_arg1:int):void{
destangel = (_arg1 - sprite.body.rotation);
if (destangel > 180){
destangel = (destangel - 360);
} else {
if (destangel < -180){
destangel = (destangel + 360);
};
};
if (!destangel){
return;
};
rotating = true;
}
public function isAlive():Boolean{
return ((health > 0));
}
public function attack():void{
if (rotating){
rotate();
return;
};
if (!step){
sprite.setAttackSprite();
engine.playSoundPos(attacksound, pos);
};
if (step >= attackssteps){
engine.game_process.runBullet(this, attacktarget, attackpos);
reset();
sprite.setMoveSprite();
} else {
step++;
sprite.setFrame(((step * sprite.nframes()) / attackssteps));
};
}
public function move():void{
if (rotating){
rotate();
return;
};
if (!step){
sprite.setMoveSprite();
};
sprite.x = (sprite.x + xstep);
sprite.y = (sprite.y + ystep);
step++;
sprite.setFrame(((step * sprite.nframes()) / movesteps));
if (step >= movesteps){
if ((flags & UnitFlags.Flying)){
engine.game_board.airworld.setpos(pos, 0);
} else {
engine.game_board.world.setpos(pos, 0);
};
pos = movetarget;
reset();
};
}
public function reset():void{
cstate = Consts.IDLE;
step = (ystep = (xstep = 0));
attacktarget = null;
rotating = false;
}
public function rotate():void{
var _local1:int;
if (Math.abs(destangel) < rotstep){
sprite.body.rotation = (sprite.body.rotation + destangel);
destangel = 0;
rotating = false;
} else {
_local1 = ((Math.abs(destangel) > rotstep)) ? ((destangel > 0)) ? rotstep : -(rotstep) : destangel;
sprite.body.rotation = (sprite.body.rotation + _local1);
destangel = (destangel - _local1);
};
}
public function startmove(_arg1:Position):void{
reset();
movetarget = _arg1;
cstate = Consts.MOVING;
xstep = (((movetarget.x * Consts.cell_size) - sprite.x) / movesteps);
ystep = (((movetarget.y * Consts.cell_size) - sprite.y) / movesteps);
startrotate((((Math.atan2(ystep, xstep) / Math.PI) * 180) - 90));
}
public function activate(_arg1:Engine):void{
life = new LifeGoal(_arg1, this);
_arg1.goal_system.add(life);
}
public function destroy():void{
reset();
if (cstate != Consts.DEATH){
cstate = Consts.DEATH;
};
sprite.removeEventListener(MouseEvent.MOUSE_OVER, onmouseover);
sprite.removeEventListener(MouseEvent.MOUSE_OUT, onmouseout);
sprite.select(false);
}
}
}//package fai
Section 52
//UnitBuilder (fai.UnitBuilder)
package fai {
public class UnitBuilder {
private var engine:Engine;// = null
private var tasks:Array;
public function UnitBuilder(_arg1:Engine):void{
engine = null;
tasks = new Array();
super();
engine = _arg1;
}
public function addTask(_arg1:Unit, _arg2:String):void{
var _local3:Boolean;
var _local4:BuildingTask;
_local3 = false;
_local4 = null;
for each (_local4 in tasks) {
if ((((_local4.building == _arg1)) && ((_local4.task == _arg2)))){
_local4.addTask();
_local3 = true;
break;
};
};
if (!_local3){
_local4 = new BuildingTask(_arg1, _arg2, engine.utypes.buildSteps(_arg2), engine.utypes.params(_arg2).health, engine.utypes.params(_arg2).flag(UnitFlags.Building));
tasks.push(_local4);
};
if (_local4){
engine.play_window.right_menu.unit_info.building(_local4.task, _local4.completed());
};
}
public function buildTick():void{
var _local1:uint;
var _local2:BuildingTask;
var _local3:Boolean;
_local1 = 0;
while (_local1 < tasks.length) {
_local2 = tasks[_local1];
_local3 = _local2.build();
if (_local2.finished()){
delete tasks[_local1];
tasks.splice(_local1, 1);
} else {
_local1++;
};
if (_local3){
engine.game_process.endBuilding(_local2.building, _local2.task, _local2.finished());
};
if (engine.game_process.isSelectedUnit(_local2.building)){
if (((!(_local2.finished())) && (((_local2.tick % 5) == 0)))){
engine.play_window.right_menu.unit_info.building(_local2.task, _local2.completed());
};
};
};
}
public function clear():void{
var _local1:BuildingTask;
for each (_local1 in tasks) {
(_local1.building == null);
};
tasks.length = 0;
}
public function inBuilding(_arg1:Unit):String{
var _local2:BuildingTask;
for each (_local2 in tasks) {
if (_local2.building == _arg1){
return (_local2.task);
};
};
return (null);
}
public function cancelTask(_arg1:Unit, _arg2:String):Boolean{
var _local3:uint;
var _local4:BuildingTask;
_local3 = 0;
while (_local3 < tasks.length) {
_local4 = tasks[_local3];
if ((((_local4.building == _arg1)) && ((_local4.task == _arg2)))){
_local4.count--;
if (!_local4.count){
tasks.splice(_local3, 1);
engine.play_window.updateInfo();
};
return (true);
};
_local3++;
};
return (false);
}
}
}//package fai
class BuildingTask {
public var task:String;// = ""
public var fullHealth:int;// = 0
private var chunk:Number;// = 0
public var count:int;// = 0
public var building:Unit;// = null
public var isconstr:Boolean;// = false
private var health:Number;// = 0
public var tick:int;// = 0
private function BuildingTask(_arg1:Unit, _arg2:String, _arg3:int, _arg4:int, _arg5:Boolean):void{
building = null;
count = 0;
task = "";
fullHealth = 0;
chunk = 0;
health = 0;
isconstr = false;
tick = 0;
super();
building = _arg1;
fullHealth = _arg4;
task = _arg2;
chunk = (fullHealth / _arg3);
health = 1;
isconstr = _arg5;
if (isconstr){
building.health = (fullHealth / 2);
};
addTask();
}
public function completed():int{
return (int(health));
}
public function addTask():void{
count++;
}
public function build():Boolean{
health = (health + chunk);
tick++;
if (isconstr){
if (!building.isAlive()){
count--;
tick = 0;
health = 0;
return (true);
};
};
if (health >= fullHealth){
if (isconstr){
building.health = fullHealth;
};
count--;
health = 0;
tick = 0;
return (true);
};
return (false);
}
public function finished():Boolean{
return ((count <= 0));
}
}
Section 53
//UnitFlags (fai.UnitFlags)
package fai {
public final class UnitFlags {
public static const Building:uint = 2;
public static const Peaceful:uint = 1;
public static const Antiaircraft:uint = 8;
public static const Antilandforces:uint = 16;
public static const Flying:uint = 4;
}
}//package fai
Section 54
//UnitInfo (fai.UnitInfo)
package fai {
import flash.display.*;
import flash.text.*;
import flash.filters.*;
public class UnitInfo extends Sprite {
public var description:TextField;
private var status_bitmap:AnimatedBitmap;// = null
public var repair_button:SimpleButton;
public var armor:TextField;
private var last_type:String;// = ""
public var range:TextField;
private var engine:Engine;// = null
public var info_icons:MovieClip;
public var attack:TextField;
public var title:TextField;
public var health:TextField;
public var up_crystals:TextField;
public var building_txt:TextField;
public var up_attack:TextField;
private var last_frontier:int;// = -1
public var stop_repair_button:SimpleButton;
public var selected_sprites:Array;// = null
public var up_armor:TextField;
public var upgrade_button:SimpleButton;
public var sell_button:MovieClip;
private var build_progress:Shape;// = null
public var crystals:TextField;
public function UnitInfo():void{
engine = null;
status_bitmap = null;
last_type = "";
build_progress = null;
last_frontier = -1;
selected_sprites = null;
super();
}
public function destroy():void{
clearGroupSprites();
if (build_progress){
removeChild(build_progress);
build_progress = null;
};
}
private function getBitmapFilter():BitmapFilter{
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Boolean;
var _local7:Boolean;
var _local8:Number;
_local1 = 2387199;
_local2 = 0.8;
_local3 = 15;
_local4 = 15;
_local5 = 2;
_local6 = false;
_local7 = false;
_local8 = BitmapFilterQuality.HIGH;
return (new GlowFilter(_local1, _local2, _local3, _local4, _local5, _local8, _local6, _local7));
}
public function init(_arg1:Engine):void{
engine = _arg1;
sell_button.buttonMode = true;
sell_button.mouseChildren = false;
build_progress = new Shape();
build_progress.x = 90;
build_progress.y = 80;
build_progress.visible = false;
addChild(build_progress);
}
private function setStatus(_arg1:String, _arg2:Number):void{
var _local3:BitmapFilter;
var _local4:Array;
if (((status_bitmap) && (!((last_type == _arg1))))){
status_bitmap.bitmapData.dispose();
removeChild(status_bitmap);
status_bitmap = null;
};
if (_arg1 == ""){
return;
};
if (!status_bitmap){
status_bitmap = engine.sloader.getStatusSprite(_arg1);
status_bitmap.x = 15;
status_bitmap.y = 45;
addChild(status_bitmap);
_local3 = getBitmapFilter();
_local4 = new Array();
_local4.push(_local3);
status_bitmap.filters = _local4;
};
status_bitmap.setFrame(((4 - (5 * _arg2)) + 1));
last_type = _arg1;
}
public function updateGroup(_arg1:Array):void{
var _local2:int;
var _local3:Array;
var _local4:SelectedSprite;
var _local5:Boolean;
var _local6:Boolean;
var _local7:Boolean;
var _local8:int;
title.text = (("Selected " + _arg1.length.toString()) + " units");
building_txt.visible = false;
build_progress.visible = false;
crystals.visible = false;
armor.visible = false;
attack.visible = false;
range.visible = false;
health.visible = false;
description.visible = false;
info_icons.visible = false;
sell_button.visible = true;
upgrade_button.visible = true;
setStatus("", 0);
_local2 = 0;
clearGroupSprites();
_local3 = engine.game_process.selected_units;
_local4 = null;
_local5 = false;
_local6 = false;
_local7 = false;
_local8 = 0;
_local2 = 0;
while (_local2 < _local3.length) {
_local4 = new SelectedSprite(engine, _local3[_local2]);
selected_sprites.push(_local4);
_local4.x = ((_local2 % 2) * (SelectedSprite.wsize + 5));
_local4.y = (40 + (int((_local2 / 2)) * (SelectedSprite.hsize + 5)));
addChild(_local4);
if (_local3[_local2].life.auto_repair){
_local6 = true;
};
if (_local3[_local2].upgradeLevel < 5){
_local7 = true;
};
_local8 = (_local8 + int(((_local3[_local2].cost_crystals * _local3[_local2].health) / _local3[_local2].full_health)));
_local2++;
};
sell_button.caption.text = ("Sell for " + _local8.toString());
if (_local6){
repair_button.visible = true;
stop_repair_button.visible = false;
} else {
repair_button.visible = false;
stop_repair_button.visible = true;
};
if (_local7){
showUpgrade();
up_crystals.text = "*";
up_attack.text = "*";
up_armor.text = "*";
} else {
hideUpgrade();
};
}
private function showUpgrade():void{
up_crystals.visible = true;
up_attack.visible = true;
up_armor.visible = true;
upgrade_button.visible = true;
info_icons.x = 30;
crystals.x = 50;
range.x = 50;
armor.x = 50;
attack.x = 50;
}
public function building(_arg1:String, _arg2:int):void{
var full_health:int;
var rects:int;
var frontier:int;
var rsize:*;
var startx:*;
var i:*;
var type = _arg1;
var compl = _arg2;
full_health = engine.utypes.params(type).health;
rects = 16;
frontier = ((compl * rects) / full_health);
if (frontier != last_frontier){
last_frontier = frontier;
var _local4 = build_progress;
with (_local4) {
rsize = 6;
startx = 0;
graphics.clear();
graphics.lineStyle(1, 2244111);
i = 0;
while (i < rects) {
if (i < frontier){
graphics.beginFill(0xFF00);
} else {
graphics.beginFill(0x808080);
};
graphics.drawRect(startx, 0, rsize, rsize);
if (i < frontier){
graphics.endFill();
};
startx = (startx + rsize);
i++;
};
};
};
}
public function update(_arg1:Unit):void{
var _local2:int;
var _local3:Number;
var _local4:TextFormat;
var _local5:Number;
clearGroupSprites();
if ((((Consts.myId == _arg1.mapid)) || (!(_arg1.mapid)))){
upgrade_button.visible = true;
sell_button.visible = !((_arg1.type == UnitTypes.harvester));
if (!_arg1.mapid){
hideUpgrade();
sell_button.visible = false;
} else {
showUpgrade();
};
} else {
upgrade_button.visible = false;
sell_button.visible = false;
hideUpgrade();
};
crystals.visible = true;
armor.visible = true;
attack.visible = true;
range.visible = true;
info_icons.visible = true;
_local2 = _arg1.full_health;
_local3 = (_arg1.health / _local2);
if (((_arg1.life) && ((_arg1.mapid == Consts.myId)))){
if (_arg1.life.auto_repair){
repair_button.visible = true;
stop_repair_button.visible = false;
} else {
repair_button.visible = false;
stop_repair_button.visible = true;
};
} else {
repair_button.visible = false;
stop_repair_button.visible = false;
};
title.text = _arg1.type;
description.text = _arg1.desc;
_local4 = health.defaultTextFormat;
_local4.color = Utils.healthcolor((_local3 * 100));
health.defaultTextFormat = _local4;
health.text = ((_arg1.health.toString() + "/") + _local2.toString());
health.visible = true;
if (Consts.crystalsId == _arg1.mapid){
building_txt.visible = false;
build_progress.visible = false;
description.visible = true;
crystals.visible = false;
armor.visible = false;
attack.visible = false;
range.visible = false;
info_icons.visible = false;
setStatus(_arg1.type, _local3);
return;
};
if ((((((Consts.myId == _arg1.mapid)) && ((UnitTypes.harvester == _arg1.type)))) && (_arg1.life.ore_goal))){
title.text = (title.text + ((" (Loaded: " + _arg1.life.ore_goal.harvested.toString()) + "/24)"));
};
if (engine.game_process.builder.inBuilding(_arg1) != null){
building_txt.visible = true;
build_progress.visible = true;
description.visible = false;
attack.text = "-";
sell_button.visible = false;
hideUpgrade();
} else {
building_txt.visible = false;
build_progress.visible = false;
description.visible = true;
attack.text = _arg1.damage.toString();
if (_arg1.upgradeLevel >= 5){
hideUpgrade();
} else {
if (upgrade_button.visible){
showUpgrade();
_local5 = Utils.upgradeCost(_arg1.type, (_arg1.upgradeLevel + 1));
up_crystals.text = ("+" + int((_local5 * _arg1.cost_crystals)).toString());
up_attack.text = ("+" + int((_local5 * _arg1.damage)).toString());
up_armor.text = "+1";
};
};
if (sell_button.visible){
sell_button.caption.text = ("Sell for " + int(((_arg1.cost_crystals * _arg1.health) / _arg1.full_health)).toString());
};
};
crystals.text = _arg1.cost_crystals.toString();
armor.text = _arg1.armor.toString();
range.text = Utils.textrange(_arg1.eyerange);
setStatus(_arg1.type, _local3);
}
private function clearGroupSprites():void{
var _local1:SelectedSprite;
engine.play_window.sstooltip.visible = false;
if (selected_sprites){
while (selected_sprites.length > 0) {
_local1 = selected_sprites.shift();
_local1.destroy();
removeChild(_local1);
};
};
selected_sprites = new Array();
}
private function hideUpgrade():void{
up_crystals.visible = false;
up_attack.visible = false;
up_armor.visible = false;
upgrade_button.visible = false;
info_icons.x = 65;
crystals.x = 95;
range.x = 95;
armor.x = 95;
attack.x = 95;
}
}
}//package fai
Section 55
//UnitSprite (fai.UnitSprite)
package fai {
import flash.display.*;
import flash.filters.*;
public class UnitSprite extends Sprite {
public var bullet:BitmapData;// = null
public var selection:Shape;// = null
public var body:Sprite;
private var owner:Unit;// = null
private var building:BuildingMC;// = null
public var sprite:AnimatedBitmap;// = null
private var lastfrontier:int;// = -1
public var bulletexp:BitmapData;// = null
public var abuffer:BitmapData;// = null
public var orders:Sprite;// = null
public var mbuffer:BitmapData;// = null
public function UnitSprite(_arg1:Unit){
body = new Sprite();
selection = null;
sprite = null;
owner = null;
orders = null;
building = null;
mbuffer = null;
abuffer = null;
bullet = null;
bulletexp = null;
lastfrontier = -1;
super();
owner = _arg1;
visible = false;
}
public function select(_arg1:Boolean):void{
var sqcount:*;
var hpercent:*;
var frontier:*;
var diameter:*;
var isenemy:*;
var rsize:*;
var startx:*;
var i:*;
var enable = _arg1;
if (!selection){
selection = new Shape();
addChildAt(selection, 1);
selection.x = (selection.x - (sprite.width / 2));
selection.y = (selection.y - (sprite.height / 2));
selection.alpha = 0.5;
};
if (enable){
var _local3 = selection;
with (_local3) {
visible = true;
sqcount = 7;
hpercent = ((owner.health * 100) / owner.full_health);
frontier = ((hpercent * sqcount) / 100);
if (frontier != lastfrontier){
lastfrontier = frontier;
diameter = (Math.max(sprite.width, sprite.height) + 8);
graphics.clear();
isenemy = (owner.mapid == Consts.hostileId);
if (isenemy){
graphics.lineStyle(2, 0xFF0000);
} else {
graphics.lineStyle(2, 253443);
};
graphics.drawCircle((sprite.width / 2), (sprite.height / 2), (diameter / 2));
rsize = 5;
startx = (((-(rsize) * sqcount) / 2) + (sprite.width / 2));
graphics.lineStyle(1, 0);
i = 0;
i = 0;
while (i < sqcount) {
if (i < frontier){
if (isenemy){
graphics.beginFill(0xFF0000);
} else {
graphics.beginFill(0xFF00);
};
};
graphics.drawRect(startx, (diameter - rsize), rsize, rsize);
if (i < frontier){
graphics.endFill();
};
startx = (startx + rsize);
i++;
};
};
};
} else {
selection.visible = false;
};
}
public function setFrame(_arg1:uint):void{
sprite.setFrame(_arg1);
}
public function addOrder(_arg1:AnimatedBitmap, _arg2:int):void{
_arg1.x = ((_arg2 - 1) * _arg1.width);
orders.addChild(_arg1);
}
public function startBuilding():void{
building = new BuildingMC();
building.scaleX = (building.scaleY = (Consts.cell_size / building.height));
body.alpha = 0.7;
addChild(building);
}
public function rotate(_arg1:uint):void{
body.rotation = _arg1;
}
public function nframes():uint{
return (sprite.nframes);
}
public function setAttackSprite():void{
sprite.setBuffer(abuffer);
}
public function stopBuilding():void{
if (building){
removeChild(building);
body.alpha = 1;
building = null;
};
}
public function setAppearence(_arg1:BitmapData, _arg2:BitmapData, _arg3:BitmapData, _arg4:BitmapData, _arg5:int, _arg6:uint, _arg7:Boolean=true):void{
var _local8:BitmapFilter;
var _local9:Array;
if (_arg7){
mbuffer = setColor(_arg1, _arg6);
abuffer = setColor(_arg2, _arg6);
} else {
mbuffer = _arg1;
abuffer = _arg2;
};
bullet = _arg3;
bulletexp = _arg4;
sprite = new AnimatedBitmap(mbuffer, _arg5, mbuffer.height);
orders = new Sprite();
body.addChild(sprite);
sprite.x = (sprite.x - (sprite.width / 2));
sprite.y = (sprite.y - (sprite.height / 2));
addChild(body);
orders.x = sprite.x;
orders.y = (sprite.y + (sprite.height / 8));
addChild(orders);
if (owner.flag(UnitFlags.Flying)){
_local8 = getBitmapFilter();
_local9 = new Array();
_local9.push(_local8);
filters = _local9;
};
cacheAsBitmap = true;
}
private function getBitmapFilter():BitmapFilter{
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Boolean;
var _local9:Boolean;
var _local10:Number;
_local1 = 0;
_local2 = 45;
_local3 = 0.8;
_local4 = 5;
_local5 = 5;
_local6 = 10;
_local7 = 0.8;
_local8 = false;
_local9 = false;
_local10 = BitmapFilterQuality.LOW;
return (new DropShadowFilter(_local6, _local2, _local1, _local3, _local4, _local5, _local7, _local10, _local8, _local9));
}
public function setMoveSprite():void{
sprite.setBuffer(mbuffer);
}
public static function setColor(_arg1:BitmapData, _arg2:uint):BitmapData{
var _local3:BitmapData;
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:int;
var _local8:uint;
var _local9:uint;
var _local10:uint;
var _local11:uint;
var _local12:uint;
if (!_arg1){
return (null);
};
_local3 = _arg1.clone();
_local4 = _local3.width;
_local5 = _local3.height;
_local6 = 0;
while (_local6 < _local4) {
_local7 = 0;
while (_local7 < _local5) {
_local8 = _local3.getPixel32(_local6, _local7);
_local9 = ((_local8 >> 24) & 0xFF);
_local10 = ((_local8 >> 16) & 0xFF);
_local11 = ((_local8 >> 8) & 0xFF);
_local12 = (_local8 & 0xFF);
if ((((((_local11 == 0)) && ((_local12 == 0)))) && ((_local10 > 250)))){
_local3.setPixel(_local6, _local7, _arg2);
};
_local7++;
};
_local6++;
};
return (_local3);
}
}
}//package fai
Section 56
//UnitTypes (fai.UnitTypes)
package fai {
import flash.utils.*;
public class UnitTypes {
private var bsteps:Dictionary;
private var sloader:SmartLoader;// = null
private var engine:Engine;// = null
private var initiated:Boolean;// = false
private var unitToButton:Dictionary;
public var units:Dictionary;
public static const fighter_t2:String = "Fighter T2";
public static const fighter_t3:String = "Fighter T3";
public static const m_crystals:String = "crystals.png";
public static const m_energy:String = "energy.png";
public static const sp_debris:String = "debris.png";
public static const sp_crystals:String = "Crystals";
public static const stunner:String = "Stunner";
public static const sp_my_order:String = "My Order";
public static const interceptor:String = "Interceptor";
public static const destroyer:String = "Destroyer";
public static const missile_turret:String = "Missile Turret";
public static const nitro_bomb:String = "Nitro Bomb";
public static const enemies:Array = [battle_shuttle, destroyer, fighter_t1, fighter_t2, fighter_t3, gunship, jackal, rock, war_bird];
public static const war_bird:String = "War Bird";
public static const plasma_mortar:String = "Plasma Mortar";
public static const battle_shuttle:String = "Battle Shuttle";
public static const b_stop:String = "Stop";
public static const b_attack:String = "Attack";
public static const artillery:String = "Artillery";
public static const command_center:String = "Command Center";
public static const nuclear_missile:String = "Nuclear Missile";
public static const star_conqueror:String = "Star Conqueror";
public static const jackal:String = "Jackal";
public static const executor:String = "Executor";
public static const harvester:String = "Harvester";
public static const m_attack:String = "attack.png";
public static const bosses:Array = [executor, interceptor, star_conqueror];
public static const sp_death1:String = "death1.png";
public static const rock:String = "Rock";
public static const sp_hostile_order:String = "Hostile Order";
public static const m_armor:String = "shield.png";
public static const laser_cannon:String = "Laser Cannon";
public static const m_range:String = "range.png";
public static const refinery:String = "Refinery";
public static const cumulative_bomb:String = "Cumulative Bomb";
public static const b_cancel:String = "Cancel";
public static const types:Array = [artillery, laser_cannon, missile_turret, plasma_mortar, harvester, stunner, command_center, refinery, power_station, battle_shuttle, destroyer, executor, fighter_t1, fighter_t2, fighter_t3, gunship, interceptor, jackal, rock, star_conqueror, war_bird];
public static const power_station:String = "Power Station";
public static const gunship:String = "Gunship";
public static const fighter_t1:String = "Fighter T1";
public function UnitTypes(_arg1:Engine):void{
var _local2:String;
var _local3:Unit;
units = new Dictionary();
bsteps = new Dictionary();
unitToButton = new Dictionary();
sloader = null;
engine = null;
initiated = false;
super();
engine = _arg1;
sloader = engine.sloader;
for each (_local2 in types) {
units[_local2] = createUnit(_local2, 0);
};
_local3 = createUnit(sp_crystals, 0);
if (_local3){
units[sp_crystals] = _local3;
};
initBuildSteps();
initiated = true;
}
public function createUnit(_arg1:String, _arg2:int):Unit{
var _local3:Unit;
_local3 = null;
switch (_arg1){
case laser_cannon:
_local3 = new Unit(engine, _arg2, _arg1);
_local3.health = 100;
_local3.damage = 5;
_local3.cost_crystals = 50;
_local3.eyerange = 7;
_local3.sprite_width = 32;
_local3.rechargetime = 40;
_local3.desc = "(Air, Ground)\nSmall health, fire and cost rate.";
_local3.armor = 1;
_local3.flags = (_local3.flags | ((UnitFlags.Building | UnitFlags.Antilandforces) | UnitFlags.Antiaircraft));
break;
case artillery:
_local3 = new Unit(engine, _arg2, _arg1);
_local3.health = 150;
_local3.damage = 10;
_local3.cost_crystals = 75;
_local3.sprite_width = 30;
_local3.eyerange = 9;
_local3.desc = "(Ground)\nGood surface defender.";
_local3.armor = 2;
_local3.flags = (_local3.flags | (UnitFlags.Building | UnitFlags.Antilandforces));
break;
case missile_turret:
_local3 = new Unit(engine, _arg2, _arg1);
_local3.health = 80;
_local3.damage = 5;
_local3.cost_crystals = 125;
_local3.sprite_width = 32;
_local3.eyerange = 10;
_local3.rechargetime = 5;
_local3.desc = "(Air)\nBest Anti-Aircraft unit. Good fire power, small health rate.";
_local3.armor = 0;
_local3.flags = (_local3.flags | (UnitFlags.Building | UnitFlags.Antiaircraft));
if (initiated){
_local3.attacksound = sloader.getSound(Sounds.missile_turret_launch);
};
break;
case plasma_mortar:
_local3 = new Unit(engine, _arg2, _arg1);
_local3.health = 400;
_local3.damage = 16;
_local3.cost_crystals = 250;
_local3.sprite_width = 32;
_local3.eyerange = 7;
_local3.desc = "(Air, Ground)\nHeaviest unit. Best health and fire rate.";
_local3.armor = 4;
_local3.flags = (_local3.flags | ((UnitFlags.Building | UnitFlags.Antiaircraft) | UnitFlags.Antilandforces));
break;
case stunner:
_local3 = new Unit(engine, _arg2, _arg1);
_local3.health = 100;
_local3.damage = 3;
_local3.cost_crystals = 200;
_local3.sprite_width = 32;
_local3.eyerange = 8;
_local3.rechargetime = 100;
_local3.desc = "(Air, Ground)\nStuns enemies for several seconds. Longer recharge.";
_local3.armor = 1;
_local3.flags = (_local3.flags | ((UnitFlags.Building | UnitFlags.Antilandforces) | UnitFlags.Antiaircraft));
break;
case command_center:
_local3 = new Unit(engine, _arg2, _arg1);
_local3.health = 1500;
_local3.desc = "Rebel Headquarters. This building must not be destroyed.";
_local3.armor = 1;
_local3.cost_crystals = 500;
_local3.sprite_width = 64;
_local3.flags = (_local3.flags | (UnitFlags.Building | UnitFlags.Peaceful));
break;
case refinery:
_local3 = new Unit(engine, _arg2, _arg1);
_local3.health = 500;
_local3.cost_crystals = 150;
_local3.desc = "Crystals Refinery. Refines crystals mined by the harvester.";
_local3.armor = 0;
_local3.flags = (_local3.flags | (UnitFlags.Building | UnitFlags.Peaceful));
_local3.sprite_width = 34;
break;
case power_station:
_local3 = new Unit(engine, _arg2, _arg1);
_local3.health = 800;
_local3.cost_crystals = 60;
_local3.desc = "This building increases energy treshold by 5 points.";
_local3.armor = 0;
_local3.flags = (_local3.flags | (UnitFlags.Building | UnitFlags.Peaceful));
_local3.sprite_width = 42;
break;
case harvester:
_local3 = new Unit(engine, _arg2, _arg1);
_local3.health = 400;
_local3.cost_crystals = 125;
_local3.movesteps = 12;
_local3.desc = "This unit harvests crystals and departs them to its Refinery.";
_local3.armor = 5;
_local3.flags = (_local3.flags | (UnitFlags.Peaceful | UnitFlags.Flying));
_local3.eyerange = 10;
_local3.sprite_width = 22;
break;
case battle_shuttle:
_local3 = new Unit(engine, _arg2, _arg1);
_local3.health = 30;
_local3.damage = 3;
_local3.cost_crystals = 30;
_local3.eyerange = 3;
_local3.rechargetime = 40;
_local3.sprite_width = 30;
_local3.armor = 0;
_local3.death_cost = 2;
_local3.flags = (_local3.flags | (UnitFlags.Flying | UnitFlags.Antilandforces));
if (initiated){
_local3.attacksound = sloader.getSound(Sounds.laser2);
};
break;
case destroyer:
_local3 = new Unit(engine, _arg2, _arg1);
_local3.health = 50;
_local3.damage = 4;
_local3.cost_crystals = 50;
_local3.eyerange = 4;
_local3.rechargetime = 40;
_local3.sprite_width = 32;
_local3.armor = 1;
_local3.death_cost = 3;
_local3.flags = (_local3.flags | UnitFlags.Antilandforces);
if (initiated){
_local3.attacksound = sloader.getSound(Sounds.laser2);
};
break;
case fighter_t1:
_local3 = new Unit(engine, _arg2, _arg1);
_local3.health = 50;
_local3.damage = 3;
_local3.cost_crystals = 60;
_local3.eyerange = 4;
_local3.sprite_width = 30;
_local3.rechargetime = 40;
_local3.movesteps = 8;
_local3.armor = 0;
_local3.death_cost = 3;
_local3.flags = (_local3.flags | (UnitFlags.Flying | UnitFlags.Antilandforces));
if (initiated){
_local3.attacksound = sloader.getSound(Sounds.laser2);
};
break;
case fighter_t2:
_local3 = new Unit(engine, _arg2, _arg1);
_local3.health = 75;
_local3.damage = 3;
_local3.cost_crystals = 80;
_local3.eyerange = 4;
_local3.sprite_width = 32;
_local3.rechargetime = 40;
_local3.movesteps = 8;
_local3.armor = 0;
_local3.death_cost = 3;
_local3.flags = (_local3.flags | (UnitFlags.Flying | UnitFlags.Antilandforces));
if (initiated){
_local3.attacksound = sloader.getSound(Sounds.laser2);
};
break;
case fighter_t3:
_local3 = new Unit(engine, _arg2, _arg1);
_local3.health = 90;
_local3.damage = 4;
_local3.cost_crystals = 100;
_local3.eyerange = 4;
_local3.movesteps = 5;
_local3.sprite_width = 32;
_local3.rechargetime = 40;
_local3.armor = 0;
_local3.death_cost = 4;
_local3.flags = (_local3.flags | (UnitFlags.Flying | UnitFlags.Antilandforces));
break;
case gunship:
_local3 = new Unit(engine, _arg2, _arg1);
_local3.health = 120;
_local3.damage = 5;
_local3.cost_crystals = 120;
_local3.eyerange = 4;
_local3.sprite_width = 32;
_local3.rechargetime = 40;
_local3.armor = 0;
_local3.death_cost = 5;
_local3.flags = (_local3.flags | UnitFlags.Antilandforces);
if (initiated){
_local3.attacksound = sloader.getSound(Sounds.laser2);
};
break;
case jackal:
_local3 = new Unit(engine, _arg2, _arg1);
_local3.health = 180;
_local3.damage = 5;
_local3.cost_crystals = 180;
_local3.eyerange = 4;
_local3.sprite_width = 32;
_local3.rechargetime = 40;
_local3.armor = 0;
_local3.death_cost = 5;
_local3.flags = (_local3.flags | UnitFlags.Antilandforces);
if (initiated){
_local3.attacksound = sloader.getSound(Sounds.laser2);
};
break;
case rock:
_local3 = new Unit(engine, _arg2, _arg1);
_local3.health = 400;
_local3.damage = 6;
_local3.cost_crystals = 500;
_local3.eyerange = 2;
_local3.sprite_width = 24;
_local3.rechargetime = 40;
_local3.movesteps = 30;
_local3.armor = 0;
_local3.rotstep = 3;
_local3.death_cost = 10;
_local3.flags = (_local3.flags | UnitFlags.Antilandforces);
break;
case war_bird:
_local3 = new Unit(engine, _arg2, _arg1);
_local3.health = 200;
_local3.damage = 7;
_local3.cost_crystals = 250;
_local3.eyerange = 4;
_local3.sprite_width = 32;
_local3.rechargetime = 40;
_local3.movesteps = 20;
_local3.armor = 0;
_local3.death_cost = 8;
_local3.flags = (_local3.flags | UnitFlags.Antilandforces);
if (initiated){
_local3.attacksound = sloader.getSound(Sounds.laser2);
};
break;
case interceptor:
_local3 = new Unit(engine, _arg2, _arg1);
_local3.health = 1100;
_local3.damage = 20;
_local3.cost_crystals = 1500;
_local3.eyerange = 4;
_local3.sprite_width = 90;
_local3.rechargetime = 40;
_local3.movesteps = 25;
_local3.rotstep = 3;
_local3.armor = 1;
_local3.death_cost = 100;
_local3.flags = (_local3.flags | (UnitFlags.Flying | UnitFlags.Antilandforces));
break;
case executor:
_local3 = new Unit(engine, _arg2, _arg1);
_local3.health = 2500;
_local3.damage = 25;
_local3.cost_crystals = 3000;
_local3.eyerange = 4;
_local3.sprite_width = 80;
_local3.rechargetime = 40;
_local3.rotstep = 3;
_local3.movesteps = 28;
_local3.armor = 2;
_local3.death_cost = 300;
_local3.flags = (_local3.flags | (UnitFlags.Flying | UnitFlags.Antilandforces));
break;
case star_conqueror:
_local3 = new Unit(engine, _arg2, _arg1);
_local3.health = 5000;
_local3.damage = 35;
_local3.cost_crystals = 5000;
_local3.eyerange = 4;
_local3.sprite_width = 85;
_local3.rechargetime = 45;
_local3.rotstep = 2;
_local3.movesteps = 32;
_local3.armor = 3;
_local3.death_cost = 1000;
_local3.flags = (_local3.flags | (UnitFlags.Flying | UnitFlags.Antilandforces));
break;
case sp_crystals:
_local3 = new Unit(engine, Consts.crystalsId, _arg1);
_local3.health = 3000;
_local3.cost_crystals = 0;
_local3.sprite_width = 32;
_local3.desc = "Ore crystals. The general trade resource.";
_local3.armor = 0;
_local3.flags = (_local3.flags | (UnitFlags.Building | UnitFlags.Peaceful));
break;
};
_local3.full_health = _local3.health;
if (initiated){
_local3.copyProperties(units[_arg1]);
if (_local3.flag(UnitFlags.Peaceful)){
switch (_local3.mapid){
case Consts.crystalsId:
sloader.dressResource(_local3, _arg1, engine);
break;
default:
sloader.dressPeacefulUnit(_local3, _arg1, engine);
break;
};
} else {
sloader.dressUnit(_local3, _arg1, engine);
};
};
return (_local3);
}
public function params(_arg1:String):Unit{
return (units[_arg1]);
}
private function initBuildSteps():void{
bsteps[artillery] = 210;
bsteps[harvester] = 100;
bsteps[laser_cannon] = 150;
bsteps[missile_turret] = 280;
bsteps[plasma_mortar] = 500;
bsteps[refinery] = 400;
bsteps[power_station] = 250;
bsteps[stunner] = 400;
}
public function buildSteps(_arg1:String):int{
return (bsteps[_arg1]);
}
public static function isBoss(_arg1:String):Boolean{
return ((((((_arg1 == star_conqueror)) || ((_arg1 == interceptor)))) || ((_arg1 == executor))));
}
}
}//package fai
Section 57
//Utils (fai.Utils)
package fai {
import flash.text.*;
public class Utils {
public static function textrange(_arg1:int):String{
if (_arg1 < 6){
return ("Small");
};
if (_arg1 < 7){
return ("Average");
};
return ("Big");
}
public static function createTextField(_arg1:uint, _arg2:uint=10):TextField{
var _local3:TextField;
var _local4:TextFormat;
_local3 = new TextField();
_local3.autoSize = TextFieldAutoSize.LEFT;
_local3.background = false;
_local3.border = false;
_local3.selectable = false;
_local4 = new TextFormat();
_local4.font = "Verdana";
_local4.color = _arg1;
_local4.size = _arg2;
_local4.bold = true;
_local3.defaultTextFormat = _local4;
return (_local3);
}
public static function healthcolor(_arg1:int):int{
if (_arg1 >= 70){
return (0xFF00);
};
if (_arg1 > 30){
return (16576567);
};
return (0xFF0000);
}
public static function drawRect(_arg1, _arg2:int, _arg3:int, _arg4:int, _arg5:int, _arg6:int, _arg7:Boolean=false, _arg8:int=0, _arg9:int=0):void{
var s = _arg1;
var border = _arg2;
var bcolor = _arg3;
var fcolor = _arg4;
var w = _arg5;
var h = _arg6;
var rr = _arg7;
var xs = _arg8;
var ys = _arg9;
var _local11 = s.graphics;
with (_local11) {
lineStyle(border, bcolor);
beginFill(fcolor);
if (rr){
drawRoundRect(xs, ys, w, h, (w / 5), (h / 5));
} else {
drawRect(xs, ys, w, h);
};
endFill();
};
}
public static function upgradeCost(_arg1:String, _arg2:int):int{
switch (_arg1){
case UnitTypes.artillery:
switch (_arg2){
case 5:
return (1.25);
};
break;
case UnitTypes.missile_turret:
switch (_arg2){
case 5:
return (1.5);
};
break;
case UnitTypes.plasma_mortar:
switch (_arg2){
case 5:
return (1.5);
};
break;
case UnitTypes.war_bird:
switch (_arg2){
case 5:
return (1.5);
};
break;
};
return (1);
}
public static function unitId(_arg1:Unit):int{
return (((_arg1.pos.x * 1987600) + _arg1.pos.y));
}
}
}//package fai
Section 58
//BaseButton (fl.controls.BaseButton)
package fl.controls {
import flash.events.*;
import flash.display.*;
import fl.core.*;
import flash.utils.*;
import fl.events.*;
public class BaseButton extends UIComponent {
protected var _selected:Boolean;// = false
private var unlockedMouseState:String;
protected var pressTimer:Timer;
protected var mouseState:String;
protected var background:DisplayObject;
private var _mouseStateLocked:Boolean;// = false
protected var _autoRepeat:Boolean;// = false
private static var defaultStyles:Object = {upSkin:"Button_upSkin", downSkin:"Button_downSkin", overSkin:"Button_overSkin", disabledSkin:"Button_disabledSkin", selectedDisabledSkin:"Button_selectedDisabledSkin", selectedUpSkin:"Button_selectedUpSkin", selectedDownSkin:"Button_selectedDownSkin", selectedOverSkin:"Button_selectedOverSkin", focusRectSkin:null, focusRectPadding:null, repeatDelay:500, repeatInterval:35};
public function BaseButton(){
_selected = false;
_autoRepeat = false;
_mouseStateLocked = false;
super();
buttonMode = true;
mouseChildren = false;
useHandCursor = false;
setupMouseEvents();
setMouseState("up");
pressTimer = new Timer(1, 0);
pressTimer.addEventListener(TimerEvent.TIMER, buttonDown, false, 0, true);
}
protected function endPress():void{
pressTimer.reset();
}
public function set mouseStateLocked(_arg1:Boolean):void{
_mouseStateLocked = _arg1;
if (_arg1 == false){
setMouseState(unlockedMouseState);
} else {
unlockedMouseState = mouseState;
};
}
public function get autoRepeat():Boolean{
return (_autoRepeat);
}
public function set autoRepeat(_arg1:Boolean):void{
_autoRepeat = _arg1;
}
override public function set enabled(_arg1:Boolean):void{
super.enabled = _arg1;
mouseEnabled = _arg1;
}
public function get selected():Boolean{
return (_selected);
}
protected function mouseEventHandler(_arg1:MouseEvent):void{
if (_arg1.type == MouseEvent.MOUSE_DOWN){
setMouseState("down");
startPress();
} else {
if ((((_arg1.type == MouseEvent.ROLL_OVER)) || ((_arg1.type == MouseEvent.MOUSE_UP)))){
setMouseState("over");
endPress();
} else {
if (_arg1.type == MouseEvent.ROLL_OUT){
setMouseState("up");
endPress();
};
};
};
}
public function setMouseState(_arg1:String):void{
if (_mouseStateLocked){
unlockedMouseState = _arg1;
return;
};
if (mouseState == _arg1){
return;
};
mouseState = _arg1;
invalidate(InvalidationType.STATE);
}
protected function startPress():void{
if (_autoRepeat){
pressTimer.delay = Number(getStyleValue("repeatDelay"));
pressTimer.start();
};
dispatchEvent(new ComponentEvent(ComponentEvent.BUTTON_DOWN, true));
}
protected function buttonDown(_arg1:TimerEvent):void{
if (!_autoRepeat){
endPress();
return;
};
if (pressTimer.currentCount == 1){
pressTimer.delay = Number(getStyleValue("repeatInterval"));
};
dispatchEvent(new ComponentEvent(ComponentEvent.BUTTON_DOWN, true));
}
public function set selected(_arg1:Boolean):void{
if (_selected == _arg1){
return;
};
_selected = _arg1;
invalidate(InvalidationType.STATE);
}
override public function get enabled():Boolean{
return (super.enabled);
}
override protected function draw():void{
if (isInvalid(InvalidationType.STYLES, InvalidationType.STATE)){
drawBackground();
invalidate(InvalidationType.SIZE, false);
};
if (isInvalid(InvalidationType.SIZE)){
drawLayout();
};
super.draw();
}
protected function setupMouseEvents():void{
addEventListener(MouseEvent.ROLL_OVER, mouseEventHandler, false, 0, true);
addEventListener(MouseEvent.MOUSE_DOWN, mouseEventHandler, false, 0, true);
addEventListener(MouseEvent.MOUSE_UP, mouseEventHandler, false, 0, true);
addEventListener(MouseEvent.ROLL_OUT, mouseEventHandler, false, 0, true);
}
protected function drawLayout():void{
background.width = width;
background.height = height;
}
protected function drawBackground():void{
var _local1:String;
var _local2:DisplayObject;
_local1 = (enabled) ? mouseState : "disabled";
if (selected){
_local1 = (("selected" + _local1.substr(0, 1).toUpperCase()) + _local1.substr(1));
};
_local1 = (_local1 + "Skin");
_local2 = background;
background = getDisplayObjectInstance(getStyleValue(_local1));
addChildAt(background, 0);
if (((!((_local2 == null))) && (!((_local2 == background))))){
removeChild(_local2);
};
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
}
}//package fl.controls
Section 59
//Button (fl.controls.Button)
package fl.controls {
import flash.display.*;
import fl.core.*;
import fl.managers.*;
public class Button extends LabelButton implements IFocusManagerComponent {
protected var emphasizedBorder:DisplayObject;
protected var _emphasized:Boolean;// = false
private static var defaultStyles:Object = {emphasizedSkin:"Button_emphasizedSkin", emphasizedPadding:2};
public static var createAccessibilityImplementation:Function;
public function Button(){
_emphasized = false;
super();
}
override public function drawFocus(_arg1:Boolean):void{
var _local2:Number;
var _local3:*;
super.drawFocus(_arg1);
if (_arg1){
_local2 = Number(getStyleValue("emphasizedPadding"));
if ((((_local2 < 0)) || (!(_emphasized)))){
_local2 = 0;
};
_local3 = getStyleValue("focusRectPadding");
_local3 = ((_local3)==null) ? 2 : _local3;
_local3 = (_local3 + _local2);
uiFocusRect.x = -(_local3);
uiFocusRect.y = -(_local3);
uiFocusRect.width = (width + (_local3 * 2));
uiFocusRect.height = (height + (_local3 * 2));
};
}
public function set emphasized(_arg1:Boolean):void{
_emphasized = _arg1;
invalidate(InvalidationType.STYLES);
}
override protected function draw():void{
if (((isInvalid(InvalidationType.STYLES)) || (isInvalid(InvalidationType.SIZE)))){
drawEmphasized();
};
super.draw();
if (emphasizedBorder != null){
setChildIndex(emphasizedBorder, (numChildren - 1));
};
}
public function get emphasized():Boolean{
return (_emphasized);
}
override protected function initializeAccessibility():void{
if (Button.createAccessibilityImplementation != null){
Button.createAccessibilityImplementation(this);
};
}
protected function drawEmphasized():void{
var _local1:Object;
var _local2:Number;
if (emphasizedBorder != null){
removeChild(emphasizedBorder);
};
emphasizedBorder = null;
if (!_emphasized){
return;
};
_local1 = getStyleValue("emphasizedSkin");
if (_local1 != null){
emphasizedBorder = getDisplayObjectInstance(_local1);
};
if (emphasizedBorder != null){
addChildAt(emphasizedBorder, 0);
_local2 = Number(getStyleValue("emphasizedPadding"));
emphasizedBorder.x = (emphasizedBorder.y = -(_local2));
emphasizedBorder.width = (width + (_local2 * 2));
emphasizedBorder.height = (height + (_local2 * 2));
};
}
public static function getStyleDefinition():Object{
return (UIComponent.mergeStyles(LabelButton.getStyleDefinition(), defaultStyles));
}
}
}//package fl.controls
Section 60
//ButtonLabelPlacement (fl.controls.ButtonLabelPlacement)
package fl.controls {
public class ButtonLabelPlacement {
public static const TOP:String = "top";
public static const LEFT:String = "left";
public static const BOTTOM:String = "bottom";
public static const RIGHT:String = "right";
}
}//package fl.controls
Section 61
//LabelButton (fl.controls.LabelButton)
package fl.controls {
import flash.events.*;
import flash.display.*;
import flash.text.*;
import fl.core.*;
import fl.managers.*;
import fl.events.*;
import flash.ui.*;
public class LabelButton extends BaseButton implements IFocusManagerComponent {
protected var _labelPlacement:String;// = "right"
protected var _toggle:Boolean;// = false
protected var icon:DisplayObject;
protected var oldMouseState:String;
protected var mode:String;// = "center"
public var textField:TextField;
protected var _label:String;// = "Label"
private static var defaultStyles:Object = {icon:null, upIcon:null, downIcon:null, overIcon:null, disabledIcon:null, selectedDisabledIcon:null, selectedUpIcon:null, selectedDownIcon:null, selectedOverIcon:null, textFormat:null, disabledTextFormat:null, textPadding:5, embedFonts:false};
public static var createAccessibilityImplementation:Function;
public function LabelButton(){
_labelPlacement = ButtonLabelPlacement.RIGHT;
_toggle = false;
_label = "Label";
mode = "center";
super();
}
protected function toggleSelected(_arg1:MouseEvent):void{
selected = !(selected);
dispatchEvent(new Event(Event.CHANGE, true));
}
public function get labelPlacement():String{
return (_labelPlacement);
}
override protected function keyDownHandler(_arg1:KeyboardEvent):void{
if (!enabled){
return;
};
if (_arg1.keyCode == Keyboard.SPACE){
if (oldMouseState == null){
oldMouseState = mouseState;
};
setMouseState("down");
startPress();
};
}
protected function setEmbedFont(){
var _local1:Object;
_local1 = getStyleValue("embedFonts");
if (_local1 != null){
textField.embedFonts = _local1;
};
}
override protected function keyUpHandler(_arg1:KeyboardEvent):void{
if (!enabled){
return;
};
if (_arg1.keyCode == Keyboard.SPACE){
setMouseState(oldMouseState);
oldMouseState = null;
endPress();
dispatchEvent(new MouseEvent(MouseEvent.CLICK));
};
}
override public function get selected():Boolean{
return ((_toggle) ? _selected : false);
}
public function set labelPlacement(_arg1:String):void{
_labelPlacement = _arg1;
invalidate(InvalidationType.SIZE);
}
public function set toggle(_arg1:Boolean):void{
if (((!(_arg1)) && (super.selected))){
selected = false;
};
_toggle = _arg1;
if (_toggle){
addEventListener(MouseEvent.CLICK, toggleSelected, false, 0, true);
} else {
removeEventListener(MouseEvent.CLICK, toggleSelected);
};
invalidate(InvalidationType.STATE);
}
public function get label():String{
return (_label);
}
override public function set selected(_arg1:Boolean):void{
_selected = _arg1;
if (_toggle){
invalidate(InvalidationType.STATE);
};
}
override protected function draw():void{
if (textField.text != _label){
label = _label;
};
if (isInvalid(InvalidationType.STYLES, InvalidationType.STATE)){
drawBackground();
drawIcon();
drawTextFormat();
invalidate(InvalidationType.SIZE, false);
};
if (isInvalid(InvalidationType.SIZE)){
drawLayout();
};
if (isInvalid(InvalidationType.SIZE, InvalidationType.STYLES)){
if (((isFocused) && (focusManager.showFocusIndicator))){
drawFocus(true);
};
};
validate();
}
public function get toggle():Boolean{
return (_toggle);
}
override protected function configUI():void{
super.configUI();
textField = new TextField();
textField.type = TextFieldType.DYNAMIC;
textField.selectable = false;
addChild(textField);
}
override protected function drawLayout():void{
var _local1:Number;
var _local2:String;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
_local1 = Number(getStyleValue("textPadding"));
_local2 = ((((icon == null)) && ((mode == "center")))) ? ButtonLabelPlacement.TOP : _labelPlacement;
textField.height = (textField.textHeight + 4);
_local3 = (textField.textWidth + 4);
_local4 = (textField.textHeight + 4);
_local5 = ((icon)==null) ? 0 : (icon.width + _local1);
_local6 = ((icon)==null) ? 0 : (icon.height + _local1);
textField.visible = (label.length > 0);
if (icon != null){
icon.x = Math.round(((width - icon.width) / 2));
icon.y = Math.round(((height - icon.height) / 2));
};
if (textField.visible == false){
textField.width = 0;
textField.height = 0;
} else {
if ((((_local2 == ButtonLabelPlacement.BOTTOM)) || ((_local2 == ButtonLabelPlacement.TOP)))){
_local7 = Math.max(0, Math.min(_local3, (width - (2 * _local1))));
if ((height - 2) > _local4){
_local8 = _local4;
} else {
_local8 = (height - 2);
};
_local3 = _local7;
textField.width = _local3;
_local4 = _local8;
textField.height = _local4;
textField.x = Math.round(((width - _local3) / 2));
textField.y = Math.round(((((height - textField.height) - _local6) / 2) + ((_local2)==ButtonLabelPlacement.BOTTOM) ? _local6 : 0));
if (icon != null){
icon.y = Math.round(((_local2)==ButtonLabelPlacement.BOTTOM) ? (textField.y - _local6) : ((textField.y + textField.height) + _local1));
};
} else {
_local7 = Math.max(0, Math.min(_local3, ((width - _local5) - (2 * _local1))));
_local3 = _local7;
textField.width = _local3;
textField.x = Math.round(((((width - _local3) - _local5) / 2) + ((_local2)!=ButtonLabelPlacement.LEFT) ? _local5 : 0));
textField.y = Math.round(((height - textField.height) / 2));
if (icon != null){
icon.x = Math.round(((_local2)!=ButtonLabelPlacement.LEFT) ? (textField.x - _local5) : ((textField.x + _local3) + _local1));
};
};
};
super.drawLayout();
}
override protected function initializeAccessibility():void{
if (LabelButton.createAccessibilityImplementation != null){
LabelButton.createAccessibilityImplementation(this);
};
}
protected function drawIcon():void{
var _local1:DisplayObject;
var _local2:String;
var _local3:Object;
_local1 = icon;
_local2 = (enabled) ? mouseState : "disabled";
if (selected){
_local2 = (("selected" + _local2.substr(0, 1).toUpperCase()) + _local2.substr(1));
};
_local2 = (_local2 + "Icon");
_local3 = getStyleValue(_local2);
if (_local3 == null){
_local3 = getStyleValue("icon");
};
if (_local3 != null){
icon = getDisplayObjectInstance(_local3);
};
if (icon != null){
addChildAt(icon, 1);
};
if (((!((_local1 == null))) && (!((_local1 == icon))))){
removeChild(_local1);
};
}
public function set label(_arg1:String):void{
_label = _arg1;
if (textField.text != _label){
textField.text = _label;
dispatchEvent(new ComponentEvent(ComponentEvent.LABEL_CHANGE));
};
invalidate(InvalidationType.SIZE);
invalidate(InvalidationType.STYLES);
}
protected function drawTextFormat():void{
var _local1:Object;
var _local2:TextFormat;
var _local3:TextFormat;
_local1 = UIComponent.getStyleDefinition();
_local2 = (enabled) ? (_local1.defaultTextFormat as TextFormat) : (_local1.defaultDisabledTextFormat as TextFormat);
textField.setTextFormat(_local2);
_local3 = (getStyleValue((enabled) ? "textFormat" : "disabledTextFormat") as TextFormat);
if (_local3 != null){
textField.setTextFormat(_local3);
} else {
_local3 = _local2;
};
textField.defaultTextFormat = _local3;
setEmbedFont();
}
public static function getStyleDefinition():Object{
return (mergeStyles(defaultStyles, BaseButton.getStyleDefinition()));
}
}
}//package fl.controls
Section 62
//Slider (fl.controls.Slider)
package fl.controls {
import flash.events.*;
import flash.display.*;
import fl.core.*;
import fl.managers.*;
import fl.events.*;
import flash.ui.*;
public class Slider extends UIComponent implements IFocusManagerComponent {
protected var _direction:String;
protected var _liveDragging:Boolean;// = false
protected var _value:Number;// = 0
protected var _snapInterval:Number;// = 0
protected var _minimum:Number;// = 0
protected var _maximum:Number;// = 10
protected var track:BaseButton;
protected var _tickInterval:Number;// = 0
protected var tickContainer:Sprite;
protected var thumb:BaseButton;
protected static const TICK_STYLES:Object = {upSkin:"tickSkin"};
protected static const TRACK_STYLES:Object = {upSkin:"sliderTrackSkin", overSkin:"sliderTrackSkin", downSkin:"sliderTrackSkin", disabledSkin:"sliderTrackDisabledSkin"};
protected static const THUMB_STYLES:Object = {upSkin:"thumbUpSkin", overSkin:"thumbOverSkin", downSkin:"thumbDownSkin", disabledSkin:"thumbDisabledSkin"};
protected static var defaultStyles:Object = {thumbUpSkin:"SliderThumb_upSkin", thumbOverSkin:"SliderThumb_overSkin", thumbDownSkin:"SliderThumb_downSkin", thumbDisabledSkin:"SliderThumb_disabledSkin", sliderTrackSkin:"SliderTrack_skin", sliderTrackDisabledSkin:"SliderTrack_disabledSkin", tickSkin:"SliderTick_skin", focusRectSkin:null, focusRectPadding:null};
public function Slider(){
_direction = SliderDirection.HORIZONTAL;
_minimum = 0;
_maximum = 10;
_value = 0;
_tickInterval = 0;
_snapInterval = 0;
_liveDragging = false;
super();
setStyles();
}
public function get minimum():Number{
return (_minimum);
}
public function set minimum(_arg1:Number):void{
_minimum = _arg1;
this.value = Math.max(_arg1, this.value);
invalidate(InvalidationType.DATA);
}
public function get maximum():Number{
return (_maximum);
}
protected function positionThumb():void{
thumb.x = ((((_direction)==SliderDirection.VERTICAL) ? ((maximum - minimum) - value) : (value - minimum) / (maximum - minimum)) * _width);
}
protected function clearTicks():void{
if (((!(tickContainer)) || (!(tickContainer.parent)))){
return;
};
removeChild(tickContainer);
}
protected function onTrackClick(_arg1:MouseEvent):void{
calculateValue(track.mouseX, InteractionInputType.MOUSE, SliderEventClickTarget.TRACK);
if (!liveDragging){
dispatchEvent(new SliderEvent(SliderEvent.CHANGE, value, SliderEventClickTarget.TRACK, InteractionInputType.MOUSE));
};
}
public function set maximum(_arg1:Number):void{
_maximum = _arg1;
this.value = Math.min(_arg1, this.value);
invalidate(InvalidationType.DATA);
}
public function get liveDragging():Boolean{
return (_liveDragging);
}
protected function doDrag(_arg1:MouseEvent):void{
var _local2:Number;
var _local3:Number;
_local2 = (_width / snapInterval);
_local3 = track.mouseX;
calculateValue(_local3, InteractionInputType.MOUSE, SliderEventClickTarget.THUMB);
dispatchEvent(new SliderEvent(SliderEvent.THUMB_DRAG, value, SliderEventClickTarget.THUMB, InteractionInputType.MOUSE));
}
override protected function keyDownHandler(_arg1:KeyboardEvent):void{
var _local2:uint;
var _local3:Number;
var _local4:Boolean;
if (!enabled){
return;
};
_local2 = ((snapInterval)>0) ? snapInterval : 1;
_local4 = (direction == SliderDirection.HORIZONTAL);
if ((((((_arg1.keyCode == Keyboard.DOWN)) && (!(_local4)))) || ((((_arg1.keyCode == Keyboard.LEFT)) && (_local4))))){
_local3 = (value - _local2);
} else {
if ((((((_arg1.keyCode == Keyboard.UP)) && (!(_local4)))) || ((((_arg1.keyCode == Keyboard.RIGHT)) && (_local4))))){
_local3 = (value + _local2);
} else {
if ((((((_arg1.keyCode == Keyboard.PAGE_DOWN)) && (!(_local4)))) || ((((_arg1.keyCode == Keyboard.HOME)) && (_local4))))){
_local3 = minimum;
} else {
if ((((((_arg1.keyCode == Keyboard.PAGE_UP)) && (!(_local4)))) || ((((_arg1.keyCode == Keyboard.END)) && (_local4))))){
_local3 = maximum;
};
};
};
};
if (!isNaN(_local3)){
_arg1.stopPropagation();
doSetValue(_local3, InteractionInputType.KEYBOARD, null, _arg1.keyCode);
};
}
override public function set enabled(_arg1:Boolean):void{
if (enabled == _arg1){
return;
};
super.enabled = _arg1;
track.enabled = (thumb.enabled = _arg1);
}
protected function thumbPressHandler(_arg1:MouseEvent):void{
stage.addEventListener(MouseEvent.MOUSE_MOVE, doDrag, false, 0, true);
stage.addEventListener(MouseEvent.MOUSE_UP, thumbReleaseHandler, false, 0, true);
dispatchEvent(new SliderEvent(SliderEvent.THUMB_PRESS, value, InteractionInputType.MOUSE, SliderEventClickTarget.THUMB));
}
public function get snapInterval():Number{
return (_snapInterval);
}
protected function thumbReleaseHandler(_arg1:MouseEvent):void{
stage.removeEventListener(MouseEvent.MOUSE_MOVE, doDrag);
stage.removeEventListener(MouseEvent.MOUSE_UP, thumbReleaseHandler);
dispatchEvent(new SliderEvent(SliderEvent.THUMB_RELEASE, value, InteractionInputType.MOUSE, SliderEventClickTarget.THUMB));
dispatchEvent(new SliderEvent(SliderEvent.CHANGE, value, SliderEventClickTarget.THUMB, InteractionInputType.MOUSE));
}
public function set liveDragging(_arg1:Boolean):void{
_liveDragging = _arg1;
}
public function set value(_arg1:Number):void{
doSetValue(_arg1);
}
public function set direction(_arg1:String):void{
var _local2:Boolean;
_direction = _arg1;
_local2 = (_direction == SliderDirection.VERTICAL);
if (isLivePreview){
if (_local2){
setScaleY(-1);
y = track.height;
} else {
setScaleY(1);
y = 0;
};
positionThumb();
return;
};
if (((_local2) && (componentInspectorSetting))){
if ((rotation % 90) == 0){
setScaleY(-1);
};
};
if (!componentInspectorSetting){
rotation = (_local2) ? 90 : 0;
};
}
public function set tickInterval(_arg1:Number):void{
_tickInterval = _arg1;
invalidate(InvalidationType.SIZE);
}
override public function get enabled():Boolean{
return (super.enabled);
}
override protected function draw():void{
if (isInvalid(InvalidationType.STYLES)){
setStyles();
invalidate(InvalidationType.SIZE, false);
};
if (isInvalid(InvalidationType.SIZE)){
track.setSize(_width, track.height);
track.drawNow();
thumb.drawNow();
};
if (tickInterval > 0){
drawTicks();
} else {
clearTicks();
};
positionThumb();
super.draw();
}
override protected function configUI():void{
super.configUI();
thumb = new BaseButton();
thumb.setSize(13, 13);
thumb.autoRepeat = false;
addChild(thumb);
thumb.addEventListener(MouseEvent.MOUSE_DOWN, thumbPressHandler, false, 0, true);
track = new BaseButton();
track.move(0, 0);
track.setSize(80, 4);
track.autoRepeat = false;
track.useHandCursor = false;
track.addEventListener(MouseEvent.CLICK, onTrackClick, false, 0, true);
addChildAt(track, 0);
}
public function set snapInterval(_arg1:Number):void{
_snapInterval = _arg1;
}
public function get value():Number{
return (_value);
}
public function get direction():String{
return (_direction);
}
public function get tickInterval():Number{
return (_tickInterval);
}
override public function setSize(_arg1:Number, _arg2:Number):void{
if ((((_direction == SliderDirection.VERTICAL)) && (!(isLivePreview)))){
super.setSize(_arg2, _arg1);
} else {
super.setSize(_arg1, _arg2);
};
invalidate(InvalidationType.SIZE);
}
protected function drawTicks():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:uint;
var _local5:DisplayObject;
clearTicks();
tickContainer = new Sprite();
_local1 = ((maximum)<1) ? (tickInterval / 100) : tickInterval;
_local2 = ((maximum - minimum) / _local1);
_local3 = (_width / _local2);
_local4 = 0;
while (_local4 <= _local2) {
_local5 = getDisplayObjectInstance(getStyleValue("tickSkin"));
_local5.x = (_local3 * _local4);
_local5.y = ((track.y - _local5.height) - 2);
tickContainer.addChild(_local5);
_local4++;
};
addChild(tickContainer);
}
protected function calculateValue(_arg1:Number, _arg2:String, _arg3:String, _arg4:int=undefined):void{
var _local5:Number;
_local5 = ((_arg1 / _width) * (maximum - minimum));
if (_direction == SliderDirection.VERTICAL){
_local5 = (maximum - _local5);
} else {
_local5 = (minimum + _local5);
};
doSetValue(_local5, _arg2, _arg3, _arg4);
}
protected function getPrecision(_arg1:Number):Number{
var _local2:String;
_local2 = _arg1.toString();
if (_local2.indexOf(".") == -1){
return (0);
};
return (_local2.split(".").pop().length);
}
protected function doSetValue(_arg1:Number, _arg2:String=null, _arg3:String=null, _arg4:int=undefined):void{
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
_local5 = _value;
if (((!((_snapInterval == 0))) && (!((_snapInterval == 1))))){
_local6 = Math.pow(10, getPrecision(snapInterval));
_local7 = (_snapInterval * _local6);
_local8 = Math.round((_arg1 * _local6));
_local9 = (Math.round((_local8 / _local7)) * _local7);
_arg1 = (_local9 / _local6);
_value = Math.max(minimum, Math.min(maximum, _arg1));
} else {
_value = Math.max(minimum, Math.min(maximum, Math.round(_arg1)));
};
if (((!((_local5 == _value))) && (((((liveDragging) && (!((_arg3 == null))))) || ((_arg2 == InteractionInputType.KEYBOARD)))))){
dispatchEvent(new SliderEvent(SliderEvent.CHANGE, value, _arg3, _arg2, _arg4));
};
positionThumb();
}
protected function setStyles():void{
copyStylesToChild(thumb, THUMB_STYLES);
copyStylesToChild(track, TRACK_STYLES);
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
}
}//package fl.controls
Section 63
//SliderDirection (fl.controls.SliderDirection)
package fl.controls {
public class SliderDirection {
public static var HORIZONTAL:String = "horizontal";
public static var VERTICAL:String = "vertical";
}
}//package fl.controls
Section 64
//ComponentShim (fl.core.ComponentShim)
package fl.core {
import flash.display.*;
public dynamic class ComponentShim extends MovieClip {
}
}//package fl.core
Section 65
//InvalidationType (fl.core.InvalidationType)
package fl.core {
public class InvalidationType {
public static const SIZE:String = "size";
public static const ALL:String = "all";
public static const DATA:String = "data";
public static const SCROLL:String = "scroll";
public static const STATE:String = "state";
public static const STYLES:String = "styles";
public static const SELECTED:String = "selected";
public static const RENDERER_STYLES:String = "rendererStyles";
}
}//package fl.core
Section 66
//UIComponent (fl.core.UIComponent)
package fl.core {
import flash.events.*;
import flash.display.*;
import flash.text.*;
import fl.managers.*;
import flash.utils.*;
import fl.events.*;
import flash.system.*;
public class UIComponent extends Sprite {
protected var _enabled:Boolean;// = true
private var _mouseFocusEnabled:Boolean;// = true
protected var startHeight:Number;
protected var _height:Number;
protected var _oldIMEMode:String;// = null
protected var startWidth:Number;
public var focusTarget:IFocusManagerComponent;
protected var errorCaught:Boolean;// = false
protected var uiFocusRect:DisplayObject;
protected var _width:Number;
public var version:String;// = "3.0.0.15"
protected var isFocused:Boolean;// = false
protected var callLaterMethods:Dictionary;
private var _focusEnabled:Boolean;// = true
private var tempText:TextField;
protected var invalidateFlag:Boolean;// = false
protected var _inspector:Boolean;// = false
protected var sharedStyles:Object;
protected var invalidHash:Object;
protected var isLivePreview:Boolean;// = false
protected var _imeMode:String;// = null
protected var instanceStyles:Object;
protected var _x:Number;
protected var _y:Number;
public static var inCallLaterPhase:Boolean = false;
private static var defaultStyles:Object = {focusRectSkin:"focusRectSkin", focusRectPadding:2, textFormat:new TextFormat("_sans", 11, 0, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0), disabledTextFormat:new TextFormat("_sans", 11, 0x999999, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0), defaultTextFormat:new TextFormat("_sans", 11, 0, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0), defaultDisabledTextFormat:new TextFormat("_sans", 11, 0x999999, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0)};
public static var createAccessibilityImplementation:Function;
private static var focusManagers:Dictionary = new Dictionary(false);
public function UIComponent(){
version = "3.0.0.15";
isLivePreview = false;
invalidateFlag = false;
_enabled = true;
isFocused = false;
_focusEnabled = true;
_mouseFocusEnabled = true;
_imeMode = null;
_oldIMEMode = null;
errorCaught = false;
_inspector = false;
super();
instanceStyles = {};
sharedStyles = {};
invalidHash = {};
callLaterMethods = new Dictionary();
StyleManager.registerInstance(this);
configUI();
invalidate(InvalidationType.ALL);
tabEnabled = (this is IFocusManagerComponent);
focusRect = false;
if (tabEnabled){
addEventListener(FocusEvent.FOCUS_IN, focusInHandler);
addEventListener(FocusEvent.FOCUS_OUT, focusOutHandler);
addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler);
addEventListener(KeyboardEvent.KEY_UP, keyUpHandler);
};
initializeFocusManager();
addEventListener(Event.ENTER_FRAME, hookAccessibility, false, 0, true);
}
public function drawFocus(_arg1:Boolean):void{
var _local2:Number;
isFocused = _arg1;
if (((!((uiFocusRect == null))) && (contains(uiFocusRect)))){
removeChild(uiFocusRect);
uiFocusRect = null;
};
if (_arg1){
uiFocusRect = (getDisplayObjectInstance(getStyleValue("focusRectSkin")) as Sprite);
if (uiFocusRect == null){
return;
};
_local2 = Number(getStyleValue("focusRectPadding"));
uiFocusRect.x = -(_local2);
uiFocusRect.y = -(_local2);
uiFocusRect.width = (width + (_local2 * 2));
uiFocusRect.height = (height + (_local2 * 2));
addChildAt(uiFocusRect, 0);
};
}
private function callLaterDispatcher(_arg1:Event):void{
var _local2:Dictionary;
var _local3:Object;
if (_arg1.type == Event.ADDED_TO_STAGE){
removeEventListener(Event.ADDED_TO_STAGE, callLaterDispatcher);
stage.addEventListener(Event.RENDER, callLaterDispatcher, false, 0, true);
stage.invalidate();
return;
};
_arg1.target.removeEventListener(Event.RENDER, callLaterDispatcher);
if (stage == null){
addEventListener(Event.ADDED_TO_STAGE, callLaterDispatcher, false, 0, true);
return;
};
inCallLaterPhase = true;
_local2 = callLaterMethods;
for (_local3 in _local2) {
_local3();
delete _local2[_local3];
};
inCallLaterPhase = false;
}
private function addedHandler(_arg1:Event):void{
removeEventListener("addedToStage", addedHandler);
initializeFocusManager();
}
protected function getStyleValue(_arg1:String):Object{
return (((instanceStyles[_arg1])==null) ? sharedStyles[_arg1] : instanceStyles[_arg1]);
}
protected function isOurFocus(_arg1:DisplayObject):Boolean{
return ((_arg1 == this));
}
override public function get scaleX():Number{
return ((width / startWidth));
}
override public function get scaleY():Number{
return ((height / startHeight));
}
override public function set height(_arg1:Number):void{
if (_height == _arg1){
return;
};
setSize(width, _arg1);
}
protected function keyDownHandler(_arg1:KeyboardEvent):void{
}
protected function focusInHandler(_arg1:FocusEvent):void{
var _local2:IFocusManager;
if (isOurFocus((_arg1.target as DisplayObject))){
_local2 = focusManager;
if (((_local2) && (_local2.showFocusIndicator))){
drawFocus(true);
isFocused = true;
};
};
}
public function setStyle(_arg1:String, _arg2:Object):void{
if ((((instanceStyles[_arg1] === _arg2)) && (!((_arg2 is TextFormat))))){
return;
};
instanceStyles[_arg1] = _arg2;
invalidate(InvalidationType.STYLES);
}
override public function get visible():Boolean{
return (super.visible);
}
public function get componentInspectorSetting():Boolean{
return (_inspector);
}
override public function get x():Number{
return ((isNaN(_x)) ? super.x : _x);
}
override public function get y():Number{
return ((isNaN(_y)) ? super.y : _y);
}
protected function setIMEMode(_arg1:Boolean){
var enabled = _arg1;
if (_imeMode != null){
if (enabled){
IME.enabled = true;
_oldIMEMode = IME.conversionMode;
try {
if (((!(errorCaught)) && (!((IME.conversionMode == IMEConversionMode.UNKNOWN))))){
IME.conversionMode = _imeMode;
};
errorCaught = false;
} catch(e:Error) {
errorCaught = true;
throw (new Error(("IME mode not supported: " + _imeMode)));
};
} else {
if (((!((IME.conversionMode == IMEConversionMode.UNKNOWN))) && (!((_oldIMEMode == IMEConversionMode.UNKNOWN))))){
IME.conversionMode = _oldIMEMode;
};
IME.enabled = false;
};
};
}
public function set enabled(_arg1:Boolean):void{
if (_arg1 == _enabled){
return;
};
_enabled = _arg1;
invalidate(InvalidationType.STATE);
}
public function setSharedStyle(_arg1:String, _arg2:Object):void{
if ((((sharedStyles[_arg1] === _arg2)) && (!((_arg2 is TextFormat))))){
return;
};
sharedStyles[_arg1] = _arg2;
if (instanceStyles[_arg1] == null){
invalidate(InvalidationType.STYLES);
};
}
protected function keyUpHandler(_arg1:KeyboardEvent):void{
}
public function set focusEnabled(_arg1:Boolean):void{
_focusEnabled = _arg1;
}
override public function set scaleX(_arg1:Number):void{
setSize((startWidth * _arg1), height);
}
public function get mouseFocusEnabled():Boolean{
return (_mouseFocusEnabled);
}
override public function set scaleY(_arg1:Number):void{
setSize(width, (startHeight * _arg1));
}
protected function getDisplayObjectInstance(_arg1:Object):DisplayObject{
var classDef:Object;
var skin = _arg1;
classDef = null;
if ((skin is Class)){
return ((new (skin) as DisplayObject));
};
if ((skin is DisplayObject)){
(skin as DisplayObject).x = 0;
(skin as DisplayObject).y = 0;
return ((skin as DisplayObject));
};
try {
classDef = getDefinitionByName(skin.toString());
} catch(e:Error) {
try {
classDef = (loaderInfo.applicationDomain.getDefinition(skin.toString()) as Object);
} catch(e:Error) {
};
};
if (classDef == null){
return (null);
};
return ((new (classDef) as DisplayObject));
}
protected function copyStylesToChild(_arg1:UIComponent, _arg2:Object):void{
var _local3:String;
for (_local3 in _arg2) {
_arg1.setStyle(_local3, getStyleValue(_arg2[_local3]));
};
}
protected function beforeComponentParameters():void{
}
protected function callLater(_arg1:Function):void{
if (inCallLaterPhase){
return;
};
callLaterMethods[_arg1] = true;
if (stage != null){
stage.addEventListener(Event.RENDER, callLaterDispatcher, false, 0, true);
stage.invalidate();
} else {
addEventListener(Event.ADDED_TO_STAGE, callLaterDispatcher, false, 0, true);
};
}
protected function createFocusManager():void{
if (focusManagers[stage] == null){
focusManagers[stage] = new FocusManager(stage);
};
}
override public function set visible(_arg1:Boolean):void{
var _local2:String;
if (super.visible == _arg1){
return;
};
super.visible = _arg1;
_local2 = (_arg1) ? ComponentEvent.SHOW : ComponentEvent.HIDE;
dispatchEvent(new ComponentEvent(_local2, true));
}
protected function hookAccessibility(_arg1:Event):void{
removeEventListener(Event.ENTER_FRAME, hookAccessibility);
initializeAccessibility();
}
public function set componentInspectorSetting(_arg1:Boolean):void{
_inspector = _arg1;
if (_inspector){
beforeComponentParameters();
} else {
afterComponentParameters();
};
}
override public function set x(_arg1:Number):void{
move(_arg1, _y);
}
public function drawNow():void{
draw();
}
override public function set y(_arg1:Number):void{
move(_x, _arg1);
}
protected function checkLivePreview():Boolean{
var className:String;
if (parent == null){
return (false);
};
try {
className = getQualifiedClassName(parent);
} catch(e:Error) {
};
return ((className == "fl.livepreview::LivePreviewParent"));
}
protected function focusOutHandler(_arg1:FocusEvent):void{
if (isOurFocus((_arg1.target as DisplayObject))){
drawFocus(false);
isFocused = false;
};
}
public function set mouseFocusEnabled(_arg1:Boolean):void{
_mouseFocusEnabled = _arg1;
}
public function getFocus():InteractiveObject{
if (stage){
return (stage.focus);
};
return (null);
}
protected function validate():void{
invalidHash = {};
}
override public function get height():Number{
return (_height);
}
public function invalidate(_arg1:String="all", _arg2:Boolean=true):void{
invalidHash[_arg1] = true;
if (_arg2){
this.callLater(draw);
};
}
public function get enabled():Boolean{
return (_enabled);
}
protected function getScaleX():Number{
return (super.scaleX);
}
protected function getScaleY():Number{
return (super.scaleY);
}
public function get focusEnabled():Boolean{
return (_focusEnabled);
}
protected function afterComponentParameters():void{
}
protected function draw():void{
if (isInvalid(InvalidationType.SIZE, InvalidationType.STYLES)){
if (((isFocused) && (focusManager.showFocusIndicator))){
drawFocus(true);
};
};
validate();
}
protected function configUI():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
isLivePreview = checkLivePreview();
_local1 = rotation;
rotation = 0;
_local2 = super.width;
_local3 = super.height;
var _local4 = 1;
super.scaleY = _local4;
super.scaleX = _local4;
setSize(_local2, _local3);
move(super.x, super.y);
rotation = _local1;
startWidth = _local2;
startHeight = _local3;
if (numChildren > 0){
removeChildAt(0);
};
}
protected function setScaleX(_arg1:Number):void{
super.scaleX = _arg1;
}
protected function setScaleY(_arg1:Number):void{
super.scaleY = _arg1;
}
private function initializeFocusManager():void{
if (stage == null){
addEventListener(Event.ADDED_TO_STAGE, addedHandler, false, 0, true);
} else {
createFocusManager();
};
}
public function set focusManager(_arg1:IFocusManager):void{
UIComponent.focusManagers[this] = _arg1;
}
public function clearStyle(_arg1:String):void{
setStyle(_arg1, null);
}
protected function isInvalid(_arg1:String, ... _args):Boolean{
if (((invalidHash[_arg1]) || (invalidHash[InvalidationType.ALL]))){
return (true);
};
while (_args.length > 0) {
if (invalidHash[_args.pop()]){
return (true);
};
};
return (false);
}
public function setSize(_arg1:Number, _arg2:Number):void{
_width = _arg1;
_height = _arg2;
invalidate(InvalidationType.SIZE);
dispatchEvent(new ComponentEvent(ComponentEvent.RESIZE, false));
}
override public function set width(_arg1:Number):void{
if (_width == _arg1){
return;
};
setSize(_arg1, height);
}
public function setFocus():void{
if (stage){
stage.focus = this;
};
}
protected function initializeAccessibility():void{
if (UIComponent.createAccessibilityImplementation != null){
UIComponent.createAccessibilityImplementation(this);
};
}
public function get focusManager():IFocusManager{
var _local1:DisplayObject;
_local1 = this;
while (_local1) {
if (UIComponent.focusManagers[_local1] != null){
return (IFocusManager(UIComponent.focusManagers[_local1]));
};
_local1 = _local1.parent;
};
return (null);
}
override public function get width():Number{
return (_width);
}
public function move(_arg1:Number, _arg2:Number):void{
_x = _arg1;
_y = _arg2;
super.x = Math.round(_arg1);
super.y = Math.round(_arg2);
dispatchEvent(new ComponentEvent(ComponentEvent.MOVE));
}
public function validateNow():void{
invalidate(InvalidationType.ALL, false);
draw();
}
public function getStyle(_arg1:String):Object{
return (instanceStyles[_arg1]);
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
public static function mergeStyles(... _args):Object{
var _local2:Object;
var _local3:uint;
var _local4:uint;
var _local5:Object;
var _local6:String;
_local2 = {};
_local3 = _args.length;
_local4 = 0;
while (_local4 < _local3) {
_local5 = _args[_local4];
for (_local6 in _local5) {
if (_local2[_local6] != null){
} else {
_local2[_local6] = _args[_local4][_local6];
};
};
_local4++;
};
return (_local2);
}
}
}//package fl.core
Section 67
//ComponentEvent (fl.events.ComponentEvent)
package fl.events {
import flash.events.*;
public class ComponentEvent extends Event {
public static const HIDE:String = "hide";
public static const BUTTON_DOWN:String = "buttonDown";
public static const MOVE:String = "move";
public static const RESIZE:String = "resize";
public static const ENTER:String = "enter";
public static const LABEL_CHANGE:String = "labelChange";
public static const SHOW:String = "show";
public function ComponentEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false){
super(_arg1, _arg2, _arg3);
}
override public function toString():String{
return (formatToString("ComponentEvent", "type", "bubbles", "cancelable"));
}
override public function clone():Event{
return (new ComponentEvent(type, bubbles, cancelable));
}
}
}//package fl.events
Section 68
//InteractionInputType (fl.events.InteractionInputType)
package fl.events {
public class InteractionInputType {
public static const MOUSE:String = "mouse";
public static const KEYBOARD:String = "keyboard";
}
}//package fl.events
Section 69
//SliderEvent (fl.events.SliderEvent)
package fl.events {
import flash.events.*;
public class SliderEvent extends Event {
protected var _triggerEvent:String;
protected var _keyCode:Number;
protected var _value:Number;
protected var _clickTarget:String;
public static const CHANGE:String = "change";
public static const THUMB_PRESS:String = "thumbPress";
public static const THUMB_DRAG:String = "thumbDrag";
public static const THUMB_RELEASE:String = "thumbRelease";
public function SliderEvent(_arg1:String, _arg2:Number, _arg3:String, _arg4:String, _arg5:int=0){
_value = _arg2;
_keyCode = _arg5;
_triggerEvent = _arg4;
_clickTarget = _arg3;
super(_arg1);
}
public function get clickTarget():String{
return (_clickTarget);
}
override public function clone():Event{
return (new SliderEvent(type, _value, _clickTarget, _triggerEvent, _keyCode));
}
override public function toString():String{
return (formatToString("SliderEvent", "type", "value", "bubbles", "cancelable", "keyCode", "triggerEvent", "clickTarget"));
}
public function get triggerEvent():String{
return (_triggerEvent);
}
public function get value():Number{
return (_value);
}
public function get keyCode():Number{
return (_keyCode);
}
}
}//package fl.events
Section 70
//SliderEventClickTarget (fl.events.SliderEventClickTarget)
package fl.events {
public class SliderEventClickTarget {
public static const TRACK:String = "track";
public static const THUMB:String = "thumb";
}
}//package fl.events
Section 71
//FocusManager (fl.managers.FocusManager)
package fl.managers {
import flash.events.*;
import fl.controls.*;
import flash.display.*;
import flash.text.*;
import fl.core.*;
import flash.utils.*;
import flash.ui.*;
public class FocusManager implements IFocusManager {
private var focusableObjects:Dictionary;
private var _showFocusIndicator:Boolean;// = true
private var defButton:Button;
private var focusableCandidates:Array;
private var _form:DisplayObjectContainer;
private var _defaultButtonEnabled:Boolean;// = true
private var activated:Boolean;// = false
private var _defaultButton:Button;
private var calculateCandidates:Boolean;// = true
private var lastFocus:InteractiveObject;
private var lastAction:String;
public function FocusManager(_arg1:DisplayObjectContainer){
activated = false;
calculateCandidates = true;
_showFocusIndicator = true;
_defaultButtonEnabled = true;
super();
focusableObjects = new Dictionary(true);
if (_arg1 != null){
_form = _arg1;
addFocusables(DisplayObject(_arg1));
_arg1.addEventListener(Event.ADDED, addedHandler);
_arg1.addEventListener(Event.REMOVED, removedHandler);
activate();
};
}
public function get showFocusIndicator():Boolean{
return (_showFocusIndicator);
}
private function getIndexOfNextObject(_arg1:int, _arg2:Boolean, _arg3:Boolean, _arg4:String):int{
var _local5:int;
var _local6:int;
var _local7:DisplayObject;
var _local8:IFocusManagerGroup;
var _local9:int;
var _local10:DisplayObject;
var _local11:IFocusManagerGroup;
_local5 = focusableCandidates.length;
_local6 = _arg1;
while (true) {
if (_arg2){
_arg1--;
} else {
_arg1++;
};
if (_arg3){
if (((_arg2) && ((_arg1 < 0)))){
break;
};
if (((!(_arg2)) && ((_arg1 == _local5)))){
break;
};
} else {
_arg1 = ((_arg1 + _local5) % _local5);
if (_local6 == _arg1){
break;
};
};
if (isValidFocusCandidate(focusableCandidates[_arg1], _arg4)){
_local7 = DisplayObject(findFocusManagerComponent(focusableCandidates[_arg1]));
if ((_local7 is IFocusManagerGroup)){
_local8 = IFocusManagerGroup(_local7);
_local9 = 0;
while (_local9 < focusableCandidates.length) {
_local10 = focusableCandidates[_local9];
if ((_local10 is IFocusManagerGroup)){
_local11 = IFocusManagerGroup(_local10);
if ((((_local11.groupName == _local8.groupName)) && (_local11.selected))){
_arg1 = _local9;
break;
};
};
_local9++;
};
};
return (_arg1);
};
};
return (_arg1);
}
public function set form(_arg1:DisplayObjectContainer):void{
_form = _arg1;
}
private function addFocusables(_arg1:DisplayObject, _arg2:Boolean=false):void{
var focusable:IFocusManagerComponent;
var io:InteractiveObject;
var doc:DisplayObjectContainer;
var i:int;
var child:DisplayObject;
var o = _arg1;
var skipTopLevel = _arg2;
if (!skipTopLevel){
if ((o is IFocusManagerComponent)){
focusable = IFocusManagerComponent(o);
if (focusable.focusEnabled){
if (((focusable.tabEnabled) && (isTabVisible(o)))){
focusableObjects[o] = true;
calculateCandidates = true;
};
o.addEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
o.addEventListener(Event.TAB_INDEX_CHANGE, tabIndexChangeHandler);
};
} else {
if ((o is InteractiveObject)){
io = (o as InteractiveObject);
if (((((io) && (io.tabEnabled))) && ((findFocusManagerComponent(io) == io)))){
focusableObjects[io] = true;
calculateCandidates = true;
};
io.addEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
io.addEventListener(Event.TAB_INDEX_CHANGE, tabIndexChangeHandler);
};
};
};
if ((o is DisplayObjectContainer)){
doc = DisplayObjectContainer(o);
o.addEventListener(Event.TAB_CHILDREN_CHANGE, tabChildrenChangeHandler);
if ((((((doc is Stage)) || ((doc.parent is Stage)))) || (doc.tabChildren))){
i = 0;
while (i < doc.numChildren) {
try {
child = doc.getChildAt(i);
if (child != null){
addFocusables(doc.getChildAt(i));
};
} catch(error:SecurityError) {
};
i = (i + 1);
};
};
};
}
private function getChildIndex(_arg1:DisplayObjectContainer, _arg2:DisplayObject):int{
return (_arg1.getChildIndex(_arg2));
}
private function mouseFocusChangeHandler(_arg1:FocusEvent):void{
if ((_arg1.relatedObject is TextField)){
return;
};
_arg1.preventDefault();
}
private function focusOutHandler(_arg1:FocusEvent):void{
var _local2:InteractiveObject;
_local2 = (_arg1.target as InteractiveObject);
}
private function isValidFocusCandidate(_arg1:DisplayObject, _arg2:String):Boolean{
var _local3:IFocusManagerGroup;
if (!isEnabledAndVisible(_arg1)){
return (false);
};
if ((_arg1 is IFocusManagerGroup)){
_local3 = IFocusManagerGroup(_arg1);
if (_arg2 == _local3.groupName){
return (false);
};
};
return (true);
}
public function findFocusManagerComponent(_arg1:InteractiveObject):InteractiveObject{
var _local2:InteractiveObject;
_local2 = _arg1;
while (_arg1) {
if ((((_arg1 is IFocusManagerComponent)) && (IFocusManagerComponent(_arg1).focusEnabled))){
return (_arg1);
};
_arg1 = _arg1.parent;
};
return (_local2);
}
private function sortFocusableObjectsTabIndex():void{
var _local1:Object;
var _local2:InteractiveObject;
focusableCandidates = [];
for (_local1 in focusableObjects) {
_local2 = InteractiveObject(_local1);
if (((_local2.tabIndex) && (!(isNaN(Number(_local2.tabIndex)))))){
focusableCandidates.push(_local2);
};
};
focusableCandidates.sort(sortByTabIndex);
}
private function removeFocusables(_arg1:DisplayObject):void{
var _local2:Object;
var _local3:DisplayObject;
if ((_arg1 is DisplayObjectContainer)){
_arg1.removeEventListener(Event.TAB_CHILDREN_CHANGE, tabChildrenChangeHandler);
_arg1.removeEventListener(Event.TAB_INDEX_CHANGE, tabIndexChangeHandler);
for (_local2 in focusableObjects) {
_local3 = DisplayObject(_local2);
if (DisplayObjectContainer(_arg1).contains(_local3)){
if (_local3 == lastFocus){
lastFocus = null;
};
_local3.removeEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
delete focusableObjects[_local2];
calculateCandidates = true;
};
};
};
}
private function addedHandler(_arg1:Event):void{
var _local2:DisplayObject;
_local2 = DisplayObject(_arg1.target);
if (_local2.stage){
addFocusables(DisplayObject(_arg1.target));
};
}
private function getTopLevelFocusTarget(_arg1:InteractiveObject):InteractiveObject{
while (_arg1 != InteractiveObject(form)) {
if ((((((((_arg1 is IFocusManagerComponent)) && (IFocusManagerComponent(_arg1).focusEnabled))) && (IFocusManagerComponent(_arg1).mouseFocusEnabled))) && (UIComponent(_arg1).enabled))){
return (_arg1);
};
_arg1 = _arg1.parent;
if (_arg1 == null){
break;
};
};
return (null);
}
private function tabChildrenChangeHandler(_arg1:Event):void{
var _local2:DisplayObjectContainer;
if (_arg1.target != _arg1.currentTarget){
return;
};
calculateCandidates = true;
_local2 = DisplayObjectContainer(_arg1.target);
if (_local2.tabChildren){
addFocusables(_local2, true);
} else {
removeFocusables(_local2);
};
}
public function sendDefaultButtonEvent():void{
defButton.dispatchEvent(new MouseEvent(MouseEvent.CLICK));
}
public function getFocus():InteractiveObject{
var _local1:InteractiveObject;
_local1 = form.stage.focus;
return (findFocusManagerComponent(_local1));
}
private function isEnabledAndVisible(_arg1:DisplayObject):Boolean{
var _local2:DisplayObjectContainer;
var _local3:TextField;
var _local4:SimpleButton;
_local2 = DisplayObject(form).parent;
while (_arg1 != _local2) {
if ((_arg1 is UIComponent)){
if (!UIComponent(_arg1).enabled){
return (false);
};
} else {
if ((_arg1 is TextField)){
_local3 = TextField(_arg1);
if ((((_local3.type == TextFieldType.DYNAMIC)) || (!(_local3.selectable)))){
return (false);
};
} else {
if ((_arg1 is SimpleButton)){
_local4 = SimpleButton(_arg1);
if (!_local4.enabled){
return (false);
};
};
};
};
if (!_arg1.visible){
return (false);
};
_arg1 = _arg1.parent;
};
return (true);
}
public function set defaultButton(_arg1:Button):void{
var _local2:Button;
_local2 = (_arg1) ? Button(_arg1) : null;
if (_local2 != _defaultButton){
if (_defaultButton){
_defaultButton.emphasized = false;
};
if (defButton){
defButton.emphasized = false;
};
_defaultButton = _local2;
defButton = _local2;
if (_local2){
_local2.emphasized = true;
};
};
}
private function deactivateHandler(_arg1:Event):void{
var _local2:InteractiveObject;
_local2 = InteractiveObject(_arg1.target);
}
public function setFocus(_arg1:InteractiveObject):void{
if ((_arg1 is IFocusManagerComponent)){
IFocusManagerComponent(_arg1).setFocus();
} else {
form.stage.focus = _arg1;
};
}
private function setFocusToNextObject(_arg1:FocusEvent):void{
var _local2:InteractiveObject;
if (!hasFocusableObjects()){
return;
};
_local2 = getNextFocusManagerComponent(_arg1.shiftKey);
if (_local2){
setFocus(_local2);
};
}
private function hasFocusableObjects():Boolean{
var _local1:Object;
for (_local1 in focusableObjects) {
return (true);
};
return (false);
}
private function tabIndexChangeHandler(_arg1:Event):void{
calculateCandidates = true;
}
private function sortFocusableObjects():void{
var _local1:Object;
var _local2:InteractiveObject;
focusableCandidates = [];
for (_local1 in focusableObjects) {
_local2 = InteractiveObject(_local1);
if (((((_local2.tabIndex) && (!(isNaN(Number(_local2.tabIndex)))))) && ((_local2.tabIndex > 0)))){
sortFocusableObjectsTabIndex();
return;
};
focusableCandidates.push(_local2);
};
focusableCandidates.sort(sortByDepth);
}
private function keyFocusChangeHandler(_arg1:FocusEvent):void{
showFocusIndicator = true;
if ((((((_arg1.keyCode == Keyboard.TAB)) || ((_arg1.keyCode == 0)))) && (!(_arg1.isDefaultPrevented())))){
setFocusToNextObject(_arg1);
_arg1.preventDefault();
};
}
private function getIndexOfFocusedObject(_arg1:DisplayObject):int{
var _local2:int;
var _local3:int;
_local2 = focusableCandidates.length;
_local3 = 0;
_local3 = 0;
while (_local3 < _local2) {
if (focusableCandidates[_local3] == _arg1){
return (_local3);
};
_local3++;
};
return (-1);
}
public function hideFocus():void{
}
private function removedHandler(_arg1:Event):void{
var _local2:int;
var _local3:DisplayObject;
var _local4:InteractiveObject;
_local3 = DisplayObject(_arg1.target);
if ((((_local3 is IFocusManagerComponent)) && ((focusableObjects[_local3] == true)))){
if (_local3 == lastFocus){
IFocusManagerComponent(lastFocus).drawFocus(false);
lastFocus = null;
};
_local3.removeEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
delete focusableObjects[_local3];
calculateCandidates = true;
} else {
if ((((_local3 is InteractiveObject)) && ((focusableObjects[_local3] == true)))){
_local4 = (_local3 as InteractiveObject);
if (_local4){
if (_local4 == lastFocus){
lastFocus = null;
};
delete focusableObjects[_local4];
calculateCandidates = true;
};
_local3.addEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
};
};
removeFocusables(_local3);
}
private function sortByDepth(_arg1:InteractiveObject, _arg2:InteractiveObject):Number{
var _local3:String;
var _local4:String;
var _local5:int;
var _local6:String;
var _local7:String;
var _local8:String;
var _local9:DisplayObject;
var _local10:DisplayObject;
_local3 = "";
_local4 = "";
_local8 = "0000";
_local9 = DisplayObject(_arg1);
_local10 = DisplayObject(_arg2);
while (((!((_local9 == DisplayObject(form)))) && (_local9.parent))) {
_local5 = getChildIndex(_local9.parent, _local9);
_local6 = _local5.toString(16);
if (_local6.length < 4){
_local7 = (_local8.substring(0, (4 - _local6.length)) + _local6);
};
_local3 = (_local7 + _local3);
_local9 = _local9.parent;
};
while (((!((_local10 == DisplayObject(form)))) && (_local10.parent))) {
_local5 = getChildIndex(_local10.parent, _local10);
_local6 = _local5.toString(16);
if (_local6.length < 4){
_local7 = (_local8.substring(0, (4 - _local6.length)) + _local6);
};
_local4 = (_local7 + _local4);
_local10 = _local10.parent;
};
return (((_local3 > _local4)) ? 1 : ((_local3 < _local4)) ? -1 : 0);
}
public function get defaultButton():Button{
return (_defaultButton);
}
private function activateHandler(_arg1:Event):void{
var _local2:InteractiveObject;
_local2 = InteractiveObject(_arg1.target);
if (lastFocus){
if ((lastFocus is IFocusManagerComponent)){
IFocusManagerComponent(lastFocus).setFocus();
} else {
form.stage.focus = lastFocus;
};
};
lastAction = "ACTIVATE";
}
public function showFocus():void{
}
public function set defaultButtonEnabled(_arg1:Boolean):void{
_defaultButtonEnabled = _arg1;
}
public function getNextFocusManagerComponent(_arg1:Boolean=false):InteractiveObject{
var _local2:DisplayObject;
var _local3:String;
var _local4:int;
var _local5:Boolean;
var _local6:int;
var _local7:int;
var _local8:IFocusManagerGroup;
if (!hasFocusableObjects()){
return (null);
};
if (calculateCandidates){
sortFocusableObjects();
calculateCandidates = false;
};
_local2 = form.stage.focus;
_local2 = DisplayObject(findFocusManagerComponent(InteractiveObject(_local2)));
_local3 = "";
if ((_local2 is IFocusManagerGroup)){
_local8 = IFocusManagerGroup(_local2);
_local3 = _local8.groupName;
};
_local4 = getIndexOfFocusedObject(_local2);
_local5 = false;
_local6 = _local4;
if (_local4 == -1){
if (_arg1){
_local4 = focusableCandidates.length;
};
_local5 = true;
};
_local7 = getIndexOfNextObject(_local4, _arg1, _local5, _local3);
return (findFocusManagerComponent(focusableCandidates[_local7]));
}
private function mouseDownHandler(_arg1:MouseEvent):void{
var _local2:InteractiveObject;
if (_arg1.isDefaultPrevented()){
return;
};
_local2 = getTopLevelFocusTarget(InteractiveObject(_arg1.target));
if (!_local2){
return;
};
showFocusIndicator = false;
if (((((!((_local2 == lastFocus))) || ((lastAction == "ACTIVATE")))) && (!((_local2 is TextField))))){
setFocus(_local2);
};
lastAction = "MOUSEDOWN";
}
private function isTabVisible(_arg1:DisplayObject):Boolean{
var _local2:DisplayObjectContainer;
_local2 = _arg1.parent;
while (((((_local2) && (!((_local2 is Stage))))) && (!(((_local2.parent) && ((_local2.parent is Stage))))))) {
if (!_local2.tabChildren){
return (false);
};
_local2 = _local2.parent;
};
return (true);
}
public function get nextTabIndex():int{
return (0);
}
private function keyDownHandler(_arg1:KeyboardEvent):void{
if (_arg1.keyCode == Keyboard.TAB){
lastAction = "KEY";
if (calculateCandidates){
sortFocusableObjects();
calculateCandidates = false;
};
};
if (((((((defaultButtonEnabled) && ((_arg1.keyCode == Keyboard.ENTER)))) && (defaultButton))) && (defButton.enabled))){
sendDefaultButtonEvent();
};
}
private function focusInHandler(_arg1:FocusEvent):void{
var _local2:InteractiveObject;
var _local3:Button;
_local2 = InteractiveObject(_arg1.target);
if (form.contains(_local2)){
lastFocus = findFocusManagerComponent(InteractiveObject(_local2));
if ((lastFocus is Button)){
_local3 = Button(lastFocus);
if (defButton){
defButton.emphasized = false;
defButton = _local3;
_local3.emphasized = true;
};
} else {
if (((defButton) && (!((defButton == _defaultButton))))){
defButton.emphasized = false;
defButton = _defaultButton;
_defaultButton.emphasized = true;
};
};
};
}
private function tabEnabledChangeHandler(_arg1:Event):void{
var _local2:InteractiveObject;
var _local3:Boolean;
calculateCandidates = true;
_local2 = InteractiveObject(_arg1.target);
_local3 = (focusableObjects[_local2] == true);
if (_local2.tabEnabled){
if (((!(_local3)) && (isTabVisible(_local2)))){
if (!(_local2 is IFocusManagerComponent)){
_local2.focusRect = false;
};
focusableObjects[_local2] = true;
};
} else {
if (_local3){
delete focusableObjects[_local2];
};
};
}
public function set showFocusIndicator(_arg1:Boolean):void{
_showFocusIndicator = _arg1;
}
public function get form():DisplayObjectContainer{
return (_form);
}
private function sortByTabIndex(_arg1:InteractiveObject, _arg2:InteractiveObject):int{
return (((_arg1.tabIndex > _arg2.tabIndex)) ? 1 : ((_arg1.tabIndex < _arg2.tabIndex)) ? -1 : sortByDepth(_arg1, _arg2));
}
public function activate():void{
if (activated){
return;
};
form.stage.addEventListener(FocusEvent.MOUSE_FOCUS_CHANGE, mouseFocusChangeHandler, false, 0, true);
form.stage.addEventListener(FocusEvent.KEY_FOCUS_CHANGE, keyFocusChangeHandler, false, 0, true);
form.addEventListener(FocusEvent.FOCUS_IN, focusInHandler, true);
form.addEventListener(FocusEvent.FOCUS_OUT, focusOutHandler, true);
form.stage.addEventListener(Event.ACTIVATE, activateHandler, false, 0, true);
form.stage.addEventListener(Event.DEACTIVATE, deactivateHandler, false, 0, true);
form.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
form.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler, true);
activated = true;
if (lastFocus){
setFocus(lastFocus);
};
}
public function deactivate():void{
form.stage.removeEventListener(FocusEvent.MOUSE_FOCUS_CHANGE, mouseFocusChangeHandler);
form.stage.removeEventListener(FocusEvent.KEY_FOCUS_CHANGE, keyFocusChangeHandler);
form.removeEventListener(FocusEvent.FOCUS_IN, focusInHandler, true);
form.removeEventListener(FocusEvent.FOCUS_OUT, focusOutHandler, true);
form.stage.removeEventListener(Event.ACTIVATE, activateHandler);
form.stage.removeEventListener(Event.DEACTIVATE, deactivateHandler);
form.removeEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
form.removeEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler, true);
activated = false;
}
public function get defaultButtonEnabled():Boolean{
return (_defaultButtonEnabled);
}
}
}//package fl.managers
Section 72
//IFocusManager (fl.managers.IFocusManager)
package fl.managers {
import fl.controls.*;
import flash.display.*;
public interface IFocusManager {
function getFocus():InteractiveObject;
function deactivate():void;
function set defaultButton(_arg1:Button):void;
function set showFocusIndicator(_arg1:Boolean):void;
function get defaultButtonEnabled():Boolean;
function get nextTabIndex():int;
function get defaultButton():Button;
function get showFocusIndicator():Boolean;
function setFocus(_arg1:InteractiveObject):void;
function activate():void;
function showFocus():void;
function set defaultButtonEnabled(_arg1:Boolean):void;
function hideFocus():void;
function findFocusManagerComponent(_arg1:InteractiveObject):InteractiveObject;
function getNextFocusManagerComponent(_arg1:Boolean=false):InteractiveObject;
}
}//package fl.managers
Section 73
//IFocusManagerComponent (fl.managers.IFocusManagerComponent)
package fl.managers {
public interface IFocusManagerComponent {
function set focusEnabled(_arg1:Boolean):void;
function drawFocus(_arg1:Boolean):void;
function setFocus():void;
function get focusEnabled():Boolean;
function get tabEnabled():Boolean;
function get tabIndex():int;
function get mouseFocusEnabled():Boolean;
}
}//package fl.managers
Section 74
//IFocusManagerGroup (fl.managers.IFocusManagerGroup)
package fl.managers {
public interface IFocusManagerGroup {
function set groupName(_arg1:String):void;
function set selected(_arg1:Boolean):void;
function get groupName():String;
function get selected():Boolean;
}
}//package fl.managers
Section 75
//StyleManager (fl.managers.StyleManager)
package fl.managers {
import flash.text.*;
import fl.core.*;
import flash.utils.*;
public class StyleManager {
private var globalStyles:Object;
private var classToDefaultStylesDict:Dictionary;
private var styleToClassesHash:Object;
private var classToStylesDict:Dictionary;
private var classToInstancesDict:Dictionary;
private static var _instance:StyleManager;
public function StyleManager(){
styleToClassesHash = {};
classToInstancesDict = new Dictionary(true);
classToStylesDict = new Dictionary(true);
classToDefaultStylesDict = new Dictionary(true);
globalStyles = UIComponent.getStyleDefinition();
}
public static function clearComponentStyle(_arg1:Object, _arg2:String):void{
var _local3:Class;
var _local4:Object;
_local3 = getClassDef(_arg1);
_local4 = getInstance().classToStylesDict[_local3];
if (((!((_local4 == null))) && (!((_local4[_arg2] == null))))){
delete _local4[_arg2];
invalidateComponentStyle(_local3, _arg2);
};
}
private static function getClassDef(_arg1:Object):Class{
var component = _arg1;
if ((component is Class)){
return ((component as Class));
};
try {
return ((getDefinitionByName(getQualifiedClassName(component)) as Class));
} catch(e:Error) {
if ((component is UIComponent)){
try {
return ((component.loaderInfo.applicationDomain.getDefinition(getQualifiedClassName(component)) as Class));
} catch(e:Error) {
};
};
};
return (null);
}
public static function clearStyle(_arg1:String):void{
setStyle(_arg1, null);
}
public static function setComponentStyle(_arg1:Object, _arg2:String, _arg3:Object):void{
var _local4:Class;
var _local5:Object;
_local4 = getClassDef(_arg1);
_local5 = getInstance().classToStylesDict[_local4];
if (_local5 == null){
_local5 = (getInstance().classToStylesDict[_local4] = {});
};
if (_local5 == _arg3){
return;
};
_local5[_arg2] = _arg3;
invalidateComponentStyle(_local4, _arg2);
}
private static function setSharedStyles(_arg1:UIComponent):void{
var _local2:StyleManager;
var _local3:Class;
var _local4:Object;
var _local5:String;
_local2 = getInstance();
_local3 = getClassDef(_arg1);
_local4 = _local2.classToDefaultStylesDict[_local3];
for (_local5 in _local4) {
_arg1.setSharedStyle(_local5, getSharedStyle(_arg1, _local5));
};
}
public static function getComponentStyle(_arg1:Object, _arg2:String):Object{
var _local3:Class;
var _local4:Object;
_local3 = getClassDef(_arg1);
_local4 = getInstance().classToStylesDict[_local3];
return (((_local4)==null) ? null : _local4[_arg2]);
}
private static function getInstance(){
if (_instance == null){
_instance = new (StyleManager);
};
return (_instance);
}
private static function invalidateComponentStyle(_arg1:Class, _arg2:String):void{
var _local3:Dictionary;
var _local4:Object;
var _local5:UIComponent;
_local3 = getInstance().classToInstancesDict[_arg1];
if (_local3 == null){
return;
};
for (_local4 in _local3) {
_local5 = (_local4 as UIComponent);
if (_local5 == null){
} else {
_local5.setSharedStyle(_arg2, getSharedStyle(_local5, _arg2));
};
};
}
private static function invalidateStyle(_arg1:String):void{
var _local2:Dictionary;
var _local3:Object;
_local2 = getInstance().styleToClassesHash[_arg1];
if (_local2 == null){
return;
};
for (_local3 in _local2) {
invalidateComponentStyle(Class(_local3), _arg1);
};
}
public static function registerInstance(_arg1:UIComponent):void{
var inst:StyleManager;
var classDef:Class;
var target:Class;
var defaultStyles:Object;
var styleToClasses:Object;
var n:String;
var instance = _arg1;
inst = getInstance();
classDef = getClassDef(instance);
if (classDef == null){
return;
};
if (inst.classToInstancesDict[classDef] == null){
inst.classToInstancesDict[classDef] = new Dictionary(true);
target = classDef;
while (defaultStyles == null) {
if (target["getStyleDefinition"] != null){
defaultStyles = target["getStyleDefinition"]();
break;
};
try {
target = (instance.loaderInfo.applicationDomain.getDefinition(getQualifiedSuperclassName(target)) as Class);
} catch(err:Error) {
try {
target = (getDefinitionByName(getQualifiedSuperclassName(target)) as Class);
} catch(e:Error) {
defaultStyles = UIComponent.getStyleDefinition();
break;
};
};
};
styleToClasses = inst.styleToClassesHash;
for (n in defaultStyles) {
if (styleToClasses[n] == null){
styleToClasses[n] = new Dictionary(true);
};
styleToClasses[n][classDef] = true;
};
inst.classToDefaultStylesDict[classDef] = defaultStyles;
inst.classToStylesDict[classDef] = {};
};
inst.classToInstancesDict[classDef][instance] = true;
setSharedStyles(instance);
}
public static function getStyle(_arg1:String):Object{
return (getInstance().globalStyles[_arg1]);
}
private static function getSharedStyle(_arg1:UIComponent, _arg2:String):Object{
var _local3:Class;
var _local4:StyleManager;
var _local5:Object;
_local3 = getClassDef(_arg1);
_local4 = getInstance();
_local5 = _local4.classToStylesDict[_local3][_arg2];
if (_local5 != null){
return (_local5);
};
_local5 = _local4.globalStyles[_arg2];
if (_local5 != null){
return (_local5);
};
return (_local4.classToDefaultStylesDict[_local3][_arg2]);
}
public static function setStyle(_arg1:String, _arg2:Object):void{
var _local3:Object;
_local3 = getInstance().globalStyles;
if ((((_local3[_arg1] === _arg2)) && (!((_arg2 is TextFormat))))){
return;
};
_local3[_arg1] = _arg2;
invalidateStyle(_arg1);
}
}
}//package fl.managers
Section 76
//MochiScores (mochi.MochiScores)
package mochi {
import flash.display.*;
import flash.text.*;
public class MochiScores {
private static var boardID:String;
public static var onErrorHandler:Object;
public static var onCloseHandler:Object;
public static function showLeaderboard(_arg1:Object=null):void{
var options = _arg1;
if (options != null){
if (options.clip != null){
if ((options.clip is Sprite)){
MochiServices.setContainer(options.clip);
};
delete options.clip;
} else {
MochiServices.setContainer();
};
MochiServices.stayOnTop();
if (options.name != null){
if ((options.name is TextField)){
if (options.name.text.length > 0){
options.name = options.name.text;
};
};
};
if (options.score != null){
if ((options.score is TextField)){
if (options.score.text.length > 0){
options.score = options.score.text;
};
};
};
if (options.onDisplay != null){
options.onDisplay();
} else {
if (MochiServices.clip != null){
if ((MochiServices.clip is MovieClip)){
MochiServices.clip.stop();
//unresolved jump
};
};
};
} else {
options = {};
if ((MochiServices.clip is MovieClip)){
MochiServices.clip.stop();
//unresolved jump
};
};
if (options.onClose != null){
onCloseHandler = options.onClose;
} else {
onCloseHandler = function ():void{
if ((MochiServices.clip is MovieClip)){
MochiServices.clip.play();
//unresolved jump
};
};
};
if (options.onError != null){
onErrorHandler = options.onError;
} else {
onErrorHandler = null;
};
if (options.boardID == null){
if (MochiScores.boardID != null){
options.boardID = MochiScores.boardID;
};
};
MochiServices.send("scores_showLeaderboard", {options:options}, null, onClose);
}
public static function closeLeaderboard():void{
MochiServices.send("scores_closeLeaderboard");
}
public static function getPlayerInfo(_arg1:Object, _arg2:Object=null):void{
MochiServices.send("scores_getPlayerInfo", null, _arg1, _arg2);
}
public static function requestList(_arg1:Object, _arg2:Object=null):void{
MochiServices.send("scores_requestList", null, _arg1, _arg2);
}
public static function scoresArrayToObjects(_arg1:Object):Object{
var _local2:Object;
var _local3:Number;
var _local4:Number;
var _local5:Object;
var _local6:Object;
var _local7:String;
var _local8:String;
_local2 = {};
for (_local7 in _arg1) {
if (typeof(_arg1[_local7]) == "object"){
if (((!((_arg1[_local7].cols == null))) && (!((_arg1[_local7].rows == null))))){
_local2[_local7] = [];
_local5 = _arg1[_local7];
_local4 = 0;
while (_local4 < _local5.rows.length) {
_local6 = {};
_local3 = 0;
while (_local3 < _local5.cols.length) {
_local6[_local5.cols[_local3]] = _local5.rows[_local4][_local3];
_local3++;
};
_local2[_local7].push(_local6);
_local4++;
};
} else {
_local2[_local7] = {};
for (_local8 in _arg1[_local7]) {
_local2[_local7][_local8] = _arg1[_local7][_local8];
};
};
} else {
_local2[_local7] = _arg1[_local7];
};
};
return (_local2);
}
public static function submit(_arg1:Number, _arg2:String, _arg3:Object=null, _arg4:Object=null):void{
MochiServices.send("scores_submit", {score:_arg1, name:_arg2}, _arg3, _arg4);
}
public static function onClose(_arg1:Object=null):void{
if (_arg1 != null){
if (_arg1.error != null){
if (_arg1.error == true){
if (onErrorHandler != null){
if (_arg1.errorCode == null){
_arg1.errorCode = "IOError";
};
onErrorHandler(_arg1.errorCode);
MochiServices.doClose();
return;
};
};
};
};
onCloseHandler();
MochiServices.doClose();
}
public static function setBoardID(_arg1:String):void{
MochiScores.boardID = _arg1;
MochiServices.send("scores_setBoardID", {boardID:_arg1});
}
}
}//package mochi
Section 77
//MochiServices (mochi.MochiServices)
package mochi {
import flash.display.*;
import flash.events.*;
import flash.net.*;
import flash.utils.*;
import flash.system.*;
public class MochiServices {
private static var _container:Object;
private static var _connected:Boolean = false;
private static var _swfVersion:String;
private static var _sendChannel:LocalConnection;
private static var _rcvChannelName:String;
private static var _gatewayURL:String = "http://www.mochiads.com/static/lib/services/services.swf";
private static var _clip:MovieClip;
private static var _loader:Loader;
private static var _id:String;
private static var _listenChannel:LocalConnection;
private static var _timer:Timer;
private static var _sendChannelName:String;
private static var _startTime:Number;
private static var _connecting:Boolean = false;
public static var onError:Object;
private static var _listenChannelName:String = "__mochiservices";
private static var _rcvChannel:LocalConnection;
public static function isNetworkAvailable():Boolean{
return (!((Security.sandboxType == "localWithFile")));
}
public static function send(_arg1:String, _arg2:Object=null, _arg3:Object=null, _arg4:Object=null):void{
if (_connected){
_sendChannel.send(_sendChannelName, "onReceive", {methodName:_arg1, args:_arg2, callbackID:_clip._nextcallbackID});
} else {
if ((((_clip == null)) || (!(_connecting)))){
onError("NotConnected");
handleError(_arg2, _arg3, _arg4);
flush(true);
return;
};
_clip._queue.push({methodName:_arg1, args:_arg2, callbackID:_clip._nextcallbackID});
};
if (_clip != null){
if (((!((_clip._callbacks == null))) && (!((_clip._nextcallbackID == null))))){
_clip._callbacks[_clip._nextcallbackID] = {callbackObject:_arg3, callbackMethod:_arg4};
_clip._nextcallbackID++;
};
};
}
public static function get connected():Boolean{
return (_connected);
}
private static function flush(_arg1:Boolean):void{
var _local2:Object;
var _local3:Object;
if (_clip != null){
if (_clip._queue != null){
while (_clip._queue.length > 0) {
_local2 = _clip._queue.shift();
_local3 = null;
if (_local2 != null){
if (_local2.callbackID != null){
_local3 = _clip._callbacks[_local2.callbackID];
};
delete _clip._callbacks[_local2.callbackID];
if (((_arg1) && (!((_local3 == null))))){
handleError(_local2.args, _local3.callbackObject, _local3.callbackMethod);
};
};
};
};
};
}
private static function init(_arg1:String, _arg2:Object):void{
_id = _arg1;
if (_arg2 != null){
_container = _arg2;
loadCommunicator(_arg1, _container);
};
}
public static function get childClip():Object{
return (_clip);
}
public static function get id():String{
return (_id);
}
public static function stayOnTop():void{
_container.addEventListener(Event.ENTER_FRAME, MochiServices.bringToTop, false, 0, true);
if (_clip != null){
_clip.visible = true;
};
}
public static function getVersion():String{
return ("1.31");
}
public static function disconnect():void{
if (((_connected) || (_connecting))){
if (_clip != null){
if (_clip.parent != null){
if ((_clip.parent is Sprite)){
Sprite(_clip.parent).removeChild(_clip);
_clip = null;
};
};
};
_connecting = (_connected = false);
flush(true);
try {
_listenChannel.close();
_rcvChannel.close();
} catch(error:Error) {
};
};
if (_timer != null){
try {
_timer.stop();
} catch(error:Error) {
};
};
}
public static function allowDomains(_arg1:String):String{
var _local2:String;
Security.allowDomain("*");
Security.allowInsecureDomain("*");
if (_arg1.indexOf("http://") != -1){
_local2 = _arg1.split("/")[2].split(":")[0];
Security.allowDomain(_local2);
Security.allowInsecureDomain(_local2);
};
return (_local2);
}
public static function doClose():void{
_container.removeEventListener(Event.ENTER_FRAME, MochiServices.bringToTop);
if (_clip.parent != null){
Sprite(_clip.parent).removeChild(_clip);
};
}
public static function setContainer(_arg1:Object=null, _arg2:Boolean=true):void{
if (_arg1 != null){
if ((_arg1 is Sprite)){
_container = _arg1;
};
};
if (_arg2){
if ((_container is Sprite)){
Sprite(_container).addChild(_clip);
};
};
}
private static function onStatus(_arg1:StatusEvent):void{
switch (_arg1.level){
case "error":
_connected = false;
_listenChannel.connect(_listenChannelName);
break;
};
}
private static function initComChannels():void{
if (!_connected){
_sendChannel.addEventListener(StatusEvent.STATUS, MochiServices.onStatus);
_sendChannel.send(_sendChannelName, "onReceive", {methodName:"handshakeDone"});
_sendChannel.send(_sendChannelName, "onReceive", {methodName:"registerGame", id:_id, clip:_container, version:getVersion()});
_rcvChannel.addEventListener(StatusEvent.STATUS, MochiServices.onStatus);
_clip.onReceive = function (_arg1:Object):void{
var cb:String;
var cblst:Object;
var method:*;
var methodName:String;
var obj:Object;
var pkg = _arg1;
cb = pkg.callbackID;
cblst = this.client._callbacks[cb];
if (!cblst){
return;
};
method = cblst.callbackMethod;
methodName = "";
obj = cblst.callbackObject;
if (((obj) && ((typeof(method) == "string")))){
methodName = method;
if (obj[method] != null){
method = obj[method];
//unresolved jump
};
};
if (method != undefined){
try {
method.apply(obj, pkg.args);
} catch(error:Error) {
};
} else {
if (obj != null){
try {
obj(pkg.args);
} catch(error:Error) {
};
};
};
delete this.client._callbacks[cb];
};
_clip.onError = function ():void{
MochiServices.onError("IOError");
};
_rcvChannel.connect(_rcvChannelName);
_connecting = false;
_connected = true;
_listenChannel.close();
while (_clip._queue.length > 0) {
_sendChannel.send(_sendChannelName, "onReceive", _clip._queue.shift());
};
};
}
private static function listen():void{
_listenChannel = new LocalConnection();
_listenChannel.client = _clip;
_clip.handshake = function (_arg1:Object):void{
MochiServices.comChannelName = _arg1.newChannel;
};
_listenChannel.allowDomain("*", "localhost");
_listenChannel.allowInsecureDomain("*", "localhost");
_listenChannel.connect(_listenChannelName);
}
private static function handleError(_arg1:Object, _arg2:Object, _arg3:Object):void{
var args = _arg1;
var callbackObject = _arg2;
var callbackMethod = _arg3;
if (args != null){
if (args.onError != null){
args.onError.apply(null, ["NotConnected"]);
};
};
if (callbackMethod != null){
args = {};
args.error = true;
args.errorCode = "NotConnected";
if (((!((callbackObject == null))) && ((callbackMethod is String)))){
try {
var _local5 = callbackObject;
_local5[callbackMethod](args);
} catch(error:Error) {
};
} else {
if (callbackMethod != null){
try {
callbackMethod.apply(args);
} catch(error:Error) {
};
};
};
};
}
public static function get clip():Object{
return (_container);
}
public static function set comChannelName(_arg1:String):void{
if (_arg1 != null){
if (_arg1.length > 3){
_sendChannelName = (_arg1 + "_fromgame");
_rcvChannelName = _arg1;
initComChannels();
};
};
}
private static function loadCommunicator(_arg1:String, _arg2:Object):MovieClip{
var clipname:String;
var f:Function;
var req:URLRequest;
var id = _arg1;
var clip = _arg2;
clipname = ("_mochiservices_com_" + id);
if (_clip != null){
return (_clip);
};
if (!MochiServices.isNetworkAvailable()){
return (null);
};
MochiServices.allowDomains(_gatewayURL);
_clip = createEmptyMovieClip(clip, clipname, 10336, false);
_loader = new Loader();
_timer = new Timer(1000, 0);
_startTime = getTimer();
_timer.addEventListener(TimerEvent.TIMER, connectWait);
_timer.start();
f = function (_arg1:Object):void{
_clip._mochiad_ctr_failed = true;
MochiServices.disconnect();
MochiServices.onError("IOError");
};
_loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, f);
req = new URLRequest(_gatewayURL);
_loader.load(req);
_clip.addChild(_loader);
_clip._mochiservices_com = _loader;
_sendChannel = new LocalConnection();
_clip._queue = [];
_rcvChannel = new LocalConnection();
_rcvChannel.allowDomain("*", "localhost");
_rcvChannel.allowInsecureDomain("*", "localhost");
_rcvChannel.client = _clip;
_clip._nextcallbackID = 0;
_clip._callbacks = {};
listen();
return (_clip);
}
public static function bringToTop(_arg1:Event):void{
var e = _arg1;
if (MochiServices.clip != null){
if (MochiServices.childClip != null){
try {
if (MochiServices.clip.numChildren > 1){
MochiServices.clip.setChildIndex(MochiServices.childClip, (MochiServices.clip.numChildren - 1));
};
} catch(errorObject:Error) {
_container.removeEventListener(Event.ENTER_FRAME, MochiServices.bringToTop);
};
};
};
}
public static function connect(_arg1:String, _arg2:Object, _arg3:Object=null):void{
var id = _arg1;
var clip = _arg2;
var onError = _arg3;
if ((clip is DisplayObject)){
if (((!(_connected)) && ((_clip == null)))){
_connecting = true;
init(id, clip);
};
//unresolved jump
};
if (onError != null){
MochiServices.onError = onError;
} else {
if (MochiServices.onError == null){
MochiServices.onError = function (_arg1:String):void{
};
};
};
}
public static function createEmptyMovieClip(_arg1:Object, _arg2:String, _arg3:Number, _arg4:Boolean=true):MovieClip{
var mc:MovieClip;
var parent = _arg1;
var name = _arg2;
var depth = _arg3;
var doAdd = _arg4;
mc = new MovieClip();
if (doAdd){
if (((false) && (depth))){
parent.addChildAt(mc, depth);
} else {
parent.addChild(mc);
};
};
try {
parent[name] = mc;
} catch(e:Error) {
throw (new Error("MochiServices requires a clip that is an instance of a dynamic class. If your class extends Sprite or MovieClip, you must make it dynamic."));
};
mc["_name"] = name;
return (mc);
}
public static function connectWait(_arg1:TimerEvent):void{
if ((getTimer() - _startTime) > 10000){
if (!_connected){
_clip._mochiad_ctr_failed = true;
MochiServices.disconnect();
MochiServices.onError("IOError");
};
_timer.stop();
};
}
}
}//package mochi
Section 78
//BibbAssetsMC_20 (sr_fla.BibbAssetsMC_20)
package sr_fla {
import flash.display.*;
public dynamic class BibbAssetsMC_20 extends MovieClip {
public function BibbAssetsMC_20(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package sr_fla
Section 79
//GameMessageMC_108 (sr_fla.GameMessageMC_108)
package sr_fla {
import flash.display.*;
import flash.text.*;
public dynamic class GameMessageMC_108 extends MovieClip {
public var message_txt:TextField;
}
}//package sr_fla
Section 80
//LOGO_YOUGAME_5 (sr_fla.LOGO_YOUGAME_5)
package sr_fla {
import flash.display.*;
public dynamic class LOGO_YOUGAME_5 extends MovieClip {
public function LOGO_YOUGAME_5(){
addFrameScript(0, frame1, 197, frame198);
}
function frame1(){
}
function frame198(){
MovieClip(parent).play();
}
}
}//package sr_fla
Section 81
//PlanetsBackMC_65 (sr_fla.PlanetsBackMC_65)
package sr_fla {
import flash.display.*;
public dynamic class PlanetsBackMC_65 extends MovieClip {
public var rebel12:MovieClip;
public var rebel10:MovieClip;
public var empire2:MovieClip;
public var empire6:MovieClip;
public var empire7:MovieClip;
public var empire9:MovieClip;
public var empire8:MovieClip;
public var level1:SimpleButton;
public var level2:SimpleButton;
public var level4:SimpleButton;
public var level6:SimpleButton;
public var level7:SimpleButton;
public var level3:SimpleButton;
public var level5:SimpleButton;
public var level8:SimpleButton;
public var level9:SimpleButton;
public var rebel11:MovieClip;
public var empire3:MovieClip;
public var rebel1:MovieClip;
public var rebel2:MovieClip;
public var rebel3:MovieClip;
public var rebel6:MovieClip;
public var rebel8:MovieClip;
public var rebel5:MovieClip;
public var level12:SimpleButton;
public var empire10:MovieClip;
public var empire12:MovieClip;
public var rebel4:MovieClip;
public var rebel7:MovieClip;
public var empire11:MovieClip;
public var level10:SimpleButton;
public var empire4:MovieClip;
public var empire5:MovieClip;
public var level11:SimpleButton;
public var rebel9:MovieClip;
}
}//package sr_fla
Section 82
//PlanetsLevelMessageMC_97 (sr_fla.PlanetsLevelMessageMC_97)
package sr_fla {
import flash.display.*;
import flash.text.*;
public dynamic class PlanetsLevelMessageMC_97 extends MovieClip {
public var msg:TextField;
}
}//package sr_fla
Section 83
//RebelArmsMC_90 (sr_fla.RebelArmsMC_90)
package sr_fla {
import flash.display.*;
public dynamic class RebelArmsMC_90 extends MovieClip {
public function RebelArmsMC_90(){
addFrameScript(0, frame1, 14, frame15);
}
function frame15(){
gotoAndPlay("glow");
}
function frame1(){
stop();
}
}
}//package sr_fla
Section 84
//SellButton_36 (sr_fla.SellButton_36)
package sr_fla {
import flash.display.*;
import flash.text.*;
public dynamic class SellButton_36 extends MovieClip {
public var caption:TextField;
public function SellButton_36(){
addFrameScript(0, frame1, 1, frame2);
}
function frame1(){
stop();
}
function frame2(){
stop();
}
}
}//package sr_fla
Section 85
//BombTooltipMC (BombTooltipMC)
package {
import flash.display.*;
import flash.text.*;
public dynamic class BombTooltipMC extends MovieClip {
public var epicenter:TextField;
public var title:TextField;
public var crystals:TextField;
}
}//package
Section 86
//BuildingMC (BuildingMC)
package {
import flash.display.*;
public dynamic class BuildingMC extends MovieClip {
}
}//package
Section 87
//focusRectSkin (focusRectSkin)
package {
import flash.display.*;
public dynamic class focusRectSkin extends MovieClip {
}
}//package
Section 88
//GameMessageMotion (GameMessageMotion)
package {
import flash.display.*;
public dynamic class GameMessageMotion extends MovieClip {
public var msg:MovieClip;
public function GameMessageMotion(){
addFrameScript(54, frame55);
}
function frame55(){
stop();
visible = false;
}
}
}//package
Section 89
//GameStage (GameStage)
package {
import flash.display.*;
import flash.events.*;
import mochi.*;
import flash.system.*;
import flash.ui.*;
public dynamic class GameStage extends MovieClip {
public var assets_bibb:MovieClip;
public var main_menu:MovieClip;
public var loadingMC:MovieClip;
public var initialized:Boolean;// = false
public static var main_stage = null;
public static var main_holder:Sprite = null;
public function GameStage():void{
initialized = false;
super();
addFrameScript(0, frame1, 11, frame12, 19, frame20);
Security.allowDomain("*");
}
function frame12(){
MochiAd.showPreGameAd({clip:root, id:"701c9f8f42284a14", res:"800x600"});
}
function frame1(){
MochiServices.connect("701c9f8f42284a14", root);
stop();
if (initialized){
gotoAndStop(10);
} else {
root.loaderInfo.addEventListener(ProgressEvent.PROGRESS, update);
};
}
function frame20(){
try {
MochiBot.track(this, "cf36b48a");
} finally {
};
this.initTheGame();
stop();
}
public function update(_arg1:ProgressEvent):void{
var _local2:Number;
_local2 = Math.floor(((_arg1.bytesLoaded * 100) / _arg1.bytesTotal));
if ((loadingMC is MovieClip)){
loadingMC.progress_mc.gotoAndStop(_local2);
loadingMC.loaded_txt.text = (("Loaded: " + _local2.toString()) + "%");
};
if (_local2 >= 100){
loadingMC.progress_mc.stop();
loadingMC.progress_mc.visible = false;
removeChild(loadingMC);
loadingMC = null;
play();
};
}
public function initTheGame():void{
if (initialized){
return;
};
removeChild(assets_bibb);
assets_bibb = null;
main_stage = this.stage;
main_menu.initGame(this);
initialized = true;
}
public function showMainMenu():void{
main_menu.visible = true;
}
}
}//package
Section 90
//Image_artillery_attack (Image_artillery_attack)
package {
import flash.display.*;
public dynamic class Image_artillery_attack extends BitmapData {
public function Image_artillery_attack(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 91
//Image_artillery_be (Image_artillery_be)
package {
import flash.display.*;
public dynamic class Image_artillery_be extends BitmapData {
public function Image_artillery_be(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 92
//Image_artillery_body (Image_artillery_body)
package {
import flash.display.*;
public dynamic class Image_artillery_body extends BitmapData {
public function Image_artillery_body(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 93
//Image_artillery_bullet (Image_artillery_bullet)
package {
import flash.display.*;
public dynamic class Image_artillery_bullet extends BitmapData {
public function Image_artillery_bullet(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 94
//Image_artillery_status_sprite (Image_artillery_status_sprite)
package {
import flash.display.*;
public dynamic class Image_artillery_status_sprite extends BitmapData {
public function Image_artillery_status_sprite(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 95
//Image_b_artillery (Image_b_artillery)
package {
import flash.display.*;
public dynamic class Image_b_artillery extends BitmapData {
public function Image_b_artillery(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 96
//Image_b_attack (Image_b_attack)
package {
import flash.display.*;
public dynamic class Image_b_attack extends BitmapData {
public function Image_b_attack(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 97
//Image_b_cancel (Image_b_cancel)
package {
import flash.display.*;
public dynamic class Image_b_cancel extends BitmapData {
public function Image_b_cancel(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 98
//Image_b_cumulative_bomb (Image_b_cumulative_bomb)
package {
import flash.display.*;
public dynamic class Image_b_cumulative_bomb extends BitmapData {
public function Image_b_cumulative_bomb(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 99
//Image_b_laser_cannon (Image_b_laser_cannon)
package {
import flash.display.*;
public dynamic class Image_b_laser_cannon extends BitmapData {
public function Image_b_laser_cannon(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 100
//Image_b_missile_turret (Image_b_missile_turret)
package {
import flash.display.*;
public dynamic class Image_b_missile_turret extends BitmapData {
public function Image_b_missile_turret(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 101
//Image_b_nitro_bomb (Image_b_nitro_bomb)
package {
import flash.display.*;
public dynamic class Image_b_nitro_bomb extends BitmapData {
public function Image_b_nitro_bomb(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 102
//Image_b_nuclear_missile (Image_b_nuclear_missile)
package {
import flash.display.*;
public dynamic class Image_b_nuclear_missile extends BitmapData {
public function Image_b_nuclear_missile(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 103
//Image_b_plasma_mortar (Image_b_plasma_mortar)
package {
import flash.display.*;
public dynamic class Image_b_plasma_mortar extends BitmapData {
public function Image_b_plasma_mortar(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 104
//Image_b_power_station (Image_b_power_station)
package {
import flash.display.*;
public dynamic class Image_b_power_station extends BitmapData {
public function Image_b_power_station(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 105
//Image_b_refinery (Image_b_refinery)
package {
import flash.display.*;
public dynamic class Image_b_refinery extends BitmapData {
public function Image_b_refinery(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 106
//Image_b_stop (Image_b_stop)
package {
import flash.display.*;
public dynamic class Image_b_stop extends BitmapData {
public function Image_b_stop(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 107
//Image_b_stunner (Image_b_stunner)
package {
import flash.display.*;
public dynamic class Image_b_stunner extends BitmapData {
public function Image_b_stunner(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 108
//Image_battle_shuttle_attack (Image_battle_shuttle_attack)
package {
import flash.display.*;
public dynamic class Image_battle_shuttle_attack extends BitmapData {
public function Image_battle_shuttle_attack(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 109
//Image_battle_shuttle_be (Image_battle_shuttle_be)
package {
import flash.display.*;
public dynamic class Image_battle_shuttle_be extends BitmapData {
public function Image_battle_shuttle_be(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 110
//Image_battle_shuttle_body (Image_battle_shuttle_body)
package {
import flash.display.*;
public dynamic class Image_battle_shuttle_body extends BitmapData {
public function Image_battle_shuttle_body(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 111
//Image_battle_shuttle_bullet (Image_battle_shuttle_bullet)
package {
import flash.display.*;
public dynamic class Image_battle_shuttle_bullet extends BitmapData {
public function Image_battle_shuttle_bullet(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 112
//Image_battle_shuttle_status_sprite (Image_battle_shuttle_status_sprite)
package {
import flash.display.*;
public dynamic class Image_battle_shuttle_status_sprite extends BitmapData {
public function Image_battle_shuttle_status_sprite(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 113
//Image_command_center_body (Image_command_center_body)
package {
import flash.display.*;
public dynamic class Image_command_center_body extends BitmapData {
public function Image_command_center_body(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 114
//Image_command_center_status_sprite (Image_command_center_status_sprite)
package {
import flash.display.*;
public dynamic class Image_command_center_status_sprite extends BitmapData {
public function Image_command_center_status_sprite(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 115
//Image_crystals_status (Image_crystals_status)
package {
import flash.display.*;
public dynamic class Image_crystals_status extends BitmapData {
public function Image_crystals_status(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 116
//Image_destroyer_attack (Image_destroyer_attack)
package {
import flash.display.*;
public dynamic class Image_destroyer_attack extends BitmapData {
public function Image_destroyer_attack(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 117
//Image_destroyer_be (Image_destroyer_be)
package {
import flash.display.*;
public dynamic class Image_destroyer_be extends BitmapData {
public function Image_destroyer_be(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 118
//Image_destroyer_body (Image_destroyer_body)
package {
import flash.display.*;
public dynamic class Image_destroyer_body extends BitmapData {
public function Image_destroyer_body(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 119
//Image_destroyer_bullet (Image_destroyer_bullet)
package {
import flash.display.*;
public dynamic class Image_destroyer_bullet extends BitmapData {
public function Image_destroyer_bullet(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 120
//Image_destroyer_status_sprite (Image_destroyer_status_sprite)
package {
import flash.display.*;
public dynamic class Image_destroyer_status_sprite extends BitmapData {
public function Image_destroyer_status_sprite(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 121
//Image_executor_attack (Image_executor_attack)
package {
import flash.display.*;
public dynamic class Image_executor_attack extends BitmapData {
public function Image_executor_attack(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 122
//Image_executor_be (Image_executor_be)
package {
import flash.display.*;
public dynamic class Image_executor_be extends BitmapData {
public function Image_executor_be(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 123
//Image_executor_body (Image_executor_body)
package {
import flash.display.*;
public dynamic class Image_executor_body extends BitmapData {
public function Image_executor_body(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 124
//Image_executor_bullet (Image_executor_bullet)
package {
import flash.display.*;
public dynamic class Image_executor_bullet extends BitmapData {
public function Image_executor_bullet(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 125
//Image_executor_status_sprite (Image_executor_status_sprite)
package {
import flash.display.*;
public dynamic class Image_executor_status_sprite extends BitmapData {
public function Image_executor_status_sprite(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 126
//Image_fighter_t1_attack (Image_fighter_t1_attack)
package {
import flash.display.*;
public dynamic class Image_fighter_t1_attack extends BitmapData {
public function Image_fighter_t1_attack(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 127
//Image_fighter_t1_be (Image_fighter_t1_be)
package {
import flash.display.*;
public dynamic class Image_fighter_t1_be extends BitmapData {
public function Image_fighter_t1_be(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 128
//Image_fighter_t1_body (Image_fighter_t1_body)
package {
import flash.display.*;
public dynamic class Image_fighter_t1_body extends BitmapData {
public function Image_fighter_t1_body(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 129
//Image_fighter_t1_bullet (Image_fighter_t1_bullet)
package {
import flash.display.*;
public dynamic class Image_fighter_t1_bullet extends BitmapData {
public function Image_fighter_t1_bullet(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 130
//Image_fighter_t1_status_sprite (Image_fighter_t1_status_sprite)
package {
import flash.display.*;
public dynamic class Image_fighter_t1_status_sprite extends BitmapData {
public function Image_fighter_t1_status_sprite(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 131
//Image_fighter_t2_attack (Image_fighter_t2_attack)
package {
import flash.display.*;
public dynamic class Image_fighter_t2_attack extends BitmapData {
public function Image_fighter_t2_attack(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 132
//Image_fighter_t2_be (Image_fighter_t2_be)
package {
import flash.display.*;
public dynamic class Image_fighter_t2_be extends BitmapData {
public function Image_fighter_t2_be(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 133
//Image_fighter_t2_body (Image_fighter_t2_body)
package {
import flash.display.*;
public dynamic class Image_fighter_t2_body extends BitmapData {
public function Image_fighter_t2_body(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 134
//Image_fighter_t2_bullet (Image_fighter_t2_bullet)
package {
import flash.display.*;
public dynamic class Image_fighter_t2_bullet extends BitmapData {
public function Image_fighter_t2_bullet(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 135
//Image_fighter_t2_status_sprite (Image_fighter_t2_status_sprite)
package {
import flash.display.*;
public dynamic class Image_fighter_t2_status_sprite extends BitmapData {
public function Image_fighter_t2_status_sprite(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 136
//Image_fighter_t3_attack (Image_fighter_t3_attack)
package {
import flash.display.*;
public dynamic class Image_fighter_t3_attack extends BitmapData {
public function Image_fighter_t3_attack(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 137
//Image_fighter_t3_be (Image_fighter_t3_be)
package {
import flash.display.*;
public dynamic class Image_fighter_t3_be extends BitmapData {
public function Image_fighter_t3_be(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 138
//Image_fighter_t3_body (Image_fighter_t3_body)
package {
import flash.display.*;
public dynamic class Image_fighter_t3_body extends BitmapData {
public function Image_fighter_t3_body(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 139
//Image_fighter_t3_bullet (Image_fighter_t3_bullet)
package {
import flash.display.*;
public dynamic class Image_fighter_t3_bullet extends BitmapData {
public function Image_fighter_t3_bullet(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 140
//Image_fighter_t3_status_sprite (Image_fighter_t3_status_sprite)
package {
import flash.display.*;
public dynamic class Image_fighter_t3_status_sprite extends BitmapData {
public function Image_fighter_t3_status_sprite(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 141
//Image_ground_desert (Image_ground_desert)
package {
import flash.display.*;
public dynamic class Image_ground_desert extends BitmapData {
public function Image_ground_desert(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 142
//Image_ground_driedtree (Image_ground_driedtree)
package {
import flash.display.*;
public dynamic class Image_ground_driedtree extends BitmapData {
public function Image_ground_driedtree(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 143
//Image_ground_grass (Image_ground_grass)
package {
import flash.display.*;
public dynamic class Image_ground_grass extends BitmapData {
public function Image_ground_grass(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 144
//Image_ground_moon (Image_ground_moon)
package {
import flash.display.*;
public dynamic class Image_ground_moon extends BitmapData {
public function Image_ground_moon(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 145
//Image_ground_platform (Image_ground_platform)
package {
import flash.display.*;
public dynamic class Image_ground_platform extends BitmapData {
public function Image_ground_platform(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 146
//Image_ground_platformtube (Image_ground_platformtube)
package {
import flash.display.*;
public dynamic class Image_ground_platformtube extends BitmapData {
public function Image_ground_platformtube(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 147
//Image_ground_stone (Image_ground_stone)
package {
import flash.display.*;
public dynamic class Image_ground_stone extends BitmapData {
public function Image_ground_stone(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 148
//Image_ground_tree (Image_ground_tree)
package {
import flash.display.*;
public dynamic class Image_ground_tree extends BitmapData {
public function Image_ground_tree(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 149
//Image_ground_tree2 (Image_ground_tree2)
package {
import flash.display.*;
public dynamic class Image_ground_tree2 extends BitmapData {
public function Image_ground_tree2(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 150
//Image_ground_wall1 (Image_ground_wall1)
package {
import flash.display.*;
public dynamic class Image_ground_wall1 extends BitmapData {
public function Image_ground_wall1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 151
//Image_ground_wall2 (Image_ground_wall2)
package {
import flash.display.*;
public dynamic class Image_ground_wall2 extends BitmapData {
public function Image_ground_wall2(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 152
//Image_gunship_attack (Image_gunship_attack)
package {
import flash.display.*;
public dynamic class Image_gunship_attack extends BitmapData {
public function Image_gunship_attack(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 153
//Image_gunship_be (Image_gunship_be)
package {
import flash.display.*;
public dynamic class Image_gunship_be extends BitmapData {
public function Image_gunship_be(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 154
//Image_gunship_body (Image_gunship_body)
package {
import flash.display.*;
public dynamic class Image_gunship_body extends BitmapData {
public function Image_gunship_body(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 155
//Image_gunship_bullet (Image_gunship_bullet)
package {
import flash.display.*;
public dynamic class Image_gunship_bullet extends BitmapData {
public function Image_gunship_bullet(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 156
//Image_gunship_status_sprite (Image_gunship_status_sprite)
package {
import flash.display.*;
public dynamic class Image_gunship_status_sprite extends BitmapData {
public function Image_gunship_status_sprite(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 157
//Image_harvester_body (Image_harvester_body)
package {
import flash.display.*;
public dynamic class Image_harvester_body extends BitmapData {
public function Image_harvester_body(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 158
//Image_harvester_status_sprite (Image_harvester_status_sprite)
package {
import flash.display.*;
public dynamic class Image_harvester_status_sprite extends BitmapData {
public function Image_harvester_status_sprite(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 159
//Image_hatch (Image_hatch)
package {
import flash.display.*;
public dynamic class Image_hatch extends BitmapData {
public function Image_hatch(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 160
//Image_hostile_order (Image_hostile_order)
package {
import flash.display.*;
public dynamic class Image_hostile_order extends BitmapData {
public function Image_hostile_order(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 161
//Image_interceptor_attack (Image_interceptor_attack)
package {
import flash.display.*;
public dynamic class Image_interceptor_attack extends BitmapData {
public function Image_interceptor_attack(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 162
//Image_interceptor_be (Image_interceptor_be)
package {
import flash.display.*;
public dynamic class Image_interceptor_be extends BitmapData {
public function Image_interceptor_be(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 163
//Image_interceptor_body (Image_interceptor_body)
package {
import flash.display.*;
public dynamic class Image_interceptor_body extends BitmapData {
public function Image_interceptor_body(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 164
//Image_interceptor_bullet (Image_interceptor_bullet)
package {
import flash.display.*;
public dynamic class Image_interceptor_bullet extends BitmapData {
public function Image_interceptor_bullet(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 165
//Image_interceptor_status_sprite (Image_interceptor_status_sprite)
package {
import flash.display.*;
public dynamic class Image_interceptor_status_sprite extends BitmapData {
public function Image_interceptor_status_sprite(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 166
//Image_jackal_attack (Image_jackal_attack)
package {
import flash.display.*;
public dynamic class Image_jackal_attack extends BitmapData {
public function Image_jackal_attack(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 167
//Image_jackal_be (Image_jackal_be)
package {
import flash.display.*;
public dynamic class Image_jackal_be extends BitmapData {
public function Image_jackal_be(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 168
//Image_jackal_body (Image_jackal_body)
package {
import flash.display.*;
public dynamic class Image_jackal_body extends BitmapData {
public function Image_jackal_body(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 169
//Image_jackal_bullet (Image_jackal_bullet)
package {
import flash.display.*;
public dynamic class Image_jackal_bullet extends BitmapData {
public function Image_jackal_bullet(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 170
//Image_jackal_status_sprite (Image_jackal_status_sprite)
package {
import flash.display.*;
public dynamic class Image_jackal_status_sprite extends BitmapData {
public function Image_jackal_status_sprite(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 171
//Image_laser_cannon_attack (Image_laser_cannon_attack)
package {
import flash.display.*;
public dynamic class Image_laser_cannon_attack extends BitmapData {
public function Image_laser_cannon_attack(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 172
//Image_laser_cannon_be (Image_laser_cannon_be)
package {
import flash.display.*;
public dynamic class Image_laser_cannon_be extends BitmapData {
public function Image_laser_cannon_be(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 173
//Image_laser_cannon_body (Image_laser_cannon_body)
package {
import flash.display.*;
public dynamic class Image_laser_cannon_body extends BitmapData {
public function Image_laser_cannon_body(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 174
//Image_laser_cannon_bullet (Image_laser_cannon_bullet)
package {
import flash.display.*;
public dynamic class Image_laser_cannon_bullet extends BitmapData {
public function Image_laser_cannon_bullet(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 175
//Image_laser_cannon_status_sprite (Image_laser_cannon_status_sprite)
package {
import flash.display.*;
public dynamic class Image_laser_cannon_status_sprite extends BitmapData {
public function Image_laser_cannon_status_sprite(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 176
//Image_m_attack (Image_m_attack)
package {
import flash.display.*;
public dynamic class Image_m_attack extends BitmapData {
public function Image_m_attack(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 177
//Image_m_crystals (Image_m_crystals)
package {
import flash.display.*;
public dynamic class Image_m_crystals extends BitmapData {
public function Image_m_crystals(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 178
//Image_m_energy (Image_m_energy)
package {
import flash.display.*;
public dynamic class Image_m_energy extends BitmapData {
public function Image_m_energy(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 179
//Image_m_range (Image_m_range)
package {
import flash.display.*;
public dynamic class Image_m_range extends BitmapData {
public function Image_m_range(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 180
//Image_m_shield (Image_m_shield)
package {
import flash.display.*;
public dynamic class Image_m_shield extends BitmapData {
public function Image_m_shield(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 181
//Image_missile_turret_attack (Image_missile_turret_attack)
package {
import flash.display.*;
public dynamic class Image_missile_turret_attack extends BitmapData {
public function Image_missile_turret_attack(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 182
//Image_missile_turret_be (Image_missile_turret_be)
package {
import flash.display.*;
public dynamic class Image_missile_turret_be extends BitmapData {
public function Image_missile_turret_be(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 183
//Image_missile_turret_body (Image_missile_turret_body)
package {
import flash.display.*;
public dynamic class Image_missile_turret_body extends BitmapData {
public function Image_missile_turret_body(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 184
//Image_missile_turret_bullet (Image_missile_turret_bullet)
package {
import flash.display.*;
public dynamic class Image_missile_turret_bullet extends BitmapData {
public function Image_missile_turret_bullet(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 185
//Image_missile_turret_status_sprite (Image_missile_turret_status_sprite)
package {
import flash.display.*;
public dynamic class Image_missile_turret_status_sprite extends BitmapData {
public function Image_missile_turret_status_sprite(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 186
//Image_moon_picket (Image_moon_picket)
package {
import flash.display.*;
public dynamic class Image_moon_picket extends BitmapData {
public function Image_moon_picket(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 187
//Image_my_order (Image_my_order)
package {
import flash.display.*;
public dynamic class Image_my_order extends BitmapData {
public function Image_my_order(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 188
//Image_plasma_mortar_attack (Image_plasma_mortar_attack)
package {
import flash.display.*;
public dynamic class Image_plasma_mortar_attack extends BitmapData {
public function Image_plasma_mortar_attack(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 189
//Image_plasma_mortar_be (Image_plasma_mortar_be)
package {
import flash.display.*;
public dynamic class Image_plasma_mortar_be extends BitmapData {
public function Image_plasma_mortar_be(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 190
//Image_plasma_mortar_body (Image_plasma_mortar_body)
package {
import flash.display.*;
public dynamic class Image_plasma_mortar_body extends BitmapData {
public function Image_plasma_mortar_body(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 191
//Image_plasma_mortar_bullet (Image_plasma_mortar_bullet)
package {
import flash.display.*;
public dynamic class Image_plasma_mortar_bullet extends BitmapData {
public function Image_plasma_mortar_bullet(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 192
//Image_plasma_mortar_status_sprite (Image_plasma_mortar_status_sprite)
package {
import flash.display.*;
public dynamic class Image_plasma_mortar_status_sprite extends BitmapData {
public function Image_plasma_mortar_status_sprite(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 193
//Image_power_station_body (Image_power_station_body)
package {
import flash.display.*;
public dynamic class Image_power_station_body extends BitmapData {
public function Image_power_station_body(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 194
//Image_power_station_status_sprite (Image_power_station_status_sprite)
package {
import flash.display.*;
public dynamic class Image_power_station_status_sprite extends BitmapData {
public function Image_power_station_status_sprite(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 195
//Image_refinery_body (Image_refinery_body)
package {
import flash.display.*;
public dynamic class Image_refinery_body extends BitmapData {
public function Image_refinery_body(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 196
//Image_refinery_status_sprite (Image_refinery_status_sprite)
package {
import flash.display.*;
public dynamic class Image_refinery_status_sprite extends BitmapData {
public function Image_refinery_status_sprite(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 197
//Image_rock_attack (Image_rock_attack)
package {
import flash.display.*;
public dynamic class Image_rock_attack extends BitmapData {
public function Image_rock_attack(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 198
//Image_rock_be (Image_rock_be)
package {
import flash.display.*;
public dynamic class Image_rock_be extends BitmapData {
public function Image_rock_be(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 199
//Image_rock_body (Image_rock_body)
package {
import flash.display.*;
public dynamic class Image_rock_body extends BitmapData {
public function Image_rock_body(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 200
//Image_rock_bullet (Image_rock_bullet)
package {
import flash.display.*;
public dynamic class Image_rock_bullet extends BitmapData {
public function Image_rock_bullet(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 201
//Image_rock_status_sprite (Image_rock_status_sprite)
package {
import flash.display.*;
public dynamic class Image_rock_status_sprite extends BitmapData {
public function Image_rock_status_sprite(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 202
//Image_sp_crystals (Image_sp_crystals)
package {
import flash.display.*;
public dynamic class Image_sp_crystals extends BitmapData {
public function Image_sp_crystals(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 203
//Image_sp_cumulative_bomb (Image_sp_cumulative_bomb)
package {
import flash.display.*;
public dynamic class Image_sp_cumulative_bomb extends BitmapData {
public function Image_sp_cumulative_bomb(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 204
//Image_sp_death1 (Image_sp_death1)
package {
import flash.display.*;
public dynamic class Image_sp_death1 extends BitmapData {
public function Image_sp_death1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 205
//Image_sp_debris (Image_sp_debris)
package {
import flash.display.*;
public dynamic class Image_sp_debris extends BitmapData {
public function Image_sp_debris(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 206
//Image_sp_nitro_bomb (Image_sp_nitro_bomb)
package {
import flash.display.*;
public dynamic class Image_sp_nitro_bomb extends BitmapData {
public function Image_sp_nitro_bomb(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 207
//Image_sp_nuclear_bomb (Image_sp_nuclear_bomb)
package {
import flash.display.*;
public dynamic class Image_sp_nuclear_bomb extends BitmapData {
public function Image_sp_nuclear_bomb(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 208
//Image_star_conqueror_attack (Image_star_conqueror_attack)
package {
import flash.display.*;
public dynamic class Image_star_conqueror_attack extends BitmapData {
public function Image_star_conqueror_attack(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 209
//Image_star_conqueror_be (Image_star_conqueror_be)
package {
import flash.display.*;
public dynamic class Image_star_conqueror_be extends BitmapData {
public function Image_star_conqueror_be(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 210
//Image_star_conqueror_body (Image_star_conqueror_body)
package {
import flash.display.*;
public dynamic class Image_star_conqueror_body extends BitmapData {
public function Image_star_conqueror_body(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 211
//Image_star_conqueror_bullet (Image_star_conqueror_bullet)
package {
import flash.display.*;
public dynamic class Image_star_conqueror_bullet extends BitmapData {
public function Image_star_conqueror_bullet(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 212
//Image_star_conqueror_status_sprite (Image_star_conqueror_status_sprite)
package {
import flash.display.*;
public dynamic class Image_star_conqueror_status_sprite extends BitmapData {
public function Image_star_conqueror_status_sprite(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 213
//Image_station_picket (Image_station_picket)
package {
import flash.display.*;
public dynamic class Image_station_picket extends BitmapData {
public function Image_station_picket(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 214
//Image_stunner_attack (Image_stunner_attack)
package {
import flash.display.*;
public dynamic class Image_stunner_attack extends BitmapData {
public function Image_stunner_attack(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 215
//Image_stunner_be (Image_stunner_be)
package {
import flash.display.*;
public dynamic class Image_stunner_be extends BitmapData {
public function Image_stunner_be(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 216
//Image_stunner_body (Image_stunner_body)
package {
import flash.display.*;
public dynamic class Image_stunner_body extends BitmapData {
public function Image_stunner_body(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 217
//Image_stunner_bullet (Image_stunner_bullet)
package {
import flash.display.*;
public dynamic class Image_stunner_bullet extends BitmapData {
public function Image_stunner_bullet(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 218
//Image_stunner_status_sprite (Image_stunner_status_sprite)
package {
import flash.display.*;
public dynamic class Image_stunner_status_sprite extends BitmapData {
public function Image_stunner_status_sprite(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 219
//Image_war_bird_attack (Image_war_bird_attack)
package {
import flash.display.*;
public dynamic class Image_war_bird_attack extends BitmapData {
public function Image_war_bird_attack(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 220
//Image_war_bird_be (Image_war_bird_be)
package {
import flash.display.*;
public dynamic class Image_war_bird_be extends BitmapData {
public function Image_war_bird_be(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 221
//Image_war_bird_body (Image_war_bird_body)
package {
import flash.display.*;
public dynamic class Image_war_bird_body extends BitmapData {
public function Image_war_bird_body(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 222
//Image_war_bird_bullet (Image_war_bird_bullet)
package {
import flash.display.*;
public dynamic class Image_war_bird_bullet extends BitmapData {
public function Image_war_bird_bullet(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 223
//Image_war_bird_status_sprite (Image_war_bird_status_sprite)
package {
import flash.display.*;
public dynamic class Image_war_bird_status_sprite extends BitmapData {
public function Image_war_bird_status_sprite(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 224
//LoadingMC (LoadingMC)
package {
import flash.display.*;
import flash.text.*;
public dynamic class LoadingMC extends MovieClip {
public var loaded_txt:TextField;
public var error_txt:TextField;
public var progress_mc:MovieClip;
}
}//package
Section 225
//MochiAd (MochiAd)
package {
import flash.display.*;
import flash.events.*;
import flash.net.*;
import flash.utils.*;
import flash.system.*;
public class MochiAd {
public static function getVersion():String{
return ("2.5");
}
public static function showClickAwayAd(_arg1:Object):void{
var DEFAULTS:Object;
var clip:Object;
var ad_timeout:Number;
var mc:MovieClip;
var wh:Array;
var w:Number;
var h:Number;
var chk:MovieClip;
var sendHostProgress:Boolean;
var options = _arg1;
DEFAULTS = {ad_timeout:2000, regpt:"o", method:"showClickAwayAd", res:"300x250", no_bg:true, ad_started:function ():void{
}, ad_finished:function ():void{
}, ad_loaded:function (_arg1:Number, _arg2:Number):void{
}, ad_failed:function ():void{
}, ad_skipped:function ():void{
}};
options = MochiAd._parseOptions(options, DEFAULTS);
clip = options.clip;
ad_timeout = options.ad_timeout;
delete options.ad_timeout;
if (!MochiAd.load(options)){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
MochiAd._cleanup(mc);
options.ad_finished();
};
wh = MochiAd._getRes(options, clip);
w = wh[0];
h = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
mc.unloadAd = function ():void{
MochiAd.unload(clip);
};
mc.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.rpc = function (_arg1:Number, _arg2:Object):void{
MochiAd.rpc(clip, _arg1, _arg2);
};
sendHostProgress = false;
mc.regContLC = function (_arg1:String):void{
mc._containerLCName = _arg1;
};
chk["onEnterFrame"] = function ():void{
var _local1:Object;
var _local2:Number;
var _local3:Boolean;
var _local4:Number;
if (!this.parent){
delete this.onEnterFrame;
return;
};
_local1 = this.parent._mochiad_ctr;
_local2 = (getTimer() - this.started);
_local3 = false;
if (!chk.showing){
_local4 = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (_local4 > 0){
chk.showing = true;
_local3 = true;
chk.started = getTimer();
} else {
if (_local2 > chk.ad_timeout){
options.ad_failed();
_local3 = true;
};
};
};
if (this.root == null){
_local3 = true;
};
if (_local3){
delete this.onEnterFrame;
};
};
doOnEnterFrame(chk);
}
public static function _isNetworkAvailable():Boolean{
return (!((Security.sandboxType == "localWithFile")));
}
public static function _allowDomains(_arg1:String):String{
var _local2:String;
_local2 = _arg1.split("/")[2].split(":")[0];
Security.allowDomain("*");
Security.allowDomain(_local2);
Security.allowInsecureDomain("*");
Security.allowInsecureDomain(_local2);
return (_local2);
}
public static function unload(_arg1:Object):Boolean{
if (((_arg1.clip) && (_arg1.clip._mochiad))){
_arg1 = _arg1.clip;
};
if (_arg1.origFrameRate != undefined){
_arg1.stage.frameRate = _arg1.origFrameRate;
};
if (!_arg1._mochiad){
return (false);
};
if (_arg1._mochiad._containerLCName != undefined){
_arg1._mochiad.lc.send(_arg1._mochiad._containerLCName, "notify", {id:"unload"});
};
if (_arg1._mochiad.onUnload){
_arg1._mochiad.onUnload();
};
delete _arg1._mochiad_loaded;
delete _arg1._mochiad;
return (true);
}
public static function showInterLevelAd(_arg1:Object):void{
var DEFAULTS:Object;
var clip:Object;
var ad_msec:Number;
var ad_timeout:Number;
var fadeout_time:Number;
var mc:MovieClip;
var wh:Array;
var w:Number;
var h:Number;
var chk:MovieClip;
var options = _arg1;
DEFAULTS = {ad_timeout:2000, fadeout_time:250, regpt:"o", method:"showTimedAd", ad_started:function ():void{
if ((this.clip is MovieClip)){
this.clip.stop();
} else {
throw (new Error("MochiAd.showInterLevelAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_finished:function ():void{
if ((this.clip is MovieClip)){
this.clip.play();
} else {
throw (new Error("MochiAd.showInterLevelAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_loaded:function (_arg1:Number, _arg2:Number):void{
}, ad_failed:function ():void{
}, ad_skipped:function ():void{
}};
options = MochiAd._parseOptions(options, DEFAULTS);
clip = options.clip;
ad_msec = 11000;
ad_timeout = options.ad_timeout;
delete options.ad_timeout;
fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!MochiAd.load(options)){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
MochiAd._cleanup(mc);
options.ad_finished();
};
wh = MochiAd._getRes(options, clip);
w = wh[0];
h = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.ad_msec = ad_msec;
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function ():void{
var _local1:Number;
if (!this.parent){
delete this.onEnterFrame;
delete this.fadeFunction;
return;
};
_local1 = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (_local1 > 0){
this.parent.alpha = (_local1 * 0.01);
} else {
MochiAd.unload(clip);
delete this["onEnterFrame"];
};
};
mc.unloadAd = function ():void{
MochiAd.unload(clip);
};
mc.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.adjustProgress = function (_arg1:Number):void{
var _local2:Object;
_local2 = mc._mochiad_wait;
_local2.server_control = true;
_local2.showing = true;
_local2.started = getTimer();
_local2.ad_msec = (_arg1 - 250);
};
mc.rpc = function (_arg1:Number, _arg2:Object):void{
MochiAd.rpc(clip, _arg1, _arg2);
};
chk["onEnterFrame"] = function ():void{
var _local1:Object;
var _local2:Number;
var _local3:Boolean;
var _local4:Number;
if (!this.parent){
delete this.onEnterFrame;
delete this.fadeFunction;
return;
};
_local1 = this.parent._mochiad_ctr;
_local2 = (getTimer() - this.started);
_local3 = false;
if (!chk.showing){
_local4 = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (_local4 > 0){
chk.showing = true;
chk.started = getTimer();
MochiAd.adShowing(clip);
} else {
if (_local2 > chk.ad_timeout){
options.ad_failed();
_local3 = true;
};
};
};
if (_local2 > chk.ad_msec){
_local3 = true;
};
if (_local3){
if (this.server_control){
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = this.fadeFunction;
};
};
};
doOnEnterFrame(chk);
}
public static function _parseOptions(_arg1:Object, _arg2:Object):Object{
var _local3:Object;
var _local4:String;
var _local5:Array;
var _local6:Number;
var _local7:Array;
_local3 = {};
for (_local4 in _arg2) {
_local3[_local4] = _arg2[_local4];
};
if (_arg1){
for (_local4 in _arg1) {
_local3[_local4] = _arg1[_local4];
};
};
if (_local3.clip == undefined){
throw (new Error("MochiAd is missing the 'clip' parameter. This should be a MovieClip, Sprite or an instance of a class that extends MovieClip or Sprite."));
};
_arg1 = _local3.clip.loaderInfo.parameters.mochiad_options;
if (_arg1){
_local5 = _arg1.split("&");
_local6 = 0;
while (_local6 < _local5.length) {
_local7 = _local5[_local6].split("=");
_local3[unescape(_local7[0])] = unescape(_local7[1]);
_local6++;
};
};
if (_local3.id == "test"){
};
return (_local3);
}
public static function _cleanup(_arg1:Object):void{
var idx:Number;
var k:String;
var lc:LocalConnection;
var f:Function;
var mc = _arg1;
if (("lc" in mc)){
lc = mc.lc;
f = function ():void{
try {
lc.client = null;
lc.close();
} catch(e:Error) {
};
};
setTimeout(f, 0);
};
idx = DisplayObjectContainer(mc).numChildren;
while (idx > 0) {
idx = (idx - 1);
DisplayObjectContainer(mc).removeChildAt(idx);
};
for (k in mc) {
delete mc[k];
};
}
public static function load(_arg1:Object):MovieClip{
var DEFAULTS:Object;
var clip:Object;
var depth:Number;
var mc:MovieClip;
var wh:Array;
var lv:URLVariables;
var k:String;
var server:String;
var hostname:String;
var lc:LocalConnection;
var name:String;
var loader:Loader;
var g:Function;
var req:URLRequest;
var v:Object;
var options = _arg1;
DEFAULTS = {server:"http://x.mochiads.com/srv/1/", method:"load", depth:10333, id:"_UNKNOWN_"};
options = MochiAd._parseOptions(options, DEFAULTS);
options.swfv = 9;
options.mav = MochiAd.getVersion();
clip = options.clip;
if (!MochiAd._isNetworkAvailable()){
return (null);
};
try {
if (clip._mochiad_loaded){
return (null);
};
} catch(e:Error) {
throw (new Error("MochiAd requires a clip that is an instance of a dynamic class. If your class extends Sprite or MovieClip, you must make it dynamic."));
};
depth = options.depth;
delete options.depth;
mc = createEmptyMovieClip(clip, "_mochiad", depth);
wh = MochiAd._getRes(options, clip);
options.res = ((wh[0] + "x") + wh[1]);
options.server = (options.server + options.id);
delete options.id;
clip._mochiad_loaded = true;
if (clip.loaderInfo.loaderURL.indexOf("http") == 0){
options.as3_swf = clip.loaderInfo.loaderURL;
};
lv = new URLVariables();
for (k in options) {
v = options[k];
if (!(v is Function)){
lv[k] = v;
};
};
server = lv.server;
delete lv.server;
hostname = _allowDomains(server);
lc = new LocalConnection();
lc.client = mc;
name = ["", Math.floor(new Date().getTime()), Math.floor((Math.random() * 999999))].join("_");
lc.allowDomain("*", "localhost");
lc.allowInsecureDomain("*", "localhost");
lc.connect(name);
mc.lc = lc;
mc.lcName = name;
lv.lc = name;
lv.st = getTimer();
loader = new Loader();
g = function (_arg1:Object):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
MochiAd.unload(clip);
};
loader.contentLoaderInfo.addEventListener(Event.UNLOAD, g);
req = new URLRequest((server + ".swf"));
req.contentType = "application/x-www-form-urlencoded";
req.method = URLRequestMethod.POST;
req.data = lv;
loader.load(req);
mc.addChild(loader);
mc._mochiad_ctr = loader;
return (mc);
}
public static function runMethod(_arg1:Object, _arg2:String, _arg3:Array):Object{
var _local4:Array;
var _local5:Number;
_local4 = _arg2.split(".");
_local5 = 0;
while (_local5 < (_local4.length - 1)) {
if ((((_arg1[_local4[_local5]] == undefined)) || ((_arg1[_local4[_local5]] == null)))){
return (undefined);
};
_arg1 = _arg1[_local4[_local5]];
_local5++;
};
if (typeof(_arg1[_local4[_local5]]) == "function"){
return (_arg1[_local4[_local5]].apply(_arg1, _arg3));
};
return (undefined);
}
public static function createEmptyMovieClip(_arg1:Object, _arg2:String, _arg3:Number):MovieClip{
var _local4:MovieClip;
_local4 = new MovieClip();
if (((false) && (_arg3))){
_arg1.addChildAt(_local4, _arg3);
} else {
_arg1.addChild(_local4);
};
_arg1[_arg2] = _local4;
_local4["_name"] = _arg2;
return (_local4);
}
public static function _getRes(_arg1:Object, _arg2:Object):Array{
var _local3:Object;
var _local4:Number;
var _local5:Number;
var _local6:Array;
_local3 = _arg2.getBounds(_arg2.root);
_local4 = 0;
_local5 = 0;
if (typeof(_arg1.res) != "undefined"){
_local6 = _arg1.res.split("x");
_local4 = parseFloat(_local6[0]);
_local5 = parseFloat(_local6[1]);
} else {
_local4 = (_local3.xMax - _local3.xMin);
_local5 = (_local3.yMax - _local3.yMin);
};
if ((((_local4 == 0)) || ((_local5 == 0)))){
_local4 = _arg2.stage.stageWidth;
_local5 = _arg2.stage.stageHeight;
};
return ([_local4, _local5]);
}
public static function adShowing(_arg1:Object):void{
_arg1.origFrameRate = _arg1.stage.frameRate;
_arg1.stage.frameRate = 30;
}
public static function getValue(_arg1:Object, _arg2:String):Object{
var _local3:Array;
var _local4:Number;
_local3 = _arg2.split(".");
_local4 = 0;
while (_local4 < (_local3.length - 1)) {
if ((((_arg1[_local3[_local4]] == undefined)) || ((_arg1[_local3[_local4]] == null)))){
return (undefined);
};
_arg1 = _arg1[_local3[_local4]];
_local4++;
};
return (_arg1[_local3[_local4]]);
}
public static function rpc(_arg1:Object, _arg2:Number, _arg3:Object):void{
var _local4:Object;
var _local5:Object;
switch (_arg3.id){
case "setValue":
MochiAd.setValue(_arg1, _arg3.objectName, _arg3.value);
break;
case "getValue":
_local4 = MochiAd.getValue(_arg1, _arg3.objectName);
_arg1._mochiad.lc.send(_arg1._mochiad._containerLCName, "rpcResult", _arg2, _local4);
break;
case "runMethod":
_local5 = MochiAd.runMethod(_arg1, _arg3.method, _arg3.args);
_arg1._mochiad.lc.send(_arg1._mochiad._containerLCName, "rpcResult", _arg2, _local5);
break;
};
}
public static function setValue(_arg1:Object, _arg2:String, _arg3:Object):void{
var _local4:Array;
var _local5:Number;
_local4 = _arg2.split(".");
_local5 = 0;
while (_local5 < (_local4.length - 1)) {
if ((((_arg1[_local4[_local5]] == undefined)) || ((_arg1[_local4[_local5]] == null)))){
return;
};
_arg1 = _arg1[_local4[_local5]];
_local5++;
};
_arg1[_local4[_local5]] = _arg3;
}
public static function showPreGameAd(_arg1:Object):void{
var DEFAULTS:Object;
var clip:Object;
var ad_msec:Number;
var ad_timeout:Number;
var fadeout_time:Number;
var mc:MovieClip;
var wh:Array;
var w:Number;
var h:Number;
var chk:MovieClip;
var bar:MovieClip;
var bar_color:Number;
var bar_background:Number;
var bar_outline:Number;
var backing_mc:MovieClip;
var backing:Object;
var inside_mc:MovieClip;
var inside:Object;
var outline_mc:MovieClip;
var outline:Object;
var complete:Boolean;
var unloaded:Boolean;
var f:Function;
var sendHostProgress:Boolean;
var r:MovieClip;
var options = _arg1;
DEFAULTS = {ad_timeout:3000, fadeout_time:250, regpt:"o", method:"showPreloaderAd", color:0xFF8A00, background:16777161, outline:13994812, no_progress_bar:false, ad_started:function ():void{
if ((this.clip is MovieClip)){
this.clip.stop();
} else {
throw (new Error("MochiAd.showPreGameAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_finished:function ():void{
if ((this.clip is MovieClip)){
this.clip.play();
} else {
throw (new Error("MochiAd.showPreGameAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_loaded:function (_arg1:Number, _arg2:Number):void{
}, ad_failed:function ():void{
}, ad_skipped:function ():void{
}, ad_progress:function (_arg1:Number):void{
}};
options = MochiAd._parseOptions(options, DEFAULTS);
if ("c862232051e0a94e1c3609b3916ddb17".substr(0) == "dfeada81ac97cde83665f81c12da7def"){
options.ad_started();
setTimeout(options.ad_finished, 100);
return;
};
clip = options.clip;
ad_msec = 11000;
ad_timeout = options.ad_timeout;
delete options.ad_timeout;
fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!MochiAd.load(options)){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
var fn:Function;
MochiAd._cleanup(mc);
fn = function ():void{
options.ad_finished();
};
setTimeout(fn, 100);
};
wh = MochiAd._getRes(options, clip);
w = wh[0];
h = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.x = (w * -0.5);
chk.y = (h * -0.5);
bar = createEmptyMovieClip(chk, "_mochiad_bar", 4);
if (options.no_progress_bar){
bar.visible = false;
delete options.no_progress_bar;
} else {
bar.x = 10;
bar.y = (h - 20);
};
bar_color = options.color;
delete options.color;
bar_background = options.background;
delete options.background;
bar_outline = options.outline;
delete options.outline;
backing_mc = createEmptyMovieClip(bar, "_outline", 1);
backing = backing_mc.graphics;
backing.beginFill(bar_background);
backing.moveTo(0, 0);
backing.lineTo((w - 20), 0);
backing.lineTo((w - 20), 10);
backing.lineTo(0, 10);
backing.lineTo(0, 0);
backing.endFill();
inside_mc = createEmptyMovieClip(bar, "_inside", 2);
inside = inside_mc.graphics;
inside.beginFill(bar_color);
inside.moveTo(0, 0);
inside.lineTo((w - 20), 0);
inside.lineTo((w - 20), 10);
inside.lineTo(0, 10);
inside.lineTo(0, 0);
inside.endFill();
inside_mc.scaleX = 0;
outline_mc = createEmptyMovieClip(bar, "_outline", 3);
outline = outline_mc.graphics;
outline.lineStyle(0, bar_outline, 100);
outline.moveTo(0, 0);
outline.lineTo((w - 20), 0);
outline.lineTo((w - 20), 10);
outline.lineTo(0, 10);
outline.lineTo(0, 0);
chk.ad_msec = ad_msec;
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
chk.last_pcnt = 0;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function ():void{
var _local1:Number;
_local1 = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (_local1 > 0){
this.parent.alpha = (_local1 * 0.01);
} else {
MochiAd.unload(clip);
delete this["onEnterFrame"];
};
};
complete = false;
unloaded = false;
f = function (_arg1:Event):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
complete = true;
if (unloaded){
MochiAd.unload(clip);
};
};
clip.loaderInfo.addEventListener(Event.COMPLETE, f);
if ((clip.root is MovieClip)){
r = (clip.root as MovieClip);
if (r.framesLoaded >= r.totalFrames){
complete = true;
};
};
mc.unloadAd = function ():void{
unloaded = true;
if (complete){
MochiAd.unload(clip);
};
};
mc.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.adjustProgress = function (_arg1:Number):void{
var _local2:Object;
_local2 = mc._mochiad_wait;
_local2.server_control = true;
_local2.showing = true;
_local2.started = getTimer();
_local2.ad_msec = _arg1;
};
mc.rpc = function (_arg1:Number, _arg2:Object):void{
MochiAd.rpc(clip, _arg1, _arg2);
};
mc.rpcTestFn = function (_arg1:String):Object{
return (_arg1);
};
mc.regContLC = function (_arg1:String):void{
mc._containerLCName = _arg1;
};
sendHostProgress = false;
mc.sendHostLoadProgress = function (_arg1:String):void{
sendHostProgress = true;
};
chk["onEnterFrame"] = function ():void{
var _local1:Object;
var _local2:Object;
var _local3:Number;
var _local4:Boolean;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Object;
var _local10:Number;
var _local11:Number;
if (((!(this.parent)) || (!(this.parent.parent)))){
delete this["onEnterFrame"];
return;
};
_local1 = this.parent.parent.root;
_local2 = this.parent._mochiad_ctr;
_local3 = (getTimer() - this.started);
_local4 = false;
_local5 = _local1.loaderInfo.bytesTotal;
_local6 = _local1.loaderInfo.bytesLoaded;
if (complete){
_local6 = Math.max(1, _local6);
_local5 = _local6;
};
_local7 = ((100 * _local6) / _local5);
_local8 = ((100 * _local3) / chk.ad_msec);
_local9 = this._mochiad_bar._inside;
_local10 = Math.min(100, Math.min(((_local7) || (0)), _local8));
_local10 = Math.max(this.last_pcnt, _local10);
this.last_pcnt = _local10;
_local9.scaleX = (_local10 * 0.01);
options.ad_progress(_local10);
if (sendHostProgress){
clip._mochiad.lc.send(clip._mochiad._containerLCName, "notify", {id:"hostLoadPcnt", pcnt:_local7});
if (_local7 == 100){
sendHostProgress = false;
};
};
if (!chk.showing){
_local11 = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (_local11 > 0){
chk.showing = true;
chk.started = getTimer();
MochiAd.adShowing(clip);
} else {
if ((((_local3 > chk.ad_timeout)) && ((_local7 == 100)))){
options.ad_failed();
_local4 = true;
};
};
};
if (_local3 > chk.ad_msec){
_local4 = true;
};
if (((complete) && (_local4))){
if (this.server_control){
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = chk.fadeFunction;
};
};
};
doOnEnterFrame(chk);
}
public static function showPreloaderAd(_arg1:Object):void{
MochiAd.showPreGameAd(_arg1);
}
public static function showTimedAd(_arg1:Object):void{
MochiAd.showInterLevelAd(_arg1);
}
public static function doOnEnterFrame(_arg1:MovieClip):void{
var f:Function;
var mc = _arg1;
f = function (_arg1:Object):void{
if (((("onEnterFrame" in mc)) && (mc.onEnterFrame))){
mc.onEnterFrame();
} else {
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
};
};
mc.addEventListener(Event.ENTER_FRAME, f);
}
}
}//package
Section 226
//MochiBot (MochiBot)
package {
import flash.display.*;
import flash.net.*;
import flash.system.*;
public dynamic class MochiBot extends Sprite {
public static function track(_arg1:Sprite, _arg2:String):MochiBot{
var _local3:MochiBot;
var _local4:String;
var _local5:URLVariables;
var _local6:String;
var _local7:URLRequest;
var _local8:Loader;
if (Security.sandboxType == "localWithFile"){
return (null);
};
_local3 = new (MochiBot);
_arg1.addChild(_local3);
Security.allowDomain("*");
Security.allowInsecureDomain("*");
_local4 = "http://core.mochibot.com/my/core.swf";
_local5 = new URLVariables();
_local5["sb"] = Security.sandboxType;
_local5["v"] = Capabilities.version;
_local5["swfid"] = _arg2;
_local5["mv"] = "8";
_local5["fv"] = "9";
_local6 = _arg1.loaderInfo.url;
if (_local6.indexOf("http") == 0){
_local5["url"] = _local6;
} else {
_local5["url"] = "local";
};
_local7 = new URLRequest(_local4);
_local7.contentType = "application/x-www-form-urlencoded";
_local7.method = URLRequestMethod.POST;
_local7.data = _local5;
_local8 = new Loader();
_local3.addChild(_local8);
_local8.load(_local7);
return (_local3);
}
}
}//package
Section 227
//PauseMC (PauseMC)
package {
import flash.display.*;
public dynamic class PauseMC extends MovieClip {
public function PauseMC(){
addFrameScript(9, frame10);
}
function frame10(){
stop();
}
}
}//package
Section 228
//PlanetsInfoMC (PlanetsInfoMC)
package {
import flash.display.*;
import flash.text.*;
public dynamic class PlanetsInfoMC extends MovieClip {
public var resume_game_button:SimpleButton;
public var title:TextField;
public var desc:TextField;
public var waves:TextField;
public var play_button:SimpleButton;
}
}//package
Section 229
//RepairSign (RepairSign)
package {
import flash.display.*;
public dynamic class RepairSign extends MovieClip {
}
}//package
Section 230
//SelectedSpriteTooltip (SelectedSpriteTooltip)
package {
import flash.display.*;
public dynamic class SelectedSpriteTooltip extends Sprite {
}
}//package
Section 231
//SliderThumb_disabledSkin (SliderThumb_disabledSkin)
package {
import flash.display.*;
public dynamic class SliderThumb_disabledSkin extends MovieClip {
}
}//package
Section 232
//SliderThumb_downSkin (SliderThumb_downSkin)
package {
import flash.display.*;
public dynamic class SliderThumb_downSkin extends MovieClip {
}
}//package
Section 233
//SliderThumb_overSkin (SliderThumb_overSkin)
package {
import flash.display.*;
public dynamic class SliderThumb_overSkin extends MovieClip {
}
}//package
Section 234
//SliderThumb_upSkin (SliderThumb_upSkin)
package {
import flash.display.*;
public dynamic class SliderThumb_upSkin extends MovieClip {
}
}//package
Section 235
//SliderTick_skin (SliderTick_skin)
package {
import flash.display.*;
public dynamic class SliderTick_skin extends MovieClip {
}
}//package
Section 236
//SliderTrack_disabledSkin (SliderTrack_disabledSkin)
package {
import flash.display.*;
public dynamic class SliderTrack_disabledSkin extends MovieClip {
}
}//package
Section 237
//SliderTrack_skin (SliderTrack_skin)
package {
import flash.display.*;
public dynamic class SliderTrack_skin extends MovieClip {
}
}//package
Section 238
//Sound_build (Sound_build)
package {
import flash.media.*;
public dynamic class Sound_build extends Sound {
}
}//package
Section 239
//Sound_click (Sound_click)
package {
import flash.media.*;
public dynamic class Sound_click extends Sound {
}
}//package
Section 240
//Sound_click1 (Sound_click1)
package {
import flash.media.*;
public dynamic class Sound_click1 extends Sound {
}
}//package
Section 241
//Sound_defeat (Sound_defeat)
package {
import flash.media.*;
public dynamic class Sound_defeat extends Sound {
}
}//package
Section 242
//Sound_explosion1 (Sound_explosion1)
package {
import flash.media.*;
public dynamic class Sound_explosion1 extends Sound {
}
}//package
Section 243
//Sound_laser1 (Sound_laser1)
package {
import flash.media.*;
public dynamic class Sound_laser1 extends Sound {
}
}//package
Section 244
//Sound_laser2 (Sound_laser2)
package {
import flash.media.*;
public dynamic class Sound_laser2 extends Sound {
}
}//package
Section 245
//Sound_missile_turret_launch (Sound_missile_turret_launch)
package {
import flash.media.*;
public dynamic class Sound_missile_turret_launch extends Sound {
}
}//package
Section 246
//Sound_new_wave (Sound_new_wave)
package {
import flash.media.*;
public dynamic class Sound_new_wave extends Sound {
}
}//package
Section 247
//Sound_planets (Sound_planets)
package {
import flash.media.*;
public dynamic class Sound_planets extends Sound {
}
}//package
Section 248
//Sound_stat_appear (Sound_stat_appear)
package {
import flash.media.*;
public dynamic class Sound_stat_appear extends Sound {
}
}//package
Section 249
//Sound_tada (Sound_tada)
package {
import flash.media.*;
public dynamic class Sound_tada extends Sound {
}
}//package
Section 250
//Sound_unpause (Sound_unpause)
package {
import flash.media.*;
public dynamic class Sound_unpause extends Sound {
}
}//package
Section 251
//Sound_upgrade (Sound_upgrade)
package {
import flash.media.*;
public dynamic class Sound_upgrade extends Sound {
}
}//package
Section 252
//SwitchButton (SwitchButton)
package {
import flash.display.*;
import flash.text.*;
public dynamic class SwitchButton extends MovieClip {
public var buttonLabel:TextField;
public function SwitchButton(){
addFrameScript(4, frame5, 9, frame10);
}
function frame10(){
stop();
}
function frame5(){
stop();
}
}
}//package
Section 253
//UpHeader (UpHeader)
package {
import flash.display.*;
import flash.text.*;
public dynamic class UpHeader extends MovieClip {
public var wave_time:TextField;
public var energy:TextField;
public var score:TextField;
public var send_next_button:SimpleButton;
public var crystals:TextField;
}
}//package