Section 1
//AnimatedBitmap (fai.common.AnimatedBitmap)
package fai.common {
import flash.display.*;
import flash.geom.*;
public class AnimatedBitmap extends Bitmap {
private var initial_height:int;// = 0
private var point:Point;// = null
private var rect:Rectangle;// = null
private var initial_width:int;// = 0
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;
initial_width = 0;
initial_height = 0;
initial_width = _arg2;
initial_height = _arg3;
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 / initial_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 * initial_width), 0, initial_width, initial_height);
_local1.copyPixels(curbuffer, rect, point);
bitmapData = _local1;
smoothing = true;
}
}
}//package fai.common
Section 2
//Astar (fai.common.Astar)
package fai.common {
import fai.*;
public class Astar {
private var maxf:uint;// = 0
public var checkxy:Function;// = null
public var destination:Position;
private var node:AstarNode;// = null
private var tempg:uint;// = 0
private var temph:uint;// = 0
public var tid:uint;// = 0
private var nextbestpos:Position;// = null
private var curf:int;// = 0
private var openedMap:AstarMap;// = null
private var start_node:AstarNode;// = null
public var ns:Array;
public var map:MapMatrix;// = null
private var cnode:AstarNode;// = null
private var closed:AstarMap;// = null
private var opened:AstarMap;// = null
private var onode:AstarNode;// = null
public var cell_type:int;// = 0
private static var check_step:Number = 4;
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;
start_node = null;
node = null;
destination = new Position();
cell_type = 0;
super();
checkxy = check_cell_type_id;
map = _arg1;
tid = _arg2;
}
public function check_cell_type(_arg1:uint, _arg2:uint):Boolean{
return ((map.getxy(_arg1, _arg2) == cell_type));
}
private function addToOpened(_arg1:AstarNode):void{
opened.add(_arg1.key(), _arg1);
openedMap.add(_arg1.h, _arg1);
}
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.width)))) && ((_local5 < map.height)))){
if (checkxy(_local4, _local5)){
destination.set(_local4, _local5);
return;
};
};
_local5++;
};
_local4++;
};
_local3++;
if (((((((((_arg1.x - _local3) < 0)) && (((_arg1.x + _local3) >= map.width)))) && (((_arg1.y - _local3) < 0)))) && (((_arg1.y + _local3) >= map.height)))){
destination = null;
return;
};
};
}
private function walkable(_arg1:Position, _arg2:Position):Boolean{
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:int;
var _local11:int;
_local3 = ((_arg2.y - _arg1.y) * Consts.cell_size);
_local4 = ((_arg2.x - _arg1.x) * Consts.cell_size);
_local5 = (Math.sqrt(((_local3 * _local3) + (_local4 * _local4))) / check_step);
_local6 = (_local4 / _local5);
_local7 = (_local3 / _local5);
_local8 = (_arg1.x * Consts.cell_size);
_local9 = (_arg1.y * Consts.cell_size);
_local10 = 0;
_local11 = 0;
while (_local5 > 0) {
if (_local5 < 1){
_local8 = (_local8 + (_local6 * _local5));
_local9 = (_local9 + (_local7 * _local5));
} else {
_local8 = (_local8 + _local6);
_local9 = (_local9 + _local7);
};
_local10 = Math.floor(((_local8 / Consts.cell_size) + 0.5));
_local11 = Math.floor(((_local9 / Consts.cell_size) + 0.5));
if (((!(checkxy(_local10, _local11))) && (!(start_node.pos.isSameXY(_local10, _local11))))){
return (false);
};
_local5--;
};
return (true);
}
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);
};
start_node = new AstarNode();
node = null;
start_node.pos = _arg1;
start_node.f = (start_node.h = hestimate(_arg1, destination));
addToOpened(start_node);
return (true);
}
public function isPathExists(_arg1:Position, _arg2:Position):Boolean{
var _local3:Position;
var _local4:AstarNode;
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);
};
start_node = new AstarNode();
node = null;
start_node.pos = _arg1;
start_node.f = (start_node.h = hestimate(_arg1, destination));
addToOpened(start_node);
while (!(opened.empty())) {
node = getBestNode();
if (node.pos.isequal(destination)){
return (true);
};
neighbours(node.pos);
for each (_local3 in ns) {
tempg = (node.g + hestimate(node.pos, _local3));
temph = hestimate(_local3, destination);
curf = (tempg + temph);
onode = opened.get(((_local3.x * 1000) + _local3.y));
if (((onode) && ((onode.f <= curf)))){
} else {
cnode = closed.get(((_local3.x * 1000) + _local3.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 = _local3;
_local4.g = tempg;
_local4.h = temph;
_local4.f = curf;
_local4.parent = node;
addToOpened(_local4);
};
};
};
closed.add(node.key(), node);
};
return (false);
}
private function smooth(_arg1:Array, _arg2:AstarNode):void{
var _local3:AstarNode;
var _local4:AstarNode;
_local3 = _arg2;
_local4 = _arg2.parent;
while (((_local4.parent) && (!((_local4 == start_node))))) {
if (walkable(_local3.pos, _local4.parent.pos)){
_local4 = _local4.parent;
} else {
_arg1.unshift(_local3.pos);
_local3 = _local4;
_local4 = _local4.parent;
};
};
_arg1.unshift(_local3.pos);
}
public function search(_arg1:Array):Boolean{
var _local2:Position;
var _local3:AstarNode;
while (!(opened.empty())) {
npasses--;
if (npasses <= 0){
return (true);
};
node = getBestNode();
if (node.pos.isequal(destination)){
smooth(_arg1, node);
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());
};
_local3 = new AstarNode();
_local3.pos = _local2;
_local3.g = tempg;
_local3.h = temph;
_local3.f = curf;
_local3.parent = node;
addToOpened(_local3);
};
};
};
closed.add(node.key(), node);
};
return (false);
}
public function check_cell_type_id(_arg1:uint, _arg2:uint):Boolean{
var _local3:uint;
_local3 = map.getxy(_arg1, _arg2);
return ((((_local3 == cell_type)) || ((_local3 == tid))));
}
public function checkwall(_arg1:uint, _arg2:uint):Boolean{
return (!((Consts.Wall == map.getxy(_arg1, _arg2))));
}
public function allgood(_arg1:uint, _arg2:uint):Boolean{
return (true);
}
public function checknotempty(_arg1:uint, _arg2:uint):Boolean{
return (!(map.getxy(_arg1, _arg2)));
}
public function checkwallid(_arg1:uint, _arg2:uint):Boolean{
var _local3:uint;
_local3 = map.getxy(_arg1, _arg2);
return (((((!((_local3 == Consts.Wall))) && (!((_local3 == Consts.resourceId))))) && (!((_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.height - 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.width - 1)){
if (checkxy((_arg1.x + 1), _arg1.y)){
ns.push(new Position((_arg1.x + 1), _arg1.y));
};
if ((((_arg1.y < (map.height - 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.height - 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);
}
public static function hestimate(_arg1:Position, _arg2:Position):uint{
return ((Math.abs((_arg1.x - _arg2.x)) + Math.abs((_arg1.y - _arg2.y))));
}
}
}//package fai.common
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++;
};
trace("ERROR ___ 1");
} else {
keys.splice(index_, 1);
values.splice(index_, 1);
};
};
}
}
Section 3
//AstarNode (fai.common.AstarNode)
package fai.common {
public 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
public function AstarNode(){
f = 0;
g = 0;
h = 0;
parent = null;
pos = null;
super();
}
public function key():uint{
return (((pos.x * 1000) + pos.y));
}
}
}//package fai.common
Section 4
//Flags (fai.common.Flags)
package fai.common {
public class Flags {
private var flags:uint;// = 0
public function Flags():void{
flags = 0;
super();
}
public function isSet(_arg1:uint):Boolean{
return ((flags & _arg1));
}
public function set value(_arg1:int):void{
flags = _arg1;
}
public function reset(_arg1:uint):void{
flags = (flags ^ _arg1);
}
public function get value():int{
return (flags);
}
public function put(_arg1:uint):void{
flags = (flags | _arg1);
}
public function clear():void{
flags = 0;
}
}
}//package fai.common
Section 5
//KeyboardKeys (fai.common.KeyboardKeys)
package fai.common {
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{
_arg1.addEventListener(KeyboardEvent.KEY_DOWN, keyPressed);
_arg1.addEventListener(KeyboardEvent.KEY_UP, keyReleased);
initialized = true;
}
private static function keyPressed(_arg1:KeyboardEvent):void{
keys[_arg1.keyCode] = true;
}
public static function stop(_arg1):void{
_arg1.removeEventListener(KeyboardEvent.KEY_DOWN, keyPressed);
_arg1.removeEventListener(KeyboardEvent.KEY_UP, keyReleased);
initialized = false;
}
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.common
Section 6
//Map (fai.common.Map)
package fai.common {
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.common
Section 7
//MapMatrix (fai.common.MapMatrix)
package fai.common {
public class MapMatrix {
public var matrix:Array;
public var width:uint;// = 0
public var height:uint;// = 0
public function MapMatrix(_arg1:uint, _arg2:uint):void{
var _local3:int;
var _local4:int;
matrix = new Array();
width = 0;
height = 0;
super();
width = _arg1;
height = _arg2;
_local3 = 0;
while (_local3 < height) {
matrix.push(new Array(width));
_local4 = 0;
while (_local4 < width) {
matrix[(matrix.length - 1)][_local4] = 0;
_local4++;
};
_local3++;
};
}
public function setxy(_arg1:uint, _arg2:uint, _arg3:uint):void{
matrix[_arg2][_arg1] = _arg3;
}
public function clear():void{
var _local1:int;
var _local2:int;
_local1 = 0;
while (_local1 < height) {
_local2 = 0;
while (_local2 < width) {
matrix[_local1][_local2] = 0;
_local2++;
};
_local1++;
};
}
public function setpos(_arg1:Position, _arg2:uint):void{
matrix[_arg1.y][_arg1.x] = _arg2;
}
public function copy(_arg1:MapMatrix):void{
var _local2:int;
var _local3:int;
_local2 = 0;
while (_local2 < height) {
_local3 = 0;
while (_local3 < width) {
matrix[_local2][_local3] = _arg1.matrix[_local2][_local3];
_local3++;
};
_local2++;
};
}
public function getxy(_arg1:uint, _arg2:uint):uint{
return (matrix[_arg2][_arg1]);
}
public function copyFiltered(_arg1:MapMatrix, _arg2:int):void{
var _local3:int;
var _local4:int;
_local3 = 0;
while (_local3 < height) {
_local4 = 0;
while (_local4 < width) {
if (_arg1.matrix[_local3][_local4] == _arg2){
matrix[_local3][_local4] = _arg1.matrix[_local3][_local4];
};
_local4++;
};
_local3++;
};
}
public function getpos(_arg1:Position):uint{
return (matrix[_arg1.y][_arg1.x]);
}
}
}//package fai.common
Section 8
//Mutex (fai.common.Mutex)
package fai.common {
public class Mutex {
private var actions_locked:int;// = 0
public function Mutex(){
actions_locked = 0;
super();
}
public function isLocked():Boolean{
return ((actions_locked > 0));
}
public function unlock():void{
actions_locked--;
}
public function lock():void{
actions_locked++;
}
}
}//package fai.common
Section 9
//Position (fai.common.Position)
package fai.common {
public final 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))));
}
public function isSameXY(_arg1:int, _arg2:int):Boolean{
return ((((x == _arg1)) && ((y == _arg2))));
}
}
}//package fai.common
Section 10
//Utils (fai.common.Utils)
package fai.common {
import fai.units.*;
import flash.text.*;
public class Utils {
public static function textrange(_arg1:int):String{
if (_arg1 <= 3){
return ("Small");
};
if (_arg1 <= 4){
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 distance2(_arg1, _arg2):Number{
var _local3:Number;
var _local4:Number;
_local3 = (_arg1.x - _arg2.x);
_local4 = (_arg1.y - _arg2.y);
return (((_local3 * _local3) + (_local4 * _local4)));
}
public static function distance(_arg1, _arg2):Number{
var _local3:Number;
var _local4:Number;
_local3 = (_arg1.x - _arg2.x);
_local4 = (_arg1.y - _arg2.y);
return (Math.sqrt(((_local3 * _local3) + (_local4 * _local4))));
}
public static function unitId(_arg1:Unit):int{
return (((_arg1.pos.x * 1987600) + _arg1.pos.y));
}
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{
return (1);
}
public static function fitToSize(_arg1, _arg2:int):void{
if (_arg1.width > _arg1.height){
_arg1.scaleX = (_arg1.scaleY = (_arg2 / _arg1.width));
} else {
_arg1.scaleX = (_arg1.scaleY = (_arg2 / _arg1.height));
};
}
public static function getNormalOffset(_arg1:Number, _arg2:Number, _arg3:Boolean):Object{
var _local4:Object;
_local4 = new Object();
if ((((_arg1 <= 0)) && ((_arg2 < 0)))){
if (_arg3){
_local4.dx = _arg2;
_local4.dy = Math.abs(_arg1);
} else {
_local4.dx = Math.abs(_arg2);
_local4.dy = _arg1;
};
} else {
if ((((_arg1 > 0)) && ((_arg2 <= 0)))){
if (_arg3){
_local4.dx = -(Math.abs(_arg2));
_local4.dy = -(Math.abs(_arg1));
} else {
_local4.dx = Math.abs(_arg2);
_local4.dy = Math.abs(_arg1);
};
} else {
if ((((_arg1 >= 0)) && ((_arg2 > 0)))){
if (_arg3){
_local4.dx = Math.abs(_arg2);
_local4.dy = -(Math.abs(_arg1));
} else {
_local4.dx = -(Math.abs(_arg2));
_local4.dy = Math.abs(_arg1);
};
} else {
if ((((_arg1 < 0)) && ((_arg2 >= 0)))){
if (_arg3){
_local4.dx = Math.abs(_arg2);
_local4.dy = Math.abs(_arg1);
} else {
_local4.dx = -(Math.abs(_arg2));
_local4.dy = -(Math.abs(_arg1));
};
};
};
};
};
return (_local4);
}
}
}//package fai.common
Section 11
//AttackGoal (fai.goals.AttackGoal)
package fai.goals {
import fai.logic.*;
import fai.units.*;
import fai.common.*;
import fai.*;
public class AttackGoal extends Goal {
private var waiting_target:Unit;// = null
private var engine:Engine;// = null
private var waiting_for_the_target:Boolean;// = false
private var move_goal:MoveGoal;// = null
private var attacking:Boolean;// = false
private var onlyFlying:Boolean;// = false
private var auto_attack:Boolean;// = false
private var hostile_camp:Camp;// = null
private var attack_target:Unit;// = null
private var recharging:int;// = 0
private var owner:Unit;// = null
private var paused:Boolean;// = false
private var onlyLand:Boolean;// = false
private var step:int;// = 0
public function AttackGoal(_arg1:Engine, _arg2:Unit, _arg3:Camp, _arg4:Boolean):void{
hostile_camp = null;
attack_target = null;
waiting_target = null;
move_goal = null;
onlyFlying = false;
onlyLand = false;
recharging = 0;
attacking = false;
owner = null;
step = 0;
paused = false;
auto_attack = false;
waiting_for_the_target = false;
engine = null;
super();
owner = _arg2;
hostile_camp = _arg3;
auto_attack = _arg4;
engine = _arg1;
priority = Consts.AttackGoalPriority;
resetWeapon();
}
private function startAttack(_arg1:Unit):void{
attack_target = _arg1;
step = 0;
recharging = 0;
waiting_for_the_target = false;
waiting_target = null;
owner.sprite.setAttackSprite();
rotateTowardTarget();
attacking = true;
}
private function doAttack():void{
if (owner.rotating){
owner.rotate();
return;
};
if (!step){
engine.game_process.runBullet(owner, attack_target);
};
if (step < owner.sprite.sprite.nframes){
owner.sprite.sprite.setFrame(step);
step++;
} else {
step = 0;
owner.sprite.sprite.setFrame(0);
recharging = owner.weapon.recharge_time;
if (0 == recharging){
recharging = 1;
};
};
}
public function advance():void{
var _local1:Unit;
if (paused){
return;
};
if (waiting_for_the_target){
if (((move_goal) && (!(move_goal.active)))){
clear();
return;
};
if (Utils.distance(owner.sprite, waiting_target.sprite) <= ((owner.weapon.eyerange * owner.weapon.range_multiplier) * Consts.cell_size)){
owner.life.stop();
startAttack(waiting_target);
};
} else {
if (attacking){
if (recharging > 0){
recharging--;
rotateTowardTarget();
if (owner.rotating){
owner.rotate();
};
if (!recharging){
if (!attack_target.isAlive()){
stopAttack();
return;
};
if (Utils.distance(owner.sprite, attack_target.sprite) <= ((owner.weapon.eyerange * owner.weapon.range_multiplier) * Consts.cell_size)){
rotateTowardTarget();
doAttack();
} else {
if (owner.flag(UnitFlags.Building)){
clear();
return;
};
moveCloser();
};
};
} else {
doAttack();
};
} else {
if (auto_attack){
_local1 = hostile_camp.getNearestUnitG(owner, onlyFlying, onlyLand);
if (_local1 != null){
startAttack(_local1);
};
};
};
};
}
public function resetWeapon():void{
paused = true;
if (!owner.weapon.flag(UnitFlags.AntiAir)){
onlyLand = true;
};
if (!owner.weapon.flag(UnitFlags.AntiLand)){
onlyFlying = true;
};
if (attack_target){
setAttackTarget(attack_target);
} else {
if (waiting_for_the_target){
if (((((waiting_target.flag(UnitFlags.Flying)) && (!(owner.weapon.flag(UnitFlags.AntiAir))))) || (((!(waiting_target.flag(UnitFlags.Flying))) && (!(owner.weapon.flag(UnitFlags.AntiLand))))))){
clear();
};
};
};
paused = false;
}
private function clear():void{
if (((attacking) || (waiting_for_the_target))){
stopAttack();
waiting_for_the_target = false;
waiting_target = null;
};
}
public function setAttackTarget(_arg1:Unit):void{
var _local2:Boolean;
if (attack_target == _arg1){
return;
};
clear();
if (null == _arg1){
return;
};
if (!_arg1.isAlive()){
clear();
return;
};
if (((((_arg1.flag(UnitFlags.Flying)) && (!(owner.weapon.flag(UnitFlags.AntiAir))))) || (((!(_arg1.flag(UnitFlags.Flying))) && (!(owner.weapon.flag(UnitFlags.AntiLand))))))){
clear();
return;
};
_local2 = (Utils.distance(owner.sprite, _arg1.sprite) <= ((owner.weapon.eyerange * owner.weapon.range_multiplier) * Consts.cell_size));
if (!_local2){
if (owner.flag(UnitFlags.Building)){
clear();
return;
};
attack_target = _arg1;
moveCloser();
return;
};
startAttack(_arg1);
}
public function setMoveGoal(_arg1:MoveGoal):void{
move_goal = _arg1;
}
private function rotateTowardTarget():void{
owner.startRotate((((Math.atan2((attack_target.sprite.y - owner.sprite.y), (attack_target.sprite.x - owner.sprite.x)) / Math.PI) * 180) - 90));
}
public function holdFire(_arg1:Boolean):void{
if (_arg1){
paused = true;
clear();
} else {
paused = false;
};
}
private function stopAttack():void{
owner.sprite.setMoveSprite();
recharging = 0;
step = 0;
attack_target = null;
attacking = false;
if (owner.mapid == Consts.hostileId){
owner.life.startMoving(engine.lastLevel.target_spot, false);
};
}
private function moveCloser():void{
waiting_target = attack_target;
stopAttack();
owner.life.startMoving(waiting_target.pos, false);
waiting_for_the_target = true;
}
}
}//package fai.goals
Section 12
//BoomerangBulletGoal (fai.goals.BoomerangBulletGoal)
package fai.goals {
import fai.logic.*;
import fai.units.*;
import fai.common.*;
import flash.display.*;
import fai.*;
import flash.geom.*;
public class BoomerangBulletGoal extends Goal {
private var engine:Engine;// = null
private var odx:Number;// = 0
private var max_steps:Number;// = 0
public var bullet:Sprite;
private var back_movement:Boolean;// = false
private var boomerang;// = null
private var ody:Number;// = 0
private var dx:Number;// = 0
private var dy:Number;// = 0
private var steps:Number;// = 0
private var assaulter:Unit;// = null
private var subject:Unit;// = null
public var velocity:int;// = 5
private var dest_pos:Point;// = null
private var distance:Number;// = 0
public function BoomerangBulletGoal(_arg1:Unit, _arg2:Unit, _arg3:Engine):void{
assaulter = null;
subject = null;
engine = null;
bullet = new Sprite();
back_movement = false;
dest_pos = null;
dx = 0;
dy = 0;
steps = 0;
velocity = 5;
distance = 0;
odx = 0;
ody = 0;
max_steps = 0;
boomerang = null;
super();
engine = _arg3;
assaulter = _arg1;
subject = _arg2;
boomerang = new Boomerang();
bullet.addChild(boomerang);
boomerang.x = (boomerang.x - (boomerang.width / 2));
boomerang.y = (boomerang.y - (boomerang.height / 2));
velocity = assaulter.weapon.bullet_speed;
dest_pos = new Point();
dest_pos.x = subject.sprite.x;
dest_pos.y = subject.sprite.y;
bullet.x = _arg1.sprite.x;
bullet.y = _arg1.sprite.y;
recalculate();
}
private function checkNearTargets():void{
var _local1:int;
var _local2:Unit;
var _local3:Number;
_local1 = 0;
_local2 = null;
while (_local1 < engine.gameBoard.enemy_camp.units.length) {
_local2 = engine.gameBoard.enemy_camp.units[_local1];
_local3 = Utils.distance(bullet, _local2.sprite);
if (_local3 < 32){
engine.gameProcess.hitUnit(assaulter.weapon.damage, _local2);
if (_local2.flag(UnitFlags.Flying)){
engine.gameProcess.hitUnit((assaulter.weapon.damage / 2), _local2);
};
};
if (_local2.isAlive()){
_local1++;
};
};
}
private function recalculate():void{
var _local1:Object;
dx = (dest_pos.x - bullet.x);
dy = (dest_pos.y - bullet.y);
distance = Math.sqrt(((dx * dx) + (dy * dy)));
steps = (distance / velocity);
_local1 = Utils.getNormalOffset(dx, dy, true);
dx = (dx / steps);
dy = (dy / steps);
odx = (_local1.dx / steps);
ody = (_local1.dy / steps);
max_steps = steps;
}
public function advance():void{
var _local1:Number;
if (steps > 0){
_local1 = (((2 * steps) / max_steps) - 1);
if (steps > 1){
bullet.x = (bullet.x + (dx + (odx * _local1)));
bullet.y = (bullet.y + (dy + (ody * _local1)));
} else {
bullet.x = (bullet.x + ((dx + (odx * _local1)) * steps));
bullet.y = (bullet.y + ((dy + (ody * _local1)) * steps));
};
checkNearTargets();
steps--;
} else {
if (back_movement){
deactivate();
} else {
back_movement = true;
dest_pos.x = assaulter.sprite.x;
dest_pos.y = assaulter.sprite.y;
recalculate();
};
};
}
override public function deactivate():void{
super.deactivate();
if (bullet){
engine.gameBoard.bulletlayer.removeChild(bullet);
assaulter = (subject = null);
bullet = null;
};
}
}
}//package fai.goals
Section 13
//BulletGoal (fai.goals.BulletGoal)
package fai.goals {
import fai.logic.*;
import flash.media.*;
import fai.units.*;
import fai.common.*;
import flash.display.*;
import fai.*;
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:Engine):void{
var _local4:int;
var _local5:int;
var _local6:Sound;
assaulter = null;
subject = null;
sprite = null;
expl = null;
engine = null;
gip = 0;
hitpos = null;
bullet = new Sprite();
framen = 0;
super();
engine = _arg3;
assaulter = _arg1;
subject = _arg2;
sprite = assaulter.sprite.getBulletBitmap();
expl = assaulter.sprite.getExplosionBitmap();
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((subject.sprite.y - _arg1.sprite.y), (subject.sprite.x - _arg1.sprite.x)) / Math.PI) * 180) - 90);
_local4 = (subject.pos.x - assaulter.pos.x);
_local5 = (subject.pos.y - assaulter.pos.y);
gip = (Math.sqrt(((_local4 * _local4) + (_local5 * _local5))) * Consts.cell_size);
_local6 = null;
switch (assaulter.type){
case StringConsts.pellet_gnome:
if ((((StringConsts.spear_gnome == assaulter.upgrades.trueTitle())) || ((StringConsts.razor_gnome == assaulter.upgrades.trueTitle())))){
_local6 = new Sound_spear();
} else {
_local6 = new Sound_pellet();
};
break;
case StringConsts.boomerang_gnome:
_local6 = new Sound_boomerang();
break;
case StringConsts.bomb_gnome:
if (StringConsts.rocket_gnome == assaulter.upgrades.trueTitle()){
_local6 = new Sound_rocket();
} else {
_local6 = new Sound_boom();
};
break;
};
engine.playSoundData(_local6);
}
override public function deactivate():void{
super.deactivate();
if (bullet){
bullet.removeChild(sprite);
bullet.removeChild(expl);
engine.gameBoard.bulletlayer.removeChild(bullet);
sprite = null;
assaulter = (subject = null);
bullet = null;
};
}
public function advance():void{
if (gip <= 0){
if (framen < expl.nframes){
expl.setFrame(framen);
framen++;
return;
};
deactivate();
} else {
gip = (gip - assaulter.weapon.bullet_speed);
if (gip <= 0){
sprite.y = (sprite.y + (assaulter.weapon.bullet_speed + gip));
sprite.visible = false;
expl.x = sprite.x;
expl.y = sprite.y;
expl.visible = true;
engine.game_process.hitUnit(assaulter.weapon.damage, subject);
if (!subject.isAlive()){
if (engine.game_process.isSelectedUnit(assaulter)){
engine.play_window.updateInfo();
};
};
} else {
sprite.y = (sprite.y + assaulter.weapon.bullet_speed);
};
};
}
}
}//package fai.goals
Section 14
//DieGoal (fai.goals.DieGoal)
package fai.goals {
import fai.logic.*;
import flash.media.*;
import fai.units.*;
import fai.common.*;
import flash.display.*;
import fai.*;
public class DieGoal extends Goal {
public var engine:Engine;// = null
public var unit:Unit;// = null
private var spriteScale:Number;// = 1
private var framen:int;// = 0
private var lifegoal:LifeGoal;// = null
private var esprite:Sprite;// = null
private var expl:AnimatedBitmap;// = null
private var pause:int;// = 0
private var leave:int;// = 100
private var sprite_visible:Boolean;// = false
private var debris:AnimatedBitmap;// = null
public function DieGoal(_arg1:Unit, _arg2:Engine, _arg3:LifeGoal):void{
var _local4:int;
var _local5:Sound;
unit = null;
engine = null;
leave = Consts.UNIT_LEAVE_COUNT;
lifegoal = null;
expl = null;
debris = null;
pause = 0;
spriteScale = 1;
esprite = null;
framen = 0;
sprite_visible = false;
super();
unit = _arg1;
engine = _arg2;
lifegoal = _arg3;
sprite_visible = _arg1.sprite.visible;
unit.destroy();
_local4 = engine.gameData.getSpecial(StringConsts.sp_danimation).height;
expl = engine.gameData.getSpecialBitmap(StringConsts.sp_danimation, _local4);
if (!unit.flag(UnitFlags.Flying)){
debris = engine.gameData.getSpecialBitmap(StringConsts.sp_debris);
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.myId){
expl.visible = false;
};
_arg1.sprite.orders.visible = false;
if (_arg1.sprite.visible){
_local5 = null;
switch (_arg1.type){
case StringConsts.beetle:
case StringConsts.colorado_beetle:
case StringConsts.butterfly:
case StringConsts.bumblebee:
case StringConsts.dragonfly:
case StringConsts.worm:
case StringConsts.little_worm:
case StringConsts.caterpillar:
_local5 = new Sound_invader_killed();
break;
default:
_local5 = new Sound_sell_turret();
break;
};
engine.playSoundData(_local5);
};
}
public function advance():void{
if (pause > 0){
pause--;
return;
};
if (expl.framen < expl.nframes){
spriteScale = (spriteScale - 0.2);
unit.sprite.sprite.alpha = spriteScale;
if (unit.clip){
unit.sprite.clip.alpha = spriteScale;
};
framen++;
expl.setFrame(framen);
if (expl.framen >= expl.nframes){
unit.sprite.sprite.visible = false;
if (unit.clip){
unit.sprite.clip.visible = false;
};
};
return;
} else {
if (leave > 0){
if (leave == Consts.UNIT_LEAVE_COUNT){
expl.visible = false;
if (((!(unit.flag(UnitFlags.Flying))) && (!((unit.mapid == Consts.myId))))){
engine.gameBoard.resourcelayer.addChild(debris);
debris.x = unit.sprite.x;
debris.y = unit.sprite.y;
debris.scaleX = (debris.scaleY = (unit.sprite_width / 32));
debris.x = (debris.x - (debris.width / 2));
debris.y = (debris.y - (debris.height / 2));
debris.visible = sprite_visible;
};
unit.sprite.sprite.visible = false;
};
leave--;
return;
};
};
deactivate();
}
override public function deactivate():void{
if (((debris) && (debris.visible))){
engine.gameBoard.resourcelayer.removeChild(debris);
debris = null;
};
super.deactivate();
lifegoal.destroy(true);
}
}
}//package fai.goals
Section 15
//EffectGoal (fai.goals.EffectGoal)
package fai.goals {
import fai.logic.*;
import fai.common.*;
public class EffectGoal extends Goal {
public var engine:Engine;// = null
public var sprite:AnimatedBitmap;// = null
private var frame:int;// = 0
private var pause: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.gameBoard.bulletlayer.removeChild(sprite);
sprite = null;
};
}
}
}//package fai.goals
Section 16
//FrozeGoal (fai.goals.FrozeGoal)
package fai.goals {
import fai.logic.*;
import fai.units.*;
import fai.common.*;
import fai.*;
public class FrozeGoal extends Goal {
private var engine:Engine;// = null
private var frozen_unit:Unit;// = null
public var delay:int;// = 100
private var life_goal:LifeGoal;// = null
public function FrozeGoal(_arg1:Engine, _arg2:Unit):void{
var _local3:int;
var _local4:*;
engine = null;
frozen_unit = null;
life_goal = null;
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 (frozen_unit.life == _local4){
life_goal = _local4;
engine.goal_system.goals[_local3] = new Goal();
engine.goal_system.goals[_local3].deactivate();
break;
};
_local3++;
};
}
public function advance():void{
if (delay > 0){
delay--;
return;
};
deactivate();
}
override public function deactivate():void{
if (!active){
return;
};
super.deactivate();
engine.goal_system.add(life_goal);
life_goal.unfroze();
life_goal = null;
}
}
}//package fai.goals
Section 17
//GasSprayerGoal (fai.goals.GasSprayerGoal)
package fai.goals {
import fai.logic.*;
import flash.media.*;
import fai.units.*;
import fai.common.*;
import flash.display.*;
import fai.*;
public class GasSprayerGoal extends Goal {
private var engine:Engine;// = null
private var delay:int;// = 75
public var bullet:Sprite;
private var assaulter:Unit;// = null
private var cloud;// = null
public function GasSprayerGoal(_arg1:Unit, _arg2:Engine):void{
var _local3:Sound;
assaulter = null;
engine = null;
bullet = new Sprite();
delay = Consts.GAS_SPRAYER_DELAY;
cloud = null;
super();
engine = _arg2;
assaulter = _arg1;
cloud = new GasCloud();
bullet.addChild(cloud);
cloud.scaleX = (cloud.scaleY = (1 + (0.5 * _arg1.upgrade_level)));
bullet.x = _arg1.sprite.x;
bullet.y = _arg1.sprite.y;
cloud.inner.gotoAndPlay("fire_state");
_local3 = new Sound_gas();
engine.playSoundPos(_local3, assaulter.pos);
}
private function checkNearTargets():void{
var _local1:int;
var _local2:Unit;
var _local3:Number;
_local1 = 0;
_local2 = null;
while (_local1 < engine.gameBoard.enemy_camp.units.length) {
_local2 = engine.gameBoard.enemy_camp.units[_local1];
_local3 = Utils.distance(assaulter.sprite, _local2.sprite);
if ((((_local3 < ((assaulter.weapon.eyerange * assaulter.weapon.range_multiplier) * Consts.cell_size))) && (!((_local2.type == StringConsts.dragonfly))))){
engine.game_process.hitUnit(assaulter.weapon.damage, _local2);
};
if (_local2.isAlive()){
_local1++;
};
};
}
public function advance():void{
if (delay > 0){
delay--;
checkNearTargets();
return;
};
deactivate();
}
override public function deactivate():void{
super.deactivate();
if (bullet){
cloud.stop();
bullet.removeChild(cloud);
engine.gameBoard.bulletlayer.removeChild(bullet);
assaulter = null;
bullet = null;
};
}
}
}//package fai.goals
Section 18
//Goal (fai.goals.Goal)
package fai.goals {
public class Goal {
public var priority:int;// = 100
public var active:Boolean;// = true
public function Goal(){
active = true;
priority = 100;
super();
}
public function deactivate():void{
active = false;
}
}
}//package fai.goals
Section 19
//InvaderGoal (fai.goals.InvaderGoal)
package fai.goals {
import fai.logic.*;
import fai.ui.*;
import fai.units.*;
public class InvaderGoal extends Goal {
private var engine:Engine;// = null
private var move_goal:MoveInvaderGoal;// = null
private var unit:Unit;// = null
public function InvaderGoal(_arg1:Engine, _arg2:Unit, _arg3=null):void{
var _local4:RoadPath;
engine = null;
unit = null;
move_goal = null;
super();
engine = _arg1;
unit = _arg2;
unit.invader_goal = this;
if (_arg3){
move_goal = new MoveInvaderGoal(engine, unit, _arg3, true);
} else {
_local4 = engine.playWindow.getNextRoad();
move_goal = new MoveInvaderGoal(engine, unit, _local4);
};
unit.life.move_invader_goal = move_goal;
}
public function advance():void{
if (!unit.isAlive()){
deactivate();
return;
};
if (move_goal.active){
move_goal.advance();
} else {
engine.invaderPassed(unit);
deactivate();
};
}
public function getMoveGoal():MoveInvaderGoal{
return (move_goal);
}
}
}//package fai.goals
Section 20
//ItemShrinkGoal (fai.goals.ItemShrinkGoal)
package fai.goals {
import fai.logic.*;
import fai.ui.*;
import fai.units.*;
import fai.common.*;
import fai.*;
public class ItemShrinkGoal extends Goal {
private var engine:Engine;// = null
private var item;// = null
public function ItemShrinkGoal(_arg1:Engine, _arg2):void{
engine = null;
item = null;
super();
engine = _arg1;
item = _arg2;
}
public function advance():void{
item.scaleX = (item.scaleY = (item.scaleX * 0.9));
if (item.scaleX < 0.05){
item.visible = false;
deactivate();
};
}
}
}//package fai.goals
Section 21
//LaserTowersFireGoal (fai.goals.LaserTowersFireGoal)
package fai.goals {
import fai.logic.*;
import flash.media.*;
import fai.units.*;
import fai.common.*;
public class LaserTowersFireGoal extends Goal {
private var engine:Engine;// = null
private var delay:int;// = 0
private var assaulter:Unit;// = null
public function LaserTowersFireGoal(_arg1:Unit, _arg2:Engine):void{
var _local3:Sound;
assaulter = null;
engine = null;
delay = 0;
super();
engine = _arg2;
assaulter = _arg1;
delay = assaulter.weapon.action_delay;
_local3 = new Sound_lasers();
engine.playSoundPos(_local3, assaulter.pos);
}
public function advance():void{
if (delay > 0){
delay--;
if ((delay % 2) == 0){
checkNearTargets();
};
return;
} else {
deactivate();
};
}
private function checkNearTargets():void{
var _local1:int;
var _local2:Unit;
var _local3:Number;
_local1 = 0;
_local2 = null;
while (_local1 < engine.gameBoard.enemy_camp.units.length) {
_local2 = engine.gameBoard.enemy_camp.units[_local1];
_local3 = Utils.distance(assaulter.sprite, _local2.sprite);
if (_local3 < 32){
engine.gameProcess.hitUnit(assaulter.weapon.damage, _local2);
};
if (_local2.isAlive()){
_local1++;
};
};
}
override public function deactivate():void{
super.deactivate();
}
}
}//package fai.goals
Section 22
//LifeGoal (fai.goals.LifeGoal)
package fai.goals {
import fai.logic.*;
import fai.units.*;
import fai.common.*;
import fai.goalsystem.*;
import fai.*;
public class LifeGoal extends Goal {
private var move_goal:MoveGoal;// = null
private var repair_goal:RepairGoal;// = null
private var engine:Engine;// = null
private var slow_down_goal:SlowDownGoal;// = null
private var goal_system:PriorityGoalSystem;// = null
private var attack_goal:AttackGoal;// = null
private var froze_goal:FrozeGoal;// = null
private var owner:Unit;// = null
public var move_invader_goal:MoveInvaderGoal;// = null
public function LifeGoal(_arg1:Engine, _arg2:Unit):void{
move_goal = null;
attack_goal = null;
repair_goal = null;
froze_goal = null;
slow_down_goal = null;
goal_system = null;
engine = null;
owner = null;
move_invader_goal = null;
super();
owner = _arg2;
engine = _arg1;
goal_system = new PriorityGoalSystem();
}
public function slowDown():void{
if (!owner.isAlive()){
return;
};
if (((!((slow_down_goal == null))) && (slow_down_goal.active))){
slow_down_goal.resetDelay();
return;
};
slow_down_goal = new SlowDownGoal(engine, owner);
engine.goal_system.add(slow_down_goal);
}
public function repair():void{
if (repair_goal){
repair_goal.deactivate();
repair_goal = null;
return;
};
repair_goal = new RepairGoal(owner, engine);
goal_system.add(repair_goal);
}
public function froze():void{
if (!owner.isAlive()){
return;
};
if (froze_goal != null){
froze_goal.delay = Consts.FrozeDelay;
return;
};
froze_goal = new FrozeGoal(engine, owner);
engine.goal_system.add(froze_goal);
}
public function startMoving(_arg1:Position, _arg2:Boolean):void{
if (((move_goal) && (move_goal.active))){
move_goal.deactivate();
move_goal = null;
};
move_goal = new MoveGoal(owner, engine);
move_goal.setMoveTarget(_arg1);
goal_system.add(move_goal);
if (attack_goal){
if (_arg2){
attack_goal.holdFire(true);
};
attack_goal.setMoveGoal(move_goal);
};
}
public function advance():void{
goal_system.tick();
if (((move_goal) && (!(move_goal.active)))){
move_goal = null;
if (attack_goal){
attack_goal.holdFire(false);
};
};
}
public function get moveGoal():MoveGoal{
return (move_goal);
}
public function unfroze():void{
if (froze_goal){
froze_goal.deactivate();
froze_goal = null;
};
}
public function isMoving():Boolean{
return (((move_goal) && (move_goal.active)));
}
public function resetWeapon():void{
if (attack_goal){
attack_goal.resetWeapon();
};
}
public function unslowDown():void{
if (slow_down_goal){
slow_down_goal.deactivate();
slow_down_goal = null;
};
}
public function underRepair():Boolean{
return (((repair_goal) && (repair_goal.active)));
}
public function attack(_arg1:Camp, _arg2:Boolean):void{
if (attack_goal){
attack_goal.deactivate();
attack_goal = null;
};
attack_goal = new AttackGoal(engine, owner, _arg1, _arg2);
goal_system.add(attack_goal);
}
public function isSlow():Boolean{
return (!((slow_down_goal == null)));
}
public function destroy(_arg1:Boolean=false):void{
unfroze();
unslowDown();
goal_system.deactivateAll();
move_goal = null;
repair_goal = null;
attack_goal = null;
froze_goal = null;
if (((_arg1) && (owner))){
engine.gameBoard.wipeUnit(owner);
owner.destroy();
owner = null;
active = false;
};
}
public function stop():void{
if (((move_goal) && (move_goal.active))){
move_goal.deactivate();
move_goal = null;
};
if (attack_goal){
attack_goal.setAttackTarget(null);
attack_goal.holdFire(false);
};
}
public function isFrozen():Boolean{
return (((froze_goal) && (froze_goal.active)));
}
override public function deactivate():void{
if (owner){
destroy();
engine.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.setAttackTarget(_arg1);
};
}
}
}//package fai.goals
Section 23
//MoveGoal (fai.goals.MoveGoal)
package fai.goals {
import fai.logic.*;
import fai.units.*;
import fai.common.*;
import fai.*;
public class MoveGoal extends Goal {
private var nsteps:Number;// = 0
private var reset_target:Boolean;// = false
private var target:Position;
private var world:MapMatrix;// = null
private var dx:Number;// = 0
private var dy:Number;// = 0
private var path:Array;
private var dogo:Boolean;// = false
private var motion_step:int;// = 0
private var path_index:uint;// = 0
private var pos_recalc_time:int;// = 0
private var engine:Engine;// = null
private var freeCellType:int;// = 0
private var owner:Unit;// = null
private var nchecks:int;// = 0
private var velocity:Number;// = 5
public var astar:Astar;// = null
private var docheck:Boolean;// = false
private static const MaxChecks:uint = 4;
public function MoveGoal(_arg1:Unit, _arg2:Engine, _arg3:int=20):void{
target = new Position();
path = new Array();
path_index = 0;
world = null;
nchecks = 0;
astar = null;
engine = null;
velocity = 5;
dx = 0;
dy = 0;
nsteps = 0;
motion_step = 0;
pos_recalc_time = 0;
dogo = false;
docheck = false;
owner = null;
freeCellType = 0;
reset_target = false;
super();
engine = _arg2;
owner = _arg1;
priority = Consts.MoveGoalPriority;
if (owner.flag(UnitFlags.Flying)){
world = engine.gameBoard.airworld;
} else {
world = engine.gameBoard.world;
};
velocity = owner.velocity;
pos_recalc_time = 4;
freeCellType = _arg3;
}
public function advance():void{
if (owner.rotating){
owner.rotate();
if (motion_step < owner.sprite.sprite.nframes){
motion_step++;
} else {
motion_step = 0;
};
owner.sprite.sprite.setFrame(motion_step);
if (reset_target){
return;
};
};
if (reset_target){
reset_target = false;
setMoveTarget(target);
return;
};
if (dogo){
if (motion_step < owner.sprite.sprite.nframes){
motion_step++;
} else {
motion_step = 0;
};
owner.sprite.sprite.setFrame(motion_step);
if (nsteps > 0){
moveOwner();
} else {
if (path_index < (path.length - 1)){
dogo = false;
nextGo();
} else {
deactivate();
if ((((owner.mapid == Consts.hostileId)) && (owner.pos.isequal(target)))){
engine.invaderPassed(owner);
};
};
};
} else {
if (docheck){
guessNext();
} else {
if (0 == path.length){
keepSearching();
};
};
};
}
private function nextGo():void{
path_index++;
startGoing();
}
private function keepSearching():void{
if (astar.search(path)){
if (path.length > 0){
path_index = 0;
startGoing();
};
} else {
owner.startRotate((Math.random() * 360));
reset_target = true;
};
}
private function startGoing():void{
var _local1:Position;
var _local2:Number;
var _local3:Number;
_local1 = path[path_index];
_local2 = ((_local1.x * Consts.cell_size) - owner.sprite.x);
_local3 = ((_local1.y * Consts.cell_size) - owner.sprite.y);
nsteps = (Math.sqrt(((_local2 * _local2) + (_local3 * _local3))) / velocity);
dx = (_local2 / nsteps);
dy = (_local3 / nsteps);
owner.startRotate((((Math.atan2(dy, dx) / Math.PI) * 180) + 90));
if (nsteps > 0){
moveOwner();
};
dogo = true;
}
public function setMoveTarget(_arg1:Position):void{
path.length = 0;
path_index = 0;
target.copy(_arg1);
astar = new Astar(world, owner.mapid);
astar.cell_type = freeCellType;
if (!owner.sprite.isMoveSprite()){
owner.sprite.setMoveSprite();
};
if (!astar.startSearch(owner.pos, target)){
deactivate();
} else {
target.copy(astar.destination);
};
}
public function updateVelocity():void{
var _local1:Boolean;
_local1 = dogo;
dogo = false;
velocity = owner.velocity;
startGoing();
dogo = _local1;
}
private function recalculatePosition():void{
var _local1:int;
var _local2:int;
_local1 = Math.floor(((owner.sprite.x / Consts.cell_size) + 0.5));
_local2 = Math.floor(((owner.sprite.y / Consts.cell_size) + 0.5));
if (((!((owner.pos.x == _local1))) || (!((owner.pos.y == _local2))))){
if (astar.checkxy(_local1, _local2)){
owner.pos.set(_local1, _local2);
};
};
}
private function moveOwner():void{
if (nsteps < 1){
owner.sprite.x = (owner.sprite.x + (dx * nsteps));
owner.sprite.y = (owner.sprite.y + (dy * nsteps));
} else {
owner.sprite.x = (owner.sprite.x + dx);
owner.sprite.y = (owner.sprite.y + dy);
};
nsteps--;
if ((int(nsteps) % pos_recalc_time) == 0){
recalculatePosition();
guessNext();
};
}
private function guessNext():void{
var _local1:Number;
var _local2:int;
var _local3:int;
_local1 = (((nsteps > pos_recalc_time)) ? pos_recalc_time : nsteps + 1);
_local2 = Math.floor((((owner.sprite.x + (dx * _local1)) / Consts.cell_size) + 0.5));
_local3 = Math.floor((((owner.sprite.y + (dy * _local1)) / Consts.cell_size) + 0.5));
if (docheck){
nchecks++;
if (nchecks > MaxChecks){
nchecks = 0;
dogo = false;
docheck = false;
setMoveTarget(target);
return;
};
};
if (((!(owner.pos.isSameXY(_local2, _local3))) && (!(astar.checkxy(_local2, _local3))))){
dogo = false;
docheck = true;
return;
};
nchecks = 0;
docheck = false;
dogo = true;
}
override public function deactivate():void{
if (owner){
owner.rotating = false;
recalculatePosition();
};
super.deactivate();
}
}
}//package fai.goals
Section 24
//MoveInvaderGoal (fai.goals.MoveInvaderGoal)
package fai.goals {
import fai.logic.*;
import fai.ui.*;
import fai.units.*;
import fai.common.*;
public class MoveInvaderGoal extends Goal {
private var road_enum:RoadGraph;// = null
private var engine:Engine;// = null
private var node:RoadPoint;// = null
private var unit:Unit;// = null
private var road:RoadPath;// = null
private var motion_step:int;// = 0
private var simple_move:MoveSimpleGoal;// = null
public function MoveInvaderGoal(_arg1:Engine, _arg2:Unit, _arg3:RoadPath, _arg4:Boolean=false):void{
engine = null;
unit = null;
road = null;
road_enum = null;
node = null;
simple_move = null;
motion_step = 0;
super();
engine = _arg1;
unit = _arg2;
road = _arg3;
if (_arg4){
virtualGotoNext();
} else {
gotoNext();
};
}
public function resetParams():void{
simple_move.resetParams();
}
public function advance():void{
if (unit.rotating){
unit.rotate();
if (motion_step < unit.sprite.sprite.nframes){
motion_step++;
} else {
motion_step = 0;
};
unit.sprite.sprite.setFrame(motion_step);
};
if (simple_move){
if (motion_step < unit.sprite.sprite.nframes){
motion_step++;
} else {
motion_step = 0;
};
unit.sprite.sprite.setFrame(motion_step);
simple_move.advance();
if (!simple_move.active){
simple_move = null;
gotoNext();
};
};
}
public function currentNode(){
return (node);
}
public function reset():void{
if (simple_move){
simple_move.deactivate();
simple_move = null;
};
gotoNext();
advance();
}
public function virtualGotoNext():void{
var _local1:RoadPoint;
if (!road_enum){
road_enum = new RoadGraph(road);
_local1 = road_enum.getFirst();
unit.recalcGraphicalPos();
};
node = road_enum.getNext();
if (node){
if (((simple_move) && (simple_move.active))){
simple_move.deactivate();
simple_move = null;
};
simple_move = new MoveSimpleGoal(engine, unit);
simple_move.moveToXY((road.x + node.x), (road.y + node.y));
} else {
deactivate();
};
}
public function theRoad(){
return (road);
}
public function gotoNext():void{
var _local1:RoadPoint;
if (!road_enum){
road_enum = new RoadGraph(road);
_local1 = road_enum.getFirst();
unit.sprite.x = (road.x + _local1.x);
unit.sprite.y = (road.y + _local1.y);
unit.recalcGraphicalPos();
};
node = road_enum.getNext();
if (node){
if (((simple_move) && (simple_move.active))){
simple_move.deactivate();
simple_move = null;
};
simple_move = new MoveSimpleGoal(engine, unit);
simple_move.moveToXY((road.x + node.x), (road.y + node.y));
} else {
deactivate();
};
}
public function anyNextNodePos():Position{
var _local1:RoadPoint;
_local1 = road_enum.lookAnyNext();
return (new Position((road.x + _local1.x), (road.y + _local1.y)));
}
}
}//package fai.goals
Section 25
//MoveSimpleGoal (fai.goals.MoveSimpleGoal)
package fai.goals {
import fai.logic.*;
import fai.units.*;
import fai.common.*;
public class MoveSimpleGoal extends Goal {
private var engine:Engine;// = null
private var steps:Number;// = 0
private var target:Position;// = null
private var unit:Unit;// = null
private var dx:Number;// = 0
private var dy:Number;// = 0
public function MoveSimpleGoal(_arg1:Engine, _arg2:Unit):void{
engine = null;
unit = null;
steps = 0;
dx = 0;
dy = 0;
target = null;
super();
engine = _arg1;
unit = _arg2;
}
public function advance():void{
if (steps < 1){
unit.sprite.x = (unit.sprite.x + (dx * steps));
unit.sprite.y = (unit.sprite.y + (dy * steps));
steps = 0;
} else {
unit.sprite.x = (unit.sprite.x + dx);
unit.sprite.y = (unit.sprite.y + dy);
steps--;
};
unit.recalcGraphicalPos();
if (steps <= 0){
deactivate();
};
}
public function moveToXY(_arg1:int, _arg2:int):void{
var _local3:Number;
var _local4:Number;
var _local5:int;
target = new Position(_arg1, _arg2);
_local3 = (target.x - unit.sprite.x);
_local4 = (target.y - unit.sprite.y);
steps = (Math.sqrt(((_local3 * _local3) + (_local4 * _local4))) / unit.velocity);
_local5 = (((Math.atan2(_local4, _local3) / Math.PI) * 180) + 90);
unit.startRotate(_local5);
dx = (_local3 / steps);
dy = (_local4 / steps);
}
public function resetParams():void{
moveToXY(target.x, target.y);
}
public function moveTo(_arg1:Position):void{
moveToXY(_arg1.x, _arg1.y);
}
}
}//package fai.goals
Section 26
//RepairGoal (fai.goals.RepairGoal)
package fai.goals {
import fai.logic.*;
import fai.units.*;
public class RepairGoal extends Goal {
private var engine:Engine;// = null
private var orebeacon:Number;// = 0
private var orecost:Number;// = 0
private var owner:Unit;// = null
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;
owner = null;
super();
owner = _arg1;
engine = _arg2;
life = _arg1.full_health;
orecost = ((owner.cost / life) / 2);
}
public function advance():void{
var _local1:int;
if (pause > 0){
pause--;
return;
};
if ((((engine.money <= 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.money < _local1){
engine.log("Not enough resources for repair");
deactivate();
} else {
engine.money = (engine.money - _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.goals
Section 27
//SlowDownGoal (fai.goals.SlowDownGoal)
package fai.goals {
import fai.logic.*;
import fai.units.*;
public class SlowDownGoal extends Goal {
private var engine:Engine;// = null
private var slowed_unit:Unit;// = null
public var delay:int;// = 65
private var life_goal:LifeGoal;// = null
private static const VelocityDecrease:int = 2;
private static const InitialDelay:int = 65;
public function SlowDownGoal(_arg1:Engine, _arg2:Unit):void{
engine = null;
slowed_unit = null;
life_goal = null;
delay = InitialDelay;
super();
engine = _arg1;
slowed_unit = _arg2;
slowed_unit.velocity = (slowed_unit.velocity / 2);
if (slowed_unit.life.isMoving()){
slowed_unit.life.moveGoal.updateVelocity();
};
if (slowed_unit.life.move_invader_goal){
slowed_unit.life.move_invader_goal.resetParams();
};
}
public function advance():void{
if (delay > 0){
delay--;
return;
};
deactivate();
}
override public function deactivate():void{
if (!active){
return;
};
super.deactivate();
slowed_unit.velocity = engine.gameData.params(slowed_unit.type).velocity;
if (slowed_unit.life.isMoving()){
slowed_unit.life.moveGoal.updateVelocity();
};
slowed_unit.life.unslowDown();
}
public function resetDelay():void{
delay = InitialDelay;
}
}
}//package fai.goals
Section 28
//TextPopupGoal (fai.goals.TextPopupGoal)
package fai.goals {
import fai.logic.*;
import fai.*;
public final class TextPopupGoal extends Goal {
private var money:int;// = 0
private var engine:Engine;// = null
private var top_edge:int;// = 0
private var mpopup;// = null
public function TextPopupGoal(_arg1:Engine, _arg2:String, _arg3:int, _arg4:int, _arg5:Boolean=false):void{
engine = null;
money = 0;
top_edge = 0;
mpopup = null;
super();
engine = _arg1;
if (_arg5){
mpopup = new MoneyAddPopupMC();
} else {
mpopup = new MoneyPopupMC();
};
mpopup.txt.text = _arg2;
mpopup.x = _arg3;
mpopup.y = _arg4;
engine.gameBoard.bulletlayer.addChild(mpopup);
top_edge = (mpopup.y - 50);
}
public function advance():void{
if (mpopup.y < top_edge){
deactivate();
return;
};
mpopup.y--;
}
override public function deactivate():void{
if (mpopup){
engine.gameBoard.bulletlayer.removeChild(mpopup);
mpopup = null;
};
super.deactivate();
}
}
}//package fai.goals
Section 29
//TimerBombGoal (fai.goals.TimerBombGoal)
package fai.goals {
import fai.logic.*;
import fai.ui.*;
import fai.units.*;
import fai.common.*;
import fai.*;
public class TimerBombGoal extends Goal {
private var engine:Engine;// = null
private var bomb_time:int;// = 149
private var explosion_pause:int;// = 40
private var unit:Unit;// = null
private var explosion;// = null
public function TimerBombGoal(_arg1:Engine, _arg2:Unit):void{
engine = null;
unit = null;
bomb_time = 149;
explosion_pause = 40;
explosion = null;
super();
engine = _arg1;
unit = _arg2;
}
public function advance():void{
if (bomb_time > 0){
unit.sprite.clip.timer_txt.text = int(((bomb_time / 30) + 1)).toString();
bomb_time--;
if (bomb_time == 0){
explosion = new BombExplosion();
explosion.x = unit.sprite.x;
explosion.y = unit.sprite.y;
engine.gameBoard.bulletlayer.addChild(explosion);
explosion.inner.gotoAndPlay("fire_state");
checkNearTargets(unit);
unit.sprite.visible = false;
engine.game_process.hitUnit(1000, unit);
engine.playSound(SoundConsts.bomb_explosion);
};
} else {
if (explosion_pause > 0){
explosion_pause--;
} else {
engine.gameBoard.bulletlayer.removeChild(explosion);
explosion = null;
deactivate();
};
};
}
private function checkNearTargets(_arg1:Unit):void{
var _local2:int;
var _local3:Unit;
var _local4:Number;
_local2 = 0;
_local3 = null;
while (_local2 < engine.gameBoard.enemy_camp.units.length) {
_local3 = engine.gameBoard.enemy_camp.units[_local2];
_local4 = Utils.distance(_arg1.sprite, _local3.sprite);
if (_local4 < Consts.TIMER_BOMB_RANGE){
engine.game_process.hitUnit(_arg1.weapon.damage, _local3);
};
if (_local3.isAlive()){
_local2++;
};
};
}
}
}//package fai.goals
Section 30
//GoalSystem (fai.goalsystem.GoalSystem)
package fai.goalsystem {
import 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--;
};
}
}
}//package fai.goalsystem
Section 31
//PriorityGoalSystem (fai.goalsystem.PriorityGoalSystem)
package fai.goalsystem {
import fai.common.*;
import fai.*;
public class PriorityGoalSystem {
public var goals:Map;
private var active_count:int;// = 0
private var counter:int;// = 0
private var mutex:Mutex;
public function PriorityGoalSystem(){
goals = new Map();
counter = 0;
active_count = 0;
mutex = new Mutex();
super();
}
public function add(_arg1):void{
goals.add(_arg1.priority, _arg1);
}
public function activeCount():int{
return (active_count);
}
public function deactivateAll():void{
var _local1:int;
mutex.lock();
_local1 = 0;
while (_local1 < goals.values.length) {
goals.values[_local1].deactivate();
_local1++;
};
goals.clear();
mutex.unlock();
}
private function cleanGoals():void{
var _local1:int;
mutex.lock();
_local1 = 0;
while (_local1 < goals.values.length) {
if (!goals.values[_local1].active){
goals.keys.splice(_local1, 1);
goals.values.splice(_local1, 1);
} else {
_local1++;
};
};
mutex.unlock();
}
public function tick():void{
var _local1:uint;
if (mutex.isLocked()){
return;
};
_local1 = 0;
active_count = 0;
while (_local1 < goals.values.length) {
if (goals.values[_local1].active){
goals.values[_local1].advance();
active_count++;
};
_local1++;
};
if (!counter){
cleanGoals();
counter = Consts.GOALSCLEANPAUSE;
} else {
counter--;
};
}
}
}//package fai.goalsystem
Section 32
//GameData (fai.loading.GameData)
package fai.loading {
import fai.logic.*;
import fai.ui.*;
import fai.units.*;
import fai.common.*;
import flash.display.*;
import fai.goals.*;
import flash.utils.*;
import fai.*;
public class GameData {
private var engine:Engine;// = null
private var loading_errors:String;// = ""
private var allies:Map;// = null
private var bosses:Map;// = null
private var enemies:Map;// = null
private var current_game;// = null
private static var suits:Dictionary = new Dictionary();
private static var backs:Dictionary = new Dictionary();
private static var decors:Dictionary = new Dictionary();
private static var units:Dictionary = new Dictionary();
private static var levels:Array = [];
private static var specials:Dictionary = new Dictionary();
public function GameData(_arg1:Engine, _arg2):void{
var _local3:int;
var _local4:Level;
engine = null;
enemies = null;
allies = null;
bosses = null;
current_game = null;
loading_errors = "";
super();
enemies = new Map();
allies = new Map();
bosses = new Map();
current_game = _arg2;
engine = _arg1;
levels = new Array();
_local3 = 0;
_local3 = 0;
while (_local3 < 20) {
_local4 = new Level();
_local4.number = _local3;
addLevel(_local4);
_local3++;
};
}
public function getSpecial(_arg1:String):BitmapData{
return (specials[_arg1]);
}
public function addUnit(_arg1:Unit):void{
units[_arg1.type] = _arg1;
if (Consts.hostileId == _arg1.mapid){
if (_arg1.flag(UnitFlags.Boss)){
bosses.add(_arg1.cost, _arg1);
} else {
enemies.add(_arg1.build_steps, _arg1);
};
} else {
if (Consts.myId == _arg1.mapid){
allies.add(_arg1.death_cost, _arg1);
};
};
}
public function params(_arg1:String):Unit{
return (units[_arg1]);
}
public function getEnemyByIndex(_arg1:int):Unit{
return (enemies.values[_arg1]);
}
public function get currentGame(){
return (current_game);
}
public function clear():void{
units = new Dictionary();
levels = new Array();
suits = new Dictionary();
specials = new Dictionary();
backs = new Dictionary();
decors = new Dictionary();
engine = null;
enemies = null;
allies = null;
bosses = null;
current_game = null;
loading_errors = "";
}
public function getSpecialBitmap(_arg1:String, _arg2:int=0):AnimatedBitmap{
var _local3:BitmapData;
_local3 = specials[_arg1];
if (!_arg2){
_arg2 = _local3.width;
};
return (new AnimatedBitmap(_local3, _arg2, _local3.height));
}
public function addDecor(_arg1:DecorObject):void{
decors[_arg1.type] = _arg1;
}
public function addSuit(_arg1:UnitSuit):void{
suits[_arg1.suit_id] = _arg1;
}
public function getBossByIndex(_arg1:int):Unit{
return (bosses.values[_arg1]);
}
public function getStatusBitmap(_arg1:String):AnimatedBitmap{
var _local2:UnitSuit;
var _local3:BitmapData;
_local2 = suits[_arg1];
_local3 = _local2.status_bitmap;
return (new AnimatedBitmap(_local3, 90, _local3.height));
}
public function getLevel(_arg1:int):Level{
return (LevelSelector.getLevel(_arg1));
}
public function addSpecial(_arg1:String, _arg2:BitmapData):void{
specials[_arg1] = _arg2;
}
public function createUnit(_arg1:String, _arg2:int):Unit{
var _local3:Unit;
_local3 = new Unit(engine, _arg2, _arg1);
_local3.copyProperties(units[_arg1]);
dressUnit(_local3, _arg1);
return (_local3);
}
public function bossCount():int{
return (bosses.size());
}
public function addLevel(_arg1:Level):void{
levels.push(_arg1);
}
public function getBackground(_arg1:String):BitmapData{
return (backs[_arg1].bitmap_data);
}
public function getLevels():Array{
return (levels);
}
public function enemyCount():int{
return (enemies.size());
}
public function get loadingErrors():String{
return (loading_errors);
}
public function dressUnit(_arg1:Unit, _arg2:String):void{
var _local3:UnitSuit;
var _local4:*;
_local3 = suits[_arg1.suit_id];
_arg1.sprite.setAppearence(_local3, _arg1.sprite_width);
switch (_arg1.type){
case StringConsts.spitting_cactus:
_arg1.clip = true;
_arg1.sprite.setMovieClipAppearence(new SpittingCactus());
_arg1.sprite.clip.inner.gotoAndStop("steady_state");
break;
case StringConsts.gas_sprayer:
_arg1.clip = true;
_arg1.sprite.setMovieClipAppearence(new GasSprayer());
_arg1.sprite.clip.inner.gotoAndStop("steady_state");
break;
case StringConsts.laser_towers:
_arg1.clip = true;
_local4 = new LaserTowers();
_arg1.sprite.setMovieClipAppearence(_local4);
if (((engine.gameBoard.build_cursor) && ((engine.gameBoard.build_cursor.angle == 90)))){
_arg1.sprite.rotate(90);
_arg1.lt_angle = engine.gameBoard.build_cursor.angle;
};
_arg1.sprite.clip.inner.gotoAndStop("steady_state");
break;
case StringConsts.poisoned_balls:
_arg1.clip = true;
_arg1.sprite.setMovieClipAppearence(new PoisonedBalls());
break;
case StringConsts.timer_bomb:
_arg1.clip = true;
_arg1.sprite.setMovieClipAppearence(new TimerBomb());
engine.goal_system.add(new TimerBombGoal(engine, _arg1));
break;
};
}
public function getDecorBitmap(_arg1:String):AnimatedBitmap{
var _local2:BitmapData;
_local2 = getDecor(_arg1);
return (new AnimatedBitmap(_local2, _local2.width, _local2.height));
}
public function getAllyByIndex(_arg1:int):Unit{
return (allies.values[_arg1]);
}
public function addBackground(_arg1:DecorObject):void{
backs[_arg1.type] = _arg1;
}
public function allyCount():int{
return (allies.size());
}
public function getBody(_arg1:String):BitmapData{
return (suits[_arg1].move_bitmap);
}
public function set loadingErrors(_arg1:String):void{
loading_errors = _arg1;
}
public function getDecor(_arg1:String):BitmapData{
return (decors[_arg1].bitmap_data);
}
public function getAllyByType(_arg1:String):Unit{
var _local2:int;
var _local3:Unit;
_local2 = 0;
_local2 = 0;
while (_local2 < allies.values.length) {
_local3 = allies.values[_local2];
if (_local3.type == _arg1){
return (_local3);
};
_local2++;
};
return (null);
}
public static function isBoss(_arg1:String):Boolean{
return (false);
}
}
}//package fai.loading
Section 33
//GameSchema (fai.loading.GameSchema)
package fai.loading {
public class GameSchema {
public static const schema:XML = <schema>
<units>
<unit name="Beetle">
<flag value="Peaceful"/>
<param name="health" value="30" type="i"/>
<param name="sprite_width" value="24" type="i"/>
<param name="description" value="" type="s"/>
<param name="armor" value="0" type="i"/>
<param name="rotstep" value="15" type="i"/>
<param name="cost" value="1" type="i"/>
<param name="death_cost" value="2" type="i"/>
<param name="mapid" value="4" type="i"/>
<param name="build_steps" value="1" type="i"/>
<param name="velocity" value="3" type="i"/>
<suit id="suit_0"/>
</unit>
<unit name="Colorado Beetle">
<flag value="Peaceful"/>
<param name="health" value="40" type="i"/>
<param name="sprite_width" value="32" type="i"/>
<param name="description" value="" type="s"/>
<param name="armor" value="1" type="i"/>
<param name="rotstep" value="15" type="i"/>
<param name="cost" value="1" type="i"/>
<param name="death_cost" value="3" type="i"/>
<param name="mapid" value="4" type="i"/>
<param name="build_steps" value="3" type="i"/>
<param name="velocity" value="3" type="i"/>
<suit id="suit_1"/>
</unit>
<unit name="Butterfly">
<flag value="Peaceful"/>
<flag value="Flying"/>
<param name="health" value="30" type="i"/>
<param name="sprite_width" value="49" type="i"/>
<param name="description" value="" type="s"/>
<param name="armor" value="0" type="i"/>
<param name="rotstep" value="15" type="i"/>
<param name="cost" value="1" type="i"/>
<param name="death_cost" value="3" type="i"/>
<param name="mapid" value="4" type="i"/>
<param name="build_steps" value="2" type="i"/>
<param name="velocity" value="4" type="i"/>
<suit id="suit_2"/>
</unit>
<unit name="Bumblebee">
<flag value="Peaceful"/>
<flag value="Flying"/>
<param name="health" value="40" type="i"/>
<param name="sprite_width" value="32" type="i"/>
<param name="description" value="" type="s"/>
<param name="armor" value="1" type="i"/>
<param name="rotstep" value="15" type="i"/>
<param name="cost" value="1" type="i"/>
<param name="death_cost" value="3" type="i"/>
<param name="mapid" value="4" type="i"/>
<param name="build_steps" value="4" type="i"/>
<param name="velocity" value="4" type="i"/>
<suit id="suit_3"/>
</unit>
<unit name="Dragonfly">
<flag value="Peaceful"/>
<flag value="Flying"/>
<param name="health" value="60" type="i"/>
<param name="sprite_width" value="32" type="i"/>
<param name="description" value="" type="s"/>
<param name="armor" value="1" type="i"/>
<param name="rotstep" value="15" type="i"/>
<param name="cost" value="2" type="i"/>
<param name="death_cost" value="4" type="i"/>
<param name="mapid" value="4" type="i"/>
<param name="build_steps" value="5" type="i"/>
<param name="velocity" value="3" type="i"/>
<suit id="suit_4"/>
</unit>
<unit name="Worm">
<flag value="Peaceful"/>
<param name="health" value="125" type="i"/>
<param name="sprite_width" value="31" type="i"/>
<param name="description" value="" type="s"/>
<param name="armor" value="1" type="i"/>
<param name="rotstep" value="15" type="i"/>
<param name="cost" value="2" type="i"/>
<param name="death_cost" value="5" type="i"/>
<param name="mapid" value="4" type="i"/>
<param name="build_steps" value="6" type="i"/>
<param name="velocity" value="2" type="i"/>
<suit id="suit_5"/>
</unit>
<unit name="Little Worm">
<flag value="Peaceful"/>
<param name="health" value="35" type="i"/>
<param name="sprite_width" value="26" type="i"/>
<param name="description" value="" type="s"/>
<param name="armor" value="0" type="i"/>
<param name="rotstep" value="15" type="i"/>
<param name="cost" value="1" type="i"/>
<param name="death_cost" value="2" type="i"/>
<param name="mapid" value="4" type="i"/>
<param name="build_steps" value="6" type="i"/>
<param name="velocity" value="2" type="i"/>
<suit id="suit_20"/>
</unit>
<unit name="Caterpillar">
<flag value="Peaceful"/>
<param name="health" value="200" type="i"/>
<param name="sprite_width" value="25" type="i"/>
<param name="description" value="" type="s"/>
<param name="armor" value="2" type="i"/>
<param name="rotstep" value="5" type="i"/>
<param name="cost" value="3" type="i"/>
<param name="death_cost" value="15" type="i"/>
<param name="mapid" value="4" type="i"/>
<param name="build_steps" value="10" type="i"/>
<param name="velocity" value="3" type="i"/>
<suit id="suit_6"/>
</unit>
<unit name="Mouse">
<flag value="Peaceful"/>
<flag value="Boss"/>
<param name="health" value="2000" type="i"/>
<param name="sprite_width" value="64" type="i"/>
<param name="description" value="" type="s"/>
<param name="armor" value="2" type="i"/>
<param name="rotstep" value="5" type="i"/>
<param name="cost" value="15" type="i"/>
<param name="death_cost" value="500" type="i"/>
<param name="mapid" value="4" type="i"/>
<param name="build_steps" value="7" type="i"/>
<param name="velocity" value="3" type="i"/>
<suit id="suit_21"/>
</unit>
<unit name="Rat">
<flag value="Peaceful"/>
<flag value="Boss"/>
<param name="health" value="3000" type="i"/>
<param name="sprite_width" value="64" type="i"/>
<param name="description" value="" type="s"/>
<param name="armor" value="1" type="i"/>
<param name="rotstep" value="5" type="i"/>
<param name="cost" value="25" type="i"/>
<param name="death_cost" value="1000" type="i"/>
<param name="mapid" value="4" type="i"/>
<param name="build_steps" value="7" type="i"/>
<param name="velocity" value="3" type="i"/>
<suit id="suit_22"/>
</unit>
<unit name="Spitting Cactus">
<flag value="Building"/>
<param name="health" value="50" type="i"/>
<param name="sprite_width" value="40" type="i"/>
<param name="description" value="Spits spikes in all directions. Best for placing into road bends." type="s"/>
<param name="armor" value="1" type="i"/>
<param name="rotstep" value="0" type="i"/>
<param name="cost" value="195" type="i"/>
<param name="death_cost" value="1" type="i"/>
<param name="mapid" value="3" type="i"/>
<param name="build_steps" value="35" type="i"/>
<param name="velocity" value="5" type="i"/>
<suit id="suit_7"/>
</unit>
<unit name="Laser Towers">
<flag value="Building"/>
<param name="health" value="15" type="i"/>
<param name="sprite_width" value="31" type="i"/>
<param name="description" value="Two towers at the both sides of the road. Radiate laser beam between the two towers." type="s"/>
<param name="armor" value="1" type="i"/>
<param name="rotstep" value="0" type="i"/>
<param name="cost" value="750" type="i"/>
<param name="death_cost" value="2" type="i"/>
<param name="mapid" value="3" type="i"/>
<param name="build_steps" value="45" type="i"/>
<param name="velocity" value="5" type="i"/>
<suit id="suit_10"/>
</unit>
<unit name="Gas Sprayer">
<flag value="Building"/>
<param name="health" value="50" type="i"/>
<param name="sprite_width" value="38" type="i"/>
<param name="description" value="Sprays poisoned gas. Affects air and ground units. Invaders lose health points when they are in the range of gas." type="s"/>
<param name="armor" value="1" type="i"/>
<param name="rotstep" value="0" type="i"/>
<param name="cost" value="230" type="i"/>
<param name="death_cost" value="3" type="i"/>
<param name="mapid" value="3" type="i"/>
<param name="build_steps" value="30" type="i"/>
<param name="velocity" value="5" type="i"/>
<suit id="suit_8"/>
</unit>
<unit name="Pellet Gnome">
<flag value="Building"/>
<param name="health" value="50" type="i"/>
<param name="sprite_width" value="42" type="i"/>
<param name="description" value="Shoots Air and Ground targets. Can be upgraded to Spear and Razor Gnome." type="s"/>
<param name="armor" value="1" type="i"/>
<param name="rotstep" value="25" type="i"/>
<param name="cost" value="85" type="i"/>
<param name="death_cost" value="4" type="i"/>
<param name="mapid" value="3" type="i"/>
<param name="build_steps" value="20" type="i"/>
<param name="velocity" value="5" type="i"/>
<suit id="suit_9"/>
</unit>
<unit name="Boomerang Gnome">
<flag value="Building"/>
<param name="health" value="75" type="i"/>
<param name="sprite_width" value="42" type="i"/>
<param name="description" value="Sends a boomerang which follows a curve line and returns to its initial position. Affects air targets only." type="s"/>
<param name="armor" value="1" type="i"/>
<param name="rotstep" value="25" type="i"/>
<param name="cost" value="200" type="i"/>
<param name="death_cost" value="5" type="i"/>
<param name="mapid" value="3" type="i"/>
<param name="build_steps" value="30" type="i"/>
<param name="velocity" value="5" type="i"/>
<suit id="suit_11"/>
</unit>
<unit name="Bomb Gnome">
<flag value="Building"/>
<param name="health" value="50" type="i"/>
<param name="sprite_width" value="42" type="i"/>
<param name="description" value="Fires bombs and damages all invaders near the explosion. Ground units only. Upgrades into Rocket Gnome." type="s"/>
<param name="armor" value="1" type="i"/>
<param name="rotstep" value="15" type="i"/>
<param name="cost" value="125" type="i"/>
<param name="death_cost" value="6" type="i"/>
<param name="mapid" value="3" type="i"/>
<param name="build_steps" value="40" type="i"/>
<param name="velocity" value="5" type="i"/>
<suit id="suit_12"/>
</unit>
<unit name="Chewing Gum">
<flag value="Building"/>
<param name="health" value="100" type="i"/>
<param name="sprite_width" value="33" type="i"/>
<param name="description" value="Slows down up to 10 invaders." type="s"/>
<param name="armor" value="1" type="i"/>
<param name="rotstep" value="0" type="i"/>
<param name="cost" value="15" type="i"/>
<param name="death_cost" value="6" type="i"/>
<param name="mapid" value="3" type="i"/>
<param name="build_steps" value="5" type="i"/>
<param name="velocity" value="5" type="i"/>
<suit id="suit_13"/>
</unit>
<unit name="Poisoned Balls">
<flag value="Building"/>
<param name="health" value="90" type="i"/>
<param name="sprite_width" value="43" type="i"/>
<param name="description" value="10 poisoned balls. Each ball kills one invader." type="s"/>
<param name="armor" value="0" type="i"/>
<param name="rotstep" value="0" type="i"/>
<param name="cost" value="25" type="i"/>
<param name="death_cost" value="6" type="i"/>
<param name="mapid" value="3" type="i"/>
<param name="build_steps" value="5" type="i"/>
<param name="velocity" value="5" type="i"/>
<suit id="suit_14"/>
</unit>
<unit name="Timer Bomb">
<flag value="Building"/>
<flag value="Peaceful"/>
<param name="health" value="90" type="i"/>
<param name="sprite_width" value="27" type="i"/>
<param name="description" value="Blows in 5 seconds after the set and affects all the near pests." type="s"/>
<param name="armor" value="0" type="i"/>
<param name="rotstep" value="0" type="i"/>
<param name="cost" value="40" type="i"/>
<param name="death_cost" value="6" type="i"/>
<param name="mapid" value="3" type="i"/>
<param name="build_steps" value="5" type="i"/>
<param name="velocity" value="5" type="i"/>
<suit id="suit_15"/>
</unit>
</units>
<weapons>
<weapon name="Beetle_WEAPON">
<flag value="AntiAir"/>
<flag value="AntiLand"/>
<param name="damage" value="10" type="i"/>
<param name="eyerange" value="5" type="i"/>
<param name="recharge_time" value="5" type="i"/>
<param name="bullet_speed" value="30" type="i"/>
<suit id="suit_0"/>
</weapon>
<weapon name="Colorado Beetle_WEAPON">
<flag value="AntiAir"/>
<flag value="AntiLand"/>
<param name="damage" value="10" type="i"/>
<param name="eyerange" value="5" type="i"/>
<param name="recharge_time" value="5" type="i"/>
<param name="bullet_speed" value="30" type="i"/>
<suit id="suit_1"/>
</weapon>
<weapon name="Butterfly_WEAPON">
<flag value="AntiAir"/>
<flag value="AntiLand"/>
<param name="damage" value="10" type="i"/>
<param name="eyerange" value="5" type="i"/>
<param name="recharge_time" value="5" type="i"/>
<param name="bullet_speed" value="30" type="i"/>
<suit id="suit_2"/>
</weapon>
<weapon name="Bumblebee_WEAPON">
<flag value="AntiAir"/>
<flag value="AntiLand"/>
<param name="damage" value="10" type="i"/>
<param name="eyerange" value="5" type="i"/>
<param name="recharge_time" value="5" type="i"/>
<param name="bullet_speed" value="30" type="i"/>
<suit id="suit_3"/>
</weapon>
<weapon name="Dragonfly_WEAPON">
<flag value="AntiAir"/>
<flag value="AntiLand"/>
<param name="damage" value="10" type="i"/>
<param name="eyerange" value="5" type="i"/>
<param name="recharge_time" value="5" type="i"/>
<param name="bullet_speed" value="30" type="i"/>
<suit id="suit_4"/>
</weapon>
<weapon name="Worm_WEAPON">
<flag value="AntiAir"/>
<flag value="AntiLand"/>
<param name="damage" value="10" type="i"/>
<param name="eyerange" value="5" type="i"/>
<param name="recharge_time" value="5" type="i"/>
<param name="bullet_speed" value="30" type="i"/>
<suit id="suit_5"/>
</weapon>
<weapon name="Little Worm_WEAPON">
<flag value="AntiAir"/>
<flag value="AntiLand"/>
<param name="damage" value="10" type="i"/>
<param name="eyerange" value="5" type="i"/>
<param name="recharge_time" value="5" type="i"/>
<param name="bullet_speed" value="30" type="i"/>
<suit id="suit_20"/>
</weapon>
<weapon name="Caterpillar_WEAPON">
<flag value="AntiAir"/>
<flag value="AntiLand"/>
<param name="damage" value="10" type="i"/>
<param name="eyerange" value="5" type="i"/>
<param name="recharge_time" value="5" type="i"/>
<param name="bullet_speed" value="30" type="i"/>
<suit id="suit_6"/>
</weapon>
<weapon name="Mouse_WEAPON">
<flag value="AntiAir"/>
<flag value="AntiLand"/>
<param name="damage" value="10" type="i"/>
<param name="eyerange" value="5" type="i"/>
<param name="recharge_time" value="5" type="i"/>
<param name="bullet_speed" value="30" type="i"/>
<suit id="suit_21"/>
</weapon>
<weapon name="Rat_WEAPON">
<flag value="AntiAir"/>
<flag value="AntiLand"/>
<param name="damage" value="10" type="i"/>
<param name="eyerange" value="5" type="i"/>
<param name="recharge_time" value="5" type="i"/>
<param name="bullet_speed" value="30" type="i"/>
<suit id="suit_22"/>
</weapon>
<weapon name="Spitting Cactus_WEAPON">
<flag value="AntiLand"/>
<flag value="AntiAir"/>
<param name="damage" value="16" type="i"/>
<param name="eyerange" value="3" type="i"/>
<param name="recharge_time" value="30" type="i"/>
<param name="bullet_speed" value="30" type="i"/>
<suit id="suit_7"/>
</weapon>
<weapon name="Laser Towers_WEAPON">
<flag value="AntiLand"/>
<flag value="AntiAir"/>
<param name="damage" value="350" type="i"/>
<param name="eyerange" value="1" type="i"/>
<param name="recharge_time" value="60" type="i"/>
<param name="bullet_speed" value="30" type="i"/>
<suit id="suit_10"/>
</weapon>
<weapon name="Gas Sprayer_WEAPON">
<flag value="AntiLand"/>
<flag value="AntiAir"/>
<param name="damage" value="3" type="i"/>
<param name="eyerange" value="3" type="i"/>
<param name="recharge_time" value="100" type="i"/>
<param name="bullet_speed" value="30" type="i"/>
<suit id="suit_8"/>
</weapon>
<weapon name="Pellet Gnome_WEAPON">
<flag value="AntiLand"/>
<flag value="AntiAir"/>
<param name="damage" value="10" type="i"/>
<param name="eyerange" value="3" type="i"/>
<param name="recharge_time" value="9" type="i"/>
<param name="bullet_speed" value="50" type="i"/>
<suit id="suit_9"/>
</weapon>
<weapon name="Boomerang Gnome_WEAPON">
<flag value="AntiAir"/>
<param name="damage" value="28" type="i"/>
<param name="eyerange" value="5" type="i"/>
<param name="recharge_time" value="30" type="i"/>
<param name="bullet_speed" value="25" type="i"/>
<suit id="suit_11"/>
</weapon>
<weapon name="Bomb Gnome_WEAPON">
<flag value="AntiLand"/>
<param name="damage" value="110" type="i"/>
<param name="eyerange" value="5" type="i"/>
<param name="recharge_time" value="24" type="i"/>
<param name="bullet_speed" value="30" type="i"/>
<suit id="suit_12"/>
</weapon>
<weapon name="Chewing Gum_WEAPON">
<flag value="AntiLand"/>
<param name="damage" value="1" type="i"/>
<param name="eyerange" value="1" type="i"/>
<param name="recharge_time" value="2" type="i"/>
<param name="bullet_speed" value="30" type="i"/>
<suit id="suit_13"/>
</weapon>
<weapon name="Poisoned Balls_WEAPON">
<flag value="AntiLand"/>
<flag value="AntiAir"/>
<param name="damage" value="300" type="i"/>
<param name="eyerange" value="1" type="i"/>
<param name="recharge_time" value="2" type="i"/>
<param name="bullet_speed" value="30" type="i"/>
<suit id="suit_14"/>
</weapon>
<weapon name="Timer Bomb_WEAPON">
<flag value="AntiLand"/>
<flag value="AntiAir"/>
<param name="damage" value="5000" type="i"/>
<param name="eyerange" value="3" type="i"/>
<param name="recharge_time" value="2" type="i"/>
<param name="bullet_speed" value="30" type="i"/>
<suit id="suit_15"/>
</weapon>
</weapons>
</schema>
;
public static const settings:XML = null;
public static const maps:XML = null;
}
}//package fai.loading
Section 34
//LevelPreprocessor (fai.loading.LevelPreprocessor)
package fai.loading {
import fai.logic.*;
import fai.ui.*;
import fai.units.*;
import fai.common.*;
import fai.*;
public class LevelPreprocessor {
public function LevelPreprocessor(_arg1:Level):void{
preprocess(_arg1);
}
private function preprocess(_arg1:Level):void{
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:MapMatrix;
var _local7:int;
var _local8:int;
var _local9:Boolean;
var _local10:MapElement;
var _local11:Unit;
_local2 = _arg1.map.width;
_local3 = _arg1.map.height;
_local4 = 0;
_local5 = 0;
switch (_arg1.enemy_direction){
case Consts.Left:
_local2 = (_arg1.map.width + Consts.AppendLineCount);
_local4 = Consts.AppendLineCount;
break;
case Consts.Right:
_local2 = (_arg1.map.width + Consts.AppendLineCount);
break;
case Consts.Top:
_local3 = (_arg1.map.height + Consts.AppendLineCount);
_local5 = Consts.AppendLineCount;
break;
case Consts.Down:
_local3 = (_arg1.map.height + Consts.AppendLineCount);
break;
};
_local6 = new MapMatrix(_local2, _local3);
_local7 = 0;
_local8 = 0;
_local7 = 0;
while (_local7 < _arg1.map.height) {
_local8 = 0;
while (_local8 < _arg1.map.width) {
_local6.matrix[(_local7 + _local5)][(_local8 + _local4)] = _arg1.map.matrix[_local7][_local8];
_local8++;
};
_local7++;
};
_arg1.target_spot.x = (_arg1.target_spot.x + _local4);
_arg1.target_spot.y = (_arg1.target_spot.y + _local5);
_local7 = 0;
while (_local7 < _arg1.elements.length) {
_local10 = _arg1.elements[_local7];
_arg1.elements[_local7].x = (_local10.x + (_local4 * Consts.cell_size));
_local10.y = (_local10.y + (_local5 * Consts.cell_size));
_local7++;
};
_local7 = 0;
while (_local7 < _arg1.units.length) {
_local11 = _arg1.units[_local7];
_local11.pos.x = (_local11.pos.x + _local4);
_local11.pos.y = (_local11.pos.y + _local5);
_local7++;
};
_local9 = false;
switch (_arg1.enemy_direction){
case Consts.Left:
_local7 = 0;
while (_local7 < Consts.AppendLineCount) {
_local8 = 0;
while (_local8 < _local6.height) {
_local6.setxy(_local7, _local8, Consts.Wall);
_local8++;
};
_local7++;
};
_local8 = 0;
while (_local8 < _local6.height) {
if (Consts.InvaderPath == _local6.getxy(Consts.AppendLineCount, _local8)){
_local7 = 0;
while (_local7 < Consts.AppendLineCount) {
_local6.setxy(_local7, _local8, Consts.InvaderPath);
_local7++;
};
_arg1.enemy_start_spot = new Position(0, _local8);
break;
};
_local8++;
};
break;
case Consts.Right:
_local7 = (_local6.width - Consts.AppendLineCount);
while (_local7 < _local6.width) {
_local8 = 0;
while (_local8 < _local6.height) {
_local6.setxy(_local7, _local8, Consts.Wall);
_local8++;
};
_local7++;
};
_local8 = 0;
while (_local8 < _local6.height) {
if (Consts.InvaderPath == _local6.getxy(((_local6.width - Consts.AppendLineCount) - 1), _local8)){
_local7 = (_local6.width - Consts.AppendLineCount);
while (_local7 < _local6.width) {
_local6.setxy(_local7, _local8, Consts.InvaderPath);
_local7++;
};
_arg1.enemy_start_spot = new Position((_local6.width - 1), _local8);
break;
};
_local8++;
};
break;
case Consts.Top:
_local7 = 0;
while (_local7 < _local6.width) {
_local8 = 0;
while (_local8 < Consts.AppendLineCount) {
_local6.setxy(_local7, _local8, Consts.Wall);
_local8++;
};
_local7++;
};
_local7 = 0;
while (_local7 < _local6.width) {
if (Consts.InvaderPath == _local6.getxy(_local7, Consts.AppendLineCount)){
_local8 = 0;
while (_local8 < Consts.AppendLineCount) {
_local6.setxy(_local7, _local8, Consts.InvaderPath);
_local8++;
};
_arg1.enemy_start_spot = new Position(_local7, 0);
break;
};
_local7++;
};
break;
case Consts.Down:
_local7 = 0;
while (_local7 < _local6.width) {
_local8 = (_local6.height - Consts.AppendLineCount);
while (_local8 < _local6.height) {
_local6.setxy(_local7, _local8, Consts.Wall);
_local8++;
};
_local7++;
};
_local7 = 0;
while (_local7 < _local6.width) {
if (Consts.InvaderPath == _local6.getxy(_local7, ((_local6.height - Consts.AppendLineCount) - 1))){
_local8 = (_local6.height - Consts.AppendLineCount);
while (_local8 < _local6.height) {
_local6.setxy(_local7, _local8, Consts.InvaderPath);
_local8++;
};
_arg1.enemy_start_spot = new Position(_local7, (_local6.height - 1));
break;
};
_local7++;
};
break;
};
_arg1.map = _local6;
if (!_arg1.enemy_start_spot){
return;
};
checkPathExistence(_arg1);
}
private function checkPathExistence(_arg1:Level):void{
var _local2:Astar;
_local2 = new Astar(_arg1.map, Consts.InvaderPath);
_local2.cell_type = Consts.InvaderPath;
if (!_local2.isPathExists(_arg1.enemy_start_spot, _arg1.target_spot)){
_arg1.enemy_start_spot = null;
};
}
}
}//package fai.loading
Section 35
//SchemaParser (fai.loading.SchemaParser)
package fai.loading {
import fai.units.*;
import flash.utils.*;
import fai.*;
public class SchemaParser {
private var units:Array;
private var weapons:Dictionary;// = null
private var schema_xml:XML;// = null
public function SchemaParser(_arg1:String):void{
schema_xml = null;
weapons = null;
units = [];
super();
schema_xml = new XML(_arg1);
weapons = new Dictionary();
}
private function initWeapons():void{
var _local1:XMLList;
var _local2:XML;
var _local3:Object;
var _local4:XMLList;
var _local5:XML;
var _local6:XMLList;
var _local7:XML;
var _local8:String;
var _local9:String;
_local1 = schema_xml.weapons.weapon;
for each (_local2 in _local1) {
_local3 = new Object();
_local3.flags = 0;
_local4 = _local2.flag;
for each (_local5 in _local4) {
_local8 = _local5.@value;
switch (_local8){
case "AntiAir":
_local3.flags = (_local3.flags | UnitFlags.AntiAir);
break;
case "AntiLand":
_local3.flags = (_local3.flags | UnitFlags.AntiLand);
break;
};
};
_local6 = _local2.param;
for each (_local7 in _local6) {
_local9 = _local7.@type;
switch (_local9){
case "i":
_local3[String(_local7.@name)] = int(_local7.@value);
break;
case "s":
_local3[String(_local7.@name)] = String(_local7.@value);
break;
};
};
weapons[unescape(String(_local2.@name))] = _local3;
};
}
public function parse(_arg1:SmartLoader):void{
var _local2:int;
var _local3:Object;
var _local4:Object;
var _local5:Unit;
var _local6:Weapon;
initWeapons();
initUnits();
_local2 = 0;
while (_local2 < units.length) {
_local3 = units[_local2];
_local4 = weapons[(_local3.type + "_WEAPON")];
_local5 = new Unit(null, 0, _local3.type);
_local5.suit_id = _local3.suit_id;
_local5.rotstep = _local3.rotstep;
_local5.sprite_width = _local3.sprite_width;
_local5.setFlags(_local3.flags);
_local5.armor = _local3.armor;
_local5.health = _local3.health;
_local5.description = unescape(_local3.description);
_local5.mapid = _local3.mapid;
_local5.build_steps = _local3.build_steps;
_local5.velocity = _local3.velocity;
_local5.full_health = _local5.health;
_local5.death_cost = _local3.death_cost;
_local5.cost = _local3.cost;
_local6 = new Weapon((_local3.type + "_WEAPON"));
if (_local4){
_local6.setFlags(_local4.flags);
_local6.eyerange = _local4.eyerange;
_local6.damage = _local4.damage;
_local6.recharge_time = _local4.recharge_time;
_local6.bullet_speed = _local4.bullet_speed;
};
_local5.setWeapon(_local6);
_arg1.addUnit(_local5);
_local2++;
};
}
private function initUnits():void{
var _local1:XMLList;
var _local2:XML;
var _local3:Object;
var _local4:XMLList;
var _local5:XML;
var _local6:XMLList;
var _local7:XML;
var _local8:String;
var _local9:String;
_local1 = schema_xml.units.unit;
for each (_local2 in _local1) {
_local3 = new Object();
_local3.flags = 0;
_local4 = _local2.flag;
for each (_local5 in _local4) {
_local8 = _local5.@value;
switch (_local8){
case "Building":
_local3.flags = (_local3.flags | UnitFlags.Building);
break;
case "Flying":
_local3.flags = (_local3.flags | UnitFlags.Flying);
break;
case "Peaceful":
_local3.flags = (_local3.flags | UnitFlags.Peaceful);
break;
case "Boss":
_local3.flags = (_local3.flags | UnitFlags.Boss);
break;
};
};
_local6 = _local2.param;
for each (_local7 in _local6) {
_local9 = _local7.@type;
switch (_local9){
case "i":
_local3[String(_local7.@name)] = int(_local7.@value);
break;
case "s":
_local3[String(_local7.@name)] = String(_local7.@value);
break;
};
};
_local3.type = unescape(String(_local2.@name));
_local3.suit_id = String(_local2.suit.@id);
units.push(_local3);
};
}
}
}//package fai.loading
Section 36
//SettingsParser (fai.loading.SettingsParser)
package fai.loading {
import fai.*;
public class SettingsParser {
private var settings_xml:XML;// = null
public function SettingsParser(_arg1:String):void{
settings_xml = null;
super();
settings_xml = new XML(_arg1);
}
public function parse(_arg1):void{
_arg1.theme = unescape(settings_xml.theme.toString());
_arg1.final_text = unescape(settings_xml.final_text.toString());
}
}
}//package fai.loading
Section 37
//SmartLoader (fai.loading.SmartLoader)
package fai.loading {
import fai.logic.*;
import fai.ui.*;
import fai.units.*;
import fai.common.*;
import fai.*;
public class SmartLoader {
private var engine:Engine;// = null
public var suits:Suits;// = null
private var error_log:String;// = ""
private var game_data:GameData;// = null
public var levels:Map;// = null
private var game;// = null
private var ui_data:UIData;// = null
public var units:Array;// = null
public function SmartLoader(_arg1:Engine):void{
engine = null;
game_data = null;
ui_data = null;
levels = null;
game = null;
units = null;
suits = null;
error_log = "";
super();
engine = _arg1;
}
public function addUnit(_arg1:Unit):void{
units.push(_arg1);
}
private function discardUnit(_arg1:Unit):void{
var _local2:int;
_local2 = 0;
_local2 = 0;
while (_local2 < units.length) {
if (units[_local2] == _arg1){
units.splice(_local2, 1);
return;
};
_local2++;
};
}
private function initArtwork():void{
game_data.addSpecial(StringConsts.sp_danimation, new Image_danimation(0, 0));
game_data.addSpecial(StringConsts.sp_debris, new Image_debris(0, 0));
game_data.addSpecial(StringConsts.sp_my_order, new Image_my_order(0, 0));
game_data.addSpecial(StringConsts.sp_hostile_order, new Image_hostile_order(0, 0));
}
public function clear():void{
}
public function addLevel(_arg1:Level):void{
var _local2:LevelPreprocessor;
_local2 = new LevelPreprocessor(_arg1);
levels.add(_arg1.number, _arg1);
}
public function levelAssetsConverted():void{
game_data.loadingErrors = error_log;
engine.dataReady(game_data, ui_data);
game_data = null;
ui_data = null;
}
public function suitsConverted():void{
var _local1:int;
var _local2:UnitSuit;
var _local3:Unit;
_local1 = 0;
_local1 = 0;
while (_local1 < suits.suits.size()) {
_local2 = suits.suits.values[_local1];
_local3 = unitBySuitId(_local2.suit_id);
game_data.addSuit(_local2);
_local1++;
};
_local1 = 0;
while (_local1 < units.length) {
game_data.addUnit(units[_local1]);
_local1++;
};
}
public function loadGame(_arg1):void{
var _local2:SettingsParser;
var _local3:SchemaParser;
game = _arg1;
ui_data = new UIData();
game_data = new GameData(engine, game);
initArtwork();
_local2 = new SettingsParser(game.settings);
_local2.parse(game);
units = new Array();
_local3 = new SchemaParser(game.schema);
_local3.parse(this);
suits = new Suits();
suits.updateSuit("suit_0", Suits.MoveSprite, new Image_beetle_body(0, 0));
suits.updateSuit("suit_0", Suits.StatusSprite, new Image_beetle_status(0, 0));
suits.updateSuit("suit_1", Suits.MoveSprite, new Image_colorado_beetle_body(0, 0));
suits.updateSuit("suit_1", Suits.StatusSprite, new Image_colorado_beetle_status(0, 0));
suits.updateSuit("suit_2", Suits.MoveSprite, new Image_moth_body(0, 0));
suits.updateSuit("suit_2", Suits.StatusSprite, new Image_moth_status(0, 0));
suits.updateSuit("suit_3", Suits.MoveSprite, new Image_bumblebee_body(0, 0));
suits.updateSuit("suit_3", Suits.StatusSprite, new Image_bumblebee_status(0, 0));
suits.updateSuit("suit_4", Suits.MoveSprite, new Image_dragonfly_body(0, 0));
suits.updateSuit("suit_4", Suits.StatusSprite, new Image_dragonfly_status(0, 0));
suits.updateSuit("suit_5", Suits.MoveSprite, new Image_worm_body(0, 0));
suits.updateSuit("suit_5", Suits.StatusSprite, new Image_worm_status(0, 0));
suits.updateSuit("suit_20", Suits.MoveSprite, new Image_small_worm_body(0, 0));
suits.updateSuit("suit_20", Suits.StatusSprite, new Image_small_worm_status(0, 0));
suits.updateSuit("suit_6", Suits.MoveSprite, new Image_caterpillar_body(0, 0));
suits.updateSuit("suit_6", Suits.StatusSprite, new Image_caterpillar_status(0, 0));
suits.updateSuit("suit_21", Suits.MoveSprite, new Image_mouse_move(0, 0));
suits.updateSuit("suit_21", Suits.StatusSprite, new Image_mouse_status(0, 0));
suits.updateSuit("suit_22", Suits.MoveSprite, new Image_rat_move(0, 0));
suits.updateSuit("suit_22", Suits.StatusSprite, new Image_rat_status(0, 0));
suits.updateSuit("suit_7", Suits.MoveSprite, new Image_cactus_body(0, 0));
suits.updateSuit("suit_7", Suits.AttackSprite, new Image_cactus_body(0, 0));
suits.updateSuit("suit_7", Suits.StatusSprite, new Image_spitting_cactus_status(0, 0));
suits.updateSuit("suit_7", Suits.BulletSprite, new Image_cactus_body(0, 0));
suits.updateSuit("suit_7", Suits.BESprite, new Image_cactus_body(0, 0));
suits.updateSuit("suit_8", Suits.MoveSprite, new Image_gas_sprayer_body(0, 0));
suits.updateSuit("suit_8", Suits.AttackSprite, new Image_gas_sprayer_body(0, 0));
suits.updateSuit("suit_8", Suits.StatusSprite, new Image_gas_sprayer_status(0, 0));
suits.updateSuit("suit_8", Suits.BulletSprite, null);
suits.updateSuit("suit_8", Suits.BESprite, new Image_gas_sprayer_body(0, 0));
suits.updateSuit("suit_9", Suits.MoveSprite, new Image_laser_gnome_body(0, 0));
suits.updateSuit("suit_9", Suits.AttackSprite, new Image_laser_gnome_body(0, 0));
suits.updateSuit("suit_9", Suits.StatusSprite, new Image_laser_gnome_status(0, 0));
suits.updateSuit("suit_9", Suits.BulletSprite, new Image_laser_gnome_bullet(0, 0));
suits.updateSuit("suit_9", Suits.BESprite, new Image_laser_gnome_be(0, 0));
suits.updateSuit("suit_10", Suits.MoveSprite, new Image_laser_towers_body(0, 0));
suits.updateSuit("suit_10", Suits.AttackSprite, new Image_laser_towers_body(0, 0));
suits.updateSuit("suit_10", Suits.StatusSprite, new Image_laser_towers_status(0, 0));
suits.updateSuit("suit_10", Suits.BulletSprite, new Image_laser_towers_body(0, 0));
suits.updateSuit("suit_10", Suits.BESprite, new Image_laser_towers_body(0, 0));
suits.updateSuit("suit_11", Suits.MoveSprite, new Image_boomerang_gnome_body(0, 0));
suits.updateSuit("suit_11", Suits.AttackSprite, new Image_boomerang_gnome_body(0, 0));
suits.updateSuit("suit_11", Suits.StatusSprite, new Image_boomerang_gnome_status(0, 0));
suits.updateSuit("suit_11", Suits.BulletSprite, new Image_boomerang_gnome_body(0, 0));
suits.updateSuit("suit_11", Suits.BESprite, new Image_danimation(0, 0));
suits.updateSuit("suit_12", Suits.MoveSprite, new Image_rocket_gnome_body(0, 0));
suits.updateSuit("suit_12", Suits.AttackSprite, new Image_rocket_gnome_body(0, 0));
suits.updateSuit("suit_12", Suits.StatusSprite, new Image_rocket_gnome_status(0, 0));
suits.updateSuit("suit_12", Suits.BulletSprite, new Image_rocket_gnome_bullet(0, 0));
suits.updateSuit("suit_12", Suits.BESprite, new Image_rocket_gnome_be(0, 0));
suits.updateSuit("suit_13", Suits.MoveSprite, new Image_chewing_gum_body(0, 0));
suits.updateSuit("suit_13", Suits.AttackSprite, new Image_chewing_gum_body(0, 0));
suits.updateSuit("suit_13", Suits.StatusSprite, new Image_chewing_gum_status(0, 0));
suits.updateSuit("suit_13", Suits.BulletSprite, new Image_chewing_gum_status(0, 0));
suits.updateSuit("suit_13", Suits.BESprite, new Image_chewing_gum_status(0, 0));
suits.updateSuit("suit_14", Suits.MoveSprite, new Image_poisoned_balls_body(0, 0));
suits.updateSuit("suit_14", Suits.AttackSprite, new Image_poisoned_balls_body(0, 0));
suits.updateSuit("suit_14", Suits.StatusSprite, new Image_poisoned_balls_status(0, 0));
suits.updateSuit("suit_14", Suits.BulletSprite, new Image_poisoned_balls_body(0, 0));
suits.updateSuit("suit_14", Suits.BESprite, new Image_poisoned_balls_body(0, 0));
suits.updateSuit("suit_15", Suits.MoveSprite, new Image_timer_bomb_body(0, 0));
suits.updateSuit("suit_15", Suits.AttackSprite, new Image_timer_bomb_body(0, 0));
suits.updateSuit("suit_15", Suits.StatusSprite, new Image_timer_bomb_status(0, 0));
suits.updateSuit("suit_15", Suits.BulletSprite, new Image_timer_bomb_body(0, 0));
suits.updateSuit("suit_15", Suits.BESprite, new Image_timer_bomb_body(0, 0));
suitsConverted();
levelAssetsConverted();
}
private function unitBySuitId(_arg1:String):Unit{
var _local2:int;
_local2 = 0;
_local2 = 0;
while (_local2 < units.length) {
if (units[_local2].suit_id == _arg1){
return (units[_local2]);
};
_local2++;
};
return (null);
}
private function logError(_arg1:String):void{
trace(_arg1);
}
}
}//package fai.loading
Section 38
//Suits (fai.loading.Suits)
package fai.loading {
import fai.units.*;
import fai.common.*;
import flash.display.*;
public class Suits {
public var suits:Map;// = null
public static const MoveSprite:String = "body";
public static const StatusSprite:String = "status";
public static const BESprite:String = "be";
public static const AttackSprite:String = "attack";
public static const BulletSprite:String = "bullet";
public function Suits():void{
suits = null;
super();
suits = new Map();
}
public function updateSuit(_arg1:String, _arg2:String, _arg3:BitmapData):void{
var _local4:UnitSuit;
_local4 = suits.get(_arg1);
if (!_local4){
_local4 = new UnitSuit();
_local4.suit_id = _arg1;
suits.add(_arg1, _local4);
};
switch (_arg2){
case StatusSprite:
_local4.status_bitmap = _arg3;
break;
case MoveSprite:
_local4.move_bitmap = _arg3;
break;
case AttackSprite:
_local4.attack_bitmap = _arg3;
break;
case BulletSprite:
_local4.bullet_bitmap = _arg3;
break;
case BESprite:
_local4.be_bitmap = _arg3;
break;
};
}
}
}//package fai.loading
Section 39
//UIData (fai.loading.UIData)
package fai.loading {
import fai.common.*;
import flash.display.*;
import flash.utils.*;
public class UIData {
public static var buttons:Dictionary = new Dictionary();
public static var mimages:Dictionary = new Dictionary();
public function addButton(_arg1:String, _arg2:BitmapData):void{
buttons[_arg1] = _arg2;
}
public function getButtonBitmap(_arg1:String):AnimatedBitmap{
var _local2:BitmapData;
_local2 = buttons[_arg1];
if (!_local2){
return (null);
};
return (new AnimatedBitmap(_local2, _local2.width, _local2.height));
}
public function addMenuImage(_arg1:String, _arg2:BitmapData):void{
mimages[_arg1] = _arg2;
}
public function clear():void{
buttons = new Dictionary();
mimages = new Dictionary();
}
public function getMenuItemBitmap(_arg1:String):AnimatedBitmap{
var _local2:BitmapData;
_local2 = mimages[_arg1];
return (new AnimatedBitmap(_local2, _local2.width, _local2.height));
}
}
}//package fai.loading
Section 40
//DataProxy (fai.logic.DataProxy)
package fai.logic {
import fai.*;
public class DataProxy {
public static function upgradeCost(_arg1:int, _arg2:String):int{
switch (_arg1){
case UnitUpgrades.FASTER_RELOAD:
switch (_arg2){
case StringConsts.pellet_gnome:
return (50);
case StringConsts.bomb_gnome:
return (75);
case StringConsts.boomerang_gnome:
return (100);
case StringConsts.laser_towers:
return (300);
case StringConsts.spitting_cactus:
return (100);
case StringConsts.gas_sprayer:
return (125);
};
break;
case UnitUpgrades.SUPER_FAST_RELOAD:
switch (_arg2){
case StringConsts.pellet_gnome:
return (75);
case StringConsts.bomb_gnome:
return (100);
case StringConsts.boomerang_gnome:
return (150);
case StringConsts.laser_towers:
return (750);
case StringConsts.spitting_cactus:
return (150);
case StringConsts.gas_sprayer:
return (150);
};
break;
case UnitUpgrades.EXTRA_ACTION_TIME:
return (450);
case UnitUpgrades.SUPER_ACTION_TIME:
return (850);
case UnitUpgrades.EXTRA_DAMAGE:
switch (_arg2){
case StringConsts.pellet_gnome:
return (50);
case StringConsts.bomb_gnome:
return (75);
case StringConsts.boomerang_gnome:
return (100);
case StringConsts.spitting_cactus:
return (90);
};
break;
case UnitUpgrades.DOUBLE_EXTRA_DAMAGE:
switch (_arg2){
case StringConsts.pellet_gnome:
return (75);
case StringConsts.bomb_gnome:
return (100);
case StringConsts.boomerang_gnome:
return (125);
case StringConsts.spitting_cactus:
return (215);
};
break;
case UnitUpgrades.SUPER_DAMAGE:
switch (_arg2){
case StringConsts.pellet_gnome:
return (150);
case StringConsts.bomb_gnome:
return (175);
case StringConsts.boomerang_gnome:
return (225);
case StringConsts.spitting_cactus:
return (305);
};
break;
case UnitUpgrades.EXTRA_RANGE:
switch (_arg2){
case StringConsts.pellet_gnome:
return (50);
case StringConsts.bomb_gnome:
return (75);
case StringConsts.boomerang_gnome:
return (100);
case StringConsts.gas_sprayer:
return (100);
};
break;
case UnitUpgrades.DOUBLE_EXTRA_RANGE:
switch (_arg2){
case StringConsts.pellet_gnome:
return (75);
case StringConsts.bomb_gnome:
return (150);
case StringConsts.boomerang_gnome:
return (175);
case StringConsts.gas_sprayer:
return (125);
};
break;
case UnitUpgrades.RADAR_RANGE:
switch (_arg2){
case StringConsts.pellet_gnome:
return (150);
case StringConsts.bomb_gnome:
return (200);
case StringConsts.boomerang_gnome:
return (250);
case StringConsts.gas_sprayer:
return (175);
};
break;
};
return (115);
}
}
}//package fai.logic
Section 41
//Engine (fai.logic.Engine)
package fai.logic {
import fai.loading.*;
import fai.ui.*;
import flash.media.*;
import fai.units.*;
import flash.events.*;
import fai.common.*;
import flash.display.*;
import fai.goals.*;
import fai.goalsystem.*;
import flash.utils.*;
import fai.*;
import flash.geom.*;
public class Engine {
public var volumeOff:Boolean;// = false
public var actions:PlayerActions;// = null
public var scenario:Scenario;// = null
public var score:int;// = 0
public var events:GameEvents;// = null
public var volume:Number;// = 1
public var game_process:GameProcess;// = null
public var hostilecolor:uint;// = 0xFF0000
public var paused:Boolean;// = false
private var ui_holder:Sprite;// = null
public var mycolor:uint;// = 0xFF
public var money:int;// = 0
public var uidata:UIData;// = null
public var paused_at_start:Boolean;// = false
private var last_loaded_level:Level;// = null
private var game_data:GameData;// = null
private var game_board:GameBoard;// = null
private var level_life_points:int;// = 0
public var play_window:PlayWindow;// = null
public var global_stage;// = null
public var music_channel:SoundChannel;// = null
public var goal_system:GoalSystem;// = null
private var vd_timer:Timer;// = null
private var music_sound:Sound;// = null
public static var stageRadius = 0;
public function Engine(_arg1):void{
global_stage = null;
money = 0;
score = 0;
mycolor = 0xFF;
hostilecolor = 0xFF0000;
paused = false;
goal_system = null;
events = null;
play_window = null;
game_process = null;
actions = null;
game_board = null;
scenario = null;
last_loaded_level = null;
volume = 1;
volumeOff = false;
game_data = null;
uidata = null;
level_life_points = 0;
ui_holder = null;
vd_timer = null;
music_sound = null;
music_channel = null;
paused_at_start = false;
super();
global_stage = _arg1;
actions = new PlayerActions(this);
}
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 log(_arg1:String):void{
play_window.message_mc.message_txt.text = _arg1;
play_window.message_mc.visible = true;
play_window.message_mc.gotoAndPlay("start_animation");
}
public function addResources(_arg1:int):void{
money = (money + _arg1);
play_window.stats.money = (play_window.stats.money + _arg1);
}
public function clearAll():void{
if (!game_board){
return;
};
stopMusic();
events.unregister();
events = null;
scenario.destroy();
scenario = null;
actions.clear();
play_window.destroy();
ui_holder.removeChild(play_window);
play_window = null;
game_board.destroy();
ui_holder.removeChild(game_board);
game_board = null;
GameStage.play_holder.removeChild(ui_holder);
ui_holder = null;
game_process.destroy();
game_process = null;
goal_system = null;
paused = false;
paused_at_start = false;
}
public function get lastLevel():Level{
return (last_loaded_level);
}
private function defeatHandler(_arg1:TimerEvent):void{
vd_timer.stop();
vd_timer.removeEventListener(TimerEvent.TIMER, defeatHandler);
vd_timer = null;
if (!paused){
pause();
};
play_window.stats.final_victory.visible = false;
play_window.stats.defeat();
play_window.stats.start();
play_window.stats.visible = true;
}
public function get gameBoard():GameBoard{
return (game_board);
}
public function get gameProcess():GameProcess{
return (game_process);
}
public function victory():void{
scenario.stop();
vd_timer = new Timer(2000, 1);
vd_timer.addEventListener(TimerEvent.TIMER, victoryHandler);
vd_timer.start();
}
public function get levelLifePoints():int{
return (level_life_points);
}
public function dataReady(_arg1:GameData, _arg2:UIData):void{
game_data = _arg1;
uidata = _arg2;
GameStage.welcomeScreen.loadEnded();
GameStage.welcomeScreen.welcome(this);
}
public function getColor(_arg1:int):uint{
if (_arg1 == Consts.myId){
return (mycolor);
};
return (hostilecolor);
}
public function playLevel(_arg1:Level):void{
if (!_arg1){
return;
};
clearAll();
last_loaded_level = _arg1;
money = _arg1.initial_money;
score = 0;
goal_system = new GoalSystem();
events = new GameEvents(this);
ui_holder = new Sprite();
GameStage.play_holder.addChild(ui_holder);
game_board = new GameBoard(this);
ui_holder.addChild(game_board);
play_window = new PlayWindow();
play_window.initialize(this);
ui_holder.addChild(play_window);
game_process = new GameProcess(this);
game_board.load(_arg1);
play_window.createCustomCursor();
level_life_points = _arg1.level_health;
scenario = new Scenario(this, _arg1);
stageRadius = Consts.ScreenHeight;
scenario.start();
events.register();
play_window.updateResources();
play_window.updateInfo();
music_sound = new Sound_level_music();
playMusic();
paused_at_start = true;
if (!paused_at_start){
} else {
pause();
};
}
public function playSoundPos(_arg1:Sound, _arg2:Position):void{
var _local3:SoundTransform;
var _local4:int;
var _local5:int;
var _local6:Number;
if (((((((!(_arg1)) || (!(volume)))) || (volumeOff))) || (paused))){
return;
};
_local3 = new SoundTransform();
_local4 = ((Consts.ScreenHeight / 2) - (_arg2.x * Consts.cell_size));
_local5 = ((Consts.ScreenHeight / 2) - (_arg2.y * 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 playSound(_arg1:int):void{
switch (_arg1){
case SoundConsts.victory:
playSoundData(new Sound_victory());
break;
case SoundConsts.upgrade:
playSoundData(new Sound_upgrade());
break;
case SoundConsts.click:
playSoundData(new Sound_click());
break;
case SoundConsts.unpause:
playSoundData(new Sound_unpause());
break;
case SoundConsts.game_over:
playSoundData(new Sound_game_over());
break;
case SoundConsts.sell_turret:
playSoundData(new Sound_sell_turret());
break;
case SoundConsts.failed:
playSoundData(new Sound_failed());
break;
case SoundConsts.bomb_explosion:
playSoundData(new Sound_bomb_explosion());
break;
case SoundConsts.gas:
playSoundData(new Sound_gas());
break;
case SoundConsts.next_wave:
playSoundData(new Sound_next_wave());
break;
case SoundConsts.pellet:
playSoundData(new Sound_pellet());
break;
case SoundConsts.placing:
playSoundData(new Sound_placing());
break;
case SoundConsts.spear:
playSoundData(new Sound_spear());
break;
case SoundConsts.boom:
playSoundData(new Sound_boom());
break;
case SoundConsts.boomerang:
playSoundData(new Sound_boomerang());
break;
case SoundConsts.lasers:
playSoundData(new Sound_lasers());
break;
case SoundConsts.rocket:
playSoundData(new Sound_rocket());
break;
case SoundConsts.spitting:
playSoundData(new Sound_spitting());
break;
case SoundConsts.poisoned_balls:
playSoundData(new Sound_poison_ball());
break;
};
}
public function get gameData():GameData{
return (game_data);
}
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 isMoneyEnough(_arg1:String):Boolean{
return ((game_data.params(_arg1).cost <= money));
}
public function stopMusic():void{
if (music_channel){
music_channel.stop();
music_channel = null;
};
}
public function upgradeUnit(_arg1:Unit):void{
var _local2:Unit;
var _local3:int;
var _local4:AnimatedBitmap;
if ((((_arg1.upgrade_level >= 5)) || (gameProcess.builder.inBuilding(_arg1)))){
return;
};
_local2 = game_data.params(_arg1.type);
_arg1.upgrade_level++;
_arg1.armor++;
_local3 = _local2.full_health;
trace("before ", _local3, _arg1.upgrade_level);
_local3 = (_local3 << _arg1.upgrade_level);
trace("after", _local3);
_arg1.full_health = _local3;
_arg1.health = (_arg1.health << _arg1.upgrade_level);
_local4 = game_data.getSpecialBitmap(((_arg1.mapid == Consts.myId)) ? StringConsts.sp_my_order : StringConsts.sp_hostile_order, 0);
_arg1.sprite.addOrder(_local4, _arg1.upgrade_level);
if (game_process.isUnitInSelection(_arg1)){
play_window.updateInfo();
};
play_window.updateResources();
}
public function isActive():Boolean{
return (!((game_board == null)));
}
public function showUI(_arg1:Boolean=true):void{
ui_holder.visible = _arg1;
}
public function invaderPassed(_arg1:Unit):void{
var _local2:int;
var _local3:int;
level_life_points = (level_life_points - _arg1.cost);
_arg1.sprite.visible = false;
if (level_life_points < 0){
level_life_points = 0;
};
play_window.resources.setLifePoints(level_life_points, last_loaded_level.level_health);
_arg1.death_cost = 0;
game_board.destroyUnit(_arg1);
playSound(SoundConsts.failed);
play_window.stats.lost++;
goal_system.add(new TextPopupGoal(this, ("-" + _arg1.cost.toString()), (_arg1.pos.x * Consts.cell_size), (_arg1.pos.y * Consts.cell_size)));
_local2 = ((1 - (level_life_points / 100)) * playWindow.garden_items.length);
_local3 = 0;
_local3 = 0;
while (_local3 < _local2) {
if (playWindow.garden_items[_local3].alive){
goal_system.add(new ItemShrinkGoal(this, playWindow.garden_items[_local3]));
};
playWindow.garden_items[_local3].alive = false;
_local3++;
};
}
public function get uiData():UIData{
return (uidata);
}
private function victoryHandler(_arg1:TimerEvent):void{
var _local2:LevelSelection;
vd_timer.stop();
vd_timer.removeEventListener(TimerEvent.TIMER, victoryHandler);
vd_timer = null;
if (!paused){
pause();
};
_local2 = GameStage.welcomeScreen.levelSelection;
play_window.stats.final_victory.visible = false;
if (lastLevel.number >= (gameData.getLevels().length - 1)){
finalVictory();
_local2.saveLevels();
};
if (_local2.current_level == lastLevel.number){
_local2.current_level++;
_local2.saveLevels();
};
play_window.stats.victory();
play_window.stats.start();
play_window.stats.visible = true;
}
public function playMusic():void{
var _local1:SoundTransform;
stopMusic();
if (((!(volumeOff)) && (music_sound))){
_local1 = new SoundTransform();
_local1.volume = volume;
music_channel = music_sound.play(0, 25, _local1);
};
}
public function get playWindow():PlayWindow{
return (play_window);
}
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:Unit;
var _local4:int;
var _local5:*;
var _local6:int;
if ((((0 == _arg2)) || ((_arg1.upgrade_level >= 5)))){
return;
};
_local3 = game_data.params(_arg1.type);
_arg1.upgrade_level = _arg2;
_arg1.armor = (_local3.armor * _arg2);
if (_arg1.armor == 0){
_arg1.armor = _arg2;
};
_local4 = _local3.full_health;
_local4 = (_local4 << _arg1.upgrade_level);
_arg1.full_health = _local4;
_arg1.health = (_arg1.health << _arg1.upgrade_level);
switch (_arg2){
case 1:
_arg1.full_health = (_arg1.full_health * 2.5);
_arg1.health = (_arg1.health * 2.5);
break;
case 2:
_arg1.full_health = (_arg1.full_health * 3.5);
_arg1.health = (_arg1.health * 3.5);
break;
case 3:
_arg1.full_health = (_arg1.full_health * 5);
_arg1.health = (_arg1.health * 5);
break;
case 4:
if ((((((((StringConsts.mouse == _arg1.type)) || ((StringConsts.rat == _arg1.type)))) || ((StringConsts.caterpillar == _arg1.type)))) || ((StringConsts.worm == _arg1.type)))){
_arg1.full_health = (_arg1.full_health * 4);
_arg1.health = (_arg1.health * 4);
} else {
_arg1.full_health = (_arg1.full_health * 7);
_arg1.health = (_arg1.health * 7);
};
break;
case 5:
if ((((((((StringConsts.mouse == _arg1.type)) || ((StringConsts.rat == _arg1.type)))) || ((StringConsts.caterpillar == _arg1.type)))) || ((StringConsts.worm == _arg1.type)))){
_arg1.full_health = (_arg1.full_health * 4);
_arg1.health = (_arg1.health * 4);
} else {
_arg1.full_health = (_arg1.full_health * 6.5);
_arg1.health = (_arg1.health * 6.5);
};
break;
};
_local5 = null;
_local6 = 0;
while (_local6 < _arg2) {
_local5 = new UnitLevelOrder();
_arg1.sprite.addOrder(_local5, (_local6 + 1));
_local6++;
};
if (game_process.isUnitInSelection(_arg1)){
play_window.updateInfo();
};
play_window.updateResources();
}
public function pause():void{
game_board.removeBuildCursor();
if (!paused){
stopMusic();
if (paused_at_start){
playWindow.click_any_dialog.visible = true;
} else {
playWindow.pause_mc.visible = true;
playWindow.pause_mc.gotoAndPlay("pause");
};
events.unregister();
if (scenario){
scenario.stop();
};
} else {
if (paused_at_start){
paused_at_start = false;
playWindow.clearClickAnyDialog();
} else {
playWindow.pause_mc.stop();
playWindow.pause_mc.visible = false;
playSound(SoundConsts.unpause);
};
playMusic();
events.register();
if (scenario){
scenario.run();
};
};
paused = !(paused);
}
}
}//package fai.logic
Section 42
//GameBoard (fai.logic.GameBoard)
package fai.logic {
import fai.ui.*;
import fai.units.*;
import fai.common.*;
import flash.display.*;
import fai.goals.*;
import fai.*;
import flash.geom.*;
public class GameBoard extends Sprite {
public var resourcelayer:Sprite;// = null
public var map_width:int;// = 0
public var resources:Camp;// = null
private var invader_road;// = 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 backlayer: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;
backlayer = null;
resourcelayer = null;
unitlayer = null;
groundlayer = null;
airlayer = null;
bulletlayer = null;
selshape = null;
invader_road = 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);
unitlayer.removeChild(backlayer);
backlayer = 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.gameData.createUnit(_arg1, _arg2);
_local6.pos.set(_arg3, _arg4);
addUnit(_local6);
drawUnit(_local6);
if (_arg5){
if (!_local6.flag(UnitFlags.Peaceful)){
_local7 = ((_local6.mapid == Consts.myId)) ? enemy_camp : my_camp;
_local6.life.attack(_local7, true);
};
};
return (_local6);
}
private function testObjects(_arg1, _arg2:Number, _arg3):Boolean{
var _local4:Point;
var _local5:Point;
_local4 = new Point(_arg1.x, _arg1.y);
_local5 = unitlayer.localToGlobal(_local4);
if (_arg3.hitTestPoint(_local5.x, _local5.y, true)){
return (false);
};
_local4 = new Point((_arg1.x + (_arg2 / 2)), _arg1.y);
_local5 = unitlayer.localToGlobal(_local4);
if (_arg3.hitTestPoint(_local5.x, _local5.y, true)){
return (false);
};
_local4 = new Point((_arg1.x - (_arg2 / 2)), _arg1.y);
_local5 = unitlayer.localToGlobal(_local4);
if (_arg3.hitTestPoint(_local5.x, _local5.y, true)){
return (false);
};
_local4 = new Point(_arg1.x, (_arg1.y - (_arg2 / 2)));
_local5 = unitlayer.localToGlobal(_local4);
if (_arg3.hitTestPoint(_local5.x, _local5.y, true)){
return (false);
};
_local4 = new Point(_arg1.x, (_arg1.y + (_arg2 / 2)));
_local5 = unitlayer.localToGlobal(_local4);
if (_arg3.hitTestPoint(_local5.x, _local5.y, true)){
return (false);
};
return (true);
}
private function removeUnit(_arg1:Unit):void{
var _local2:Camp;
var _local3:int;
_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.mapid != Consts.hostileId){
_local3 = 0;
if (_arg1.flag(UnitFlags.Flying)){
airworld.setpos(_arg1.pos, _local3);
} else {
if (_arg1.sprite_width > Consts.cell_size){
setUnitPos(_arg1, _local3);
} else {
world.setpos(_arg1.pos, _local3);
};
};
};
}
private function testCursorGraphically():Boolean{
var _local1:Number;
var _local2:int;
var _local3:Unit;
_local1 = (build_cursor.spritewidth * 0.8);
if (!testObjects(build_cursor, _local1, invader_road)){
return (false);
};
if (!testObjects(build_cursor, _local1, engine.playWindow.hedge)){
return (false);
};
_local2 = 0;
_local2 = 0;
while (_local2 < my_camp.units.length) {
_local3 = my_camp.units[_local2];
if (_local3.type == StringConsts.laser_towers){
if (!testTowersAndObject(build_cursor, _local1, _local3.sprite.body, _local3.lt_angle)){
return (false);
};
} else {
if (checkUnitCollision(build_cursor, _local1, _local3.sprite, (_local3.sprite_width * 0.75))){
return (false);
};
};
_local2++;
};
return (true);
}
public function centerScreen(_arg1:Unit):void{
var _local2:int;
var _local3:int;
}
public function wipeUnit(_arg1:Unit):void{
if ((((((_arg1.type == StringConsts.chewing_gum)) || ((_arg1.type == StringConsts.poisoned_balls)))) || ((_arg1.type == StringConsts.timer_bomb)))){
resourcelayer.removeChild(_arg1.sprite);
} else {
if (_arg1.flag(UnitFlags.Flying)){
airlayer.removeChild(_arg1.sprite);
} else {
groundlayer.removeChild(_arg1.sprite);
};
};
}
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.mapid == Consts.myId)) && (_arg1.flag(UnitFlags.Building)))){
_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.width)) && ((_local6 >= 0)))) && ((_local7 >= 0)))) && ((_local7 < _local3.height)))) && (!((_local3.getxy(_local6, _local7) == Consts.InvaderPath))))){
_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);
backlayer = new Sprite();
unitlayer.addChildAt(backlayer, 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();
}
private function testAddMeasures():Boolean{
var _local1:Number;
_local1 = (build_cursor.spritewidth * 0.2);
if (!testObjects(build_cursor, _local1, invader_road)){
return (true);
};
return (false);
}
public function createBuildingCursor(_arg1:String):void{
var _local2:Unit;
var _local3:BitmapData;
var _local4:AnimatedBitmap;
removeBuildCursor();
_local2 = engine.gameData.params(_arg1);
_local3 = engine.gameData.getBody(_local2.suit_id);
_local4 = new AnimatedBitmap(_local3, _local2.sprite_width, _local3.height);
build_cursor = new BuildCursor(_arg1, _local4, _local2.weapon.eyerange, _local2.cost, _local2.sprite_width);
build_cursor.visible = engine.events.mouseWithinMap;
unitlayer.addChild(build_cursor);
}
public function destroyUnit(_arg1:Unit):void{
_arg1.health = 0;
removeUnit(_arg1);
_arg1.sprite.stopBuilding();
if (_arg1.mapid == Consts.myId){
};
if (engine.game_process.isUnitInSelection(_arg1)){
engine.game_process.deselectUnit(_arg1);
};
checkCursor();
_arg1.life.deactivate();
engine.play_window.updateResources();
}
public function removeBuildCursor():void{
if (build_cursor){
build_cursor.destroy();
unitlayer.removeChild(build_cursor);
build_cursor = null;
};
}
private function testLaserTowersGraphically():Boolean{
var _local1:Number;
var _local2:int;
var _local3:Unit;
_local1 = (build_cursor.spritewidth * 0.8);
if (!testTowersAndObject(build_cursor, _local1, invader_road, build_cursor.angle)){
return (false);
};
if (!testTowersAndObject(build_cursor, _local1, engine.playWindow.hedge, build_cursor.angle)){
return (false);
};
_local2 = 0;
_local2 = 0;
while (_local2 < my_camp.units.length) {
_local3 = my_camp.units[_local2];
if (!testTowersAndObject(build_cursor, _local1, _local3.sprite.body, build_cursor.angle)){
return (false);
};
_local2++;
};
return (true);
}
public function checkCursor():void{
var _local1:uint;
var _local2:uint;
var _local3:Boolean;
if (build_cursor != null){
build_cursor.visible = true;
_local1 = int(((unitlayer.mouseX / Consts.cell_size) + 0.5));
_local2 = int(((unitlayer.mouseY / Consts.cell_size) + 0.5));
_local3 = true;
build_cursor.x = unitlayer.mouseX;
build_cursor.y = unitlayer.mouseY;
if ((((_local1 >= map_width)) || ((_local2 >= map_height)))){
_local3 = false;
} else {
if (build_cursor.type == StringConsts.laser_towers){
_local3 = testLaserTowersGraphically();
} else {
if ((((((build_cursor.type == StringConsts.chewing_gum)) || ((build_cursor.type == StringConsts.poisoned_balls)))) || ((build_cursor.type == StringConsts.timer_bomb)))){
_local3 = testAddMeasures();
} else {
_local3 = testCursorGraphically();
};
};
};
build_cursor.setGood(_local3);
};
}
private function disposeMap(_arg1:Level):void{
}
private function addUnit(_arg1:Unit):void{
if (_arg1.mapid != Consts.hostileId){
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 testTowersAndObject(_arg1, _arg2:Number, _arg3, _arg4:Number):Boolean{
var _local5:Number;
var _local6:Number;
var _local7:Point;
var _local8:Point;
_local5 = 41;
_local6 = 24;
_local7 = new Point(_arg1.x, (_arg1.y - _local5));
_local8 = unitlayer.localToGlobal(_local7);
if (0 == _arg4){
if (_arg3.hitTestPoint(_local8.x, _local8.y, true)){
return (false);
};
_local7 = new Point(_arg1.x, (_arg1.y + _local5));
_local8 = unitlayer.localToGlobal(_local7);
if (_arg3.hitTestPoint(_local8.x, _local8.y, true)){
return (false);
};
_local7 = new Point(_arg1.x, ((_arg1.y - _local5) - (_local6 / 2)));
_local8 = unitlayer.localToGlobal(_local7);
if (_arg3.hitTestPoint(_local8.x, _local8.y, true)){
return (false);
};
_local7 = new Point(_arg1.x, ((_arg1.y - _local5) + (_local6 / 2)));
_local8 = unitlayer.localToGlobal(_local7);
if (_arg3.hitTestPoint(_local8.x, _local8.y, true)){
return (false);
};
_local7 = new Point((_arg1.x + (_local6 / 2)), (_arg1.y - _local5));
_local8 = unitlayer.localToGlobal(_local7);
if (_arg3.hitTestPoint(_local8.x, _local8.y, true)){
return (false);
};
_local7 = new Point((_arg1.x - (_local6 / 2)), (_arg1.y - _local5));
_local8 = unitlayer.localToGlobal(_local7);
if (_arg3.hitTestPoint(_local8.x, _local8.y, true)){
return (false);
};
_local7 = new Point((_arg1.x - (_local6 / 2)), (_arg1.y + _local5));
_local8 = unitlayer.localToGlobal(_local7);
if (_arg3.hitTestPoint(_local8.x, _local8.y, true)){
return (false);
};
_local7 = new Point((_arg1.x + (_local6 / 2)), (_arg1.y + _local5));
_local8 = unitlayer.localToGlobal(_local7);
if (_arg3.hitTestPoint(_local8.x, _local8.y, true)){
return (false);
};
_local7 = new Point(_arg1.x, ((_arg1.y + _local5) + (_local6 / 2)));
_local8 = unitlayer.localToGlobal(_local7);
if (_arg3.hitTestPoint(_local8.x, _local8.y, true)){
return (false);
};
_local7 = new Point(_arg1.x, ((_arg1.y + _local5) - (_local6 / 2)));
_local8 = unitlayer.localToGlobal(_local7);
if (_arg3.hitTestPoint(_local8.x, _local8.y, true)){
return (false);
};
} else {
if (_arg4 == 90){
_local7 = new Point((_arg1.x - _local5), _arg1.y);
_local8 = unitlayer.localToGlobal(_local7);
if (_arg3.hitTestPoint(_local8.x, _local8.y, true)){
return (false);
};
_local7 = new Point((_arg1.x + _local5), _arg1.y);
_local8 = unitlayer.localToGlobal(_local7);
if (_arg3.hitTestPoint(_local8.x, _local8.y, true)){
return (false);
};
_local7 = new Point(((_arg1.x - _local5) - (_local6 / 2)), _arg1.y);
_local8 = unitlayer.localToGlobal(_local7);
if (_arg3.hitTestPoint(_local8.x, _local8.y, true)){
return (false);
};
_local7 = new Point(((_arg1.x - _local5) + (_local6 / 2)), _arg1.y);
_local8 = unitlayer.localToGlobal(_local7);
if (_arg3.hitTestPoint(_local8.x, _local8.y, true)){
return (false);
};
_local7 = new Point((_arg1.x - _local5), (_arg1.y + (_local6 / 2)));
_local8 = unitlayer.localToGlobal(_local7);
if (_arg3.hitTestPoint(_local8.x, _local8.y, true)){
return (false);
};
_local7 = new Point((_arg1.x - _local5), (_arg1.y - (_local6 / 2)));
_local8 = unitlayer.localToGlobal(_local7);
if (_arg3.hitTestPoint(_local8.x, _local8.y, true)){
return (false);
};
_local7 = new Point((_arg1.x + _local5), (_arg1.y - (_local6 / 2)));
_local8 = unitlayer.localToGlobal(_local7);
if (_arg3.hitTestPoint(_local8.x, _local8.y, true)){
return (false);
};
_local7 = new Point((_arg1.x + _local5), (_arg1.y + (_local6 / 2)));
_local8 = unitlayer.localToGlobal(_local7);
if (_arg3.hitTestPoint(_local8.x, _local8.y, true)){
return (false);
};
_local7 = new Point(((_arg1.x + _local5) + (_local6 / 2)), _arg1.y);
_local8 = unitlayer.localToGlobal(_local7);
if (_arg3.hitTestPoint(_local8.x, _local8.y, true)){
return (false);
};
_local7 = new Point(((_arg1.x + _local5) - (_local6 / 2)), _arg1.y);
_local8 = unitlayer.localToGlobal(_local7);
if (_arg3.hitTestPoint(_local8.x, _local8.y, true)){
return (false);
};
};
};
return (true);
}
public function positionLayers():void{
unitlayer.x = (Consts.cell_size / 2);
unitlayer.y = (Consts.cell_size / 2);
backlayer.x = (-(Consts.cell_size) / 2);
backlayer.y = (-(Consts.cell_size) / 2);
}
public function moveMap(_arg1:int, _arg2:int):void{
var _local3:int;
var _local4:int;
var _local5:int;
_local3 = (maplayer.x + _arg1);
_local4 = (maplayer.y + _arg2);
_local5 = Math.floor(((Consts.ScreenWidth / Consts.cell_size) + 0.5));
if (_local3 > 0){
maplayer.x = 0;
} 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:Level):void{
var _local2:*;
var _local3:Unit;
var _local4:Unit;
map_width = 15;
map_height = 16;
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();
backlayer.addChild(_arg1.level_back);
invader_road = _arg1.level_back.invader_road;
_local2 = 0;
while (_local2 < _arg1.units.length) {
_local3 = _arg1.units[_local2];
_local4 = buildUnit(_local3.type, _local3.mapid, _local3.pos.x, _local3.pos.y, true);
_local2++;
};
disposeMap(_arg1);
}
public function drawUnit(_arg1:Unit):void{
if ((((((_arg1.type == StringConsts.chewing_gum)) || ((_arg1.type == StringConsts.poisoned_balls)))) || ((_arg1.type == StringConsts.timer_bomb)))){
resourcelayer.addChild(_arg1.sprite);
} else {
if (_arg1.flag(UnitFlags.Flying)){
airlayer.addChildAt(_arg1.sprite, 0);
} else {
groundlayer.addChildAt(_arg1.sprite, 0);
};
};
}
private function checkUnitCollision(_arg1, _arg2:Number, _arg3, _arg4:Number):Boolean{
var _local5:Number;
var _local6:Number;
_local5 = Utils.distance2(_arg1, _arg3);
_local6 = ((_arg2 / 2) + (_arg4 / 2));
return ((_local5 < (_local6 * _local6)));
}
}
}//package fai.logic
Section 43
//GameEvents (fai.logic.GameEvents)
package fai.logic {
import fai.ui.*;
import fai.units.*;
import flash.events.*;
import fai.common.*;
import fai.*;
import flash.ui.*;
public class GameEvents {
private var engine:Engine;// = null
public var downPoint:Position;
public var mouseWithinMap:Boolean;// = false
public var selecting:Boolean;// = false
public var cursorpos:Position;
public function GameEvents(_arg1:Engine):void{
engine = null;
mouseWithinMap = false;
selecting = false;
downPoint = new Position();
cursorpos = new Position();
super();
engine = _arg1;
}
private function onmapmouseover(_arg1:MouseEvent):void{
mouseWithinMap = true;
if (engine.gameBoard.build_cursor){
engine.gameBoard.build_cursor.visible = true;
} else {
if (engine.play_window.custom_cursor.enabled){
engine.play_window.custom_cursor.show();
};
};
}
private function onmoving(_arg1:MouseEvent):void{
cursorpos.x = _arg1.stageX;
cursorpos.y = _arg1.stageY;
engine.gameBoard.checkCursor();
if (engine.play_window.custom_cursor.enabled){
engine.play_window.custom_cursor.x = engine.gameBoard.unitlayer.mouseX;
engine.play_window.custom_cursor.y = engine.gameBoard.unitlayer.mouseY;
};
if (selecting){
if (!_arg1.buttonDown){
engine.game_process.endSelection();
return;
};
};
}
private function onmouseup(_arg1:MouseEvent):void{
if (selecting){
engine.game_process.endSelection();
};
}
private function onKeyDown(_arg1:KeyboardEvent):void{
var _local2:Unit;
if (Keyboard.ESCAPE == _arg1.keyCode){
engine.gameBoard.removeBuildCursor();
engine.actions.endAction();
} else {
if (Keyboard.CONTROL == _arg1.keyCode){
if (((engine.gameBoard.build_cursor) && ((engine.gameBoard.build_cursor.type == StringConsts.laser_towers)))){
if (engine.gameBoard.build_cursor.angle == 0){
engine.gameBoard.build_cursor.setAngle(90);
} else {
engine.gameBoard.build_cursor.setAngle(0);
};
engine.gameBoard.checkCursor();
};
} else {
if (Keyboard.SPACE == _arg1.keyCode){
engine.pause();
} else {
if (Keyboard.F12 == _arg1.keyCode){
engine.play_window.menuPressed(null);
} else {
_local2 = null;
switch (_arg1.charCode){
case 49:
engine.actions.buttonPressed(StringConsts.pellet_gnome);
break;
case 50:
engine.actions.buttonPressed(StringConsts.bomb_gnome);
break;
case 51:
engine.actions.buttonPressed(StringConsts.boomerang_gnome);
break;
case 52:
engine.actions.buttonPressed(StringConsts.spitting_cactus);
break;
case 53:
engine.actions.buttonPressed(StringConsts.gas_sprayer);
break;
case 54:
engine.actions.buttonPressed(StringConsts.laser_towers);
break;
case 55:
engine.actions.buttonPressed(StringConsts.chewing_gum);
break;
case 56:
engine.actions.buttonPressed(StringConsts.timer_bomb);
break;
case 57:
engine.actions.buttonPressed(StringConsts.poisoned_balls);
break;
case 90:
case 122:
engine.scenario.sendNext();
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;
};
};
};
};
};
}
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.gameBoard.unitlayer.removeEventListener(MouseEvent.MOUSE_DOWN, on_mouse_down);
engine.gameBoard.unitlayer.removeEventListener(MouseEvent.MOUSE_UP, onmouseup);
engine.gameBoard.unitlayer.removeEventListener(MouseEvent.MOUSE_OUT, onmapmouseout);
engine.gameBoard.unitlayer.removeEventListener(MouseEvent.MOUSE_OVER, onmapmouseover);
unregisterUpgradeButton(engine.playWindow.right_menu.unit_info.upgrades.button1);
unregisterUpgradeButton(engine.playWindow.right_menu.unit_info.upgrades.button2);
}
private function registerUpgradeButton(_arg1):void{
_arg1.addEventListener(MouseEvent.MOUSE_DOWN, upgradesButtonClickHandler);
_arg1.addEventListener(MouseEvent.MOUSE_OVER, upgradesButtonOverHandler);
_arg1.addEventListener(MouseEvent.MOUSE_OUT, upgradesButtonOutHandler);
}
private function unregisterUpgradeButton(_arg1):void{
_arg1.removeEventListener(MouseEvent.MOUSE_DOWN, upgradesButtonClickHandler);
_arg1.removeEventListener(MouseEvent.MOUSE_OVER, upgradesButtonOverHandler);
_arg1.removeEventListener(MouseEvent.MOUSE_OUT, upgradesButtonOutHandler);
}
public function on_mouse_down(_arg1:MouseEvent):void{
var _local2:Number;
var _local3:Number;
var _local4:uint;
var _local5:uint;
var _local6:BuildCursor;
var _local7:Unit;
var _local8:Unit;
downPoint.x = engine.gameBoard.unitlayer.mouseX;
downPoint.y = engine.gameBoard.unitlayer.mouseY;
_local2 = engine.gameBoard.unitlayer.mouseX;
_local3 = engine.gameBoard.unitlayer.mouseY;
_local4 = Math.floor(((_local2 / Consts.cell_size) + 0.5));
_local5 = Math.floor(((_local3 / Consts.cell_size) + 0.5));
_local6 = engine.gameBoard.build_cursor;
if (_local6 != null){
if (engine.paused){
return;
};
if (_local6.isGood()){
if (!engine.isMoneyEnough(_local6.type)){
engine.log("Not enough money");
return;
};
engine.money = (engine.money - _local6.cost);
_local7 = engine.gameBoard.buildUnit(_local6.type, Consts.myId, _local4, _local5, false);
_local7.sprite.x = _local2;
_local7.sprite.y = _local3;
_local7.sprite.startBuilding();
engine.game_process.builder.addTask(_local7, _local6.type);
engine.actions.clear();
engine.gameBoard.removeBuildCursor();
engine.play_window.updateResources();
engine.play_window.stats.built++;
engine.score = (engine.score + (_local7.cost / 3));
engine.game_process.deselectUnits();
engine.game_process.selected_units.push(_local7);
engine.play_window.updateInfo();
engine.play_window.updateResources();
engine.playSound(SoundConsts.placing);
};
return;
};
if (engine.actions.hasDoAction()){
engine.actions.doAction();
} else {
_local8 = engine.gameBoard.my_camp.getUnder(downPoint);
if (!_local8){
_local8 = engine.gameBoard.enemy_camp.getUnder(downPoint);
if (!_local8){
_local8 = engine.gameBoard.resources.getUnder(downPoint);
};
};
if (_local8){
if (((((!(_arg1.shiftKey)) || (!((_local8.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(_local8)))){
engine.game_process.deselectUnit(_local8);
return;
};
};
if (engine.game_process.selected_units.length < 8){
engine.game_process.selected_units.push(_local8);
};
engine.play_window.updateInfo();
} else {
selecting = true;
};
};
}
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.gameBoard.unitlayer.addEventListener(MouseEvent.MOUSE_DOWN, on_mouse_down);
engine.gameBoard.unitlayer.addEventListener(MouseEvent.MOUSE_UP, onmouseup);
engine.gameBoard.unitlayer.addEventListener(MouseEvent.MOUSE_OUT, onmapmouseout);
engine.gameBoard.unitlayer.addEventListener(MouseEvent.MOUSE_OVER, onmapmouseover);
registerUpgradeButton(engine.playWindow.right_menu.unit_info.upgrades.button1);
registerUpgradeButton(engine.playWindow.right_menu.unit_info.upgrades.button2);
}
private function upgradesButtonOutHandler(_arg1:MouseEvent):void{
var _local2:Boolean;
_local2 = false;
if (_arg1.currentTarget == engine.playWindow.right_menu.unit_info.upgrades.button1){
if (((!(engine.gameProcess.selectedUnit)) || (engine.gameProcess.selectedUnit.upgrades.isButton1UpgradeDone()))){
return;
};
_local2 = engine.gameProcess.selectedUnit.upgrades.isButton1MoneyEnough();
} else {
if (((!(engine.gameProcess.selectedUnit)) || (engine.gameProcess.selectedUnit.upgrades.isButton2UpgradeDone()))){
return;
};
_local2 = engine.gameProcess.selectedUnit.upgrades.isButton2MoneyEnough();
};
if (_local2){
_arg1.currentTarget.button_back.gotoAndStop("steady_back");
} else {
_arg1.currentTarget.button_back.gotoAndStop("red_back");
};
}
private function upgradesButtonClickHandler(_arg1:MouseEvent):void{
if (_arg1.currentTarget == engine.playWindow.right_menu.unit_info.upgrades.button1){
engine.gameProcess.selectedUnit.upgrades.button1Pressed();
} else {
engine.gameProcess.selectedUnit.upgrades.button2Pressed();
};
}
private function upgradesButtonOverHandler(_arg1:MouseEvent):void{
var _local2:Boolean;
_local2 = false;
if (_arg1.currentTarget == engine.playWindow.right_menu.unit_info.upgrades.button1){
if (((!(engine.gameProcess.selectedUnit)) || (engine.gameProcess.selectedUnit.upgrades.isButton1UpgradeDone()))){
return;
};
_local2 = engine.gameProcess.selectedUnit.upgrades.isButton1MoneyEnough();
} else {
if (((!(engine.gameProcess.selectedUnit)) || (engine.gameProcess.selectedUnit.upgrades.isButton2UpgradeDone()))){
return;
};
_local2 = engine.gameProcess.selectedUnit.upgrades.isButton2MoneyEnough();
};
if (_local2){
_arg1.currentTarget.button_back.gotoAndStop("light_back");
} else {
_arg1.currentTarget.button_back.gotoAndStop("light_red_back");
};
}
private function onmapmouseout(_arg1:MouseEvent):void{
mouseWithinMap = false;
if (engine.gameBoard.build_cursor){
engine.gameBoard.build_cursor.visible = false;
} else {
if (engine.play_window.custom_cursor.enabled){
engine.play_window.custom_cursor.hide();
};
};
}
}
}//package fai.logic
Section 44
//GameProcess (fai.logic.GameProcess)
package fai.logic {
import fai.units.*;
import fai.common.*;
import flash.display.*;
import fai.goals.*;
import fai.*;
public class GameProcess {
private var engine:Engine;// = null
public var selected_units:Array;
private var gameBoard:GameBoard;// = null
public var builder:UnitBuilder;// = null
public function GameProcess(_arg1:Engine):void{
engine = null;
builder = null;
selected_units = [];
gameBoard = null;
super();
engine = _arg1;
builder = new UnitBuilder(engine);
gameBoard = engine.gameBoard;
}
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);
};
};
};
}
private function isSelectedType(_arg1:String):Boolean{
var _local2:Unit;
for each (_local2 in selected_units) {
if (_arg1 == _local2.type){
return (true);
};
};
return (false);
}
public function isSelectedUnit(_arg1:Unit):Boolean{
if ((((selected_units.length == 1)) && ((selected_units[0] == _arg1)))){
return (true);
};
return (false);
}
private function cactusNearTargets(_arg1:Unit):void{
var _local2:int;
var _local3:Unit;
var _local4:Number;
_local2 = 0;
_local3 = null;
while (_local2 < engine.gameBoard.enemy_camp.units.length) {
_local3 = engine.gameBoard.enemy_camp.units[_local2];
_local4 = Camp.distanceFrom(_arg1.pos, _local3);
if (_local4 < _arg1.weapon.eyerange){
hitUnit(_arg1.weapon.damage, _local3);
};
if (_local3.isAlive()){
_local2++;
};
};
}
public function effect(_arg1:int, _arg2:int, _arg3:String):void{
var _local4:BitmapData;
var _local5:AnimatedBitmap;
var _local6:EffectGoal;
_local4 = engine.gameData.getSpecial(_arg3);
_local5 = new AnimatedBitmap(_local4, 32, _local4.height);
_local5.x = _arg1;
_local5.y = _arg2;
gameBoard.bulletlayer.addChild(_local5);
_local6 = new EffectGoal(_local5, engine);
engine.goal_system.add(_local6);
}
private function checkNearChewingGum(_arg1:Unit):void{
var _local2:int;
var _local3:Unit;
var _local4:Number;
_local2 = 0;
_local3 = null;
while (_local2 < engine.gameBoard.enemy_camp.units.length) {
_local3 = engine.gameBoard.enemy_camp.units[_local2];
if (((!(_local3.flag(UnitFlags.Flying))) && (!(_local3.life.isSlow())))){
_local4 = Utils.distance(_arg1.sprite, _local3.sprite);
if (_local4 < 40){
_local3.life.slowDown();
hitUnit(10, _arg1);
_arg1.sprite.scaleX = (_arg1.sprite.scaleY = (_arg1.health / 100));
if (!_arg1.isAlive()){
return;
};
};
};
if (_local3.isAlive()){
_local2++;
};
};
}
public function createButterfly(_arg1:Unit):void{
createUnitFromParent(_arg1, StringConsts.butterfly);
}
public function stopUnits():void{
var _local1:Unit;
for each (_local1 in selected_units) {
_local1.life.stop();
};
}
public function createThreeWorms(_arg1:Unit):void{
var _local2:int;
_local2 = 0;
while (_local2 < 3) {
createUnitFromParent(_arg1, StringConsts.little_worm);
_local2++;
};
}
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();
};
}
private function updatePoisonedBalls(_arg1:Unit):void{
var _local2:Array;
var _local3:int;
var _local4:int;
_local2 = [_arg1.sprite.clip.ball1, _arg1.sprite.clip.ball2, _arg1.sprite.clip.ball3, _arg1.sprite.clip.ball4, _arg1.sprite.clip.ball5, _arg1.sprite.clip.ball6, _arg1.sprite.clip.ball7, _arg1.sprite.clip.ball8, _arg1.sprite.clip.ball9];
_local3 = (9 - (_arg1.health / 10));
_local4 = 0;
_local4 = 0;
while (_local4 < _local3) {
_local2[_local4].visible = false;
_local4++;
};
}
public function runBullet(_arg1:Unit, _arg2:Unit):void{
var _local3:GasSprayerGoal;
var _local4:LaserTowersFireGoal;
var _local5:BoomerangBulletGoal;
var _local6:BulletGoal;
if (StringConsts.spitting_cactus == _arg1.type){
_arg1.sprite.clip.inner.gotoAndPlay("fire_state");
cactusNearTargets(_arg1);
engine.playSound(SoundConsts.spitting);
} else {
if (StringConsts.gas_sprayer == _arg1.type){
_arg1.sprite.clip.inner.gotoAndPlay("fire_state");
_local3 = new GasSprayerGoal(_arg1, engine);
gameBoard.bulletlayer.addChild(_local3.bullet);
engine.goal_system.add(_local3);
} else {
if (StringConsts.laser_towers == _arg1.type){
if (_arg1.upgrades.getFlags().isSet(UnitUpgrades.EXTRA_ACTION_TIME)){
_arg1.sprite.clip.inner.gotoAndPlay("extra_fire_state");
} else {
if (_arg1.upgrades.getFlags().isSet(UnitUpgrades.EXTRA_ACTION_TIME)){
_arg1.sprite.clip.inner.gotoAndPlay("super_fire_state");
} else {
_arg1.sprite.clip.inner.gotoAndPlay("fire_state");
};
};
_local4 = new LaserTowersFireGoal(_arg1, engine);
engine.goal_system.add(_local4);
} else {
if (StringConsts.boomerang_gnome == _arg1.type){
_local5 = new BoomerangBulletGoal(_arg1, _arg2, engine);
gameBoard.bulletlayer.addChild(_local5.bullet);
engine.goal_system.add(_local5);
engine.playSound(SoundConsts.boomerang);
} else {
if (StringConsts.chewing_gum == _arg1.type){
checkNearChewingGum(_arg1);
} else {
if (StringConsts.poisoned_balls == _arg1.type){
checkNearPoisonedBalls(_arg1);
engine.playSound(SoundConsts.poisoned_balls);
} else {
_local6 = new BulletGoal(_arg1, _arg2, engine);
gameBoard.bulletlayer.addChild(_local6.bullet);
engine.goal_system.add(_local6);
};
};
};
};
};
};
}
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.gameData.params(_arg2).flag(UnitFlags.Building)){
_local4 = null;
if (engine.gameData.params(_arg2).flag(UnitFlags.Flying)){
_local4 = new Astar(gameBoard.airworld, 0);
} else {
_local4 = new Astar(gameBoard.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 = gameBoard.buildUnit(_arg2, _arg1.mapid, _local4.ns[0].x, _local4.ns[0].y, true);
_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)) ? gameBoard.enemy_camp : gameBoard.my_camp;
_arg1.life.attack(_local10, true);
};
};
engine.play_window.updateInfo();
engine.play_window.updateResources();
}
public function endSelection(_arg1:Unit=null):void{
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:Array;
engine.events.selecting = false;
engine.gameBoard.selshape.graphics.clear();
_local2 = (engine.events.downPoint.x - gameBoard.unitlayer.mouseX);
_local3 = (engine.events.downPoint.y - gameBoard.unitlayer.mouseY);
if ((((_local2 == 0)) || ((_local3 == 0)))){
deselectUnits();
engine.playWindow.updateInfo();
return;
};
_local4 = engine.events.downPoint.x;
_local5 = engine.events.downPoint.y;
if (_local3 > 0){
_local5 = gameBoard.unitlayer.mouseY;
};
if (_local2 > 0){
_local4 = gameBoard.unitlayer.mouseX;
};
_local6 = new Array();
if (_arg1){
_local6.push(_arg1);
};
if (_local6.length > 0){
if (_local6.length > 1){
_local6.length = 1;
};
deselectUnits();
selected_units = _local6;
} else {
deselectUnits();
};
engine.playWindow.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 createUnitFromParent(_arg1:Unit, _arg2:String):void{
var _local3:Unit;
var _local4:InvaderGoal;
var _local5:*;
var _local6:MoveInvaderGoal;
var _local7:*;
_local3 = engine.gameBoard.buildUnit(_arg2, Consts.hostileId, _arg1.pos.x, _arg1.pos.y, false);
engine.upgradeUnitToLevel(_local3, _arg1.upgrade_level);
_local4 = new InvaderGoal(engine, _local3, _arg1.invader_goal.getMoveGoal().theRoad());
engine.goal_system.add(_local4);
_local3.sprite.x = ((_arg1.sprite.x + (Math.random() * 30)) - 30);
_local3.sprite.y = ((_arg1.sprite.y + (Math.random() * 30)) - 30);
_local5 = _arg1.invader_goal.getMoveGoal().currentNode();
_local6 = _local4.getMoveGoal();
_local7 = _local6.currentNode();
while (_local7 != _local5) {
_local6.virtualGotoNext();
_local7 = _local6.currentNode();
_local3.recalcGraphicalPos();
};
}
public function hitUnit(_arg1:int, _arg2:Unit):void{
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:Number;
if (!_arg2.isAlive()){
return;
};
_local3 = (_arg1 - _arg2.armor);
if (_local3 <= 0){
_local3 = 1;
};
_arg2.health = (_arg2.health - _local3);
_arg2.updateHealth();
if (!_arg2.isAlive()){
if (StringConsts.worm == _arg2.type){
createThreeWorms(_arg2);
} else {
if (StringConsts.caterpillar == _arg2.type){
createButterfly(_arg2);
};
};
if (_arg2.life.isFrozen()){
_arg2.life.unfroze();
};
engine.gameBoard.destroyUnit(_arg2);
if (_arg2.mapid == Consts.hostileId){
_local4 = (_arg2.death_cost + (_arg2.death_cost * _arg2.upgrade_level));
engine.money = (engine.money + _local4);
engine.play_window.stats.money = (engine.play_window.stats.money + _local4);
if (_local4 > 0){
engine.goal_system.add(new TextPopupGoal(engine, _local4.toString(), (_arg2.pos.x * Consts.cell_size), (_arg2.pos.y * Consts.cell_size), true));
};
engine.play_window.stats.killed++;
engine.score = (engine.score + (_arg2.cost + (_arg2.cost * _arg2.upgrade_level)));
};
engine.scenario.checkBonuses();
engine.play_window.updateResources();
engine.play_window.updateInfo();
} else {
if (_arg2.mapid == Consts.resourceId){
_local5 = engine.gameData.params(_arg2.type).health;
_local6 = (_arg2.health / _local5);
_arg2.sprite.sprite.setFrame(((4 - (5 * _local6)) + 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;
}
private function checkNearPoisonedBalls(_arg1:Unit):void{
var _local2:int;
var _local3:Unit;
var _local4:Number;
_local2 = 0;
_local3 = null;
while (_local2 < engine.gameBoard.enemy_camp.units.length) {
_local3 = engine.gameBoard.enemy_camp.units[_local2];
_local4 = Utils.distance(_arg1.sprite, _local3.sprite);
if (_local4 < 30){
hitUnit(10, _arg1);
hitUnit(_arg1.weapon.damage, _local3);
updatePoisonedBalls(_arg1);
if (!_arg1.isAlive()){
return;
};
};
if (_local3.isAlive()){
_local2++;
};
};
}
public function getUnitUnder(_arg1:Position):Unit{
var _local2:Unit;
_local2 = gameBoard.enemy_camp.getInMapUnder(_arg1);
if (!_local2){
_local2 = gameBoard.my_camp.getInMapUnder(_arg1);
};
return (_local2);
}
public function get selectedUnit():Unit{
return (selected_units[0]);
}
}
}//package fai.logic
Section 45
//Level (fai.logic.Level)
package fai.logic {
import fai.common.*;
import flash.display.*;
import fai.*;
public class Level {
public var level_back;// = null
public var initial_money:int;// = 300
public var enemy_direction:int;// = 0
public var number:int;// = 0
public var boss_type:String;// = ""
public var thumbnail_name:String;
public var waves_number:int;// = 10
public var waves_pause:int;// = 21
public var map:MapMatrix;// = null
public var enemy_start_spot:Position;// = null
public var background_bitmap:BitmapData;// = null
public var thumbnail_bitmap:BitmapData;// = null
public var fill_background:Boolean;// = true
public var background_type:String;
public var units:Array;
public var target_spot:Position;// = null
public var boss_level:int;// = 0
public var elements:Array;
public var type:String;
public var description:String;// = ""
public var level_health:int;// = 100
public function Level(_arg1:String="", _arg2:String="", _arg3:String=""):void{
number = 0;
description = "";
background_bitmap = null;
fill_background = true;
elements = [];
map = null;
target_spot = null;
enemy_direction = 0;
waves_pause = 21;
waves_number = 10;
level_health = 100;
boss_type = "";
boss_level = 0;
units = [];
enemy_start_spot = null;
initial_money = 300;
thumbnail_bitmap = null;
level_back = null;
super();
type = _arg1;
background_type = _arg2;
map = new MapMatrix(Consts.MapWidth, Consts.MapHeight);
thumbnail_name = _arg3;
target_spot = new Position();
}
public function copy(_arg1:Level):void{
type = _arg1.type;
description = _arg1.description;
enemy_direction = _arg1.enemy_direction;
waves_pause = _arg1.waves_pause;
waves_number = _arg1.waves_number;
level_health = _arg1.level_health;
boss_type = _arg1.boss_type;
boss_level = _arg1.boss_level;
initial_money = _arg1.initial_money;
background_type = _arg1.background_type;
fill_background = _arg1.fill_background;
thumbnail_name = _arg1.thumbnail_name;
}
public function initialize():void{
}
}
}//package fai.logic
Section 46
//LevelSelector (fai.logic.LevelSelector)
package fai.logic {
import fai.units.*;
import fai.common.*;
import fai.*;
public class LevelSelector {
private static const level_bosses:Array = [[[StringConsts.mouse, 1, 0]], [[StringConsts.mouse, 1, 0], [StringConsts.rat, 1, 0]], [[StringConsts.mouse, 2, 0], [StringConsts.rat, 1, 0]], [[StringConsts.mouse, 1, 1], [StringConsts.rat, 3, 0]], [[StringConsts.mouse, 2, 1], [StringConsts.rat, 1, 1]], [[StringConsts.mouse, 3, 1], [StringConsts.rat, 1, 1]], [[StringConsts.mouse, 2, 2], [StringConsts.rat, 2, 1]], [[StringConsts.mouse, 3, 2], [StringConsts.rat, 2, 1]], [[StringConsts.mouse, 2, 2], [StringConsts.rat, 2, 2]], [[StringConsts.mouse, 2, 2], [StringConsts.rat, 2, 2]], [[StringConsts.mouse, 2, 2], [StringConsts.rat, 2, 2]], [[StringConsts.mouse, 3, 2], [StringConsts.rat, 2, 2]], [[StringConsts.mouse, 3, 2], [StringConsts.rat, 2, 2]], [[StringConsts.mouse, 3, 2], [StringConsts.rat, 3, 2]], [[StringConsts.mouse, 2, 2]], [[StringConsts.mouse, 2, 3], [StringConsts.rat, 2, 3]], [[StringConsts.mouse, 2, 4], [StringConsts.rat, 2, 4]], [[StringConsts.mouse, 2, 4], [StringConsts.rat, 2, 4]], [[StringConsts.mouse, 1, 5]], [[StringConsts.rat, 1, 5]]];
private static const level_enemies:Array = [[[[StringConsts.beetle, 5, 0]], [[StringConsts.beetle, 10, 0]], [[StringConsts.beetle, 10, 0], [StringConsts.colorado_beetle, 5, 0]], [[StringConsts.beetle, 20, 0]], [[StringConsts.beetle, 20, 0], [StringConsts.colorado_beetle, 10, 0]], [[StringConsts.butterfly, 10, 0]], [[StringConsts.colorado_beetle, 10, 0], [StringConsts.bumblebee, 10, 0]], [[StringConsts.beetle, 30, 0], [StringConsts.butterfly, 10, 0], [StringConsts.dragonfly, 5, 0]], [[StringConsts.butterfly, 10, 0], [StringConsts.dragonfly, 10, 0]], [[StringConsts.bumblebee, 10, 0]], [[StringConsts.worm, 5, 0]], [[StringConsts.beetle, 15, 1]], [[StringConsts.colorado_beetle, 10, 1], [StringConsts.beetle, 10, 1], [StringConsts.worm, 5, 0]], [[StringConsts.caterpillar, 5, 0]], [[StringConsts.mouse, 1, 0]]], [[[StringConsts.beetle, 10, 0]], [[StringConsts.beetle, 10, 0], [StringConsts.colorado_beetle, 5, 0]], [[StringConsts.colorado_beetle, 10, 0]], [[StringConsts.beetle, 10, 0], [StringConsts.colorado_beetle, 10, 0]], [[StringConsts.butterfly, 10, 0]], [[StringConsts.colorado_beetle, 10, 0], [StringConsts.bumblebee, 10, 0]], [[StringConsts.beetle, 20, 0], [StringConsts.butterfly, 10, 0], [StringConsts.dragonfly, 5, 0]], [[StringConsts.butterfly, 10, 0], [StringConsts.dragonfly, 10, 0]], [[StringConsts.beetle, 15, 0], [StringConsts.worm, 3, 0]], [[StringConsts.colorado_beetle, 10, 0]], [[StringConsts.bumblebee, 10, 0]], [[StringConsts.worm, 5, 0]], [[StringConsts.colorado_beetle, 15, 0], [StringConsts.beetle, 20, 1], [StringConsts.worm, 5, 0]], [[StringConsts.caterpillar, 5, 0]], [[StringConsts.butterfly, 10, 1]], [[StringConsts.beetle, 20, 1]], [[StringConsts.colorado_beetle, 15, 1], [StringConsts.dragonfly, 5, 1]], [[StringConsts.bumblebee, 20, 0]], [[StringConsts.worm, 10, 0]], [[StringConsts.colorado_beetle, 25, 1], [StringConsts.beetle, 20, 1]], [[StringConsts.caterpillar, 8, 0]], [[StringConsts.bumblebee, 10, 1]], [[StringConsts.worm, 5, 1], [StringConsts.beetle, 20, 1]], [[StringConsts.beetle, 10, 2]], [[StringConsts.colorado_beetle, 5, 2]], [[StringConsts.butterfly, 5, 1]], [[StringConsts.rat, 1, 0]]], [[[StringConsts.beetle, 10, 0]], [[StringConsts.beetle, 10, 0], [StringConsts.colorado_beetle, 5, 0]], [[StringConsts.colorado_beetle, 10, 0]], [[StringConsts.beetle, 10, 0], [StringConsts.colorado_beetle, 10, 0]], [[StringConsts.butterfly, 10, 0]], [[StringConsts.colorado_beetle, 10, 0], [StringConsts.bumblebee, 10, 0]], [[StringConsts.beetle, 20, 0], [StringConsts.butterfly, 10, 0], [StringConsts.dragonfly, 5, 0]], [[StringConsts.butterfly, 10, 0], [StringConsts.dragonfly, 10, 0]], [[StringConsts.beetle, 15, 0], [StringConsts.worm, 3, 0]], [[StringConsts.colorado_beetle, 10, 0]], [[StringConsts.bumblebee, 10, 0]], [[StringConsts.worm, 5, 0]], [[StringConsts.colorado_beetle, 15, 0], [StringConsts.beetle, 20, 1], [StringConsts.worm, 5, 0]], [[StringConsts.caterpillar, 5, 0]], [[StringConsts.butterfly, 10, 1]], [[StringConsts.beetle, 20, 1]], [[StringConsts.colorado_beetle, 15, 1], [StringConsts.dragonfly, 5, 1]], [[StringConsts.bumblebee, 20, 0]], [[StringConsts.worm, 10, 0]], [[StringConsts.colorado_beetle, 25, 1], [StringConsts.beetle, 20, 1]], [[StringConsts.caterpillar, 10, 0]], [[StringConsts.bumblebee, 10, 1]], [[StringConsts.worm, 5, 1], [StringConsts.beetle, 20, 1]], [[StringConsts.beetle, 15, 1], [StringConsts.colorado_beetle, 25, 1], [StringConsts.worm, 10, 1]], [[StringConsts.butterfly, 20, 1]], [[StringConsts.bumblebee, 15, 1], [StringConsts.dragonfly, 10, 1]], [[StringConsts.dragonfly, 10, 2]], [[StringConsts.beetle, 15, 2], [StringConsts.colorado_beetle, 10, 2]], [[StringConsts.bumblebee, 20, 2]], [[StringConsts.worm, 10, 2]], [[StringConsts.caterpillar, 10, 2]], [[StringConsts.rat, 1, 0]]], [[[StringConsts.beetle, 10, 0]], [[StringConsts.beetle, 10, 0], [StringConsts.colorado_beetle, 5, 0]], [[StringConsts.colorado_beetle, 10, 0]], [[StringConsts.beetle, 10, 0], [StringConsts.colorado_beetle, 10, 0]], [[StringConsts.butterfly, 10, 0]], [[StringConsts.colorado_beetle, 10, 0], [StringConsts.bumblebee, 10, 0]], [[StringConsts.beetle, 20, 0], [StringConsts.butterfly, 10, 0], [StringConsts.dragonfly, 5, 0]], [[StringConsts.butterfly, 10, 0], [StringConsts.dragonfly, 10, 0]], [[StringConsts.beetle, 15, 0], [StringConsts.worm, 3, 0]], [[StringConsts.colorado_beetle, 10, 0]], [[StringConsts.bumblebee, 10, 0]], [[StringConsts.worm, 5, 0]], [[StringConsts.colorado_beetle, 15, 0], [StringConsts.beetle, 20, 1], [StringConsts.worm, 5, 0]], [[StringConsts.caterpillar, 5, 0]], [[StringConsts.butterfly, 10, 1]], [[StringConsts.beetle, 20, 1]], [[StringConsts.colorado_beetle, 15, 1], [StringConsts.dragonfly, 5, 1]], [[StringConsts.worm, 15, 0]], [[StringConsts.colorado_beetle, 25, 1], [StringConsts.beetle, 20, 1]], [[StringConsts.caterpillar, 15, 0]], [[StringConsts.bumblebee, 15, 1]], [[StringConsts.worm, 10, 1], [StringConsts.beetle, 20, 1]], [[StringConsts.beetle, 15, 1], [StringConsts.colorado_beetle, 25, 1], [StringConsts.worm, 10, 1]], [[StringConsts.butterfly, 20, 1]], [[StringConsts.bumblebee, 15, 1], [StringConsts.dragonfly, 10, 1]], [[StringConsts.dragonfly, 10, 2]], [[StringConsts.beetle, 15, 2], [StringConsts.colorado_beetle, 15, 2]], [[StringConsts.bumblebee, 20, 2]], [[StringConsts.worm, 10, 2]], [[StringConsts.caterpillar, 10, 2]], [[StringConsts.beetle, 15, 2], [StringConsts.colorado_beetle, 20, 2], [StringConsts.worm, 15, 2]], [[StringConsts.dragonfly, 25, 2]], [[StringConsts.butterfly, 25, 3]], [[StringConsts.rat, 1, 0]]], [[[StringConsts.beetle, 10, 0]], [[StringConsts.beetle, 10, 0], [StringConsts.colorado_beetle, 5, 0]], [[StringConsts.colorado_beetle, 10, 0]], [[StringConsts.beetle, 10, 0], [StringConsts.colorado_beetle, 10, 0]], [[StringConsts.butterfly, 10, 0]], [[StringConsts.colorado_beetle, 10, 0], [StringConsts.bumblebee, 10, 0]], [[StringConsts.beetle, 20, 0], [StringConsts.butterfly, 10, 0], [StringConsts.dragonfly, 5, 0]], [[StringConsts.butterfly, 10, 0], [StringConsts.dragonfly, 10, 0]], [[StringConsts.beetle, 15, 0], [StringConsts.worm, 3, 0]], [[StringConsts.colorado_beetle, 10, 0]], [[StringConsts.bumblebee, 10, 0]], [[StringConsts.worm, 5, 0]], [[StringConsts.colorado_beetle, 15, 0], [StringConsts.beetle, 20, 1], [StringConsts.worm, 5, 0]], [[StringConsts.caterpillar, 5, 0]], [[StringConsts.butterfly, 10, 1]], [[StringConsts.beetle, 20, 1]], [[StringConsts.colorado_beetle, 15, 1], [StringConsts.dragonfly, 5, 1]], [[StringConsts.worm, 15, 0]], [[StringConsts.colorado_beetle, 25, 1], [StringConsts.beetle, 20, 1]], [[StringConsts.caterpillar, 15, 0]], [[StringConsts.bumblebee, 15, 1]], [[StringConsts.worm, 10, 1], [StringConsts.beetle, 20, 1]], [[StringConsts.beetle, 15, 1], [StringConsts.colorado_beetle, 25, 1], [StringConsts.worm, 10, 1]], [[StringConsts.butterfly, 20, 1]], [[StringConsts.bumblebee, 15, 1], [StringConsts.dragonfly, 10, 1]], [[StringConsts.dragonfly, 10, 2]], [[StringConsts.beetle, 15, 2], [StringConsts.colorado_beetle, 15, 2]], [[StringConsts.bumblebee, 20, 2]], [[StringConsts.worm, 10, 2]], [[StringConsts.caterpillar, 10, 2]], [[StringConsts.beetle, 15, 2], [StringConsts.colorado_beetle, 20, 2], [StringConsts.worm, 15, 2]], [[StringConsts.dragonfly, 25, 2]], [[StringConsts.butterfly, 25, 3]], [[StringConsts.caterpillar, 15, 2], [StringConsts.dragonfly, 5, 2], [StringConsts.butterfly, 5, 2], [StringConsts.bumblebee, 5, 2]], [[StringConsts.beetle, 15, 3]], [[StringConsts.rat, 1, 0]]], [[[StringConsts.beetle, 10, 0]], [[StringConsts.beetle, 10, 0], [StringConsts.colorado_beetle, 5, 0]], [[StringConsts.colorado_beetle, 10, 0]], [[StringConsts.beetle, 10, 0], [StringConsts.colorado_beetle, 10, 0]], [[StringConsts.butterfly, 10, 0]], [[StringConsts.colorado_beetle, 10, 0], [StringConsts.bumblebee, 10, 0]], [[StringConsts.beetle, 20, 0], [StringConsts.butterfly, 10, 0], [StringConsts.dragonfly, 5, 0]], [[StringConsts.butterfly, 10, 0], [StringConsts.dragonfly, 10, 0]], [[StringConsts.beetle, 15, 0], [StringConsts.worm, 3, 0]], [[StringConsts.colorado_beetle, 10, 0]], [[StringConsts.bumblebee, 10, 0]], [[StringConsts.worm, 5, 0]], [[StringConsts.colorado_beetle, 15, 0], [StringConsts.beetle, 20, 1], [StringConsts.worm, 5, 0]], [[StringConsts.caterpillar, 5, 0]], [[StringConsts.butterfly, 10, 1]], [[StringConsts.beetle, 20, 1]], [[StringConsts.colorado_beetle, 15, 1], [StringConsts.dragonfly, 5, 1]], [[StringConsts.worm, 15, 0]], [[StringConsts.colorado_beetle, 25, 1], [StringConsts.beetle, 20, 1]], [[StringConsts.caterpillar, 15, 0]], [[StringConsts.bumblebee, 15, 1]], [[StringConsts.worm, 10, 1], [StringConsts.beetle, 20, 1]], [[StringConsts.beetle, 15, 1], [StringConsts.colorado_beetle, 25, 1], [StringConsts.worm, 10, 1]], [[StringConsts.butterfly, 20, 1]], [[StringConsts.bumblebee, 15, 1], [StringConsts.dragonfly, 10, 1]], [[StringConsts.dragonfly, 10, 2]], [[StringConsts.beetle, 15, 2], [StringConsts.colorado_beetle, 15, 2]], [[StringConsts.bumblebee, 20, 2]], [[StringConsts.worm, 10, 2]], [[StringConsts.caterpillar, 10, 2]], [[StringConsts.beetle, 15, 2], [StringConsts.colorado_beetle, 20, 2], [StringConsts.worm, 15, 2]], [[StringConsts.dragonfly, 25, 2]], [[StringConsts.butterfly, 25, 3]], [[StringConsts.caterpillar, 15, 2], [StringConsts.dragonfly, 5, 2], [StringConsts.butterfly, 5, 2], [StringConsts.bumblebee, 5, 2]], [[StringConsts.beetle, 15, 3]], [[StringConsts.colorado_beetle, 15, 3], [StringConsts.beetle, 15, 3]], [[StringConsts.butterfly, 15, 3]], [[StringConsts.bumblebee, 15, 3]], [[StringConsts.dragonfly, 15, 3]], [[StringConsts.rat, 1, 0]]], [[[StringConsts.beetle, 10, 0]], [[StringConsts.beetle, 10, 0], [StringConsts.colorado_beetle, 5, 0]], [[StringConsts.colorado_beetle, 10, 0]], [[StringConsts.beetle, 10, 0], [StringConsts.colorado_beetle, 10, 0]], [[StringConsts.butterfly, 10, 0]], [[StringConsts.colorado_beetle, 10, 0], [StringConsts.bumblebee, 10, 0]], [[StringConsts.beetle, 20, 0], [StringConsts.butterfly, 10, 0], [StringConsts.dragonfly, 5, 0]], [[StringConsts.butterfly, 10, 0], [StringConsts.dragonfly, 10, 0]], [[StringConsts.beetle, 15, 0], [StringConsts.worm, 3, 0]], [[StringConsts.colorado_beetle, 10, 0]], [[StringConsts.bumblebee, 10, 0]], [[StringConsts.worm, 5, 0]], [[StringConsts.colorado_beetle, 15, 0], [StringConsts.beetle, 20, 1], [StringConsts.worm, 5, 0]], [[StringConsts.caterpillar, 5, 0]], [[StringConsts.butterfly, 10, 1]], [[StringConsts.beetle, 20, 1]], [[StringConsts.colorado_beetle, 15, 1], [StringConsts.dragonfly, 5, 1]], [[StringConsts.worm, 15, 0]], [[StringConsts.colorado_beetle, 25, 1], [StringConsts.beetle, 20, 1]], [[StringConsts.caterpillar, 15, 0]], [[StringConsts.bumblebee, 15, 1]], [[StringConsts.worm, 10, 1], [StringConsts.beetle, 20, 1]], [[StringConsts.beetle, 15, 1], [StringConsts.colorado_beetle, 25, 1], [StringConsts.worm, 10, 1]], [[StringConsts.butterfly, 20, 1]], [[StringConsts.bumblebee, 15, 1], [StringConsts.dragonfly, 10, 1]], [[StringConsts.dragonfly, 10, 2]], [[StringConsts.beetle, 15, 2], [StringConsts.colorado_beetle, 15, 2]], [[StringConsts.bumblebee, 20, 2]], [[StringConsts.worm, 10, 2]], [[StringConsts.caterpillar, 10, 2]], [[StringConsts.beetle, 15, 2], [StringConsts.colorado_beetle, 20, 2], [StringConsts.worm, 15, 2]], [[StringConsts.dragonfly, 25, 2]], [[StringConsts.butterfly, 25, 3]], [[StringConsts.caterpillar, 15, 2], [StringConsts.dragonfly, 5, 2], [StringConsts.butterfly, 5, 2], [StringConsts.bumblebee, 5, 2]], [[StringConsts.beetle, 15, 3]], [[StringConsts.colorado_beetle, 15, 3], [StringConsts.beetle, 15, 3]], [[StringConsts.butterfly, 15, 3]], [[StringConsts.bumblebee, 15, 3]], [[StringConsts.dragonfly, 15, 3]], [[StringConsts.worm, 15, 3]], [[StringConsts.caterpillar, 15, 3]], [[StringConsts.rat, 1, 0]]], [[[StringConsts.beetle, 10, 0]], [[StringConsts.beetle, 10, 0], [StringConsts.colorado_beetle, 5, 0]], [[StringConsts.colorado_beetle, 10, 0]], [[StringConsts.beetle, 10, 0], [StringConsts.colorado_beetle, 10, 0]], [[StringConsts.butterfly, 10, 0]], [[StringConsts.colorado_beetle, 10, 0], [StringConsts.bumblebee, 10, 0]], [[StringConsts.beetle, 20, 0], [StringConsts.butterfly, 10, 0], [StringConsts.dragonfly, 5, 0]], [[StringConsts.butterfly, 10, 0], [StringConsts.dragonfly, 10, 0]], [[StringConsts.beetle, 15, 0], [StringConsts.worm, 3, 0]], [[StringConsts.colorado_beetle, 10, 0]], [[StringConsts.bumblebee, 10, 0]], [[StringConsts.worm, 5, 0]], [[StringConsts.colorado_beetle, 15, 0], [StringConsts.beetle, 20, 1], [StringConsts.worm, 5, 0]], [[StringConsts.caterpillar, 5, 0]], [[StringConsts.butterfly, 10, 1]], [[StringConsts.beetle, 20, 1]], [[StringConsts.colorado_beetle, 15, 1], [StringConsts.dragonfly, 5, 1]], [[StringConsts.worm, 15, 0]], [[StringConsts.colorado_beetle, 25, 1], [StringConsts.beetle, 20, 1]], [[StringConsts.caterpillar, 15, 0]], [[StringConsts.bumblebee, 15, 1]], [[StringConsts.worm, 10, 1], [StringConsts.beetle, 20, 1]], [[StringConsts.beetle, 15, 1], [StringConsts.colorado_beetle, 25, 1], [StringConsts.worm, 10, 1]], [[StringConsts.butterfly, 20, 1]], [[StringConsts.bumblebee, 15, 1], [StringConsts.dragonfly, 10, 1]], [[StringConsts.dragonfly, 10, 2]], [[StringConsts.beetle, 15, 2], [StringConsts.colorado_beetle, 15, 2]], [[StringConsts.bumblebee, 20, 2]], [[StringConsts.worm, 10, 2]], [[StringConsts.caterpillar, 10, 2]], [[StringConsts.beetle, 15, 2], [StringConsts.colorado_beetle, 20, 2], [StringConsts.worm, 15, 2]], [[StringConsts.dragonfly, 25, 2]], [[StringConsts.butterfly, 25, 3]], [[StringConsts.caterpillar, 15, 2], [StringConsts.dragonfly, 5, 2], [StringConsts.butterfly, 5, 2], [StringConsts.bumblebee, 5, 2]], [[StringConsts.beetle, 15, 3]], [[StringConsts.colorado_beetle, 15, 3], [StringConsts.beetle, 15, 3]], [[StringConsts.butterfly, 15, 3]], [[StringConsts.bumblebee, 15, 3]], [[StringConsts.dragonfly, 15, 3]], [[StringConsts.worm, 15, 3]], [[StringConsts.caterpillar, 15, 3]], [[StringConsts.colorado_beetle, 10, 3], [StringConsts.bumblebee, 10, 3]], [[StringConsts.beetle, 30, 3], [StringConsts.butterfly, 10, 3], [StringConsts.dragonfly, 5, 3]], [[StringConsts.rat, 1, 0]]], [[[StringConsts.beetle, 10, 0]], [[StringConsts.beetle, 10, 0], [StringConsts.colorado_beetle, 5, 0]], [[StringConsts.colorado_beetle, 10, 0]], [[StringConsts.beetle, 10, 0], [StringConsts.colorado_beetle, 10, 0]], [[StringConsts.butterfly, 10, 0]], [[StringConsts.colorado_beetle, 10, 0], [StringConsts.bumblebee, 10, 0]], [[StringConsts.beetle, 20, 0], [StringConsts.butterfly, 10, 0], [StringConsts.dragonfly, 5, 0]], [[StringConsts.butterfly, 10, 0], [StringConsts.dragonfly, 10, 0]], [[StringConsts.beetle, 15, 0], [StringConsts.worm, 3, 0]], [[StringConsts.colorado_beetle, 10, 0]], [[StringConsts.bumblebee, 10, 0]], [[StringConsts.worm, 5, 0]], [[StringConsts.colorado_beetle, 15, 0], [StringConsts.beetle, 20, 1], [StringConsts.worm, 5, 0]], [[StringConsts.caterpillar, 5, 0]], [[StringConsts.butterfly, 10, 1]], [[StringConsts.beetle, 20, 1]], [[StringConsts.colorado_beetle, 15, 1], [StringConsts.dragonfly, 5, 1]], [[StringConsts.worm, 15, 0]], [[StringConsts.colorado_beetle, 25, 1], [StringConsts.beetle, 20, 1]], [[StringConsts.caterpillar, 15, 0]], [[StringConsts.bumblebee, 15, 1]], [[StringConsts.worm, 10, 1], [StringConsts.beetle, 20, 1]], [[StringConsts.beetle, 15, 1], [StringConsts.colorado_beetle, 25, 1], [StringConsts.worm, 10, 1]], [[StringConsts.butterfly, 20, 1]], [[StringConsts.bumblebee, 15, 1], [StringConsts.dragonfly, 10, 1]], [[StringConsts.dragonfly, 10, 2]], [[StringConsts.beetle, 15, 2], [StringConsts.colorado_beetle, 15, 2]], [[StringConsts.bumblebee, 20, 2]], [[StringConsts.worm, 10, 2]], [[StringConsts.caterpillar, 10, 2]], [[StringConsts.beetle, 15, 2], [StringConsts.colorado_beetle, 20, 2], [StringConsts.worm, 15, 2]], [[StringConsts.dragonfly, 25, 2]], [[StringConsts.butterfly, 25, 3]], [[StringConsts.caterpillar, 15, 2], [StringConsts.dragonfly, 5, 2], [StringConsts.butterfly, 5, 2], [StringConsts.bumblebee, 5, 2]], [[StringConsts.beetle, 15, 3]], [[StringConsts.colorado_beetle, 15, 3], [StringConsts.beetle, 15, 3]], [[StringConsts.butterfly, 15, 3]], [[StringConsts.bumblebee, 15, 3]], [[StringConsts.dragonfly, 15, 3]], [[StringConsts.worm, 15, 3]], [[StringConsts.caterpillar, 15, 3]], [[StringConsts.colorado_beetle, 10, 3], [StringConsts.bumblebee, 10, 3]], [[StringConsts.beetle, 30, 3], [StringConsts.butterfly, 10, 3], [StringConsts.dragonfly, 5, 3]], [[StringConsts.butterfly, 10, 3], [StringConsts.dragonfly, 10, 3]], [[StringConsts.colorado_beetle, 15, 3], [StringConsts.beetle, 20, 3], [StringConsts.worm, 10, 3]], [[StringConsts.bumblebee, 15, 3], [StringConsts.dragonfly, 15, 3]], [[StringConsts.rat, 1, 0]]], [[[StringConsts.beetle, 10, 0]], [[StringConsts.beetle, 10, 0], [StringConsts.colorado_beetle, 5, 0]], [[StringConsts.colorado_beetle, 10, 0]], [[StringConsts.beetle, 10, 0], [StringConsts.colorado_beetle, 10, 0]], [[StringConsts.butterfly, 10, 0]], [[StringConsts.colorado_beetle, 10, 0], [StringConsts.bumblebee, 10, 0]], [[StringConsts.beetle, 20, 0], [StringConsts.butterfly, 10, 0], [StringConsts.dragonfly, 5, 0]], [[StringConsts.butterfly, 10, 0], [StringConsts.dragonfly, 10, 0]], [[StringConsts.beetle, 15, 0], [StringConsts.worm, 3, 0]], [[StringConsts.colorado_beetle, 10, 0]], [[StringConsts.bumblebee, 10, 0]], [[StringConsts.worm, 5, 0]], [[StringConsts.colorado_beetle, 15, 0], [StringConsts.beetle, 20, 1], [StringConsts.worm, 5, 0]], [[StringConsts.caterpillar, 5, 0]], [[StringConsts.butterfly, 10, 1]], [[StringConsts.beetle, 20, 1]], [[StringConsts.colorado_beetle, 15, 1], [StringConsts.dragonfly, 5, 1]], [[StringConsts.worm, 15, 0]], [[StringConsts.colorado_beetle, 25, 1], [StringConsts.beetle, 20, 1]], [[StringConsts.caterpillar, 15, 0]], [[StringConsts.bumblebee, 15, 1]], [[StringConsts.worm, 10, 1], [StringConsts.beetle, 20, 1]], [[StringConsts.beetle, 15, 1], [StringConsts.colorado_beetle, 25, 1], [StringConsts.worm, 10, 1]], [[StringConsts.butterfly, 20, 1]], [[StringConsts.bumblebee, 15, 1], [StringConsts.dragonfly, 10, 1]], [[StringConsts.dragonfly, 10, 2]], [[StringConsts.beetle, 15, 2], [StringConsts.colorado_beetle, 15, 2]], [[StringConsts.bumblebee, 20, 2]], [[StringConsts.worm, 10, 2]], [[StringConsts.caterpillar, 10, 2]], [[StringConsts.beetle, 15, 2], [StringConsts.colorado_beetle, 20, 2], [StringConsts.worm, 15, 2]], [[StringConsts.dragonfly, 25, 2]], [[StringConsts.butterfly, 25, 3]], [[StringConsts.caterpillar, 15, 2], [StringConsts.dragonfly, 5, 2], [StringConsts.butterfly, 5, 2], [StringConsts.bumblebee, 5, 2]], [[StringConsts.beetle, 15, 3]], [[StringConsts.colorado_beetle, 15, 3], [StringConsts.beetle, 15, 3]], [[StringConsts.butterfly, 15, 3]], [[StringConsts.bumblebee, 15, 3]], [[StringConsts.dragonfly, 15, 3]], [[StringConsts.worm, 15, 3]], [[StringConsts.caterpillar, 15, 3]], [[StringConsts.colorado_beetle, 10, 3], [StringConsts.bumblebee, 10, 3]], [[StringConsts.beetle, 30, 3], [StringConsts.butterfly, 10, 3], [StringConsts.dragonfly, 5, 3]], [[StringConsts.butterfly, 10, 3], [StringConsts.dragonfly, 10, 3]], [[StringConsts.colorado_beetle, 15, 3], [StringConsts.beetle, 20, 3], [StringConsts.worm, 10, 3]], [[StringConsts.bumblebee, 15, 3], [StringConsts.dragonfly, 15, 3]], [[StringConsts.dragonfly, 10, 3], [StringConsts.colorado_beetle, 20, 3], [StringConsts.worm, 15, 3]], [[StringConsts.caterpillar, 15, 3], [StringConsts.dragonfly, 5, 3], [StringConsts.butterfly, 5, 3], [StringConsts.bumblebee, 5, 3]], [[StringConsts.worm, 10, 3], [StringConsts.colorado_beetle, 20, 3], [StringConsts.dragonfly, 10, 3]], [[StringConsts.rat, 1, 0]]], [[[StringConsts.beetle, 10, 0]], [[StringConsts.beetle, 10, 0], [StringConsts.colorado_beetle, 5, 0]], [[StringConsts.colorado_beetle, 10, 0]], [[StringConsts.beetle, 10, 0], [StringConsts.colorado_beetle, 10, 0]], [[StringConsts.butterfly, 10, 0]], [[StringConsts.colorado_beetle, 10, 0], [StringConsts.bumblebee, 10, 0]], [[StringConsts.beetle, 20, 0], [StringConsts.butterfly, 10, 0], [StringConsts.dragonfly, 5, 0]], [[StringConsts.butterfly, 10, 0], [StringConsts.dragonfly, 10, 0]], [[StringConsts.beetle, 15, 0], [StringConsts.worm, 3, 0]], [[StringConsts.colorado_beetle, 10, 0]], [[StringConsts.bumblebee, 10, 0]], [[StringConsts.worm, 5, 0]], [[StringConsts.colorado_beetle, 15, 0], [StringConsts.beetle, 20, 1], [StringConsts.worm, 5, 0]], [[StringConsts.caterpillar, 5, 0]], [[StringConsts.butterfly, 10, 1]], [[StringConsts.beetle, 20, 1]], [[StringConsts.colorado_beetle, 15, 1], [StringConsts.dragonfly, 5, 1]], [[StringConsts.worm, 15, 0]], [[StringConsts.colorado_beetle, 25, 1], [StringConsts.beetle, 20, 1]], [[StringConsts.caterpillar, 15, 0]], [[StringConsts.bumblebee, 15, 1]], [[StringConsts.worm, 10, 1], [StringConsts.beetle, 20, 1]], [[StringConsts.beetle, 15, 1], [StringConsts.colorado_beetle, 25, 1], [StringConsts.worm, 10, 1]], [[StringConsts.butterfly, 20, 1]], [[StringConsts.bumblebee, 15, 1], [StringConsts.dragonfly, 10, 1]], [[StringConsts.dragonfly, 10, 2]], [[StringConsts.beetle, 15, 2], [StringConsts.colorado_beetle, 15, 2]], [[StringConsts.bumblebee, 20, 2]], [[StringConsts.worm, 10, 2]], [[StringConsts.caterpillar, 10, 2]], [[StringConsts.beetle, 15, 2], [StringConsts.colorado_beetle, 20, 2], [StringConsts.worm, 15, 2]], [[StringConsts.dragonfly, 25, 2]], [[StringConsts.butterfly, 25, 3]], [[StringConsts.caterpillar, 15, 2], [StringConsts.dragonfly, 5, 2], [StringConsts.butterfly, 5, 2], [StringConsts.bumblebee, 5, 2]], [[StringConsts.beetle, 15, 3]], [[StringConsts.colorado_beetle, 15, 3], [StringConsts.beetle, 15, 3]], [[StringConsts.butterfly, 15, 3]], [[StringConsts.bumblebee, 15, 3]], [[StringConsts.dragonfly, 15, 3]], [[StringConsts.worm, 15, 3]], [[StringConsts.caterpillar, 15, 3]], [[StringConsts.colorado_beetle, 10, 3], [StringConsts.bumblebee, 10, 3]], [[StringConsts.beetle, 30, 3], [StringConsts.butterfly, 10, 3], [StringConsts.dragonfly, 5, 3]], [[StringConsts.butterfly, 10, 3], [StringConsts.dragonfly, 10, 3]], [[StringConsts.colorado_beetle, 15, 3], [StringConsts.beetle, 20, 3], [StringConsts.worm, 10, 3]], [[StringConsts.bumblebee, 15, 3], [StringConsts.dragonfly, 15, 3]], [[StringConsts.dragonfly, 10, 3], [StringConsts.colorado_beetle, 20, 3], [StringConsts.worm, 15, 3]], [[StringConsts.caterpillar, 15, 3], [StringConsts.dragonfly, 5, 3], [StringConsts.butterfly, 5, 3], [StringConsts.bumblebee, 5, 3]], [[StringConsts.worm, 10, 3], [StringConsts.colorado_beetle, 20, 3], [StringConsts.dragonfly, 10, 3]], [[StringConsts.caterpillar, 15, 3], [StringConsts.butterfly, 15, 3]], [[StringConsts.dragonfly, 20, 3], [StringConsts.worm, 30, 3]], [[StringConsts.beetle, 15, 4], [StringConsts.dragonfly, 5, 3]], [[StringConsts.rat, 1, 0]]], [[[StringConsts.beetle, 10, 0]], [[StringConsts.beetle, 10, 0], [StringConsts.colorado_beetle, 5, 0]], [[StringConsts.colorado_beetle, 10, 0]], [[StringConsts.beetle, 10, 0], [StringConsts.colorado_beetle, 10, 0]], [[StringConsts.butterfly, 10, 0]], [[StringConsts.colorado_beetle, 10, 0], [StringConsts.bumblebee, 10, 0]], [[StringConsts.beetle, 20, 0], [StringConsts.butterfly, 10, 0], [StringConsts.dragonfly, 5, 0]], [[StringConsts.butterfly, 10, 0], [StringConsts.dragonfly, 10, 0]], [[StringConsts.beetle, 15, 0], [StringConsts.worm, 3, 0]], [[StringConsts.colorado_beetle, 10, 0]], [[StringConsts.bumblebee, 10, 0]], [[StringConsts.worm, 5, 0]], [[StringConsts.colorado_beetle, 15, 0], [StringConsts.beetle, 20, 1], [StringConsts.worm, 5, 0]], [[StringConsts.caterpillar, 5, 0]], [[StringConsts.butterfly, 10, 1]], [[StringConsts.beetle, 20, 1]], [[StringConsts.colorado_beetle, 15, 1], [StringConsts.dragonfly, 5, 1]], [[StringConsts.worm, 15, 0]], [[StringConsts.colorado_beetle, 25, 1], [StringConsts.beetle, 20, 1]], [[StringConsts.caterpillar, 15, 0]], [[StringConsts.bumblebee, 15, 1]], [[StringConsts.worm, 10, 1], [StringConsts.beetle, 20, 1]], [[StringConsts.beetle, 15, 1], [StringConsts.colorado_beetle, 25, 1], [StringConsts.worm, 10, 1]], [[StringConsts.butterfly, 20, 1]], [[StringConsts.bumblebee, 15, 1], [StringConsts.dragonfly, 10, 1]], [[StringConsts.dragonfly, 10, 2]], [[StringConsts.beetle, 15, 2], [StringConsts.colorado_beetle, 15, 2]], [[StringConsts.bumblebee, 20, 2]], [[StringConsts.worm, 10, 2]], [[StringConsts.caterpillar, 10, 2]], [[StringConsts.beetle, 15, 2], [StringConsts.colorado_beetle, 20, 2], [StringConsts.worm, 15, 2]], [[StringConsts.dragonfly, 25, 2]], [[StringConsts.butterfly, 25, 3]], [[StringConsts.caterpillar, 15, 2], [StringConsts.dragonfly, 5, 2], [StringConsts.butterfly, 5, 2], [StringConsts.bumblebee, 5, 2]], [[StringConsts.beetle, 15, 3]], [[StringConsts.colorado_beetle, 15, 3], [StringConsts.beetle, 15, 3]], [[StringConsts.butterfly, 15, 3]], [[StringConsts.bumblebee, 15, 3]], [[StringConsts.dragonfly, 15, 3]], [[StringConsts.worm, 15, 3]], [[StringConsts.caterpillar, 15, 3]], [[StringConsts.colorado_beetle, 10, 3], [StringConsts.bumblebee, 10, 3]], [[StringConsts.beetle, 30, 3], [StringConsts.butterfly, 10, 3], [StringConsts.dragonfly, 5, 3]], [[StringConsts.butterfly, 10, 3], [StringConsts.dragonfly, 10, 3]], [[StringConsts.colorado_beetle, 15, 3], [StringConsts.beetle, 20, 3], [StringConsts.worm, 10, 3]], [[StringConsts.bumblebee, 15, 3], [StringConsts.dragonfly, 15, 3]], [[StringConsts.dragonfly, 10, 3], [StringConsts.colorado_beetle, 20, 3], [StringConsts.worm, 15, 3]], [[StringConsts.caterpillar, 15, 3], [StringConsts.dragonfly, 5, 3], [StringConsts.butterfly, 5, 3], [StringConsts.bumblebee, 5, 3]], [[StringConsts.worm, 10, 3], [StringConsts.colorado_beetle, 20, 3], [StringConsts.dragonfly, 10, 3]], [[StringConsts.caterpillar, 15, 3], [StringConsts.butterfly, 15, 3]], [[StringConsts.dragonfly, 20, 3], [StringConsts.worm, 30, 3]], [[StringConsts.beetle, 15, 4], [StringConsts.dragonfly, 5, 3]], [[StringConsts.colorado_beetle, 15, 4], [StringConsts.beetle, 15, 4]], [[StringConsts.butterfly, 15, 4]], [[StringConsts.rat, 1, 0]]], [[[StringConsts.beetle, 10, 0]], [[StringConsts.beetle, 10, 0], [StringConsts.colorado_beetle, 5, 0]], [[StringConsts.colorado_beetle, 10, 0]], [[StringConsts.beetle, 10, 0], [StringConsts.colorado_beetle, 10, 0]], [[StringConsts.butterfly, 10, 0]], [[StringConsts.colorado_beetle, 10, 0], [StringConsts.bumblebee, 10, 0]], [[StringConsts.beetle, 20, 0], [StringConsts.butterfly, 10, 0], [StringConsts.dragonfly, 5, 0]], [[StringConsts.butterfly, 10, 0], [StringConsts.dragonfly, 10, 0]], [[StringConsts.beetle, 15, 0], [StringConsts.worm, 3, 0]], [[StringConsts.colorado_beetle, 10, 0]], [[StringConsts.bumblebee, 10, 0]], [[StringConsts.worm, 5, 0]], [[StringConsts.colorado_beetle, 15, 0], [StringConsts.beetle, 20, 1], [StringConsts.worm, 5, 0]], [[StringConsts.caterpillar, 5, 0]], [[StringConsts.butterfly, 10, 1]], [[StringConsts.beetle, 20, 1]], [[StringConsts.colorado_beetle, 15, 1], [StringConsts.dragonfly, 5, 1]], [[StringConsts.worm, 15, 0]], [[StringConsts.colorado_beetle, 25, 1], [StringConsts.beetle, 20, 1]], [[StringConsts.caterpillar, 15, 0]], [[StringConsts.bumblebee, 15, 1]], [[StringConsts.worm, 10, 1], [StringConsts.beetle, 20, 1]], [[StringConsts.beetle, 15, 1], [StringConsts.colorado_beetle, 25, 1], [StringConsts.worm, 10, 1]], [[StringConsts.butterfly, 20, 1]], [[StringConsts.bumblebee, 15, 1], [StringConsts.dragonfly, 10, 1]], [[StringConsts.dragonfly, 10, 2]], [[StringConsts.beetle, 15, 2], [StringConsts.colorado_beetle, 15, 2]], [[StringConsts.bumblebee, 20, 2]], [[StringConsts.worm, 10, 2]], [[StringConsts.caterpillar, 10, 2]], [[StringConsts.beetle, 15, 2], [StringConsts.colorado_beetle, 20, 2], [StringConsts.worm, 15, 2]], [[StringConsts.dragonfly, 25, 2]], [[StringConsts.butterfly, 25, 3]], [[StringConsts.caterpillar, 15, 2], [StringConsts.dragonfly, 5, 2], [StringConsts.butterfly, 5, 2], [StringConsts.bumblebee, 5, 2]], [[StringConsts.beetle, 15, 3]], [[StringConsts.colorado_beetle, 15, 3], [StringConsts.beetle, 15, 3]], [[StringConsts.butterfly, 15, 3]], [[StringConsts.bumblebee, 15, 3]], [[StringConsts.dragonfly, 15, 3]], [[StringConsts.worm, 15, 3]], [[StringConsts.caterpillar, 15, 3]], [[StringConsts.colorado_beetle, 10, 3], [StringConsts.bumblebee, 10, 3]], [[StringConsts.beetle, 30, 3], [StringConsts.butterfly, 10, 3], [StringConsts.dragonfly, 5, 3]], [[StringConsts.butterfly, 10, 3], [StringConsts.dragonfly, 10, 3]], [[StringConsts.colorado_beetle, 15, 3], [StringConsts.beetle, 20, 3], [StringConsts.worm, 10, 3]], [[StringConsts.bumblebee, 15, 3], [StringConsts.dragonfly, 15, 3]], [[StringConsts.dragonfly, 10, 3], [StringConsts.colorado_beetle, 20, 3], [StringConsts.worm, 15, 3]], [[StringConsts.caterpillar, 15, 3], [StringConsts.dragonfly, 5, 3], [StringConsts.butterfly, 5, 3], [StringConsts.bumblebee, 5, 3]], [[StringConsts.worm, 10, 3], [StringConsts.colorado_beetle, 20, 3], [StringConsts.dragonfly, 10, 3]], [[StringConsts.caterpillar, 15, 3], [StringConsts.butterfly, 15, 3]], [[StringConsts.dragonfly, 20, 3], [StringConsts.worm, 30, 3]], [[StringConsts.beetle, 15, 4], [StringConsts.dragonfly, 5, 3]], [[StringConsts.colorado_beetle, 15, 4], [StringConsts.beetle, 15, 4]], [[StringConsts.butterfly, 15, 4]], [[StringConsts.bumblebee, 15, 4]], [[StringConsts.dragonfly, 15, 4]], [[StringConsts.rat, 1, 0]]], [[[StringConsts.beetle, 10, 0]], [[StringConsts.beetle, 10, 0], [StringConsts.colorado_beetle, 5, 0]], [[StringConsts.colorado_beetle, 10, 0]], [[StringConsts.beetle, 10, 0], [StringConsts.colorado_beetle, 10, 0]], [[StringConsts.butterfly, 10, 0]], [[StringConsts.colorado_beetle, 10, 0], [StringConsts.bumblebee, 10, 0]], [[StringConsts.beetle, 20, 0], [StringConsts.butterfly, 10, 0], [StringConsts.dragonfly, 5, 0]], [[StringConsts.butterfly, 10, 0], [StringConsts.dragonfly, 10, 0]], [[StringConsts.beetle, 15, 0], [StringConsts.worm, 3, 0]], [[StringConsts.colorado_beetle, 10, 0]], [[StringConsts.bumblebee, 10, 0]], [[StringConsts.worm, 5, 0]], [[StringConsts.colorado_beetle, 15, 0], [StringConsts.beetle, 20, 1], [StringConsts.worm, 5, 0]], [[StringConsts.caterpillar, 5, 0]], [[StringConsts.butterfly, 10, 1]], [[StringConsts.beetle, 20, 1]], [[StringConsts.colorado_beetle, 15, 1], [StringConsts.dragonfly, 5, 1]], [[StringConsts.worm, 15, 0]], [[StringConsts.colorado_beetle, 25, 1], [StringConsts.beetle, 20, 1]], [[StringConsts.caterpillar, 15, 0]], [[StringConsts.bumblebee, 15, 1]], [[StringConsts.worm, 10, 1], [StringConsts.beetle, 20, 1]], [[StringConsts.beetle, 15, 1], [StringConsts.colorado_beetle, 25, 1], [StringConsts.worm, 10, 1]], [[StringConsts.butterfly, 20, 1]], [[StringConsts.bumblebee, 15, 1], [StringConsts.dragonfly, 10, 1]], [[StringConsts.dragonfly, 10, 2]], [[StringConsts.beetle, 15, 2], [StringConsts.colorado_beetle, 15, 2]], [[StringConsts.bumblebee, 20, 2]], [[StringConsts.worm, 10, 2]], [[StringConsts.caterpillar, 10, 2]], [[StringConsts.beetle, 15, 2], [StringConsts.colorado_beetle, 20, 2], [StringConsts.worm, 15, 2]], [[StringConsts.dragonfly, 25, 2]], [[StringConsts.butterfly, 25, 3]], [[StringConsts.caterpillar, 15, 2], [StringConsts.dragonfly, 5, 2], [StringConsts.butterfly, 5, 2], [StringConsts.bumblebee, 5, 2]], [[StringConsts.beetle, 15, 3]], [[StringConsts.colorado_beetle, 15, 3], [StringConsts.beetle, 15, 3]], [[StringConsts.butterfly, 15, 3]], [[StringConsts.bumblebee, 15, 3]], [[StringConsts.dragonfly, 15, 3]], [[StringConsts.worm, 15, 3]], [[StringConsts.caterpillar, 15, 3]], [[StringConsts.colorado_beetle, 10, 3], [StringConsts.bumblebee, 10, 3]], [[StringConsts.beetle, 30, 3], [StringConsts.butterfly, 10, 3], [StringConsts.dragonfly, 5, 3]], [[StringConsts.butterfly, 10, 3], [StringConsts.dragonfly, 10, 3]], [[StringConsts.colorado_beetle, 15, 3], [StringConsts.beetle, 20, 3], [StringConsts.worm, 10, 3]], [[StringConsts.bumblebee, 15, 3], [StringConsts.dragonfly, 15, 3]], [[StringConsts.dragonfly, 10, 3], [StringConsts.colorado_beetle, 20, 3], [StringConsts.worm, 15, 3]], [[StringConsts.caterpillar, 15, 3], [StringConsts.dragonfly, 5, 3], [StringConsts.butterfly, 5, 3], [StringConsts.bumblebee, 5, 3]], [[StringConsts.worm, 10, 3], [StringConsts.colorado_beetle, 20, 3], [StringConsts.dragonfly, 10, 3]], [[StringConsts.caterpillar, 15, 3], [StringConsts.butterfly, 15, 3]], [[StringConsts.dragonfly, 20, 3], [StringConsts.worm, 30, 3]], [[StringConsts.beetle, 15, 4], [StringConsts.dragonfly, 5, 3]], [[StringConsts.colorado_beetle, 15, 4], [StringConsts.beetle, 15, 4]], [[StringConsts.butterfly, 15, 4]], [[StringConsts.bumblebee, 15, 4]], [[StringConsts.dragonfly, 15, 4]], [[StringConsts.worm, 12, 4]], [[StringConsts.caterpillar, 12, 4]], [[StringConsts.rat, 1, 0]]], [[[StringConsts.beetle, 10, 0]], [[StringConsts.beetle, 10, 0], [StringConsts.colorado_beetle, 5, 0]], [[StringConsts.colorado_beetle, 8, 0]], [[StringConsts.beetle, 10, 0], [StringConsts.colorado_beetle, 8, 0]], [[StringConsts.butterfly, 10, 0]], [[StringConsts.colorado_beetle, 10, 0], [StringConsts.bumblebee, 5, 0]], [[StringConsts.beetle, 20, 0], [StringConsts.butterfly, 8, 0], [StringConsts.dragonfly, 5, 0]], [[StringConsts.butterfly, 10, 0], [StringConsts.dragonfly, 8, 0]], [[StringConsts.beetle, 15, 0], [StringConsts.worm, 3, 0]], [[StringConsts.colorado_beetle, 8, 0]], [[StringConsts.bumblebee, 10, 0]], [[StringConsts.worm, 5, 0]], [[StringConsts.colorado_beetle, 15, 0], [StringConsts.beetle, 20, 1], [StringConsts.worm, 5, 0]], [[StringConsts.caterpillar, 5, 0]], [[StringConsts.butterfly, 10, 1]], [[StringConsts.beetle, 20, 1]], [[StringConsts.colorado_beetle, 15, 1], [StringConsts.dragonfly, 5, 1]], [[StringConsts.worm, 10, 0]], [[StringConsts.colorado_beetle, 25, 1], [StringConsts.beetle, 20, 1]], [[StringConsts.caterpillar, 10, 0]], [[StringConsts.bumblebee, 15, 1]], [[StringConsts.worm, 10, 1], [StringConsts.beetle, 20, 1]], [[StringConsts.beetle, 15, 1], [StringConsts.colorado_beetle, 25, 1], [StringConsts.worm, 10, 1]], [[StringConsts.butterfly, 20, 1]], [[StringConsts.bumblebee, 15, 1], [StringConsts.dragonfly, 10, 1]], [[StringConsts.dragonfly, 10, 2]], [[StringConsts.beetle, 15, 2], [StringConsts.colorado_beetle, 15, 2]], [[StringConsts.bumblebee, 20, 2]], [[StringConsts.worm, 10, 2]], [[StringConsts.caterpillar, 10, 2]], [[StringConsts.beetle, 15, 2], [StringConsts.colorado_beetle, 20, 2], [StringConsts.worm, 15, 2]], [[StringConsts.dragonfly, 10, 2]], [[StringConsts.butterfly, 25, 3]], [[StringConsts.caterpillar, 10, 2], [StringConsts.dragonfly, 5, 2], [StringConsts.butterfly, 5, 2], [StringConsts.bumblebee, 5, 2]], [[StringConsts.beetle, 15, 3]], [[StringConsts.colorado_beetle, 15, 3], [StringConsts.beetle, 15, 3]], [[StringConsts.butterfly, 15, 3]], [[StringConsts.bumblebee, 15, 3]], [[StringConsts.dragonfly, 10, 3]], [[StringConsts.worm, 15, 3]], [[StringConsts.caterpillar, 5, 3]], [[StringConsts.colorado_beetle, 10, 3], [StringConsts.bumblebee, 10, 3]], [[StringConsts.beetle, 30, 3], [StringConsts.butterfly, 10, 3], [StringConsts.dragonfly, 5, 3]], [[StringConsts.butterfly, 10, 3], [StringConsts.dragonfly, 10, 3]], [[StringConsts.colorado_beetle, 15, 3], [StringConsts.beetle, 20, 3], [StringConsts.worm, 10, 3]], [[StringConsts.bumblebee, 15, 3], [StringConsts.dragonfly, 15, 3]], [[StringConsts.dragonfly, 10, 3], [StringConsts.colorado_beetle, 20, 3], [StringConsts.worm, 5, 3]], [[StringConsts.caterpillar, 10, 3], [StringConsts.dragonfly, 5, 3], [StringConsts.butterfly, 5, 3], [StringConsts.bumblebee, 5, 3]], [[StringConsts.worm, 10, 3], [StringConsts.colorado_beetle, 20, 3], [StringConsts.dragonfly, 10, 3]], [[StringConsts.caterpillar, 5, 3], [StringConsts.butterfly, 15, 3]], [[StringConsts.dragonfly, 10, 3], [StringConsts.worm, 20, 3]], [[StringConsts.beetle, 15, 4], [StringConsts.dragonfly, 5, 3]], [[StringConsts.colorado_beetle, 10, 4], [StringConsts.beetle, 15, 4]], [[StringConsts.butterfly, 15, 4]], [[StringConsts.bumblebee, 15, 4]], [[StringConsts.dragonfly, 15, 4]], [[StringConsts.worm, 12, 4]], [[StringConsts.caterpillar, 5, 4]], [[StringConsts.rat, 1, 0]]], [[[StringConsts.beetle, 10, 0]], [[StringConsts.beetle, 10, 0], [StringConsts.colorado_beetle, 5, 0]], [[StringConsts.colorado_beetle, 10, 0]], [[StringConsts.beetle, 10, 0], [StringConsts.colorado_beetle, 10, 0]], [[StringConsts.butterfly, 10, 0]], [[StringConsts.colorado_beetle, 10, 0], [StringConsts.bumblebee, 10, 0]], [[StringConsts.beetle, 20, 0], [StringConsts.butterfly, 10, 0], [StringConsts.dragonfly, 5, 0]], [[StringConsts.butterfly, 10, 0], [StringConsts.dragonfly, 10, 0]], [[StringConsts.beetle, 15, 0], [StringConsts.worm, 3, 0]], [[StringConsts.colorado_beetle, 10, 0]], [[StringConsts.bumblebee, 10, 0]], [[StringConsts.worm, 5, 0]], [[StringConsts.colorado_beetle, 15, 0], [StringConsts.beetle, 20, 1], [StringConsts.worm, 5, 0]], [[StringConsts.caterpillar, 5, 0]], [[StringConsts.butterfly, 10, 1]], [[StringConsts.beetle, 20, 1]], [[StringConsts.colorado_beetle, 15, 1], [StringConsts.dragonfly, 5, 1]], [[StringConsts.worm, 15, 0]], [[StringConsts.colorado_beetle, 25, 1], [StringConsts.beetle, 20, 1]], [[StringConsts.caterpillar, 15, 0]], [[StringConsts.bumblebee, 15, 1]], [[StringConsts.worm, 10, 1], [StringConsts.beetle, 20, 1]], [[StringConsts.beetle, 15, 1], [StringConsts.colorado_beetle, 25, 1], [StringConsts.worm, 10, 1]], [[StringConsts.butterfly, 20, 1]], [[StringConsts.bumblebee, 15, 1], [StringConsts.dragonfly, 10, 1]], [[StringConsts.dragonfly, 10, 2]], [[StringConsts.beetle, 15, 2], [StringConsts.colorado_beetle, 15, 2]], [[StringConsts.bumblebee, 20, 2]], [[StringConsts.worm, 10, 2]], [[StringConsts.caterpillar, 10, 2]], [[StringConsts.beetle, 15, 2], [StringConsts.colorado_beetle, 20, 2], [StringConsts.worm, 15, 2]], [[StringConsts.dragonfly, 25, 2]], [[StringConsts.butterfly, 25, 3]], [[StringConsts.caterpillar, 15, 2], [StringConsts.dragonfly, 5, 2], [StringConsts.butterfly, 5, 2], [StringConsts.bumblebee, 5, 2]], [[StringConsts.beetle, 15, 3]], [[StringConsts.colorado_beetle, 15, 3], [StringConsts.beetle, 15, 3]], [[StringConsts.butterfly, 15, 3]], [[StringConsts.bumblebee, 15, 3]], [[StringConsts.dragonfly, 15, 3]], [[StringConsts.worm, 15, 3]], [[StringConsts.caterpillar, 15, 3]], [[StringConsts.colorado_beetle, 10, 3], [StringConsts.bumblebee, 10, 3]], [[StringConsts.beetle, 30, 3], [StringConsts.butterfly, 10, 3], [StringConsts.dragonfly, 5, 3]], [[StringConsts.butterfly, 10, 3], [StringConsts.dragonfly, 10, 3]], [[StringConsts.colorado_beetle, 15, 3], [StringConsts.beetle, 20, 3], [StringConsts.worm, 10, 3]], [[StringConsts.bumblebee, 15, 3], [StringConsts.dragonfly, 15, 3]], [[StringConsts.dragonfly, 10, 3], [StringConsts.colorado_beetle, 20, 3], [StringConsts.worm, 15, 3]], [[StringConsts.caterpillar, 15, 3], [StringConsts.dragonfly, 5, 3], [StringConsts.butterfly, 5, 3], [StringConsts.bumblebee, 5, 3]], [[StringConsts.worm, 10, 3], [StringConsts.colorado_beetle, 20, 3], [StringConsts.dragonfly, 10, 3]], [[StringConsts.caterpillar, 15, 3], [StringConsts.butterfly, 15, 3]], [[StringConsts.dragonfly, 20, 3], [StringConsts.worm, 30, 3]], [[StringConsts.beetle, 15, 4], [StringConsts.dragonfly, 5, 3]], [[StringConsts.colorado_beetle, 15, 4], [StringConsts.beetle, 15, 4]], [[StringConsts.butterfly, 15, 4]], [[StringConsts.bumblebee, 15, 4]], [[StringConsts.dragonfly, 15, 4]], [[StringConsts.worm, 12, 4]], [[StringConsts.caterpillar, 12, 4]], [[StringConsts.colorado_beetle, 10, 4], [StringConsts.bumblebee, 10, 4]], [[StringConsts.beetle, 30, 4], [StringConsts.butterfly, 10, 4], [StringConsts.dragonfly, 5, 4]], [[StringConsts.butterfly, 10, 4], [StringConsts.dragonfly, 10, 4]], [[StringConsts.colorado_beetle, 15, 4], [StringConsts.beetle, 20, 4], [StringConsts.worm, 10, 4]], [[StringConsts.bumblebee, 15, 4], [StringConsts.dragonfly, 15, 4]], [[StringConsts.dragonfly, 10, 4], [StringConsts.colorado_beetle, 20, 4], [StringConsts.worm, 15, 4]], [[StringConsts.caterpillar, 15, 4], [StringConsts.dragonfly, 5, 4], [StringConsts.butterfly, 5, 4], [StringConsts.bumblebee, 5, 4]], [[StringConsts.rat, 1, 0]]], [[[StringConsts.beetle, 10, 0]], [[StringConsts.beetle, 10, 0], [StringConsts.colorado_beetle, 5, 0]], [[StringConsts.colorado_beetle, 10, 0]], [[StringConsts.beetle, 10, 0], [StringConsts.colorado_beetle, 10, 0]], [[StringConsts.butterfly, 10, 0]], [[StringConsts.colorado_beetle, 10, 0], [StringConsts.bumblebee, 10, 0]], [[StringConsts.beetle, 20, 0], [StringConsts.butterfly, 10, 0], [StringConsts.dragonfly, 5, 0]], [[StringConsts.butterfly, 10, 0], [StringConsts.dragonfly, 10, 0]], [[StringConsts.beetle, 15, 0], [StringConsts.worm, 3, 0]], [[StringConsts.colorado_beetle, 10, 0]], [[StringConsts.bumblebee, 10, 0]], [[StringConsts.worm, 5, 0]], [[StringConsts.colorado_beetle, 15, 0], [StringConsts.beetle, 20, 1], [StringConsts.worm, 5, 0]], [[StringConsts.caterpillar, 5, 0]], [[StringConsts.butterfly, 10, 1]], [[StringConsts.beetle, 20, 1]], [[StringConsts.colorado_beetle, 15, 1], [StringConsts.dragonfly, 5, 1]], [[StringConsts.worm, 15, 0]], [[StringConsts.colorado_beetle, 25, 1], [StringConsts.beetle, 20, 1]], [[StringConsts.caterpillar, 15, 0]], [[StringConsts.bumblebee, 15, 1]], [[StringConsts.worm, 10, 1], [StringConsts.beetle, 20, 1]], [[StringConsts.beetle, 15, 1], [StringConsts.colorado_beetle, 25, 1], [StringConsts.worm, 10, 1]], [[StringConsts.butterfly, 20, 1]], [[StringConsts.bumblebee, 15, 1], [StringConsts.dragonfly, 10, 1]], [[StringConsts.dragonfly, 10, 2]], [[StringConsts.beetle, 15, 2], [StringConsts.colorado_beetle, 15, 2]], [[StringConsts.bumblebee, 20, 2]], [[StringConsts.worm, 10, 2]], [[StringConsts.caterpillar, 10, 2]], [[StringConsts.beetle, 15, 2], [StringConsts.colorado_beetle, 20, 2], [StringConsts.worm, 15, 2]], [[StringConsts.dragonfly, 25, 2]], [[StringConsts.butterfly, 25, 3]], [[StringConsts.caterpillar, 15, 2], [StringConsts.dragonfly, 5, 2], [StringConsts.butterfly, 5, 2], [StringConsts.bumblebee, 5, 2]], [[StringConsts.beetle, 15, 3]], [[StringConsts.colorado_beetle, 15, 3], [StringConsts.beetle, 15, 3]], [[StringConsts.butterfly, 15, 3]], [[StringConsts.bumblebee, 15, 3]], [[StringConsts.dragonfly, 15, 3]], [[StringConsts.worm, 15, 3]], [[StringConsts.caterpillar, 15, 3]], [[StringConsts.colorado_beetle, 10, 3], [StringConsts.bumblebee, 10, 3]], [[StringConsts.beetle, 30, 3], [StringConsts.butterfly, 10, 3], [StringConsts.dragonfly, 5, 3]], [[StringConsts.butterfly, 10, 3], [StringConsts.dragonfly, 10, 3]], [[StringConsts.colorado_beetle, 15, 3], [StringConsts.beetle, 20, 3], [StringConsts.worm, 10, 3]], [[StringConsts.bumblebee, 15, 3], [StringConsts.dragonfly, 15, 3]], [[StringConsts.dragonfly, 10, 3], [StringConsts.colorado_beetle, 20, 3], [StringConsts.worm, 15, 3]], [[StringConsts.caterpillar, 15, 3], [StringConsts.dragonfly, 5, 3], [StringConsts.butterfly, 5, 3], [StringConsts.bumblebee, 5, 3]], [[StringConsts.worm, 10, 3], [StringConsts.colorado_beetle, 20, 3], [StringConsts.dragonfly, 10, 3]], [[StringConsts.caterpillar, 15, 3], [StringConsts.butterfly, 15, 3]], [[StringConsts.dragonfly, 20, 3], [StringConsts.worm, 30, 3]], [[StringConsts.beetle, 15, 4], [StringConsts.dragonfly, 5, 3]], [[StringConsts.colorado_beetle, 15, 4], [StringConsts.beetle, 15, 4]], [[StringConsts.butterfly, 15, 4]], [[StringConsts.bumblebee, 15, 4]], [[StringConsts.dragonfly, 15, 4]], [[StringConsts.worm, 12, 4]], [[StringConsts.caterpillar, 12, 4]], [[StringConsts.colorado_beetle, 10, 4], [StringConsts.bumblebee, 10, 4]], [[StringConsts.beetle, 30, 4], [StringConsts.butterfly, 10, 4], [StringConsts.dragonfly, 5, 4]], [[StringConsts.butterfly, 10, 4], [StringConsts.dragonfly, 10, 4]], [[StringConsts.colorado_beetle, 15, 4], [StringConsts.beetle, 20, 4], [StringConsts.worm, 10, 4]], [[StringConsts.bumblebee, 15, 4], [StringConsts.dragonfly, 15, 4]], [[StringConsts.dragonfly, 10, 4], [StringConsts.colorado_beetle, 20, 4], [StringConsts.worm, 15, 4]], [[StringConsts.caterpillar, 15, 4], [StringConsts.dragonfly, 5, 4], [StringConsts.butterfly, 5, 4], [StringConsts.bumblebee, 5, 4]], [[StringConsts.worm, 10, 4], [StringConsts.colorado_beetle, 20, 4]], [[StringConsts.caterpillar, 15, 4], [StringConsts.butterfly, 15, 4]], [[StringConsts.dragonfly, 20, 4], [StringConsts.worm, 20, 4]], [[StringConsts.beetle, 15, 5], [StringConsts.dragonfly, 5, 4]], [[StringConsts.rat, 1, 0]]], [[[StringConsts.beetle, 10, 0]], [[StringConsts.beetle, 10, 0], [StringConsts.colorado_beetle, 5, 0]], [[StringConsts.colorado_beetle, 10, 0]], [[StringConsts.beetle, 10, 0], [StringConsts.colorado_beetle, 10, 0]], [[StringConsts.butterfly, 10, 0]], [[StringConsts.colorado_beetle, 10, 0], [StringConsts.bumblebee, 10, 0]], [[StringConsts.beetle, 20, 0], [StringConsts.butterfly, 10, 0], [StringConsts.dragonfly, 5, 0]], [[StringConsts.butterfly, 10, 0], [StringConsts.dragonfly, 10, 0]], [[StringConsts.beetle, 15, 0], [StringConsts.worm, 3, 0]], [[StringConsts.colorado_beetle, 10, 0]], [[StringConsts.bumblebee, 10, 0]], [[StringConsts.worm, 5, 0]], [[StringConsts.colorado_beetle, 15, 0], [StringConsts.beetle, 20, 1], [StringConsts.worm, 5, 0]], [[StringConsts.caterpillar, 5, 0]], [[StringConsts.butterfly, 10, 1]], [[StringConsts.beetle, 20, 1]], [[StringConsts.colorado_beetle, 15, 1], [StringConsts.dragonfly, 5, 1]], [[StringConsts.worm, 15, 0]], [[StringConsts.colorado_beetle, 25, 1], [StringConsts.beetle, 20, 1]], [[StringConsts.caterpillar, 15, 0]], [[StringConsts.bumblebee, 15, 1]], [[StringConsts.worm, 10, 1], [StringConsts.beetle, 20, 1]], [[StringConsts.beetle, 15, 1], [StringConsts.colorado_beetle, 25, 1], [StringConsts.worm, 10, 1]], [[StringConsts.butterfly, 20, 1]], [[StringConsts.bumblebee, 15, 1], [StringConsts.dragonfly, 10, 1]], [[StringConsts.dragonfly, 10, 2]], [[StringConsts.beetle, 15, 2], [StringConsts.colorado_beetle, 15, 2]], [[StringConsts.bumblebee, 20, 2]], [[StringConsts.worm, 10, 2]], [[StringConsts.caterpillar, 10, 2]], [[StringConsts.beetle, 15, 2], [StringConsts.colorado_beetle, 20, 2], [StringConsts.worm, 15, 2]], [[StringConsts.dragonfly, 25, 2]], [[StringConsts.butterfly, 25, 3]], [[StringConsts.caterpillar, 15, 2], [StringConsts.dragonfly, 5, 2], [StringConsts.butterfly, 5, 2], [StringConsts.bumblebee, 5, 2]], [[StringConsts.beetle, 15, 3]], [[StringConsts.colorado_beetle, 15, 3], [StringConsts.beetle, 15, 3]], [[StringConsts.butterfly, 15, 3]], [[StringConsts.bumblebee, 15, 3]], [[StringConsts.dragonfly, 15, 3]], [[StringConsts.worm, 15, 3]], [[StringConsts.caterpillar, 15, 3]], [[StringConsts.colorado_beetle, 10, 3], [StringConsts.bumblebee, 10, 3]], [[StringConsts.beetle, 30, 3], [StringConsts.butterfly, 10, 3], [StringConsts.dragonfly, 5, 3]], [[StringConsts.butterfly, 10, 3], [StringConsts.dragonfly, 10, 3]], [[StringConsts.colorado_beetle, 15, 3], [StringConsts.beetle, 20, 3], [StringConsts.worm, 10, 3]], [[StringConsts.bumblebee, 15, 3], [StringConsts.dragonfly, 15, 3]], [[StringConsts.dragonfly, 10, 3], [StringConsts.colorado_beetle, 20, 3], [StringConsts.worm, 15, 3]], [[StringConsts.caterpillar, 15, 3], [StringConsts.dragonfly, 5, 3], [StringConsts.butterfly, 5, 3], [StringConsts.bumblebee, 5, 3]], [[StringConsts.worm, 10, 3], [StringConsts.colorado_beetle, 20, 3], [StringConsts.dragonfly, 10, 3]], [[StringConsts.caterpillar, 15, 3], [StringConsts.butterfly, 15, 3]], [[StringConsts.dragonfly, 20, 3], [StringConsts.worm, 30, 3]], [[StringConsts.beetle, 15, 4], [StringConsts.dragonfly, 5, 3]], [[StringConsts.colorado_beetle, 15, 4], [StringConsts.beetle, 15, 4]], [[StringConsts.butterfly, 15, 4]], [[StringConsts.bumblebee, 15, 4]], [[StringConsts.dragonfly, 15, 4]], [[StringConsts.worm, 12, 4]], [[StringConsts.caterpillar, 12, 4]], [[StringConsts.colorado_beetle, 10, 4], [StringConsts.bumblebee, 10, 4]], [[StringConsts.beetle, 30, 4], [StringConsts.butterfly, 10, 4], [StringConsts.dragonfly, 5, 4]], [[StringConsts.butterfly, 10, 4], [StringConsts.dragonfly, 10, 4]], [[StringConsts.colorado_beetle, 15, 4], [StringConsts.beetle, 20, 4], [StringConsts.worm, 10, 4]], [[StringConsts.bumblebee, 15, 4], [StringConsts.dragonfly, 15, 4]], [[StringConsts.dragonfly, 10, 4], [StringConsts.colorado_beetle, 20, 4], [StringConsts.worm, 15, 4]], [[StringConsts.caterpillar, 15, 4], [StringConsts.dragonfly, 5, 4], [StringConsts.butterfly, 5, 4], [StringConsts.bumblebee, 5, 4]], [[StringConsts.worm, 10, 4], [StringConsts.colorado_beetle, 20, 4]], [[StringConsts.caterpillar, 15, 4], [StringConsts.butterfly, 15, 4]], [[StringConsts.dragonfly, 20, 4], [StringConsts.worm, 20, 4]], [[StringConsts.beetle, 15, 5], [StringConsts.dragonfly, 5, 4]], [[StringConsts.colorado_beetle, 15, 5], [StringConsts.beetle, 15, 5]], [[StringConsts.butterfly, 15, 5]], [[StringConsts.bumblebee, 15, 5]], [[StringConsts.rat, 1, 0]]], [[[StringConsts.beetle, 10, 0]], [[StringConsts.beetle, 10, 0], [StringConsts.colorado_beetle, 5, 0]], [[StringConsts.colorado_beetle, 10, 0]], [[StringConsts.beetle, 10, 0], [StringConsts.colorado_beetle, 10, 0]], [[StringConsts.butterfly, 10, 0]], [[StringConsts.colorado_beetle, 10, 0], [StringConsts.bumblebee, 10, 0]], [[StringConsts.beetle, 20, 0], [StringConsts.butterfly, 10, 0], [StringConsts.dragonfly, 5, 0]], [[StringConsts.butterfly, 10, 0], [StringConsts.dragonfly, 10, 0]], [[StringConsts.beetle, 15, 0], [StringConsts.worm, 3, 0]], [[StringConsts.colorado_beetle, 10, 0]], [[StringConsts.bumblebee, 10, 0]], [[StringConsts.worm, 5, 0]], [[StringConsts.colorado_beetle, 15, 0], [StringConsts.beetle, 20, 1], [StringConsts.worm, 5, 0]], [[StringConsts.caterpillar, 5, 0]], [[StringConsts.butterfly, 10, 1]], [[StringConsts.beetle, 20, 1]], [[StringConsts.colorado_beetle, 15, 1], [StringConsts.dragonfly, 5, 1]], [[StringConsts.worm, 15, 0]], [[StringConsts.colorado_beetle, 25, 1], [StringConsts.beetle, 20, 1]], [[StringConsts.caterpillar, 15, 0]], [[StringConsts.bumblebee, 15, 1]], [[StringConsts.worm, 10, 1], [StringConsts.beetle, 20, 1]], [[StringConsts.beetle, 15, 1], [StringConsts.colorado_beetle, 25, 1], [StringConsts.worm, 10, 1]], [[StringConsts.butterfly, 20, 1]], [[StringConsts.bumblebee, 15, 1], [StringConsts.dragonfly, 10, 1]], [[StringConsts.dragonfly, 10, 2]], [[StringConsts.beetle, 15, 2], [StringConsts.colorado_beetle, 15, 2]], [[StringConsts.bumblebee, 20, 2]], [[StringConsts.worm, 10, 2]], [[StringConsts.caterpillar, 10, 2]], [[StringConsts.beetle, 15, 2], [StringConsts.colorado_beetle, 20, 2], [StringConsts.worm, 15, 2]], [[StringConsts.dragonfly, 25, 2]], [[StringConsts.butterfly, 25, 3]], [[StringConsts.caterpillar, 15, 2], [StringConsts.dragonfly, 5, 2], [StringConsts.butterfly, 5, 2], [StringConsts.bumblebee, 5, 2]], [[StringConsts.beetle, 15, 3]], [[StringConsts.colorado_beetle, 15, 3], [StringConsts.beetle, 15, 3]], [[StringConsts.butterfly, 15, 3]], [[StringConsts.bumblebee, 15, 3]], [[StringConsts.dragonfly, 15, 3]], [[StringConsts.worm, 15, 3]], [[StringConsts.caterpillar, 15, 3]], [[StringConsts.colorado_beetle, 10, 3], [StringConsts.bumblebee, 10, 3]], [[StringConsts.beetle, 30, 3], [StringConsts.butterfly, 10, 3], [StringConsts.dragonfly, 5, 3]], [[StringConsts.butterfly, 10, 3], [StringConsts.dragonfly, 10, 3]], [[StringConsts.colorado_beetle, 15, 3], [StringConsts.beetle, 20, 3], [StringConsts.worm, 10, 3]], [[StringConsts.bumblebee, 15, 3], [StringConsts.dragonfly, 15, 3]], [[StringConsts.dragonfly, 10, 3], [StringConsts.colorado_beetle, 20, 3], [StringConsts.worm, 15, 3]], [[StringConsts.caterpillar, 15, 3], [StringConsts.dragonfly, 5, 3], [StringConsts.butterfly, 5, 3], [StringConsts.bumblebee, 5, 3]], [[StringConsts.worm, 10, 3], [StringConsts.colorado_beetle, 20, 3], [StringConsts.dragonfly, 10, 3]], [[StringConsts.caterpillar, 15, 3], [StringConsts.butterfly, 15, 3]], [[StringConsts.dragonfly, 20, 3], [StringConsts.worm, 30, 3]], [[StringConsts.beetle, 15, 4], [StringConsts.dragonfly, 5, 3]], [[StringConsts.colorado_beetle, 15, 4], [StringConsts.beetle, 15, 4]], [[StringConsts.butterfly, 15, 4]], [[StringConsts.bumblebee, 15, 4]], [[StringConsts.dragonfly, 15, 4]], [[StringConsts.worm, 12, 4]], [[StringConsts.caterpillar, 12, 4]], [[StringConsts.colorado_beetle, 10, 4], [StringConsts.bumblebee, 10, 4]], [[StringConsts.beetle, 30, 4], [StringConsts.butterfly, 10, 4], [StringConsts.dragonfly, 5, 4]], [[StringConsts.butterfly, 10, 4], [StringConsts.dragonfly, 10, 4]], [[StringConsts.colorado_beetle, 15, 4], [StringConsts.beetle, 20, 4], [StringConsts.worm, 10, 4]], [[StringConsts.bumblebee, 15, 4], [StringConsts.dragonfly, 15, 4]], [[StringConsts.dragonfly, 10, 4], [StringConsts.colorado_beetle, 20, 4], [StringConsts.worm, 15, 4]], [[StringConsts.caterpillar, 15, 4], [StringConsts.dragonfly, 5, 4], [StringConsts.butterfly, 5, 4], [StringConsts.bumblebee, 5, 4]], [[StringConsts.worm, 10, 4], [StringConsts.colorado_beetle, 20, 4]], [[StringConsts.caterpillar, 15, 4], [StringConsts.butterfly, 15, 4]], [[StringConsts.dragonfly, 20, 4], [StringConsts.worm, 20, 4]], [[StringConsts.beetle, 15, 5], [StringConsts.dragonfly, 5, 4]], [[StringConsts.colorado_beetle, 15, 5], [StringConsts.beetle, 15, 5]], [[StringConsts.butterfly, 15, 5]], [[StringConsts.bumblebee, 15, 5]], [[StringConsts.dragonfly, 15, 5]], [[StringConsts.worm, 12, 5]], [[StringConsts.caterpillar, 12, 5]], [[StringConsts.rat, 1, 0]]], [[[StringConsts.beetle, 10, 0]], [[StringConsts.beetle, 10, 0], [StringConsts.colorado_beetle, 5, 0]], [[StringConsts.colorado_beetle, 10, 0]], [[StringConsts.beetle, 10, 0], [StringConsts.colorado_beetle, 10, 0]], [[StringConsts.butterfly, 10, 0]], [[StringConsts.colorado_beetle, 10, 0], [StringConsts.bumblebee, 10, 0]], [[StringConsts.beetle, 20, 0], [StringConsts.butterfly, 10, 0], [StringConsts.dragonfly, 5, 0]], [[StringConsts.butterfly, 10, 0], [StringConsts.dragonfly, 10, 0]], [[StringConsts.beetle, 15, 0], [StringConsts.worm, 3, 0]], [[StringConsts.colorado_beetle, 10, 0]], [[StringConsts.bumblebee, 10, 0]], [[StringConsts.worm, 5, 0]], [[StringConsts.colorado_beetle, 15, 0], [StringConsts.beetle, 20, 1], [StringConsts.worm, 5, 0]], [[StringConsts.caterpillar, 5, 0]], [[StringConsts.butterfly, 10, 1]], [[StringConsts.beetle, 20, 1]], [[StringConsts.colorado_beetle, 15, 1], [StringConsts.dragonfly, 5, 1]], [[StringConsts.worm, 15, 0]], [[StringConsts.colorado_beetle, 25, 1], [StringConsts.beetle, 20, 1]], [[StringConsts.caterpillar, 15, 0]], [[StringConsts.bumblebee, 15, 1]], [[StringConsts.worm, 10, 1], [StringConsts.beetle, 20, 1]], [[StringConsts.beetle, 15, 1], [StringConsts.colorado_beetle, 25, 1], [StringConsts.worm, 10, 1]], [[StringConsts.butterfly, 20, 1]], [[StringConsts.bumblebee, 15, 1], [StringConsts.dragonfly, 10, 1]], [[StringConsts.dragonfly, 10, 2]], [[StringConsts.beetle, 15, 2], [StringConsts.colorado_beetle, 15, 2]], [[StringConsts.bumblebee, 20, 2]], [[StringConsts.worm, 10, 2]], [[StringConsts.caterpillar, 10, 2]], [[StringConsts.beetle, 15, 2], [StringConsts.colorado_beetle, 20, 2], [StringConsts.worm, 15, 2]], [[StringConsts.dragonfly, 25, 2]], [[StringConsts.butterfly, 25, 3]], [[StringConsts.caterpillar, 15, 2], [StringConsts.dragonfly, 5, 2], [StringConsts.butterfly, 5, 2], [StringConsts.bumblebee, 5, 2]], [[StringConsts.beetle, 15, 3]], [[StringConsts.colorado_beetle, 15, 3], [StringConsts.beetle, 15, 3]], [[StringConsts.butterfly, 15, 3]], [[StringConsts.bumblebee, 15, 3]], [[StringConsts.dragonfly, 15, 3]], [[StringConsts.worm, 15, 3]], [[StringConsts.caterpillar, 15, 3]], [[StringConsts.colorado_beetle, 10, 3], [StringConsts.bumblebee, 10, 3]], [[StringConsts.beetle, 30, 3], [StringConsts.butterfly, 10, 3], [StringConsts.dragonfly, 5, 3]], [[StringConsts.butterfly, 10, 3], [StringConsts.dragonfly, 10, 3]], [[StringConsts.colorado_beetle, 15, 3], [StringConsts.beetle, 20, 3], [StringConsts.worm, 10, 3]], [[StringConsts.bumblebee, 15, 3], [StringConsts.dragonfly, 15, 3]], [[StringConsts.dragonfly, 10, 3], [StringConsts.colorado_beetle, 20, 3], [StringConsts.worm, 15, 3]], [[StringConsts.caterpillar, 15, 3], [StringConsts.dragonfly, 5, 3], [StringConsts.butterfly, 5, 3], [StringConsts.bumblebee, 5, 3]], [[StringConsts.worm, 10, 3], [StringConsts.colorado_beetle, 20, 3], [StringConsts.dragonfly, 10, 3]], [[StringConsts.caterpillar, 15, 3], [StringConsts.butterfly, 15, 3]], [[StringConsts.dragonfly, 20, 3], [StringConsts.worm, 30, 3]], [[StringConsts.beetle, 15, 4], [StringConsts.dragonfly, 5, 3]], [[StringConsts.colorado_beetle, 15, 4], [StringConsts.beetle, 15, 4]], [[StringConsts.butterfly, 15, 4]], [[StringConsts.bumblebee, 15, 4]], [[StringConsts.dragonfly, 15, 4]], [[StringConsts.worm, 12, 4]], [[StringConsts.caterpillar, 12, 4]], [[StringConsts.colorado_beetle, 10, 4], [StringConsts.bumblebee, 10, 4]], [[StringConsts.beetle, 30, 4], [StringConsts.butterfly, 10, 4], [StringConsts.dragonfly, 5, 4]], [[StringConsts.butterfly, 10, 4], [StringConsts.dragonfly, 10, 4]], [[StringConsts.colorado_beetle, 15, 4], [StringConsts.beetle, 20, 4], [StringConsts.worm, 10, 4]], [[StringConsts.bumblebee, 15, 4], [StringConsts.dragonfly, 15, 4]], [[StringConsts.dragonfly, 10, 4], [StringConsts.colorado_beetle, 20, 4], [StringConsts.worm, 15, 4]], [[StringConsts.caterpillar, 15, 4], [StringConsts.dragonfly, 5, 4], [StringConsts.butterfly, 5, 4], [StringConsts.bumblebee, 5, 4]], [[StringConsts.worm, 10, 4], [StringConsts.colorado_beetle, 20, 4]], [[StringConsts.caterpillar, 15, 4], [StringConsts.butterfly, 15, 4]], [[StringConsts.dragonfly, 20, 4], [StringConsts.worm, 20, 4]], [[StringConsts.beetle, 15, 5], [StringConsts.dragonfly, 5, 4]], [[StringConsts.colorado_beetle, 15, 5], [StringConsts.beetle, 15, 5]], [[StringConsts.butterfly, 15, 5]], [[StringConsts.bumblebee, 15, 5]], [[StringConsts.dragonfly, 15, 5]], [[StringConsts.worm, 12, 5]], [[StringConsts.caterpillar, 12, 5]], [[StringConsts.colorado_beetle, 10, 5], [StringConsts.bumblebee, 10, 5]], [[StringConsts.beetle, 30, 5], [StringConsts.butterfly, 10, 5], [StringConsts.dragonfly, 5, 5]], [[StringConsts.butterfly, 10, 5], [StringConsts.dragonfly, 10, 5]], [[StringConsts.colorado_beetle, 15, 5], [StringConsts.beetle, 20, 5], [StringConsts.worm, 10, 5]], [[StringConsts.bumblebee, 15, 5], [StringConsts.dragonfly, 15, 5]], [[StringConsts.dragonfly, 10, 5], [StringConsts.colorado_beetle, 20, 5], [StringConsts.worm, 15, 5]], [[StringConsts.caterpillar, 15, 5], [StringConsts.dragonfly, 5, 5], [StringConsts.butterfly, 5, 5], [StringConsts.bumblebee, 5, 5]], [[StringConsts.worm, 10, 5], [StringConsts.colorado_beetle, 20, 5]], [[StringConsts.caterpillar, 15, 5], [StringConsts.butterfly, 15, 5]], [[StringConsts.dragonfly, 20, 5], [StringConsts.worm, 20, 5]], [[StringConsts.rat, 1, 0]]]];
public function LevelSelector():void{
}
public static function getLevelWaveNumber(_arg1:int):int{
if (_arg1 >= level_enemies.length){
return (level_enemies[0].length);
};
return (level_enemies[_arg1].length);
}
public static function getLevelEnemies(_arg1:int, _arg2:int):Array{
var _local3:Array;
if (_arg1 >= level_enemies.length){
_local3 = level_enemies[0];
if (_arg2 >= _local3.length){
return (_local3[0]);
};
return (_local3[_arg2]);
};
return (level_enemies[_arg1][_arg2]);
}
public static function getLevelBosses(_arg1:int):Array{
if (_arg1 >= level_bosses.length){
return (level_bosses[0]);
};
return (level_bosses[_arg1]);
}
public static function getLevelBackground(_arg1:int){
var _local2:*;
_local2 = null;
switch (_arg1){
case 0:
_local2 = new Level1();
break;
case 1:
_local2 = new Level2();
break;
case 2:
_local2 = new Level3();
break;
case 3:
_local2 = new Level4();
break;
case 4:
_local2 = new Level5();
break;
case 5:
_local2 = new Level6();
break;
case 6:
_local2 = new Level7();
break;
case 7:
_local2 = new Level8();
break;
case 8:
_local2 = new Level9();
break;
case 9:
_local2 = new Level10();
break;
case 10:
_local2 = new Level11();
break;
case 11:
_local2 = new Level12();
break;
case 12:
_local2 = new Level13();
break;
case 13:
_local2 = new Level14();
break;
case 14:
_local2 = new Level15();
break;
case 15:
_local2 = new Level16();
break;
case 16:
_local2 = new Level17();
break;
case 17:
_local2 = new Level18();
break;
case 18:
_local2 = new Level19();
break;
case 19:
_local2 = new Level20();
break;
};
return (_local2);
}
public static function getLevel(_arg1:int):Level{
var _local2:Level;
_local2 = new Level();
_local2.number = _arg1;
_local2.level_back = getLevelBackground(_arg1);
_local2.waves_number = getLevelWaveNumber(_arg1);
switch (_arg1){
case 0:
_local2.initial_money = 350;
break;
case 8:
_local2.initial_money = 750;
break;
case 12:
case 14:
case 19:
_local2.initial_money = 1150;
break;
case 15:
case 9:
case 17:
case 18:
_local2.initial_money = 450;
break;
};
_local2.initialize();
return (_local2);
}
}
}//package fai.logic
Section 47
//PlayerActions (fai.logic.PlayerActions)
package fai.logic {
import fai.units.*;
import fai.common.*;
import fai.*;
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.gameBoard.build_cursor){
engine.gameBoard.removeBuildCursor();
} else {
if (engine.game_process.builder.cancelTask(engine.game_process.selected_units[0], _arg1)){
engine.gameBoard.destroyUnit(engine.game_process.selected_units[0]);
engine.money = (engine.money + engine.gameData.params(_arg1).cost);
engine.play_window.updateResources();
};
};
clear();
}
public function doAction():void{
var _local1:Position;
var _local2:Unit;
var _local3:*;
_local1 = new Position(Math.floor(((engine.gameBoard.unitlayer.mouseX / Consts.cell_size) + 0.5)), Math.floor(((engine.gameBoard.unitlayer.mouseY / Consts.cell_size) + 0.5)));
_local2 = engine.game_process.getUnitUnder(_local1);
_local3 = null;
switch (current_action){
case StringConsts.b_attack:
engine.game_process.attackTarget(_local1);
engine.play_window.buttons.showButtons(engine.game_process.selected_units[0].type);
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.money < _arg1){
engine.log("Not enough money");
return;
};
clear();
engine.gameBoard.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;
var _local3:Boolean;
engine.play_window.custom_cursor.enable(false);
_local2 = engine.gameData.params(_arg1);
if (_local2 != null){
if (_local2.flag(UnitFlags.Building)){
buildConstruction(_arg1);
return;
};
};
_local3 = (engine.game_process.selected_units.length > 0);
switch (_arg1){
case StringConsts.b_attack:
if (_local3){
current_action = StringConsts.b_attack;
engine.play_window.custom_cursor.enable(true);
engine.play_window.buttons.action();
};
break;
case StringConsts.b_stop:
if (_local3){
engine.gameProcess.deselectUnits();
engine.playWindow.updateInfo();
};
break;
case StringConsts.b_cancel:
endAction();
break;
};
}
public function endAction():void{
var _local1:Unit;
_local1 = engine.gameData.params(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 == StringConsts.b_attack))));
}
private function buildConstruction(_arg1:String):void{
if (!engine.isMoneyEnough(_arg1)){
engine.log("Not enough money");
return;
};
engine.gameBoard.createBuildingCursor(_arg1);
current_action = _arg1;
engine.gameBoard.checkCursor();
}
}
}//package fai.logic
Section 48
//RoadGraph (fai.logic.RoadGraph)
package fai.logic {
import fai.ui.*;
public class RoadGraph {
private var road:RoadPath;// = null
private var counter:int;// = 0
public function RoadGraph(_arg1:RoadPath):void{
road = null;
counter = 0;
super();
road = _arg1;
}
public function lookAnyNext():RoadPoint{
if (counter >= road.points.size()){
return (road.points.values[(road.points.size() - 1)]);
};
return (road.points.values[counter]);
}
public function getNext():RoadPoint{
if ((counter + 1) >= road.points.size()){
return (null);
};
counter++;
return (road.points.values[counter]);
}
public function getFirst():RoadPoint{
counter = 0;
return (road.firstNode());
}
}
}//package fai.logic
Section 49
//Scenario (fai.logic.Scenario)
package fai.logic {
import fai.units.*;
import flash.events.*;
import fai.common.*;
import flash.text.*;
import fai.goals.*;
import flash.utils.*;
import fai.*;
public class Scenario {
private var engine:Engine;// = null
private var level:Level;// = null
private var thinktimer:Timer;// = null
private var enemy_queue:Array;
private var enemy_generator:Timer;// = null
private var last_enemy:Unit;// = null
public var next_blocked:Boolean;// = false
private var level_number:int;// = 0
private var nwaves:int;// = 0
public var pause:int;// = 0
private var current_wave:int;// = 0
private static const MaxCountOnTheBattleField:int = 40;
private static var PAUSE:int = 30;
public function Scenario(_arg1:Engine, _arg2:Level):void{
engine = null;
thinktimer = null;
pause = 0;
current_wave = 0;
nwaves = 0;
level_number = 0;
enemy_queue = [];
level = null;
enemy_generator = null;
last_enemy = null;
next_blocked = false;
super();
level = _arg2;
engine = _arg1;
nwaves = level.waves_number;
level_number = level.number;
PAUSE = level.waves_pause;
}
public function stop():void{
thinktimer.stop();
enemy_generator.stop();
}
private function placeEnemy(_arg1:String, _arg2:int):void{
var _local3:MapMatrix;
_local3 = (engine.gameData.params(_arg1).flag(UnitFlags.Flying)) ? engine.gameBoard.airworld : engine.gameBoard.world;
createEnemy(_local3, _arg1, _arg2);
}
public function run():void{
thinktimer.start();
enemy_generator.start();
}
private function aliveEnemyCount():int{
return (engine.gameBoard.enemy_camp.aliveCount());
}
public function sendNext():void{
var _local1:int;
if (((((!(thinktimer)) || (engine.paused))) || (next_blocked))){
return;
};
if (aliveEnemyCount() > MaxCountOnTheBattleField){
engine.log("Too many invaders on the field");
return;
};
if (current_wave < nwaves){
_local1 = pause;
if (_local1 > 0){
engine.playWindow.resources.addMoneyAnimation(_local1);
engine.money = (engine.money + _local1);
engine.play_window.stats.money = (engine.play_window.stats.money + _local1);
engine.playWindow.updateResources();
};
pause = 1;
thinkHandler(null);
};
}
public function start():void{
pause = PAUSE;
thinktimer = new Timer(1000, 0);
thinktimer.addEventListener(TimerEvent.TIMER, thinkHandler);
thinktimer.start();
enemy_generator = new Timer(650, 0);
enemy_generator.addEventListener(TimerEvent.TIMER, enemyGeneratorHandler);
engine.play_window.resources.setSeconds(pause);
engine.play_window.radar.setCurrentWave((current_wave + 1), nwaves);
}
public function checkBonuses():void{
var _local1:int;
_local1 = aliveEnemyCount();
if ((((_local1 > 0)) || ((enemy_queue.length > 0)))){
return;
};
if (current_wave == int(((nwaves * 0.25) + 0.5))){
engine.playWindow.showCornerBonus("cleared25");
} else {
if (current_wave == int(((nwaves * 0.5) + 0.5))){
engine.playWindow.showCornerBonus("cleared50");
} else {
if (current_wave == int(((nwaves * 0.75) + 0.5))){
engine.playWindow.showCornerBonus("cleared75");
} else {
if (current_wave == int(((nwaves * 0.9) + 0.5))){
engine.playWindow.showCornerBonus("cleared90");
} else {
if (current_wave == nwaves){
engine.playWindow.showCornerBonus("cleared_boss");
};
};
};
};
};
}
public function destroy():void{
if (thinktimer){
thinktimer.stop();
thinktimer.removeEventListener(TimerEvent.TIMER, thinkHandler);
thinktimer = null;
};
if (enemy_generator){
enemy_generator.stop();
enemy_generator.removeEventListener(TimerEvent.TIMER, enemyGeneratorHandler);
enemy_generator = null;
};
}
private function enemyGeneratorHandler(_arg1:TimerEvent):void{
var _local2:int;
if (enemy_queue.length == 0){
return;
};
_local2 = aliveEnemyCount();
if (_local2 >= MaxCountOnTheBattleField){
return;
};
placeEnemy(enemy_queue[0][0], enemy_queue[0][1]);
enemy_queue.shift();
}
private function makeEnemies():void{
var _local1:int;
var _local2:Array;
var _local3:int;
var _local4:int;
var _local5:Array;
_local1 = (current_wave - 1);
_local2 = null;
if (current_wave == nwaves){
_local2 = LevelSelector.getLevelBosses(engine.lastLevel.number);
} else {
_local2 = LevelSelector.getLevelEnemies(engine.lastLevel.number, _local1);
};
_local3 = 0;
_local4 = 0;
_local3 = 0;
while (_local3 < _local2.length) {
_local5 = _local2[_local3];
_local4 = 0;
while (_local4 < _local5[1]) {
enemy_queue.push([_local5[0], _local5[2]]);
_local4++;
};
_local3++;
};
enemy_generator.start();
}
private function thinkHandler(_arg1:TimerEvent):void{
var _local2:int;
if (engine.levelLifePoints <= 0){
engine.gameOver();
return;
};
_local2 = aliveEnemyCount();
engine.play_window.radar.setEnemyCount(_local2);
if (!_local2){
if ((((current_wave >= nwaves)) && ((enemy_queue.length == 0)))){
engine.victory();
return;
};
if (enemy_queue.length == 0){
engine.playWindow.unblockNextButton();
};
} else {
engine.playWindow.blockNextButton();
};
if (current_wave < nwaves){
if (pause > 0){
pause--;
engine.play_window.resources.setSeconds(pause);
if (pause <= 0){
current_wave++;
if (current_wave == nwaves){
engine.log("Boss is coming!");
};
engine.play_window.radar.setCurrentWave(current_wave, nwaves);
makeEnemies();
engine.playWindow.blockNextButton();
engine.playSound(SoundConsts.next_wave);
} else {
return;
};
};
pause = PAUSE;
if (current_wave > 61){
pause = (pause + PAUSE);
};
if (current_wave == (nwaves - 1)){
};
};
}
public function isRunning():Boolean{
return (!((thinktimer == null)));
}
private function createEnemy(_arg1:MapMatrix, _arg2:String, _arg3:int):void{
var _local4:*;
last_enemy = engine.gameBoard.buildUnit(_arg2, Consts.hostileId, 0, 0, true);
engine.upgradeUnitToLevel(last_enemy, _arg3);
_local4 = new InvaderGoal(engine, last_enemy);
last_enemy.invader_goal = _local4;
engine.goal_system.add(_local4);
}
}
}//package fai.logic
Section 50
//UnitUpgrades (fai.logic.UnitUpgrades)
package fai.logic {
import fai.units.*;
import fai.common.*;
import fai.*;
public class UnitUpgrades {
private var buttons;// = null
private var unit:Unit;// = null
private var flags:Flags;// = null
private var button1_type:int;// = 0
private var engine:Engine;// = null
private var button2_type:int;// = 0
public static const DOUBLE_EXTRA_RANGE:int = 0x0100;
public static const EXTRA_ACTION_TIME:int = 4;
public static const RADAR_RANGE:int = 0x0200;
public static const DOUBLE_EXTRA_DAMAGE:int = 32;
public static const FASTER_RELOAD:int = 1;
public static const SUPER_ACTION_TIME:int = 8;
public static const SUPER_DAMAGE:int = 64;
public static const EXTRA_RANGE:int = 128;
public static const SUPER_FAST_RELOAD:int = 2;
public static const EXTRA_DAMAGE:int = 16;
public function UnitUpgrades(_arg1:Unit):void{
unit = null;
flags = null;
buttons = null;
button1_type = 0;
button2_type = 0;
engine = null;
super();
unit = _arg1;
engine = unit.engine;
flags = new Flags();
}
private function updateBombGnomeUI():void{
updateGnomeButtons();
if (((((flags.isSet(SUPER_FAST_RELOAD)) && (flags.isSet(RADAR_RANGE)))) && (flags.isSet(SUPER_DAMAGE)))){
makeItRocket();
};
}
public function upgradeRadarRange():void{
flags.put(RADAR_RANGE);
unit.weapon.range_multiplier = 2;
unit.sprite.select(true);
}
public function upgradeSuperDamage():void{
flags.put(SUPER_DAMAGE);
unit.weapon.damage = (engine.gameData.params(unit.type).weapon.damage * 8);
}
public function upgradeExtraActionTime():void{
flags.put(EXTRA_ACTION_TIME);
unit.weapon.action_delay = (Consts.DEFAULT_ACTION_DELAY * 1.5);
}
private function updateDamage(_arg1):int{
_arg1.button_back.gotoAndStop("steady_back");
if (!flags.isSet(EXTRA_DAMAGE)){
_arg1.gotoAndStop("label_extra_damage");
showBuyButton(_arg1, DataProxy.upgradeCost(EXTRA_DAMAGE, unit.type));
return (EXTRA_DAMAGE);
};
if (!flags.isSet(DOUBLE_EXTRA_DAMAGE)){
_arg1.gotoAndStop("label_double_extra_damage");
showBuyButton(_arg1, DataProxy.upgradeCost(DOUBLE_EXTRA_DAMAGE, unit.type));
return (DOUBLE_EXTRA_DAMAGE);
};
if (!flags.isSet(SUPER_DAMAGE)){
_arg1.gotoAndStop("label_super_damage");
showBuyButton(_arg1, DataProxy.upgradeCost(SUPER_DAMAGE, unit.type));
return (SUPER_DAMAGE);
};
_arg1.gotoAndStop("label_damage_finished");
_arg1.button_back.gotoAndStop("done_back");
hideBuyButton(_arg1);
return (0);
}
private function updateBoomerangGnomeUI():void{
updateGnomeButtons();
}
private function makeItRazor():void{
var _local1:UnitSuit;
_local1 = new UnitSuit();
_local1.suit_id = "suit_9";
_local1.status_bitmap = new Image_razor_gnome_status(0, 0);
_local1.move_bitmap = new Image_razor_gnome_move(0, 0);
_local1.attack_bitmap = new Image_razor_gnome_move(0, 0);
_local1.be_bitmap = new Image_spear_gnome_be(0, 0);
_local1.bullet_bitmap = new Image_razor_gnome_bullet(0, 0);
unit.sprite.updateAppearence(_local1, unit.sprite_width);
if (engine.game_process.selected_units.length > 0){
engine.playWindow.right_menu.unit_info.renewStatus(engine.game_process.selected_units[0]);
};
}
private function updatePelletGnomeUI():void{
updateGnomeButtons();
if (((((flags.isSet(SUPER_FAST_RELOAD)) && (flags.isSet(RADAR_RANGE)))) && (flags.isSet(SUPER_DAMAGE)))){
makeItRazor();
} else {
if (flags.isSet(SUPER_FAST_RELOAD)){
makeItSpear();
};
};
}
private function makeItSpear():void{
var _local1:UnitSuit;
_local1 = new UnitSuit();
_local1.suit_id = "suit_9";
_local1.status_bitmap = new Image_spear_gnome_status(0, 0);
_local1.move_bitmap = new Image_spear_gnome_move(0, 0);
_local1.attack_bitmap = new Image_spear_gnome_move(0, 0);
_local1.be_bitmap = new Image_spear_gnome_be(0, 0);
_local1.bullet_bitmap = new Image_spear_gnome_bullet(0, 0);
unit.sprite.updateAppearence(_local1, unit.sprite_width);
if (engine.game_process.selected_units.length > 0){
engine.playWindow.right_menu.unit_info.renewStatus(engine.game_process.selected_units[0]);
};
}
public function isButton2UpgradeDone():Boolean{
return ((button2_type == 0));
}
public function upgradeSuperFastReload():void{
flags.put(SUPER_FAST_RELOAD);
if (StringConsts.pellet_gnome == unit.type){
unit.weapon.recharge_time = 0;
} else {
unit.weapon.recharge_time = (engine.gameData.params(unit.type).weapon.recharge_time * 0.25);
};
}
private function hideBuyButton(_arg1):void{
_arg1.notenough_txt.visible = false;
_arg1.green_button.visible = false;
_arg1.buy_txt.visible = false;
}
public function isButton2MoneyEnough():Boolean{
if (DataProxy.upgradeCost(button2_type, unit.type) > engine.money){
return (false);
};
return (true);
}
public function upgradeFasterReload():void{
flags.put(FASTER_RELOAD);
if (StringConsts.pellet_gnome == unit.type){
unit.weapon.recharge_time = 4;
} else {
unit.weapon.recharge_time = (engine.gameData.params(unit.type).weapon.recharge_time * 0.75);
};
}
private function updateLaserTowersUI():void{
button1_type = updateReload(buttons.button1);
button2_type = updateActionTime(buttons.button2);
}
private function updateReload(_arg1):int{
_arg1.button_back.gotoAndStop("steady_back");
if (!flags.isSet(FASTER_RELOAD)){
_arg1.gotoAndStop("label_faster_reload");
showBuyButton(_arg1, DataProxy.upgradeCost(FASTER_RELOAD, unit.type));
return (FASTER_RELOAD);
};
if (!flags.isSet(SUPER_FAST_RELOAD)){
_arg1.gotoAndStop("label_super_fast_reload");
showBuyButton(_arg1, DataProxy.upgradeCost(SUPER_FAST_RELOAD, unit.type));
return (SUPER_FAST_RELOAD);
};
_arg1.gotoAndStop("label_reload_finished");
_arg1.button_back.gotoAndStop("done_back");
hideBuyButton(_arg1);
return (0);
}
private function updateGasSprayerUI():void{
button1_type = updateReload(buttons.button1);
button2_type = updateRange(buttons.button2);
}
private function updateSpittingCactusUI():void{
button1_type = updateReload(buttons.button1);
button2_type = updateDamage(buttons.button2);
}
private function updateGnomeButtons():void{
button1_type = updateReload(buttons.button1);
button2_type = updateDamage(buttons.button2);
if (flags.isSet(SUPER_FAST_RELOAD)){
button1_type = updateRange(buttons.button1);
};
}
private function updateActionTime(_arg1):int{
_arg1.button_back.gotoAndStop("steady_back");
if (!flags.isSet(EXTRA_ACTION_TIME)){
_arg1.gotoAndStop("label_extra_action_time");
showBuyButton(_arg1, DataProxy.upgradeCost(EXTRA_ACTION_TIME, unit.type));
return (EXTRA_ACTION_TIME);
};
if (!flags.isSet(SUPER_ACTION_TIME)){
_arg1.gotoAndStop("label_super_action_time");
showBuyButton(_arg1, DataProxy.upgradeCost(SUPER_ACTION_TIME, unit.type));
return (SUPER_ACTION_TIME);
};
_arg1.gotoAndStop("label_action_finished");
_arg1.button_back.gotoAndStop("done_back");
hideBuyButton(_arg1);
return (0);
}
public function upgradeUnit(_arg1:int):void{
switch (_arg1){
case FASTER_RELOAD:
upgradeFasterReload();
break;
case SUPER_FAST_RELOAD:
upgradeSuperFastReload();
break;
case EXTRA_ACTION_TIME:
upgradeExtraActionTime();
break;
case SUPER_ACTION_TIME:
upgradeSuperActionTime();
break;
case EXTRA_DAMAGE:
upgradeExtraDamage();
break;
case DOUBLE_EXTRA_DAMAGE:
upgradeDoubleExtraDamage();
break;
case SUPER_DAMAGE:
upgradeSuperDamage();
break;
case EXTRA_RANGE:
upgradeExtraRange();
break;
case DOUBLE_EXTRA_RANGE:
upgradeDoubleExtraRange();
break;
case RADAR_RANGE:
upgradeRadarRange();
break;
};
updateButtons(buttons);
}
public function isButton1UpgradeDone():Boolean{
return ((button1_type == 0));
}
public function getFlags():Flags{
return (flags);
}
public function upgradeDoubleExtraDamage():void{
flags.put(DOUBLE_EXTRA_DAMAGE);
unit.weapon.damage = (engine.gameData.params(unit.type).weapon.damage * 4);
}
public function upgradeExtraRange():void{
flags.put(EXTRA_RANGE);
unit.weapon.range_multiplier = 1.2;
unit.sprite.select(true);
}
public function button2Pressed():void{
engine.playSound(SoundConsts.click);
if (isButton2UpgradeDone()){
return;
};
if (!isButton2MoneyEnough()){
engine.log("You can't afford it.");
return;
};
engine.money = (engine.money - DataProxy.upgradeCost(button2_type, unit.type));
upgradeUnit(button2_type);
engine.playWindow.updateResources();
}
public function isButton1MoneyEnough():Boolean{
if (DataProxy.upgradeCost(button1_type, unit.type) > engine.money){
return (false);
};
return (true);
}
private function showBuyButton(_arg1, _arg2:int):void{
_arg1.notenough_txt.visible = true;
_arg1.green_button.visible = true;
_arg1.buy_txt.visible = true;
_arg1.buy_txt.text = ("Buy for " + _arg2.toString());
if (_arg2 > engine.money){
_arg1.button_back.gotoAndStop("red_back");
};
}
public function upgradeExtraDamage():void{
flags.put(EXTRA_DAMAGE);
unit.weapon.damage = (engine.gameData.params(unit.type).weapon.damage * 2);
}
public function upgradeSuperActionTime():void{
flags.put(SUPER_ACTION_TIME);
unit.weapon.action_delay = (Consts.DEFAULT_ACTION_DELAY * 2);
}
public function button1Pressed():void{
engine.playSound(SoundConsts.click);
if (isButton1UpgradeDone()){
return;
};
if (!isButton1MoneyEnough()){
engine.log("You can't afford it.");
return;
};
engine.money = (engine.money - DataProxy.upgradeCost(button1_type, unit.type));
upgradeUnit(button1_type);
engine.playWindow.updateResources();
}
private function makeItRocket():void{
var _local1:UnitSuit;
_local1 = new UnitSuit();
_local1.suit_id = "suit_12";
_local1.status_bitmap = new Image_Urocket_gnome_status(0, 0);
_local1.move_bitmap = new Image_Urocket_gnome_move(0, 0);
_local1.attack_bitmap = new Image_Urocket_gnome_move(0, 0);
_local1.be_bitmap = new Image_rocket_gnome_be(0, 0);
_local1.bullet_bitmap = new Image_Urocket_gnome_bullet(0, 0);
unit.sprite.updateAppearence(_local1, unit.sprite_width);
if (engine.game_process.selected_units.length > 0){
engine.playWindow.right_menu.unit_info.renewStatus(engine.game_process.selected_units[0]);
};
}
public function trueTitle():String{
if (StringConsts.pellet_gnome == unit.type){
if (((((flags.isSet(SUPER_FAST_RELOAD)) && (flags.isSet(RADAR_RANGE)))) && (flags.isSet(SUPER_DAMAGE)))){
return (StringConsts.razor_gnome);
};
if (flags.isSet(SUPER_FAST_RELOAD)){
return (StringConsts.spear_gnome);
};
} else {
if (StringConsts.bomb_gnome == unit.type){
if (((((flags.isSet(SUPER_FAST_RELOAD)) && (flags.isSet(RADAR_RANGE)))) && (flags.isSet(SUPER_DAMAGE)))){
return (StringConsts.rocket_gnome);
};
};
};
return (unit.type);
}
private function updateRange(_arg1):int{
_arg1.button_back.gotoAndStop("steady_back");
if (!flags.isSet(EXTRA_RANGE)){
_arg1.gotoAndStop("label_extra_range");
showBuyButton(_arg1, DataProxy.upgradeCost(EXTRA_RANGE, unit.type));
return (EXTRA_RANGE);
};
if (!flags.isSet(DOUBLE_EXTRA_RANGE)){
_arg1.gotoAndStop("label_double_extra_range");
showBuyButton(_arg1, DataProxy.upgradeCost(DOUBLE_EXTRA_RANGE, unit.type));
return (DOUBLE_EXTRA_RANGE);
};
if (!flags.isSet(RADAR_RANGE)){
_arg1.gotoAndStop("label_radar_range");
showBuyButton(_arg1, DataProxy.upgradeCost(RADAR_RANGE, unit.type));
return (RADAR_RANGE);
};
_arg1.gotoAndStop("label_range_finished");
_arg1.button_back.gotoAndStop("done_back");
hideBuyButton(_arg1);
return (0);
}
public function updateButtons(_arg1):void{
buttons = _arg1;
switch (unit.type){
case StringConsts.laser_towers:
updateLaserTowersUI();
break;
case StringConsts.spitting_cactus:
updateSpittingCactusUI();
break;
case StringConsts.gas_sprayer:
updateGasSprayerUI();
break;
case StringConsts.pellet_gnome:
updatePelletGnomeUI();
break;
case StringConsts.bomb_gnome:
updateBombGnomeUI();
break;
case StringConsts.boomerang_gnome:
updateBoomerangGnomeUI();
break;
};
}
public function upgradeDoubleExtraRange():void{
flags.put(DOUBLE_EXTRA_RANGE);
unit.weapon.range_multiplier = 1.5;
unit.sprite.select(true);
}
}
}//package fai.logic
Section 51
//BuildCursor (fai.ui.BuildCursor)
package fai.ui {
import fai.common.*;
import flash.display.*;
import flash.text.*;
import fai.*;
public class BuildCursor extends Sprite {
private var goodshape:Shape;// = null
public var bitmap:AnimatedBitmap;// = null
public var type:String;// = null
public var spritewidth:int;// = 0
private var bitmap_container:Sprite;// = null
private var msg:TextField;// = null
private var badshape:Shape;// = null
public var cost:uint;// = 0
public var angle:Number;// = 0
public function BuildCursor(_arg1:String, _arg2:AnimatedBitmap, _arg3:uint, _arg4:uint, _arg5:int):void{
var _local6:*;
bitmap = null;
type = null;
badshape = null;
goodshape = null;
cost = 0;
msg = null;
spritewidth = 0;
angle = 0;
bitmap_container = null;
super();
type = _arg1;
cost = _arg4;
bitmap = new AnimatedBitmap(_arg2.curbuffer, _arg2.width, _arg2.height);
spritewidth = _arg5;
bitmap_container = new Sprite();
bitmap_container.addChild(bitmap);
addChild(bitmap_container);
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);
if (StringConsts.laser_towers == type){
_local6 = new LaserTowersBuildTutorial();
addChild(_local6);
};
}
public function isGood():Boolean{
return (goodshape.visible);
}
public function setGood(_arg1:Boolean):void{
goodshape.visible = _arg1;
badshape.visible = !(_arg1);
}
public function setAngle(_arg1:Number):void{
angle = _arg1;
if ((angle % 360) == 0){
angle = 0;
};
bitmap_container.rotation = angle;
}
public function drawEyeRange(_arg1:uint, _arg2:Shape, _arg3:uint):void{
var _local4:uint;
var _local5:uint;
_local4 = 0xFF0000;
_local5 = 2;
_arg2.graphics.lineStyle(_local5, _local4);
_arg2.graphics.beginFill(_arg1);
_arg2.graphics.drawCircle(0, 0, (_arg3 * Consts.cell_size));
_arg2.graphics.endFill();
_arg2.alpha = 0.5;
}
public function destroy():void{
removeChild(bitmap_container);
removeChild(goodshape);
removeChild(badshape);
}
}
}//package fai.ui
Section 52
//ButtonSprite (fai.ui.ButtonSprite)
package fai.ui {
import fai.common.*;
import flash.display.*;
import flash.text.*;
public class ButtonSprite extends MovieClip {
private var mouse_over:Boolean;// = false
private var disabled:Boolean;// = false
public var type:String;
public var back_mc:MovieClip;
public var selected_shape:MovieClip;
public function ButtonSprite():void{
disabled = false;
mouse_over = false;
super();
}
public function select(_arg1:Boolean):void{
if (disabled){
return;
};
mouse_over = _arg1;
selected_shape.visible = _arg1;
}
public function initialize(_arg1:int=0, _arg2:String=null, _arg3:AnimatedBitmap=null):void{
selected_shape.visible = false;
type = _arg2;
}
public function enableButton():void{
disabled = false;
selected_shape.gotoAndStop("label_over");
selected_shape.visible = mouse_over;
}
public function makeHotKey(_arg1:String):void{
var _local2:TextField;
_local2 = Utils.createTextField(0, 10);
_local2.text = _arg1;
addChild(_local2);
}
public function disableButton():void{
disabled = true;
selected_shape.gotoAndStop("label_closed");
selected_shape.visible = true;
}
}
}//package fai.ui
Section 53
//CustomCursor (fai.ui.CustomCursor)
package fai.ui {
import fai.logic.*;
import fai.units.*;
import fai.common.*;
import flash.display.*;
import fai.*;
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;
radius = 4;
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.ui
Section 54
//DecorObject (fai.ui.DecorObject)
package fai.ui {
import fai.common.*;
import flash.display.*;
public class DecorObject {
public var bitmap_data:BitmapData;// = null
public var type:String;
public function DecorObject(_arg1:String, _arg2:BitmapData):void{
bitmap_data = null;
super();
type = _arg1;
bitmap_data = _arg2;
}
public function decorBitmap():AnimatedBitmap{
if (!bitmap_data){
return (null);
};
return (new AnimatedBitmap(bitmap_data, bitmap_data.width, bitmap_data.height));
}
}
}//package fai.ui
Section 55
//GameButtons (fai.ui.GameButtons)
package fai.ui {
import fai.logic.*;
import fai.units.*;
import flash.events.*;
import fai.common.*;
import flash.display.*;
import fai.*;
public class GameButtons extends MovieClip {
public var bomb_gnome:MovieClip;
public var spitting_cactus:MovieClip;
public var timer_bomb:MovieClip;
private var other_buttons:Array;
public var engine:Engine;// = null
public var boomerang_gnome:MovieClip;
public var buttons:Map;// = null
public var selected_unit:Unit;// = null
public var pellet_gnome:MovieClip;
public var laser_towers:MovieClip;
public var chewing_gum:MovieClip;
public var gas_sprayer:MovieClip;
public var poisoned_balls:MovieClip;
private static const button_size:int = 36;
public function GameButtons():void{
engine = null;
buttons = null;
other_buttons = [];
selected_unit = null;
super();
}
public function destroy():void{
var _local1:int;
_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);
_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);
_local1++;
};
other_buttons.length = 0;
buttons.values.length = 0;
}
public function onoutbutton(_arg1:MouseEvent):void{
if ((_arg1.currentTarget is ButtonSprite)){
_arg1.currentTarget.select(false);
if (selected_unit){
selected_unit = null;
engine.play_window.updateInfo();
};
};
}
public function onclick(_arg1:MouseEvent):void{
if (engine.paused){
return;
};
engine.playSound(SoundConsts.click);
if ((_arg1.currentTarget is ButtonSprite)){
engine.actions.buttonPressed(_arg1.currentTarget.type);
};
}
public function create():void{
initButton(pellet_gnome, StringConsts.pellet_gnome, 1);
initButton(bomb_gnome, StringConsts.bomb_gnome, 2);
initButton(boomerang_gnome, StringConsts.boomerang_gnome, 3);
initButton(spitting_cactus, StringConsts.spitting_cactus, 4);
initButton(gas_sprayer, StringConsts.gas_sprayer, 5);
initButton(laser_towers, StringConsts.laser_towers, 6);
initButton(chewing_gum, StringConsts.chewing_gum, 7);
initButton(timer_bomb, StringConsts.timer_bomb, 8);
initButton(poisoned_balls, StringConsts.poisoned_balls, 9);
hideButtons();
}
public function onoverbutton(_arg1:MouseEvent):void{
if ((_arg1.currentTarget is ButtonSprite)){
_arg1.currentTarget.select(true);
selected_unit = engine.gameData.params(_arg1.currentTarget.type);
if (selected_unit){
engine.play_window.updateInfo();
};
};
}
public function action():void{
hideButtons();
}
private function initButton(_arg1, _arg2:String, _arg3:int){
_arg1.initialize(button_size, _arg2, null);
_arg1.addEventListener(MouseEvent.MOUSE_DOWN, onclick);
_arg1.addEventListener(MouseEvent.MOUSE_OVER, onoverbutton);
_arg1.addEventListener(MouseEvent.MOUSE_OUT, onoutbutton);
_arg1.makeHotKey(_arg3.toString());
other_buttons.push(_arg1);
_arg1.buttonMode = true;
_arg1.mouseChildren = false;
_arg1.selected_shape.gotoAndStop("label_over");
return (_arg1);
}
public function initialize(_arg1:Engine):void{
engine = _arg1;
if (engine){
buttons = new Map();
create();
};
}
public function updateButtons():void{
updateButtonByCost(StringConsts.pellet_gnome, pellet_gnome);
updateButtonByCost(StringConsts.bomb_gnome, bomb_gnome);
updateButtonByCost(StringConsts.boomerang_gnome, boomerang_gnome);
updateButtonByCost(StringConsts.gas_sprayer, gas_sprayer);
updateButtonByCost(StringConsts.spitting_cactus, spitting_cactus);
updateButtonByCost(StringConsts.laser_towers, laser_towers);
updateButtonByCost(StringConsts.poisoned_balls, poisoned_balls);
updateButtonByCost(StringConsts.timer_bomb, timer_bomb);
updateButtonByCost(StringConsts.chewing_gum, chewing_gum);
}
public function showButtons(_arg1:String):void{
var _local2:*;
hideButtons();
_local2 = null;
if (!engine.gameData.params(_arg1).flag(UnitFlags.Peaceful)){
};
}
public function hideButtons():void{
var _local1:*;
for each (_local1 in buttons.values) {
_local1.alpha = 0.5;
_local1.removeEventListener(MouseEvent.MOUSE_DOWN, onclick);
};
}
private function updateButtonByCost(_arg1:String, _arg2):void{
if (!engine.isMoneyEnough(_arg1)){
_arg2.disableButton();
} else {
_arg2.enableButton();
};
}
}
}//package fai.ui
Section 56
//GardenItem (fai.ui.GardenItem)
package fai.ui {
import flash.display.*;
public class GardenItem extends MovieClip {
public var alive:Boolean;// = true
public function GardenItem(){
alive = true;
super();
}
}
}//package fai.ui
Section 57
//Hedge (fai.ui.Hedge)
package fai.ui {
import flash.display.*;
public class Hedge extends MovieClip {
}
}//package fai.ui
Section 58
//LevelButton (fai.ui.LevelButton)
package fai.ui {
import fai.logic.*;
import fai.units.*;
import flash.events.*;
import fai.common.*;
import flash.display.*;
import flash.text.*;
import flash.filters.*;
import fai.*;
public class LevelButton extends MovieClip {
public var filter_back:MovieClip;
private var frame:int;// = 0
private var unit_bitmap:AnimatedBitmap;// = null
private var engine:Engine;// = null
private var level_id:int;// = 0
public var red_back:MovieClip;
public var won_back:MovieClip;
private static var enemies:Array = [StringConsts.beetle, StringConsts.colorado_beetle, StringConsts.butterfly, StringConsts.beetle, StringConsts.dragonfly, StringConsts.bumblebee, StringConsts.worm, StringConsts.beetle, StringConsts.bumblebee, StringConsts.worm, StringConsts.caterpillar, StringConsts.butterfly, StringConsts.dragonfly, StringConsts.worm, StringConsts.beetle, StringConsts.butterfly, StringConsts.bumblebee, StringConsts.dragonfly, StringConsts.worm, StringConsts.caterpillar];
private static var allies:Array = [StringConsts.spitting_cactus, StringConsts.gas_sprayer, StringConsts.pellet_gnome, StringConsts.laser_towers, StringConsts.boomerang_gnome, StringConsts.pellet_gnome, StringConsts.bomb_gnome, StringConsts.pellet_gnome, StringConsts.boomerang_gnome, StringConsts.spitting_cactus, StringConsts.bomb_gnome, StringConsts.laser_towers, StringConsts.pellet_gnome, StringConsts.boomerang_gnome, StringConsts.spitting_cactus, StringConsts.pellet_gnome, StringConsts.bomb_gnome, StringConsts.boomerang_gnome, StringConsts.pellet_gnome, StringConsts.bomb_gnome];
public function LevelButton():void{
engine = null;
level_id = 0;
unit_bitmap = null;
frame = 0;
super();
}
public function select(_arg1:Boolean):void{
var _local2:BitmapFilter;
var _local3:Array;
if (_arg1){
_local2 = getBitmapFilter();
_local3 = new Array();
_local3.push(_local2);
filter_back.filters = _local3;
} else {
filter_back.filters = new Array();
};
}
public function levelClosed():void{
clear();
red_back.visible = true;
won_back.visible = false;
unit_bitmap = engine.gameData.getStatusBitmap(engine.gameData.params(enemies[level_id]).suit_id);
setBitmap(unit_bitmap);
}
private function setBitmap(_arg1):void{
Utils.fitToSize(_arg1, 45);
_arg1.x = (_arg1.x - (_arg1.width / 2));
_arg1.y = (_arg1.y - (_arg1.height / 2));
addChild(_arg1);
}
public function levelWon():void{
clear();
won_back.visible = true;
red_back.visible = false;
unit_bitmap = engine.gameData.getStatusBitmap(engine.gameData.params(allies[level_id]).suit_id);
setBitmap(unit_bitmap);
}
public function initialize(_arg1:Engine, _arg2:int):void{
engine = _arg1;
level_id = _arg2;
buttonMode = true;
mouseChildren = false;
}
public function clear():void{
stopAnimation();
if (unit_bitmap){
removeChild(unit_bitmap);
unit_bitmap = null;
};
}
public function levelCurrent():void{
var _local1:BitmapData;
var _local2:Unit;
clear();
red_back.visible = true;
won_back.visible = false;
_local1 = engine.gameData.getBody(engine.gameData.params(enemies[level_id]).suit_id);
_local2 = engine.gameData.params(enemies[level_id]);
unit_bitmap = new AnimatedBitmap(_local1, _local2.sprite_width, _local1.height);
setBitmap(unit_bitmap);
startAnimation();
}
public function startAnimation():void{
stopAnimation();
GameStage.main_stage.addEventListener(Event.ENTER_FRAME, animHandler);
}
public function stopAnimation():void{
GameStage.main_stage.removeEventListener(Event.ENTER_FRAME, animHandler);
}
public function get levelId():int{
return (level_id);
}
private function animHandler(_arg1:Event):void{
if (unit_bitmap.framen < unit_bitmap.nframes){
frame++;
} else {
frame = 0;
};
unit_bitmap.setFrame(frame);
}
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 = 0xFF00;
_local2 = 1;
_local3 = 35;
_local4 = 35;
_local5 = 3;
_local6 = false;
_local7 = false;
_local8 = BitmapFilterQuality.HIGH;
return (new GlowFilter(_local1, _local2, _local3, _local4, _local5, _local8, _local6, _local7));
}
}
}//package fai.ui
Section 59
//LevelInfoPanel (fai.ui.LevelInfoPanel)
package fai.ui {
import fai.logic.*;
import flash.display.*;
import flash.text.*;
public class LevelInfoPanel extends MovieClip {
public var resume_game_button:SimpleButton;
public var title:TextField;
public var waves:TextField;
public var play_button:SimpleButton;
public function showLevelInfo(_arg1:Level):void{
if (_arg1){
title.text = _arg1.number.toString();
waves.text = _arg1.waves_number.toString();
};
}
}
}//package fai.ui
Section 60
//LevelSelection (fai.ui.LevelSelection)
package fai.ui {
import fai.logic.*;
import flash.media.*;
import flash.events.*;
import fai.common.*;
import flash.display.*;
import flash.text.*;
import flash.net.*;
import flash.utils.*;
import fai.*;
public class LevelSelection extends Sprite {
private var level_msg_timer:Timer;// = null
public var sound_control:MovieClip;
public var level2:MovieClip;
public var level5:MovieClip;
public var level6:MovieClip;
public var level7:MovieClip;
public var level1:MovieClip;
public var level9:MovieClip;
public var level3:MovieClip;
public var level4:MovieClip;
public var level8:MovieClip;
public var current_level:int;// = 0
public var dedegames_button:SimpleButton;
private var engine:Engine;// = null
private var music_sound:Sound;// = null
public var level_info:MovieClip;
private var hello_closed:Boolean;// = false
private var tutorial:TutorialMC;// = null
public var level_msg:MovieClip;
public var level11:MovieClip;
public var level13:MovieClip;
public var level14:MovieClip;
public var level15:MovieClip;
public var level16:MovieClip;
public var level12:MovieClip;
public var level17:MovieClip;
public var level19:MovieClip;
public var level18:MovieClip;
public var level10:MovieClip;
public var level20:MovieClip;
private var level_array:Array;
public var music_channel:SoundChannel;// = null
public function LevelSelection():void{
engine = null;
current_level = 0;
level_array = [];
level_msg_timer = null;
hello_closed = false;
music_sound = null;
music_channel = null;
tutorial = null;
super();
}
private function resumeGameClickHandler(_arg1:MouseEvent):void{
visible = false;
stopMusic();
engine.playSound(SoundConsts.click);
engine.showUI();
engine.pause();
}
public function loadLevels():void{
var _local1:*;
_local1 = SharedObject.getLocal("GardenTD_1", "/");
current_level = _local1.data.current_level;
}
public function initializeLevelButtons(_arg1:Array):void{
var _local2:int;
var _local3:LevelButton;
_local2 = 0;
_local2 = 0;
while (_local2 < level_array.length) {
_local3 = level_array[_local2];
_local3.initialize(engine, _local2);
_local3.addEventListener(MouseEvent.MOUSE_DOWN, levelClickHandler);
_local3.addEventListener(MouseEvent.MOUSE_OVER, levelOverHandler);
_local3.addEventListener(MouseEvent.MOUSE_OUT, levelOutHandler);
_local2++;
};
}
public function stopMusic():void{
if (music_channel){
music_channel.stop();
music_channel = null;
};
}
public function setLevel(_arg1:int):void{
var _local2:Level;
_local2 = engine.gameData.getLevel(_arg1);
level_info.showLevelInfo(_local2);
current_level = _arg1;
}
public function playMusic():void{
var _local1:SoundTransform;
stopMusic();
if (((!(engine.volumeOff)) && (music_sound))){
_local1 = new SoundTransform();
_local1.volume = engine.volume;
music_channel = music_sound.play(0, 99999, _local1);
};
}
public function updateLevels():void{
var _local1:int;
_local1 = 0;
_local1 = 0;
while (_local1 < level_array.length) {
if (_local1 < current_level){
level_array[_local1].levelWon();
} else {
if (_local1 == current_level){
level_array[_local1].levelCurrent();
} else {
level_array[_local1].levelClosed();
};
};
_local1++;
};
}
private function playNextClickHanler(_arg1:MouseEvent):void{
hello_closed = true;
engine.playSound(SoundConsts.click);
if (current_level >= (engine.gameData.getLevels().length - 1)){
playLevel(0);
} else {
playLevel(current_level);
};
_arg1.stopPropagation();
}
public function initialize(_arg1:Engine):void{
var _local2:Array;
engine = _arg1;
level_info.play_button.addEventListener(MouseEvent.MOUSE_DOWN, playNextClickHanler);
level_info.resume_game_button.addEventListener(MouseEvent.MOUSE_DOWN, resumeGameClickHandler);
level_info.resume_game_button.visible = false;
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();
level_array = [level1, level2, level3, level4, level5, level6, level7, level8, level9, level10, level11, level12, level13, level14, level15, level16, level17, level18, level19, level20];
music_sound = new Sound_level_selection();
sound_control.setEngine(engine);
_local2 = engine.gameData.getLevels();
initializeLevelButtons(_local2);
setLevel(0);
loadLevels();
updateLevels();
tutorial = new TutorialMC();
tutorial.init(engine);
tutorial.visible = false;
tutorial.x = 400;
tutorial.y = 300;
addChild(tutorial);
dedegames_button.addEventListener(MouseEvent.MOUSE_DOWN, GameStage.sponsorClick);
}
public function clear():void{
}
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 saveLevels():void{
var _local1:*;
_local1 = SharedObject.getLocal("GardenTD_1", "/");
_local1.data.current_level = current_level;
_local1.flush();
}
private function playLevel(_arg1:int):void{
visible = false;
stopMusic();
engine.playLevel(engine.gameData.getLevel(_arg1));
}
private function levelOverHandler(_arg1:MouseEvent):void{
if ((_arg1.currentTarget is LevelButton)){
_arg1.currentTarget.select(true);
};
}
private function levelOutHandler(_arg1:MouseEvent):void{
if ((_arg1.currentTarget is LevelButton)){
_arg1.currentTarget.select(false);
};
}
private function levelClickHandler(_arg1:MouseEvent):void{
var _local2:int;
if ((_arg1.currentTarget is LevelButton)){
engine.playSound(SoundConsts.click);
_local2 = (_arg1.currentTarget as LevelButton).levelId;
if (_local2 <= current_level){
playLevel(_local2);
} else {
showLevelMessage();
};
_arg1.stopPropagation();
};
}
private function startHelloHandler(_arg1:MouseEvent):void{
engine.playSound(SoundConsts.click);
hello_closed = true;
}
private function instructionsHandler(_arg1:MouseEvent):void{
tutorial.showTutorial();
}
private function levelMsgTimer(_arg1:TimerEvent):void{
level_msg.visible = false;
}
public function show():void{
if (engine.gameBoard != 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;
};
updateLevels();
saveLevels();
setLevel(current_level);
playMusic();
visible = true;
}
}
}//package fai.ui
Section 61
//MapElement (fai.ui.MapElement)
package fai.ui {
import fai.loading.*;
import fai.common.*;
import flash.display.*;
public class MapElement {
public var rotation:int;// = 0
public var scaleX:Number;// = 0
public var scaleY:Number;// = 0
public var x:int;// = 0
public var y:int;// = 0
public var type:String;
public function MapElement(_arg1:String, _arg2:Position):void{
x = 0;
y = 0;
scaleX = 0;
scaleY = 0;
rotation = 0;
super();
type = _arg1;
x = _arg2.x;
y = _arg2.y;
}
public function setRotation(_arg1:Number):void{
rotation = _arg1;
}
public function construct(_arg1:GameData):Sprite{
var _local2:Sprite;
var _local3:AnimatedBitmap;
_local2 = new Sprite();
_local3 = _arg1.getDecorBitmap(type);
_local2.addChild(_local3);
_local3.x = (-(_local3.width) / 2);
_local3.y = (-(_local3.height) / 2);
_local2.scaleX = scaleX;
_local2.scaleY = scaleY;
_local2.rotation = rotation;
_local2.x = x;
_local2.y = y;
return (_local2);
}
public function setScaleY(_arg1:Number):void{
scaleY = _arg1;
}
public function copy(_arg1:MapElement):void{
type = _arg1.type;
x = _arg1.x;
y = _arg1.y;
scaleX = _arg1.scaleX;
scaleY = _arg1.scaleY;
rotation = _arg1.rotation;
}
public function setY(_arg1:Number):void{
y = _arg1;
}
public function setX(_arg1:Number):void{
x = _arg1;
}
public function setScaleX(_arg1:Number):void{
scaleX = _arg1;
}
}
}//package fai.ui
Section 62
//PlayWindow (fai.ui.PlayWindow)
package fai.ui {
import fai.logic.*;
import fai.units.*;
import flash.events.*;
import fai.common.*;
import flash.display.*;
import fai.*;
import flash.ui.*;
public class PlayWindow extends MovieClip {
public var custom_cursor:CustomCursor;// = null
private var road_index:int;// = 0
public var radar:MovieClip;
public var click_any_dialog:MovieClip;
public var resources:MovieClip;
public var hedge;// = null
public var garden_items:Array;
public var roads:Array;
private var engine:Engine;// = null
public var pause_mc:MovieClip;
public var buttons:MovieClip;
public var stats:Statistics;// = null
public var right_menu:MovieClip;
public var corner_bonus:MovieClip;
public var message_mc:MovieClip;
public function PlayWindow():void{
engine = null;
custom_cursor = null;
stats = null;
roads = [];
road_index = 0;
garden_items = [];
hedge = null;
super();
}
public function destroy():void{
right_menu.unit_info.sell_button.removeEventListener(MouseEvent.MOUSE_DOWN, sellPressed);
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.flongabot_button.removeEventListener(MouseEvent.MOUSE_DOWN, GameStage.sponsorClick);
if (click_any_dialog){
click_any_dialog.start_button.removeEventListener(MouseEvent.MOUSE_DOWN, clickAnyHandler);
click_any_dialog.next_button.removeEventListener(MouseEvent.MOUSE_DOWN, tutorialNextHandler);
};
buttons.destroy();
stats.destroy();
removeChild(stats);
stats = null;
custom_cursor.destroy();
engine.gameBoard.unitlayer.removeChild(custom_cursor);
custom_cursor = null;
}
private function sendNextPressed(_arg1:MouseEvent):void{
if (engine.paused){
return;
};
engine.scenario.sendNext();
}
public function updateInfo():void{
var _local1:Unit;
var _local2:Unit;
var _local3:String;
for each (_local1 in engine.game_process.selected_units) {
if (_local1.isAlive()){
_local1.showSelection();
};
};
for each (_local2 in engine.gameBoard.enemy_camp.units) {
_local2.sprite.updateBar();
};
buttons.updateButtons();
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){
_local3 = engine.game_process.builder.inBuilding(engine.game_process.selected_units[0]);
right_menu.unit_info.update(engine.game_process.selected_units[0]);
if (_local3 != null){
buttons.action();
engine.actions.current_action = _local3;
return;
};
} else {
right_menu.unit_info.updateGroup(engine.game_process.selected_units);
};
if (((engine.gameBoard.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 (((engine.gameBoard.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;
engine.stopMusic();
right_menu.sound_off_button.visible = false;
right_menu.sound_on_button.visible = true;
}
public function getNextRoad():RoadPath{
road_index++;
if (road_index >= roads.length){
road_index = 0;
};
return (roads[road_index]);
}
private function soundOnPressed(_arg1:MouseEvent):void{
engine.volumeOff = false;
engine.playMusic();
right_menu.sound_off_button.visible = true;
right_menu.sound_on_button.visible = false;
engine.playSound(SoundConsts.click);
}
public function createCustomCursor():void{
custom_cursor = new CustomCursor(engine);
engine.gameBoard.unitlayer.addChild(custom_cursor);
}
private function pausePressed(_arg1:MouseEvent):void{
engine.playSound(SoundConsts.upgrade);
engine.pause();
}
public function updateResources():void{
resources.score.text = engine.score.toString();
resources.crystals.text = engine.money.toString();
resources.setLifePoints(engine.levelLifePoints, engine.lastLevel.level_health);
buttons.updateButtons();
if (engine.game_process.selected_units.length > 0){
if (engine.game_process.selected_units.length == 1){
right_menu.unit_info.update(engine.game_process.selected_units[0]);
};
};
}
private function clickAnyHandler(_arg1:MouseEvent):void{
engine.playSound(SoundConsts.click);
clearClickAnyDialog();
engine.pause();
}
public function initializeControls():void{
right_menu.setEngine(engine);
buttons.initialize(engine);
radar.setEngine(engine, 140, 90);
pause_mc.visible = false;
message_mc.visible = false;
stats = new Statistics();
stats.setEngine(engine);
stats.visible = false;
stats.firework1.stop();
stats.firework2.stop();
stats.setBackground(engine.gameData.currentGame.general_screen);
addChild(stats);
right_menu.unit_info.sell_button.addEventListener(MouseEvent.MOUSE_DOWN, sellPressed);
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);
right_menu.flongabot_button.addEventListener(MouseEvent.MOUSE_DOWN, GameStage.sponsorClick);
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);
click_any_dialog.start_button.addEventListener(MouseEvent.MOUSE_DOWN, clickAnyHandler);
click_any_dialog.next_button.addEventListener(MouseEvent.MOUSE_DOWN, tutorialNextHandler);
right_menu.unit_info.upgrades.button1.buttonMode = true;
right_menu.unit_info.upgrades.button1.mouseChildren = false;
right_menu.unit_info.upgrades.button2.buttonMode = true;
right_menu.unit_info.upgrades.button2.mouseChildren = false;
corner_bonus.visible = false;
corner_bonus.stop();
click_any_dialog.init(engine);
click_any_dialog.showTutorial();
message_mc.visible = false;
message_mc.stop();
}
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];
engine.money = (engine.money + int(((_local2.cost * _local2.health) / _local2.full_health)));
engine.gameBoard.destroyUnit(_local2);
};
updateResources();
}
public function clearClickAnyDialog():void{
if (click_any_dialog){
click_any_dialog.start_button.removeEventListener(MouseEvent.MOUSE_DOWN, clickAnyHandler);
click_any_dialog.next_button.removeEventListener(MouseEvent.MOUSE_DOWN, tutorialNextHandler);
click_any_dialog.visible = false;
removeChild(click_any_dialog);
click_any_dialog = null;
};
}
public function upgradePressed(_arg1:MouseEvent):void{
var _local2:int;
var _local3:Unit;
if (engine.paused){
return;
};
engine.playSound(SoundConsts.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 unpausePressed(_arg1:MouseEvent):void{
engine.playSound(SoundConsts.unpause);
if (!engine.paused){
return;
};
engine.pause();
}
public function blockNextButton():void{
resources.send_next_button.alpha = 0.5;
engine.scenario.next_blocked = true;
}
public function initialize(_arg1:Engine):void{
var _local2:int;
var _local3:int;
var _local4:*;
engine = _arg1;
initializeControls();
_local2 = 0;
_local3 = engine.lastLevel.level_back.numChildren;
_local2 = 0;
while (_local2 < _local3) {
_local4 = engine.lastLevel.level_back.getChildAt(_local2);
if ((_local4 is RoadPath)){
_local4.initialize();
_local4.visible = false;
roads.push(_local4);
} else {
if ((_local4 is GardenItem)){
garden_items.push(_local4);
} else {
if ((_local4 is Hedge)){
hedge = _local4;
};
};
};
_local2++;
};
}
private function tutorialNextHandler(_arg1:MouseEvent):void{
engine.playSound(SoundConsts.click);
click_any_dialog.nextPage();
}
public function showCornerBonus(_arg1:String):void{
if (corner_bonus.visible){
return;
};
corner_bonus.visible = true;
corner_bonus.gotoAndPlay(_arg1);
}
private function stopRepairPressed(_arg1:MouseEvent):void{
}
public function unblockNextButton():void{
resources.send_next_button.alpha = 1;
engine.scenario.next_blocked = false;
}
private function onKeyDown(_arg1:KeyboardEvent):void{
if (((click_any_dialog) && (click_any_dialog.visible))){
clearClickAnyDialog();
engine.pause();
return;
};
if ((((((Keyboard.SPACE == _arg1.keyCode)) || ((80 == _arg1.charCode)))) || ((112 == _arg1.charCode)))){
if (pause_mc.visible){
engine.pause();
};
};
}
public function menuPressed(_arg1:MouseEvent):void{
engine.playSound(SoundConsts.click);
if (((click_any_dialog) && (click_any_dialog.visible))){
} else {
engine.pause();
};
engine.showUI(false);
GameStage.welcomeScreen.showWelcome();
}
private function repairPressed(_arg1:MouseEvent):void{
}
}
}//package fai.ui
Section 63
//Radar (fai.ui.Radar)
package fai.ui {
import fai.logic.*;
import flash.display.*;
import flash.text.*;
public class Radar extends MovieClip {
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(){
radar = new Shape();
engine = null;
mwidth = 0;
mheight = 0;
super();
}
public function setEngine(_arg1:Engine, _arg2:int, _arg3:int):void{
engine = _arg1;
addChild(radar);
mwidth = _arg2;
mheight = _arg3;
}
public function setCurrentWave(_arg1:int, _arg2:int):void{
current_wave.text = ((_arg1.toString() + "/") + _arg2.toString());
}
public function setEnemyCount(_arg1:int):void{
enemy_count.text = _arg1.toString();
}
}
}//package fai.ui
Section 64
//Resources (fai.ui.Resources)
package fai.ui {
import fai.logic.*;
import fai.units.*;
import fai.common.*;
import flash.display.*;
import flash.text.*;
import flash.filters.*;
import fai.*;
public class Resources extends MovieClip {
public var wave_time:TextField;
public var score:TextField;
public var add_money_anim:MovieClip;
public var send_next_button:SimpleButton;
public var level_life:TextField;
public var crystals:TextField;
public function Resources():void{
add_money_anim.stop();
add_money_anim.visible = false;
}
public function setLifePoints(_arg1:int, _arg2:int):void{
level_life.text = ((_arg1.toString() + "/") + _arg2.toString());
}
public function addMoneyAnimation(_arg1:int):void{
add_money_anim.internal_mc.txt.text = (("+" + _arg1.toString()) + "$");
add_money_anim.visible = true;
add_money_anim.gotoAndPlay("start");
}
public function setSeconds(_arg1:int):void{
var _local2:String;
_local2 = _arg1.toString();
if (_arg1 < 10){
_local2 = ("0" + _local2);
};
wave_time.text = ("00:" + _local2);
}
}
}//package fai.ui
Section 65
//RightSideMenu (fai.ui.RightSideMenu)
package fai.ui {
import fai.logic.*;
import flash.display.*;
public class RightSideMenu extends MovieClip {
public var menu_button:SimpleButton;
public var black_back:MovieClip;
public var sound_off_button:SimpleButton;
public var sound_on_button:SimpleButton;
private var engine:Engine;// = null
public var unit_info:UnitInfo;
public var flongabot_button:SimpleButton;
public var pause_button:SimpleButton;
public function RightSideMenu(){
engine = null;
super();
}
public function destroy():void{
}
public function setEngine(_arg1:Engine):void{
engine = _arg1;
unit_info.setEngine(engine);
}
}
}//package fai.ui
Section 66
//RoadPath (fai.ui.RoadPath)
package fai.ui {
import fai.logic.*;
import fai.common.*;
import flash.display.*;
import fai.*;
public dynamic class RoadPath extends MovieClip {
public var points:Map;// = null
public function RoadPath():void{
points = null;
super();
}
public function initialize():void{
var _local1:int;
var _local2:int;
var _local3:*;
points = new Map();
_local1 = numChildren;
_local2 = 0;
_local2 = 0;
while (_local2 < _local1) {
_local3 = getChildAt(_local2);
if ((_local3 is RoadPoint)){
points.add(_local3.name, _local3);
};
_local2++;
};
}
public function firstNode():RoadPoint{
return (points.values[0]);
}
}
}//package fai.ui
Section 67
//SelectedSprite (fai.ui.SelectedSprite)
package fai.ui {
import fai.logic.*;
import fai.units.*;
import flash.events.*;
import fai.common.*;
import flash.display.*;
public class SelectedSprite extends Sprite {
private var sshape:Shape;// = null
private var engine:Engine;// = null
private var unit:Unit;// = 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;
unit = null;
engine = null;
super();
engine = _arg1;
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.gameData.getStatusBitmap(_arg2.suit_id);
_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.underRepair()){
_local5 = new RepairSign();
_local5.x = 10;
_local5.y = 10;
addChild(_local5);
};
}
private function onMouseOver(_arg1:MouseEvent):void{
sshape.visible = true;
}
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;
}
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.ui
Section 68
//SoundControlMC (fai.ui.SoundControlMC)
package fai.ui {
import fai.logic.*;
import flash.media.*;
import fai.units.*;
import fai.common.*;
import fl.controls.*;
import flash.display.*;
import flash.text.*;
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:SliderEvent):void{
var _local2:SoundTransform;
engine.volume = (sound_slider.value / 100);
if (GameStage.welcomeScreen.levelSelection.music_channel){
_local2 = GameStage.welcomeScreen.levelSelection.music_channel.soundTransform;
_local2.volume = engine.volume;
GameStage.welcomeScreen.levelSelection.music_channel.soundTransform = _local2;
};
}
public function setEngine(_arg1:Engine):void{
engine = _arg1;
sound_slider.value = (engine.volume * 100);
}
}
}//package fai.ui
Section 69
//Statistics (fai.ui.Statistics)
package fai.ui {
import fai.logic.*;
import flash.media.*;
import fai.units.*;
import flash.events.*;
import fai.common.*;
import flash.display.*;
import flash.text.*;
import flash.utils.*;
import fai.*;
public class Statistics extends Sprite {
public var dede_games:SimpleButton;
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;
private var music_sound:Sound;// = null
public var killed:int;// = 0
public var sponsorgames_button:SimpleButton;
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 money:int;// = 0
public var continue_button:SimpleButton;
public var firework1:MovieClip;
public var lost_txt:TextField;
public var firework2:MovieClip;
public var music_channel:SoundChannel;// = null
private var back:AnimatedBitmap;// = null
public var back_layer:MovieClip;
public function Statistics():void{
killed = 0;
lost = 0;
built = 0;
money = 0;
bombs = 0;
score = 0;
engine = null;
counterTimer = null;
back = null;
music_sound = null;
music_channel = null;
super();
}
public function destroy():void{
if (counterTimer){
counterTimer.stop();
counterTimer.removeEventListener(TimerEvent.TIMER, counterTick);
counterTimer = null;
};
stopMusic();
play_again_button.removeEventListener(MouseEvent.MOUSE_DOWN, playAgain);
main_menu_button.removeEventListener(MouseEvent.MOUSE_DOWN, mainMenu);
continue_button.removeEventListener(MouseEvent.MOUSE_DOWN, showLevels);
dede_games.removeEventListener(MouseEvent.MOUSE_DOWN, GameStage.sponsorClick);
sponsorgames_button.removeEventListener(MouseEvent.MOUSE_DOWN, GameStage.sponsorClick);
}
public function victory():void{
firework1.play();
firework2.play();
stat_title.text = "Well Done!";
continue_button.visible = true;
music_sound = new Sound_victory();
}
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 setBackground(_arg1:BitmapData):void{
if (!_arg1){
return;
};
back = new AnimatedBitmap(_arg1, _arg1.width, _arg1.height);
back_layer.addChild(back);
}
public function setEngine(_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, showLevels);
dede_games.addEventListener(MouseEvent.MOUSE_DOWN, GameStage.sponsorClick);
sponsorgames_button.addEventListener(MouseEvent.MOUSE_DOWN, GameStage.sponsorClick);
}
public function stopMusic():void{
if (music_channel){
music_channel.stop();
music_channel = null;
};
}
public function start():void{
playMusic();
killed_txt.text = "0";
lost_txt.text = "0";
built_txt.text = "0";
crystals_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{
engine.score = 0;
}
public function playMusic():void{
var _local1:SoundTransform;
stopMusic();
if (((!(engine.volumeOff)) && (music_sound))){
_local1 = new SoundTransform();
_local1.volume = engine.volume;
music_channel = music_sound.play(0, 1, _local1);
};
}
private function counterTick(_arg1:TimerEvent):void{
killed = (killed - counter(killed_txt, killed));
lost = (lost - counter(lost_txt, lost));
built = (built - counter(built_txt, built));
money = (money - counter(crystals_txt, money));
score = (score - counter(score_txt, score));
if ((((((killed + lost) + built) + money) + bombs) + score) == 0){
counterTimer.stop();
counterTimer.removeEventListener(TimerEvent.TIMER, counterTick);
counterTimer = null;
};
}
private function playAgain(_arg1:MouseEvent):void{
visible = false;
engine.playSound(SoundConsts.click);
engine.playLevel(engine.lastLevel);
}
public function defeat():void{
stat_title.text = "DEFEAT";
continue_button.visible = false;
music_sound = new Sound_game_over();
}
private function showLevels(_arg1:MouseEvent):void{
visible = false;
engine.playSound(SoundConsts.click);
engine.clearAll();
if (engine.lastLevel.number >= (engine.gameData.getLevels().length - 1)){
GameStage.welcomeScreen.showWelcome();
} else {
engine.playLevel(engine.gameData.getLevel((engine.lastLevel.number + 1)));
};
}
private function mainMenu(_arg1:MouseEvent):void{
visible = false;
engine.playSound(SoundConsts.click);
engine.clearAll();
GameStage.welcomeScreen.showWelcome();
}
}
}//package fai.ui
Section 70
//TutorialMC (fai.ui.TutorialMC)
package fai.ui {
import fai.logic.*;
import flash.display.*;
import fai.*;
public class TutorialMC extends MovieClip {
public var next_button:SimpleButton;
private var engine:Engine;// = null
public var current_page:String;// = "page1"
public var start_button:SimpleButton;
public function TutorialMC():void{
engine = null;
current_page = "page1";
super();
addFrameScript(0, frame1);
}
public function init(_arg1:Engine):void{
engine = _arg1;
}
public function nextPage():void{
engine.playSound(SoundConsts.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":
gotoPage("page6");
break;
case "page6":
gotoPage("page7");
break;
default:
gotoPage("page1");
break;
};
}
function frame1(){
stop();
}
public function showTutorial():void{
gotoPage("page1");
visible = true;
}
public function gotoPage(_arg1:String):void{
current_page = _arg1;
gotoAndStop(_arg1);
}
private function hideTutorial():void{
visible = false;
}
}
}//package fai.ui
Section 71
//UnitInfo (fai.ui.UnitInfo)
package fai.ui {
import fai.logic.*;
import fai.units.*;
import fai.common.*;
import flash.display.*;
import flash.text.*;
import flash.filters.*;
import fai.*;
public class UnitInfo extends Sprite {
private var status_bitmap:AnimatedBitmap;// = null
private var last_type:String;// = ""
private var engine:Engine;// = null
public var title:TextField;
private var current_unit:Unit;// = null
private var last_frontier:int;// = -1
public var status_holder:MovieClip;
public var unit_params:MovieClip;
public var selected_sprites:Array;// = null
public var sell_button:MovieClip;
public var upgrades:MovieClip;
private var build_progress:Shape;// = null
public var hostile_unit_params:MovieClip;
public function UnitInfo(){
engine = null;
status_bitmap = null;
last_type = "";
build_progress = null;
last_frontier = -1;
selected_sprites = null;
current_unit = null;
super();
}
public function showParams(_arg1:Unit):void{
unit_params.visible = true;
sell_button.visible = false;
if (engine.game_process.builder.inBuilding(_arg1) != null){
build_progress.visible = true;
sell_button.visible = false;
} else {
build_progress.visible = false;
};
unit_params.description.text = _arg1.description;
unit_params.attack_txt.text = _arg1.weapon.damage.toString();
unit_params.money_txt.text = _arg1.cost.toString();
unit_params.range_txt.text = Utils.textrange(_arg1.weapon.eyerange);
}
public function showMyUnitInfo(_arg1:Unit):void{
if ((((((_arg1.type == StringConsts.poisoned_balls)) || ((_arg1.type == StringConsts.timer_bomb)))) || ((_arg1.type == StringConsts.chewing_gum)))){
} else {
upgrades.visible = true;
_arg1.upgrades.updateButtons(upgrades);
sell_button.visible = true;
sell_button.caption.text = ("Sell for " + int(((_arg1.cost * _arg1.health) / _arg1.full_health)).toString());
};
}
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){
if (current_unit.sprite){
renewStatus(current_unit);
} else {
status_bitmap = engine.gameData.getStatusBitmap(_arg1);
status_bitmap.x = status_holder.x;
status_bitmap.y = status_holder.y;
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{
}
public function setEngine(_arg1:Engine):void{
engine = _arg1;
sell_button.buttonMode = true;
sell_button.mouseChildren = false;
sell_button.gotoAndStop("_up");
build_progress = new Shape();
build_progress.x = 10;
build_progress.y = 0;
build_progress.visible = false;
unit_params.addChild(build_progress);
unit_params.visible = false;
status_holder.visible = false;
status_holder.visible = false;
}
public function showHostileUnitInfo(_arg1:Unit):void{
hostile_unit_params.visible = true;
hostile_unit_params.health_txt.text = ((_arg1.health.toString() + "/") + _arg1.full_health.toString());
}
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.gameData.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:Number;
if (((engine.playWindow.buttons.selected_unit) && (!((engine.playWindow.buttons.selected_unit == _arg1))))){
return;
};
current_unit = _arg1;
upgrades.visible = false;
unit_params.visible = false;
hostile_unit_params.visible = false;
sell_button.visible = false;
clearGroupSprites();
if (_arg1.upgrades){
title.text = _arg1.upgrades.trueTitle();
} else {
title.text = _arg1.type;
};
if (((engine.game_process.builder.inBuilding(_arg1)) || ((null == _arg1.engine)))){
showParams(_arg1);
} else {
switch (_arg1.mapid){
case 0:
showParams(_arg1);
break;
case Consts.myId:
showMyUnitInfo(_arg1);
break;
case Consts.hostileId:
showHostileUnitInfo(_arg1);
break;
};
};
_local2 = (_arg1.health / _arg1.full_health);
setStatus(_arg1.suit_id, _local2);
}
private function clearGroupSprites():void{
var _local1:SelectedSprite;
if (selected_sprites){
while (selected_sprites.length > 0) {
_local1 = selected_sprites.shift();
_local1.destroy();
removeChild(_local1);
};
};
selected_sprites = new Array();
}
public function renewStatus(_arg1:Unit):void{
var _local2:BitmapData;
var _local3:BitmapFilter;
var _local4:Array;
if (_arg1.upgrades){
title.text = _arg1.upgrades.trueTitle();
};
if (status_bitmap){
removeChild(status_bitmap);
status_bitmap.bitmapData.dispose();
status_bitmap = null;
};
_local2 = _arg1.sprite.getSuit().status_bitmap;
status_bitmap = new AnimatedBitmap(_local2, 90, _local2.height);
status_bitmap.x = status_holder.x;
status_bitmap.y = status_holder.y;
addChild(status_bitmap);
_local3 = getBitmapFilter();
_local4 = new Array();
_local4.push(_local3);
status_bitmap.filters = _local4;
}
public function destroy():void{
clearGroupSprites();
if (build_progress){
unit_params.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));
}
}
}//package fai.ui
Section 72
//WelcomeScreen (fai.ui.WelcomeScreen)
package fai.ui {
import fai.loading.*;
import fai.logic.*;
import flash.events.*;
import fai.common.*;
import flash.display.*;
import flash.text.*;
import fai.*;
public dynamic class WelcomeScreen extends MovieClip {
public var more_games_button:SimpleButton;
private var engine:Engine;// = null
private var level_selection:LevelSelection;// = null
public var start_game_button:SimpleButton;
private var initialized:Boolean;// = false
public static var sloader:SmartLoader = null;
public function WelcomeScreen():void{
level_selection = null;
engine = null;
initialized = false;
super();
}
private function startGameHandler(_arg1:MouseEvent):void{
engine.playSound(SoundConsts.click);
showLevelSelection();
}
public function welcome(_arg1:Engine):void{
engine = _arg1;
level_selection = new LevelSelection();
level_selection.initialize(engine);
level_selection.visible = false;
GameStage.play_holder.addChild(level_selection);
}
public function get levelSelection():LevelSelection{
return (level_selection);
}
public function loadEnded():void{
sloader.clear();
sloader = null;
}
public function initialize():void{
var _local1:Object;
start_game_button.addEventListener(MouseEvent.MOUSE_DOWN, startGameHandler);
more_games_button.addEventListener(MouseEvent.MOUSE_DOWN, GameStage.sponsorClick);
_local1 = new Object();
_local1.id = 10;
_local1.title = "Garden Inventor";
_local1.width = 800;
_local1.height = 600;
_local1.theme = "";
_local1.maps = GameSchema.maps;
_local1.schema = GameSchema.schema;
_local1.settings = GameSchema.settings;
loadGame(_local1);
}
public function clear():void{
if (engine){
level_selection.stopMusic();
removeChild(GameStage.play_holder);
engine.clearAll();
KeyboardKeys.stop(GameStage.main_stage);
start_game_button.removeEventListener(MouseEvent.MOUSE_DOWN, startGameHandler);
more_games_button.removeEventListener(MouseEvent.MOUSE_DOWN, GameStage.sponsorClick);
engine.gameData.clear();
engine.uiData.clear();
engine = null;
sloader = null;
};
}
public function showWelcome():void{
visible = true;
level_selection.visible = false;
}
public function showLevelSelection():void{
if (!level_selection){
return;
};
level_selection.show();
}
private function hsHandler(_arg1:MouseEvent):void{
engine.playSound(SoundConsts.click);
}
public function loadGame(_arg1):void{
clear();
GameStage.play_holder = new Sprite();
addChild(GameStage.play_holder);
engine = new Engine(GameStage.main_stage);
sloader = new SmartLoader(engine);
sloader.loadGame(_arg1);
KeyboardKeys.init(GameStage.main_stage);
}
}
}//package fai.ui
Section 73
//Camp (fai.units.Camp)
package fai.units {
import fai.common.*;
import 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 aliveCount():int{
var _local1:int;
var _local2:int;
_local1 = 0;
_local2 = 0;
while (_local2 < units.length) {
if (units[_local2].isAlive()){
_local1++;
};
_local2++;
};
return (_local1);
}
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))))){
_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 function getNearestUnitG(_arg1:Unit, _arg2:Boolean, _arg3:Boolean):Unit{
var _local4:Unit;
var _local5:int;
var _local6:Unit;
var _local7:int;
var _local8:Number;
_local4 = null;
_local5 = 9999999;
_local6 = null;
_local7 = 0;
while (_local7 < units.length) {
_local6 = units[_local7];
if (((((_arg2) && (!(_local6.flag(UnitFlags.Flying))))) || (((_arg3) && (_local6.flag(UnitFlags.Flying)))))){
} else {
_local8 = Utils.distance(_arg1.sprite, _local6.sprite);
if (_local8 <= ((_arg1.weapon.eyerange * _arg1.weapon.range_multiplier) * Consts.cell_size)){
if (_local8 < _local5){
_local5 = _local8;
_local4 = _local6;
};
};
};
_local7++;
};
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.units
Section 74
//Unit (fai.units.Unit)
package fai.units {
import fai.logic.*;
import flash.events.*;
import fai.common.*;
import fai.goals.*;
import fai.*;
public final class Unit {
public var description:String;
public var full_health:int;// = 0
public var suit_id:String;
public var flags:uint;// = 0
public var invader_goal:InvaderGoal;// = null
public var build_steps:int;// = 200
public var weapon:Weapon;// = null
public var upgrade_level:int;// = 0
public var rotstep:int;// = 20
private var destangel:int;// = 0
public var death_cost:int;// = 1
public var type:String;// = null
public var sprite:UnitSprite;// = null
public var engine:Engine;// = null
public var sprite_width:int;// = 32
public var cost:uint;// = 20
public var armor:uint;// = 1
public var clip:Boolean;// = false
public var pos:Position;// = null
public var upgrades:UnitUpgrades;// = null
public var rotating:Boolean;// = false
public var health:int;// = 50
public var velocity:Number;// = 5
public var lt_angle:int;// = 0
public var mapid:uint;// = 0
public var life:LifeGoal;// = null
public function Unit(_arg1:Engine, _arg2:uint, _arg3:String):void{
rotstep = 20;
type = null;
sprite_width = 32;
pos = null;
sprite = null;
weapon = null;
armor = 1;
health = 50;
upgrade_level = 0;
full_health = 0;
death_cost = 1;
cost = 20;
flags = 0;
engine = null;
mapid = 0;
rotating = false;
destangel = 0;
velocity = 5;
build_steps = 200;
clip = false;
life = null;
upgrades = null;
lt_angle = 0;
invader_goal = null;
super();
engine = _arg1;
mapid = _arg2;
type = _arg3;
if (mapid == Consts.myId){
upgrades = new UnitUpgrades(this);
};
pos = new Position();
if (engine){
sprite = new UnitSprite(engine, this);
sprite.addEventListener(MouseEvent.MOUSE_DOWN, onMouseClick);
sprite.addEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
sprite.addEventListener(MouseEvent.MOUSE_OUT, onMouseOut);
};
}
public function updateHealth():void{
sprite.updateBar();
}
public function copyProperties(_arg1:Unit):void{
rotstep = _arg1.rotstep;
sprite_width = _arg1.sprite_width;
pos.copy(_arg1.pos);
weapon = new Weapon(_arg1.weapon.type);
weapon.copyProperties(_arg1.weapon);
armor = _arg1.armor;
health = _arg1.health;
upgrade_level = _arg1.upgrade_level;
full_health = _arg1.full_health;
death_cost = _arg1.death_cost;
cost = _arg1.cost;
flags = _arg1.flags;
velocity = _arg1.velocity;
build_steps = _arg1.build_steps;
description = _arg1.description;
suit_id = _arg1.suit_id;
mapid = _arg1.mapid;
}
private function onMouseOver(_arg1:MouseEvent):void{
showSelection();
}
public function showSelection():void{
sprite.select(true);
}
public function setWeapon(_arg1:Weapon):void{
weapon = _arg1;
if (life){
life.resetWeapon();
};
}
private function onMouseClick(_arg1:MouseEvent):void{
engine.gameProcess.endSelection(this);
_arg1.stopPropagation();
}
public function isAlive():Boolean{
return ((health > 0));
}
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 startRotate(_arg1:int):void{
if (!rotstep){
return;
};
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 setFlags(_arg1:uint):void{
flags = _arg1;
}
private function onMouseOut(_arg1:MouseEvent):void{
if (((!(isAlive())) || (!(engine.game_process.isUnitInSelection(this))))){
sprite.select(false);
};
}
public function recalcGraphicalPos():void{
pos.x = ((sprite.x / Consts.cell_size) + 0.5);
pos.y = ((sprite.y / Consts.cell_size) + 0.5);
}
public function flag(_arg1:uint):Boolean{
return ((flags & _arg1));
}
public function activate(_arg1:Engine):void{
life = new LifeGoal(_arg1, this);
_arg1.goal_system.add(life);
}
public function destroy():void{
sprite.removeEventListener(MouseEvent.MOUSE_DOWN, onMouseClick);
sprite.removeEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
sprite.removeEventListener(MouseEvent.MOUSE_OUT, onMouseOut);
sprite.select(false);
}
}
}//package fai.units
Section 75
//UnitBuilder (fai.units.UnitBuilder)
package fai.units {
import fai.logic.*;
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;
var _local5:Unit;
_local3 = false;
_local4 = null;
for each (_local4 in tasks) {
if ((((_local4.building == _arg1)) && ((_local4.task == _arg2)))){
_local4.addTask();
_local3 = true;
break;
};
};
if (!_local3){
_local5 = engine.gameData.params(_arg2);
_local4 = new BuildingTask(_arg1, _arg2, _local5.build_steps, _local5.health, _local5.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.units
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 76
//UnitFlags (fai.units.UnitFlags)
package fai.units {
public final class UnitFlags {
public static const AntiAir:uint = 8;
public static const Boss:uint = 32;
public static const Peaceful:uint = 1;
public static const Building:uint = 2;
public static const Flying:uint = 4;
public static const AntiLand:uint = 16;
}
}//package fai.units
Section 77
//UnitSprite (fai.units.UnitSprite)
package fai.units {
import fai.logic.*;
import fai.common.*;
import flash.display.*;
import flash.filters.*;
import fai.*;
public class UnitSprite extends Sprite {
private var suit:UnitSuit;// = null
private var bar:Shape;// = null
private var range_shape:Shape;// = null
private var engine:Engine;// = null
public var clip;// = 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 orders:Sprite;// = null
public function UnitSprite(_arg1:Engine, _arg2:Unit){
body = new Sprite();
selection = null;
bar = null;
sprite = null;
owner = null;
orders = null;
building = null;
suit = null;
lastfrontier = -1;
engine = null;
clip = null;
range_shape = null;
super();
engine = _arg1;
owner = _arg2;
visible = false;
}
public function select(_arg1:Boolean):void{
var diameter:*;
var borderColor:*;
var borderSize:*;
var enable = _arg1;
createUIElements();
if (enable){
var _local3 = selection;
with (_local3) {
visible = true;
diameter = (Math.max(sprite.width, sprite.height) + 8);
graphics.clear();
if (owner.mapid == Consts.hostileId){
graphics.lineStyle(2, 0xFF0000);
} else {
graphics.lineStyle(1, 253443);
};
if (Consts.myId == owner.mapid){
borderColor = 0xFF0000;
borderSize = 1;
range_shape.x = (this.x - (sprite.width / 2));
range_shape.y = (this.y - (sprite.height / 2));
range_shape.graphics.clear();
range_shape.visible = true;
range_shape.graphics.lineStyle(borderSize, borderColor);
range_shape.graphics.beginFill(0xEAEAEA, 0.3);
range_shape.graphics.drawCircle((sprite.width / 2), (sprite.height / 2), ((owner.weapon.eyerange * Consts.cell_size) * owner.weapon.range_multiplier));
range_shape.graphics.endFill();
} else {
graphics.drawCircle((sprite.width / 2), (sprite.height / 2), (diameter / 2));
};
};
} else {
selection.visible = false;
if (range_shape){
range_shape.visible = false;
};
};
}
public function setFrame(_arg1:uint):void{
sprite.setFrame(_arg1);
}
public function addOrder(_arg1, _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 getBulletBitmap():AnimatedBitmap{
return (new AnimatedBitmap(suit.bullet_bitmap, suit.bullet_bitmap.width, suit.bullet_bitmap.height));
}
public function getExplosionBitmap():AnimatedBitmap{
return (new AnimatedBitmap(suit.be_bitmap, suit.be_bitmap.height, suit.be_bitmap.height));
}
public function isAttackSprite():Boolean{
return ((sprite.curbuffer == suit.attack_bitmap));
}
public function getSuit():UnitSuit{
return (suit);
}
public function updateAppearence(_arg1:UnitSuit, _arg2:int):void{
suit = _arg1;
if (sprite){
body.removeChild(sprite);
sprite = null;
};
sprite = new AnimatedBitmap(suit.move_bitmap, _arg2, suit.move_bitmap.height);
body.addChildAt(sprite, 0);
sprite.x = (sprite.x - (sprite.width / 2));
sprite.y = (sprite.y - (sprite.height / 2));
updateBar();
cacheAsBitmap = true;
}
public function updateBar():void{
var is_enemy:Boolean;
var sqcount:*;
var hpercent:*;
var frontier:*;
var diameter:*;
var rsize:*;
var startx:*;
var i:*;
is_enemy = (owner.mapid == Consts.hostileId);
if (!is_enemy){
return;
};
if (!owner.isAlive()){
bar.visible = false;
};
createUIElements();
var _local2 = bar;
with (_local2) {
sqcount = 5;
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();
is_enemy = (owner.mapid == Consts.hostileId);
graphics.lineStyle();
rsize = 5;
startx = (((-(rsize) * sqcount) / 2) + (sprite.width / 2));
graphics.lineStyle(1, 0, 0.5);
i = 0;
i = 0;
while (i < sqcount) {
if (i < frontier){
if (is_enemy){
graphics.beginFill(0xFF0000);
} else {
graphics.beginFill(0xFF00);
};
};
graphics.drawRect(startx, -(rsize), rsize, rsize);
if (i < frontier){
graphics.endFill();
};
startx = (startx + rsize);
i++;
};
};
};
}
public function nframes():uint{
return (sprite.nframes);
}
public function setAttackSprite():void{
sprite.setBuffer(suit.attack_bitmap);
}
public function isMoveSprite():Boolean{
return ((sprite.curbuffer == suit.move_bitmap));
}
private function createUIElements():void{
if (!selection){
selection = new Shape();
addChildAt(selection, 1);
selection.x = (selection.x - (sprite.width / 2));
selection.y = (selection.y - (sprite.height / 2));
selection.visible = false;
if (owner.mapid == Consts.hostileId){
bar = new Shape();
addChildAt(bar, 1);
bar.x = (bar.x - (sprite.width / 2));
bar.y = (bar.y - (sprite.height / 2));
};
};
}
private function getGroundShadowFilter():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 = 2;
_local5 = 2;
_local6 = 2;
_local7 = 1;
_local8 = false;
_local9 = false;
_local10 = BitmapFilterQuality.LOW;
return (new DropShadowFilter(_local6, _local2, _local1, _local3, _local4, _local5, _local7, _local10, _local8, _local9));
}
public function stopBuilding():void{
if (building){
removeChild(building);
body.alpha = 1;
building = null;
};
}
private function getFlyingShadowFilter():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 setMovieClipAppearence(_arg1:MovieClip):void{
clip = _arg1;
sprite.visible = false;
body.addChild(clip);
clip.x = (clip.x - (clip.width / 2));
clip.y = (clip.y - (clip.height / 2));
}
public function setAppearence(_arg1:UnitSuit, _arg2:int):void{
var _local3:BitmapFilter;
var _local4:Array;
suit = _arg1;
sprite = new AnimatedBitmap(suit.move_bitmap, _arg2, suit.move_bitmap.height);
orders = new Sprite();
body.addChild(sprite);
sprite.x = (sprite.x - (sprite.width / 2));
sprite.y = (sprite.y - (sprite.height / 2));
addChild(body);
if (owner.mapid == Consts.myId){
range_shape = new Shape();
engine.gameBoard.resourcelayer.addChild(range_shape);
range_shape.x = (x - (sprite.width / 2));
range_shape.y = (y - (sprite.height / 2));
range_shape.visible = false;
};
orders.x = sprite.x;
orders.y = (sprite.y + (sprite.height / 8));
addChild(orders);
_local3 = null;
_local4 = null;
if (owner.flag(UnitFlags.Flying)){
_local3 = getFlyingShadowFilter();
_local4 = new Array();
_local4.push(_local3);
body.filters = _local4;
} else {
_local3 = getGroundShadowFilter();
_local4 = new Array();
_local4.push(_local3);
body.filters = _local4;
};
updateBar();
cacheAsBitmap = true;
}
public function setMoveSprite():void{
sprite.setBuffer(suit.move_bitmap);
}
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.units
Section 78
//UnitSuit (fai.units.UnitSuit)
package fai.units {
import flash.display.*;
public class UnitSuit {
public var attack_bitmap:BitmapData;// = null
public var be_bitmap:BitmapData;// = null
public var suit_id:String;
public var bullet_bitmap:BitmapData;// = null
public var status_bitmap:BitmapData;// = null
public var move_bitmap:BitmapData;// = null
public function UnitSuit(){
status_bitmap = null;
move_bitmap = null;
attack_bitmap = null;
bullet_bitmap = null;
be_bitmap = null;
super();
}
public function isComplete(_arg1:Unit):Boolean{
if (null == move_bitmap){
return (false);
};
if (!_arg1.flag(UnitFlags.Peaceful)){
if ((((((null == attack_bitmap)) || ((null == bullet_bitmap)))) || ((null == be_bitmap)))){
return (false);
};
};
return (true);
}
}
}//package fai.units
Section 79
//Weapon (fai.units.Weapon)
package fai.units {
public class Weapon {
public var recharge_time:int;// = 0
private var flags:int;// = 0
public var action_delay:int;// = 19
public var eyerange:int;// = 0
public var damage:int;// = 0
public var range_multiplier:Number;// = 1
public var bullet_speed:int;// = 0
public var type:String;
public function Weapon(_arg1:String):void{
flags = 0;
eyerange = 0;
damage = 0;
recharge_time = 0;
bullet_speed = 0;
action_delay = 19;
range_multiplier = 1;
super();
type = _arg1;
}
public function flag(_arg1:int):Boolean{
return ((flags & _arg1));
}
public function copyProperties(_arg1:Weapon):void{
flags = _arg1.flags;
eyerange = _arg1.eyerange;
damage = _arg1.damage;
recharge_time = _arg1.recharge_time;
bullet_speed = _arg1.bullet_speed;
}
public function setFlags(_arg1:int):void{
flags = _arg1;
}
}
}//package fai.units
Section 80
//Consts (fai.Consts)
package fai {
public class Consts {
public static const Click:int = 1;
public static const MapHeight:int = 19;
public static const DEFAULT_ACTION_DELAY:int = 19;
public static const Right:uint = 1;
public static const UNIT_LEAVE_COUNT:int = 100;
public static const PowerStationAdd:int = 5;
public static const TIMER_BOMB_RANGE:int = 100;
public static const ScreenWidth:int = 800;
public static const PathfindingsPerTick:int = 1;
public static const InvaderPath:uint = 20;
public static const Left:uint = 0;
public static const Empty:uint = 0;
public static const Top:uint = 2;
public static const hostileId:uint = 4;
public static const FrozeDelay:int = 100;
public static const cell_size:uint = 32;
public static const resourceId:int = 10;
public static const Down:uint = 3;
public static const ScreenHeight:int = 600;
public static const GAS_SPRAYER_DELAY:int = 75;
public static const AttackGoalPriority:uint = 50;
public static const AppendLineCount:int = 2;
public static const myId:uint = 3;
public static const nitro_bomb_cost:int = 50;
public static const MapWidth:int = 19;
public static const MaxEnergy:int = 50;
public static const GOALSCLEANPAUSE:uint = 10;
public static const MoveGoalPriority:uint = 80;
public static const Wall:uint = 1;
public static const cumulative_bomb_cost:int = 250;
public static const nuclear_missile_cost:int = 500;
}
}//package fai
Section 81
//SoundConsts (fai.SoundConsts)
package fai {
public final class SoundConsts {
public static var boom:int = 26;
public static var sell_turret:int = 12;
public static var next_wave:int = 22;
public static var click:int = 2;
public static var placing:int = 24;
public static var failed:int = 5;
public static var invader_stopped:int = 6;
public static var level_selection:int = 11;
public static var victory:int = 0;
public static var rocket:int = 29;
public static var gas:int = 21;
public static var boomerang:int = 27;
public static var upgrade:int = 1;
public static var game_over:int = 7;
public static var spear:int = 25;
public static var lasers:int = 28;
public static var pellet:int = 23;
public static var spitting:int = 30;
public static var poisoned_balls:int = 31;
public static var unpause:int = 4;
public static var bomb_explosion:int = 20;
}
}//package fai
Section 82
//StringConsts (fai.StringConsts)
package fai {
public class StringConsts {
public static const dragonfly:String = "Dragonfly";
public static const boomerang_gnome:String = "Boomerang Gnome";
public static const m_crystals:String = "crystals.png";
public static const worm:String = "Worm";
public static const spear_gnome:String = "Spear Gnome";
public static const sp_my_order:String = "My Order";
public static const bomb_gnome:String = "Bomb Gnome";
public static const sp_debris:String = "debris.png";
public static const beetle:String = "Beetle";
public static const enemies:Array = [beetle, colorado_beetle, butterfly, bumblebee, dragonfly, worm, caterpillar];
public static const chewing_gum:String = "Chewing Gum";
public static const poisoned_balls:String = "Poisoned Balls";
public static const pellet_gnome:String = "Pellet Gnome";
public static const b_stop:String = "Stop";
public static const colorado_beetle:String = "Colorado Beetle";
public static const sp_danimation:String = "death1.png";
public static const gas_sprayer:String = "Gas Sprayer";
public static const b_attack:String = "Attack";
public static const mouse:String = "Mouse";
public static const bumblebee:String = "Bumblebee";
public static const little_worm:String = "Little Worm";
public static const razor_gnome:String = "Razor Gnome";
public static const rat:String = "Rat";
public static const rocket_gnome:String = "Rocket Gnome";
public static const timer_bomb:String = "Timer Bomb";
public static const spitting_cactus:String = "Spitting Cactus";
public static const m_attack:String = "attack.png";
public static const sp_hostile_order:String = "Hostile Order";
public static const m_range:String = "range.png";
public static const m_armor:String = "shield.png";
public static const butterfly:String = "Butterfly";
public static const caterpillar:String = "Caterpillar";
public static const b_cancel:String = "Cancel";
public static const laser_towers:String = "Laser Towers";
}
}//package fai
Section 83
//BaseScrollPane (fl.containers.BaseScrollPane)
package fl.containers {
import flash.events.*;
import fl.controls.*;
import flash.display.*;
import fl.core.*;
import fl.events.*;
import flash.geom.*;
public class BaseScrollPane extends UIComponent {
protected var defaultLineScrollSize:Number;// = 4
protected var _maxHorizontalScrollPosition:Number;// = 0
protected var vScrollBar:Boolean;
protected var disabledOverlay:Shape;
protected var hScrollBar:Boolean;
protected var availableWidth:Number;
protected var _verticalPageScrollSize:Number;// = 0
protected var vOffset:Number;// = 0
protected var _verticalScrollBar:ScrollBar;
protected var useFixedHorizontalScrolling:Boolean;// = false
protected var contentWidth:Number;// = 0
protected var contentHeight:Number;// = 0
protected var _horizontalPageScrollSize:Number;// = 0
protected var background:DisplayObject;
protected var _useBitmpScrolling:Boolean;// = false
protected var contentPadding:Number;// = 0
protected var availableHeight:Number;
protected var _horizontalScrollBar:ScrollBar;
protected var contentScrollRect:Rectangle;
protected var _horizontalScrollPolicy:String;
protected var _verticalScrollPolicy:String;
protected static const SCROLL_BAR_STYLES:Object = {upArrowDisabledSkin:"upArrowDisabledSkin", upArrowDownSkin:"upArrowDownSkin", upArrowOverSkin:"upArrowOverSkin", upArrowUpSkin:"upArrowUpSkin", downArrowDisabledSkin:"downArrowDisabledSkin", downArrowDownSkin:"downArrowDownSkin", downArrowOverSkin:"downArrowOverSkin", downArrowUpSkin:"downArrowUpSkin", thumbDisabledSkin:"thumbDisabledSkin", thumbDownSkin:"thumbDownSkin", thumbOverSkin:"thumbOverSkin", thumbUpSkin:"thumbUpSkin", thumbIcon:"thumbIcon", trackDisabledSkin:"trackDisabledSkin", trackDownSkin:"trackDownSkin", trackOverSkin:"trackOverSkin", trackUpSkin:"trackUpSkin", repeatDelay:"repeatDelay", repeatInterval:"repeatInterval"};
private static var defaultStyles:Object = {repeatDelay:500, repeatInterval:35, skin:"ScrollPane_upSkin", contentPadding:0, disabledAlpha:0.5};
public function BaseScrollPane(){
contentWidth = 0;
contentHeight = 0;
contentPadding = 0;
vOffset = 0;
_maxHorizontalScrollPosition = 0;
_horizontalPageScrollSize = 0;
_verticalPageScrollSize = 0;
defaultLineScrollSize = 4;
useFixedHorizontalScrolling = false;
_useBitmpScrolling = false;
super();
}
protected function handleWheel(_arg1:MouseEvent):void{
if (((((!(enabled)) || (!(_verticalScrollBar.visible)))) || ((contentHeight <= availableHeight)))){
return;
};
_verticalScrollBar.scrollPosition = (_verticalScrollBar.scrollPosition - (_arg1.delta * verticalLineScrollSize));
setVerticalScrollPosition(_verticalScrollBar.scrollPosition);
dispatchEvent(new ScrollEvent(ScrollBarDirection.VERTICAL, _arg1.delta, horizontalScrollPosition));
}
public function get verticalScrollPosition():Number{
return (_verticalScrollBar.scrollPosition);
}
protected function drawDisabledOverlay():void{
if (enabled){
if (contains(disabledOverlay)){
removeChild(disabledOverlay);
};
} else {
disabledOverlay.x = (disabledOverlay.y = contentPadding);
disabledOverlay.width = availableWidth;
disabledOverlay.height = availableHeight;
disabledOverlay.alpha = (getStyleValue("disabledAlpha") as Number);
addChild(disabledOverlay);
};
}
public function set verticalScrollPosition(_arg1:Number):void{
drawNow();
_verticalScrollBar.scrollPosition = _arg1;
setVerticalScrollPosition(_verticalScrollBar.scrollPosition, false);
}
protected function setContentSize(_arg1:Number, _arg2:Number):void{
if ((((((contentWidth == _arg1)) || (useFixedHorizontalScrolling))) && ((contentHeight == _arg2)))){
return;
};
contentWidth = _arg1;
contentHeight = _arg2;
invalidate(InvalidationType.SIZE);
}
public function get horizontalScrollPosition():Number{
return (_horizontalScrollBar.scrollPosition);
}
public function get horizontalScrollBar():ScrollBar{
return (_horizontalScrollBar);
}
override public function set enabled(_arg1:Boolean):void{
if (enabled == _arg1){
return;
};
_verticalScrollBar.enabled = _arg1;
_horizontalScrollBar.enabled = _arg1;
super.enabled = _arg1;
}
public function get verticalLineScrollSize():Number{
return (_verticalScrollBar.lineScrollSize);
}
public function get horizontalScrollPolicy():String{
return (_horizontalScrollPolicy);
}
protected function calculateAvailableSize():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local1 = ScrollBar.WIDTH;
_local2 = (contentPadding = Number(getStyleValue("contentPadding")));
_local3 = ((height - (2 * _local2)) - vOffset);
vScrollBar = (((_verticalScrollPolicy == ScrollPolicy.ON)) || ((((_verticalScrollPolicy == ScrollPolicy.AUTO)) && ((contentHeight > _local3)))));
_local4 = ((width - (vScrollBar) ? _local1 : 0) - (2 * _local2));
_local5 = (useFixedHorizontalScrolling) ? _maxHorizontalScrollPosition : (contentWidth - _local4);
hScrollBar = (((_horizontalScrollPolicy == ScrollPolicy.ON)) || ((((_horizontalScrollPolicy == ScrollPolicy.AUTO)) && ((_local5 > 0)))));
if (hScrollBar){
_local3 = (_local3 - _local1);
};
if (((((((hScrollBar) && (!(vScrollBar)))) && ((_verticalScrollPolicy == ScrollPolicy.AUTO)))) && ((contentHeight > _local3)))){
vScrollBar = true;
_local4 = (_local4 - _local1);
};
availableHeight = (_local3 + vOffset);
availableWidth = _local4;
}
public function get maxVerticalScrollPosition():Number{
drawNow();
return (Math.max(0, (contentHeight - availableHeight)));
}
public function set horizontalScrollPosition(_arg1:Number):void{
drawNow();
_horizontalScrollBar.scrollPosition = _arg1;
setHorizontalScrollPosition(_horizontalScrollBar.scrollPosition, false);
}
public function get horizontalLineScrollSize():Number{
return (_horizontalScrollBar.lineScrollSize);
}
public function set verticalPageScrollSize(_arg1:Number):void{
_verticalPageScrollSize = _arg1;
invalidate(InvalidationType.SIZE);
}
public function get verticalScrollPolicy():String{
return (_verticalScrollPolicy);
}
protected function setHorizontalScrollPosition(_arg1:Number, _arg2:Boolean=false):void{
}
public function get useBitmapScrolling():Boolean{
return (_useBitmpScrolling);
}
protected function handleScroll(_arg1:ScrollEvent):void{
if (_arg1.target == _verticalScrollBar){
setVerticalScrollPosition(_arg1.position);
} else {
setHorizontalScrollPosition(_arg1.position);
};
}
public function set verticalLineScrollSize(_arg1:Number):void{
_verticalScrollBar.lineScrollSize = _arg1;
}
public function get verticalScrollBar():ScrollBar{
return (_verticalScrollBar);
}
protected function setVerticalScrollPosition(_arg1:Number, _arg2:Boolean=false):void{
}
public function set horizontalPageScrollSize(_arg1:Number):void{
_horizontalPageScrollSize = _arg1;
invalidate(InvalidationType.SIZE);
}
override protected function draw():void{
if (isInvalid(InvalidationType.STYLES)){
setStyles();
drawBackground();
if (contentPadding != getStyleValue("contentPadding")){
invalidate(InvalidationType.SIZE, false);
};
};
if (isInvalid(InvalidationType.SIZE, InvalidationType.STATE)){
drawLayout();
};
updateChildren();
super.draw();
}
public function set horizontalScrollPolicy(_arg1:String):void{
_horizontalScrollPolicy = _arg1;
invalidate(InvalidationType.SIZE);
}
override protected function configUI():void{
var _local1:Graphics;
super.configUI();
contentScrollRect = new Rectangle(0, 0, 85, 85);
_verticalScrollBar = new ScrollBar();
_verticalScrollBar.addEventListener(ScrollEvent.SCROLL, handleScroll, false, 0, true);
_verticalScrollBar.visible = false;
_verticalScrollBar.lineScrollSize = defaultLineScrollSize;
addChild(_verticalScrollBar);
copyStylesToChild(_verticalScrollBar, SCROLL_BAR_STYLES);
_horizontalScrollBar = new ScrollBar();
_horizontalScrollBar.direction = ScrollBarDirection.HORIZONTAL;
_horizontalScrollBar.addEventListener(ScrollEvent.SCROLL, handleScroll, false, 0, true);
_horizontalScrollBar.visible = false;
_horizontalScrollBar.lineScrollSize = defaultLineScrollSize;
addChild(_horizontalScrollBar);
copyStylesToChild(_horizontalScrollBar, SCROLL_BAR_STYLES);
disabledOverlay = new Shape();
_local1 = disabledOverlay.graphics;
_local1.beginFill(0xFFFFFF);
_local1.drawRect(0, 0, width, height);
_local1.endFill();
addEventListener(MouseEvent.MOUSE_WHEEL, handleWheel, false, 0, true);
}
protected function calculateContentWidth():void{
}
public function get verticalPageScrollSize():Number{
if (isNaN(availableHeight)){
drawNow();
};
return (((((_verticalPageScrollSize == 0)) && (!(isNaN(availableHeight))))) ? availableHeight : _verticalPageScrollSize);
}
protected function drawLayout():void{
calculateAvailableSize();
calculateContentWidth();
background.width = width;
background.height = height;
if (vScrollBar){
_verticalScrollBar.visible = true;
_verticalScrollBar.x = ((width - ScrollBar.WIDTH) - contentPadding);
_verticalScrollBar.y = contentPadding;
_verticalScrollBar.height = availableHeight;
} else {
_verticalScrollBar.visible = false;
};
_verticalScrollBar.setScrollProperties(availableHeight, 0, (contentHeight - availableHeight), verticalPageScrollSize);
setVerticalScrollPosition(_verticalScrollBar.scrollPosition, false);
if (hScrollBar){
_horizontalScrollBar.visible = true;
_horizontalScrollBar.x = contentPadding;
_horizontalScrollBar.y = ((height - ScrollBar.WIDTH) - contentPadding);
_horizontalScrollBar.width = availableWidth;
} else {
_horizontalScrollBar.visible = false;
};
_horizontalScrollBar.setScrollProperties(availableWidth, 0, (useFixedHorizontalScrolling) ? _maxHorizontalScrollPosition : (contentWidth - availableWidth), horizontalPageScrollSize);
setHorizontalScrollPosition(_horizontalScrollBar.scrollPosition, false);
drawDisabledOverlay();
}
protected function drawBackground():void{
var _local1:DisplayObject;
_local1 = background;
background = getDisplayObjectInstance(getStyleValue("skin"));
background.width = width;
background.height = height;
addChildAt(background, 0);
if (((!((_local1 == null))) && (!((_local1 == background))))){
removeChild(_local1);
};
}
public function set horizontalLineScrollSize(_arg1:Number):void{
_horizontalScrollBar.lineScrollSize = _arg1;
}
public function get horizontalPageScrollSize():Number{
if (isNaN(availableWidth)){
drawNow();
};
return (((((_horizontalPageScrollSize == 0)) && (!(isNaN(availableWidth))))) ? availableWidth : _horizontalPageScrollSize);
}
public function get maxHorizontalScrollPosition():Number{
drawNow();
return (Math.max(0, (contentWidth - availableWidth)));
}
protected function setStyles():void{
copyStylesToChild(_verticalScrollBar, SCROLL_BAR_STYLES);
copyStylesToChild(_horizontalScrollBar, SCROLL_BAR_STYLES);
}
protected function updateChildren():void{
_verticalScrollBar.enabled = (_horizontalScrollBar.enabled = enabled);
_verticalScrollBar.drawNow();
_horizontalScrollBar.drawNow();
}
public function set verticalScrollPolicy(_arg1:String):void{
_verticalScrollPolicy = _arg1;
invalidate(InvalidationType.SIZE);
}
public function set useBitmapScrolling(_arg1:Boolean):void{
_useBitmpScrolling = _arg1;
invalidate(InvalidationType.STATE);
}
public static function getStyleDefinition():Object{
return (mergeStyles(defaultStyles, ScrollBar.getStyleDefinition()));
}
}
}//package fl.containers
Section 84
//ScrollPane (fl.containers.ScrollPane)
package fl.containers {
import flash.events.*;
import fl.controls.*;
import flash.display.*;
import fl.core.*;
import fl.managers.*;
import fl.events.*;
import flash.net.*;
import flash.system.*;
import flash.ui.*;
public class ScrollPane extends BaseScrollPane implements IFocusManagerComponent {
protected var scrollDragHPos:Number;
protected var loader:Loader;
protected var yOffset:Number;
protected var currentContent:Object;
protected var xOffset:Number;
protected var _source:Object;// = ""
protected var scrollDragVPos:Number;
protected var _scrollDrag:Boolean;// = false
protected var contentClip:Sprite;
private static var defaultStyles:Object = {upSkin:"ScrollPane_upSkin", disabledSkin:"ScrollPane_disabledSkin", focusRectSkin:null, focusRectPadding:null, contentPadding:0};
public function ScrollPane(){
_source = "";
_scrollDrag = false;
super();
}
public function get source():Object{
return (_source);
}
public function set source(_arg1:Object):void{
var _local2:*;
clearContent();
if (isLivePreview){
return;
};
_source = _arg1;
if ((((_source == "")) || ((_source == null)))){
return;
};
currentContent = getDisplayObjectInstance(_arg1);
if (currentContent != null){
_local2 = contentClip.addChild((currentContent as DisplayObject));
dispatchEvent(new Event(Event.INIT));
update();
} else {
load(new URLRequest(_source.toString()));
};
}
public function get bytesLoaded():Number{
return (((((loader == null)) || ((loader.contentLoaderInfo == null)))) ? 0 : loader.contentLoaderInfo.bytesLoaded);
}
protected function doDrag(_arg1:MouseEvent):void{
var _local2:*;
var _local3:*;
_local2 = (scrollDragVPos - (mouseY - yOffset));
_verticalScrollBar.setScrollPosition(_local2);
setVerticalScrollPosition(_verticalScrollBar.scrollPosition, true);
_local3 = (scrollDragHPos - (mouseX - xOffset));
_horizontalScrollBar.setScrollPosition(_local3);
setHorizontalScrollPosition(_horizontalScrollBar.scrollPosition, true);
}
override protected function keyDownHandler(_arg1:KeyboardEvent):void{
var _local2:int;
_local2 = calculateAvailableHeight();
switch (_arg1.keyCode){
case Keyboard.DOWN:
verticalScrollPosition++;
break;
case Keyboard.UP:
verticalScrollPosition--;
break;
case Keyboard.RIGHT:
horizontalScrollPosition++;
break;
case Keyboard.LEFT:
horizontalScrollPosition--;
break;
case Keyboard.END:
verticalScrollPosition = maxVerticalScrollPosition;
break;
case Keyboard.HOME:
verticalScrollPosition = 0;
break;
case Keyboard.PAGE_UP:
verticalScrollPosition = (verticalScrollPosition - _local2);
break;
case Keyboard.PAGE_DOWN:
verticalScrollPosition = (verticalScrollPosition + _local2);
break;
};
}
protected function doStartDrag(_arg1:MouseEvent):void{
if (!enabled){
return;
};
xOffset = mouseX;
yOffset = mouseY;
scrollDragHPos = horizontalScrollPosition;
scrollDragVPos = verticalScrollPosition;
stage.addEventListener(MouseEvent.MOUSE_MOVE, doDrag, false, 0, true);
}
public function get content():DisplayObject{
var _local1:Object;
_local1 = currentContent;
if ((_local1 is URLRequest)){
_local1 = loader.content;
};
return ((_local1 as DisplayObject));
}
public function get percentLoaded():Number{
if (loader != null){
return (Math.round(((bytesLoaded / bytesTotal) * 100)));
};
return (0);
}
protected function endDrag(_arg1:MouseEvent):void{
stage.removeEventListener(MouseEvent.MOUSE_MOVE, doDrag);
}
public function update():void{
var _local1:DisplayObject;
_local1 = contentClip.getChildAt(0);
setContentSize(_local1.width, _local1.height);
}
override protected function setHorizontalScrollPosition(_arg1:Number, _arg2:Boolean=false):void{
var _local3:*;
_local3 = contentClip.scrollRect;
_local3.x = _arg1;
contentClip.scrollRect = _local3;
}
public function refreshPane():void{
if ((_source is URLRequest)){
_source = _source.url;
};
source = _source;
}
protected function passEvent(_arg1:Event):void{
dispatchEvent(_arg1);
}
protected function calculateAvailableHeight():Number{
var _local1:Number;
_local1 = Number(getStyleValue("contentPadding"));
return (((height - (_local1 * 2)) - ((((_horizontalScrollPolicy == ScrollPolicy.ON)) || ((((_horizontalScrollPolicy == ScrollPolicy.AUTO)) && ((_maxHorizontalScrollPosition > 0)))))) ? 15 : 0));
}
public function load(_arg1:URLRequest, _arg2:LoaderContext=null):void{
if (_arg2 == null){
_arg2 = new LoaderContext(false, ApplicationDomain.currentDomain);
};
clearContent();
initLoader();
currentContent = (_source = _arg1);
loader.load(_arg1, _arg2);
}
override protected function handleScroll(_arg1:ScrollEvent):void{
passEvent(_arg1);
super.handleScroll(_arg1);
}
override protected function setVerticalScrollPosition(_arg1:Number, _arg2:Boolean=false):void{
var _local3:*;
_local3 = contentClip.scrollRect;
_local3.y = _arg1;
contentClip.scrollRect = _local3;
}
protected function initLoader():void{
loader = new Loader();
loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, passEvent, false, 0, true);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onContentLoad, false, 0, true);
loader.contentLoaderInfo.addEventListener(Event.INIT, passEvent, false, 0, true);
contentClip.addChild(loader);
}
override protected function draw():void{
if (isInvalid(InvalidationType.STYLES)){
drawBackground();
};
if (isInvalid(InvalidationType.STATE)){
setScrollDrag();
};
super.draw();
}
override protected function configUI():void{
super.configUI();
contentClip = new Sprite();
addChild(contentClip);
contentClip.scrollRect = contentScrollRect;
_horizontalScrollPolicy = ScrollPolicy.AUTO;
_verticalScrollPolicy = ScrollPolicy.AUTO;
}
public function set scrollDrag(_arg1:Boolean):void{
_scrollDrag = _arg1;
invalidate(InvalidationType.STATE);
}
protected function clearContent():void{
if (contentClip.numChildren == 0){
return;
};
contentClip.removeChildAt(0);
currentContent = null;
if (loader != null){
try {
loader.close();
} catch(e) {
};
try {
loader.unload();
} catch(e) {
};
loader = null;
};
}
override protected function drawLayout():void{
super.drawLayout();
contentScrollRect = contentClip.scrollRect;
contentScrollRect.width = availableWidth;
contentScrollRect.height = availableHeight;
contentClip.cacheAsBitmap = useBitmapScrolling;
contentClip.scrollRect = contentScrollRect;
contentClip.x = (contentClip.y = contentPadding);
}
override protected function drawBackground():void{
var _local1:DisplayObject;
_local1 = background;
background = getDisplayObjectInstance(getStyleValue((enabled) ? "upSkin" : "disabledSkin"));
background.width = width;
background.height = height;
addChildAt(background, 0);
if (((!((_local1 == null))) && (!((_local1 == background))))){
removeChild(_local1);
};
}
public function get bytesTotal():Number{
return (((((loader == null)) || ((loader.contentLoaderInfo == null)))) ? 0 : loader.contentLoaderInfo.bytesTotal);
}
protected function onContentLoad(_arg1:Event):void{
var _local2:*;
update();
_local2 = calculateAvailableHeight();
calculateAvailableSize();
horizontalScrollBar.setScrollProperties(availableWidth, 0, (useFixedHorizontalScrolling) ? _maxHorizontalScrollPosition : (contentWidth - availableWidth), availableWidth);
verticalScrollBar.setScrollProperties(_local2, 0, (contentHeight - _local2), _local2);
passEvent(_arg1);
}
public function get scrollDrag():Boolean{
return (_scrollDrag);
}
protected function setScrollDrag():void{
if (_scrollDrag){
contentClip.addEventListener(MouseEvent.MOUSE_DOWN, doStartDrag, false, 0, true);
stage.addEventListener(MouseEvent.MOUSE_UP, endDrag, false, 0, true);
} else {
contentClip.removeEventListener(MouseEvent.MOUSE_DOWN, doStartDrag);
stage.removeEventListener(MouseEvent.MOUSE_UP, endDrag);
removeEventListener(MouseEvent.MOUSE_MOVE, doDrag);
};
contentClip.buttonMode = _scrollDrag;
}
public static function getStyleDefinition():Object{
return (mergeStyles(defaultStyles, BaseScrollPane.getStyleDefinition()));
}
}
}//package fl.containers
Section 85
//IndeterminateBar (fl.controls.progressBarClasses.IndeterminateBar)
package fl.controls.progressBarClasses {
import flash.events.*;
import flash.display.*;
import fl.core.*;
public class IndeterminateBar extends UIComponent {
protected var bar:Sprite;
protected var barMask:Sprite;
protected var patternBmp:BitmapData;
protected var animationCount:uint;// = 0
private static var defaultStyles:Object = {indeterminateSkin:"ProgressBar_indeterminateSkin"};
public function IndeterminateBar(){
animationCount = 0;
super();
setSize(0, 0);
startAnimation();
}
protected function drawBar():void{
var _local1:Graphics;
if (patternBmp == null){
return;
};
_local1 = bar.graphics;
_local1.clear();
_local1.beginBitmapFill(patternBmp);
_local1.drawRect(0, 0, (_width + patternBmp.width), _height);
_local1.endFill();
}
protected function drawMask():void{
var _local1:Graphics;
_local1 = barMask.graphics;
_local1.clear();
_local1.beginFill(0, 0);
_local1.drawRect(0, 0, _width, _height);
_local1.endFill();
}
override public function get visible():Boolean{
return (super.visible);
}
override public function set visible(_arg1:Boolean):void{
if (_arg1){
startAnimation();
} else {
stopAnimation();
};
super.visible = _arg1;
}
protected function startAnimation():void{
addEventListener(Event.ENTER_FRAME, handleEnterFrame, false, 0, true);
}
override protected function draw():void{
if (isInvalid(InvalidationType.STYLES)){
drawPattern();
invalidate(InvalidationType.SIZE, false);
};
if (isInvalid(InvalidationType.SIZE)){
drawBar();
drawMask();
};
super.draw();
}
override protected function configUI():void{
bar = new Sprite();
addChild(bar);
barMask = new Sprite();
addChild(barMask);
bar.mask = barMask;
}
protected function stopAnimation():void{
removeEventListener(Event.ENTER_FRAME, handleEnterFrame);
}
protected function drawPattern():void{
var _local1:DisplayObject;
_local1 = getDisplayObjectInstance(getStyleValue("indeterminateSkin"));
if (patternBmp){
patternBmp.dispose();
};
patternBmp = new BitmapData((_local1.width << 0), (_local1.height << 0), true, 0);
patternBmp.draw(_local1);
}
protected function handleEnterFrame(_arg1:Event):void{
if (patternBmp == null){
return;
};
animationCount = ((animationCount + 2) % patternBmp.width);
bar.x = -(animationCount);
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
}
}//package fl.controls.progressBarClasses
Section 86
//BaseButton (fl.controls.BaseButton)
package fl.controls {
import flash.events.*;
import flash.display.*;
import fl.core.*;
import fl.events.*;
import flash.utils.*;
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 87
//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 88
//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 89
//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 90
//ProgressBar (fl.controls.ProgressBar)
package fl.controls {
import flash.events.*;
import flash.display.*;
import fl.core.*;
import fl.controls.progressBarClasses.*;
public class ProgressBar extends UIComponent {
protected var _direction:String;// = "right"
protected var _mode:String;// = "event"
protected var _value:Number;// = 0
protected var _indeterminate:Boolean;// = true
protected var _minimum:Number;// = 0
protected var _maximum:Number;// = 0
protected var determinateBar:DisplayObject;
protected var _loaded:Number;
protected var _source:Object;
protected var track:DisplayObject;
protected var indeterminateBar:UIComponent;
private static var defaultStyles:Object = {trackSkin:"ProgressBar_trackSkin", barSkin:"ProgressBar_barSkin", indeterminateSkin:"ProgressBar_indeterminateSkin", indeterminateBar:IndeterminateBar, barPadding:0};
public function ProgressBar(){
_direction = ProgressBarDirection.RIGHT;
_indeterminate = true;
_mode = ProgressBarMode.EVENT;
_minimum = 0;
_maximum = 0;
_value = 0;
super();
}
public function get minimum():Number{
return (_minimum);
}
public function get source():Object{
return (_source);
}
public function set minimum(_arg1:Number):void{
if (_mode != ProgressBarMode.MANUAL){
return;
};
_minimum = _arg1;
invalidate(InvalidationType.DATA);
}
public function get maximum():Number{
return (_maximum);
}
protected function drawBars():void{
var _local1:DisplayObject;
var _local2:DisplayObject;
_local1 = determinateBar;
_local2 = indeterminateBar;
determinateBar = getDisplayObjectInstance(getStyleValue("barSkin"));
addChild(determinateBar);
indeterminateBar = (getDisplayObjectInstance(getStyleValue("indeterminateBar")) as UIComponent);
indeterminateBar.setStyle("indeterminateSkin", getStyleValue("indeterminateSkin"));
addChild(indeterminateBar);
if (((!((_local1 == null))) && (!((_local1 == determinateBar))))){
removeChild(_local1);
};
if (((!((_local2 == null))) && (!((_local2 == determinateBar))))){
removeChild(_local2);
};
}
protected function setupSourceEvents():void{
_source.addEventListener(ProgressEvent.PROGRESS, handleProgress, false, 0, true);
_source.addEventListener(Event.COMPLETE, handleComplete, false, 0, true);
}
public function set maximum(_arg1:Number):void{
setProgress(_value, _arg1);
}
public function set source(_arg1:Object):void{
if (_source == _arg1){
return;
};
if (_mode != ProgressBarMode.MANUAL){
resetProgress();
};
_source = _arg1;
if (_source == null){
return;
};
if (_mode == ProgressBarMode.EVENT){
setupSourceEvents();
} else {
if (_mode == ProgressBarMode.POLLED){
addEventListener(Event.ENTER_FRAME, pollSource, false, 0, true);
};
};
}
protected function drawTrack():void{
var _local1:DisplayObject;
_local1 = track;
track = getDisplayObjectInstance(getStyleValue("trackSkin"));
addChildAt(track, 0);
if (((!((_local1 == null))) && (!((_local1 == track))))){
removeChild(_local1);
};
}
protected function handleProgress(_arg1:ProgressEvent):void{
_setProgress(_arg1.bytesLoaded, _arg1.bytesTotal, true);
}
public function set sourceName(_arg1:String):void{
var _local2:DisplayObject;
if (!componentInspectorSetting){
return;
};
if (_arg1 == ""){
return;
};
_local2 = (parent.getChildByName(_arg1) as DisplayObject);
if (_local2 == null){
throw (new Error((("Source clip '" + _arg1) + "' not found on parent.")));
};
source = _local2;
}
protected function resetProgress():void{
if ((((_mode == ProgressBarMode.EVENT)) && (!((_source == null))))){
cleanupSourceEvents();
} else {
if (_mode == ProgressBarMode.POLLED){
removeEventListener(Event.ENTER_FRAME, pollSource);
} else {
if (_source != null){
_source = null;
};
};
};
_minimum = (_maximum = (_value = 0));
}
public function get percentComplete():Number{
return (((((_maximum <= _minimum)) || ((_value <= _minimum)))) ? 0 : Math.max(0, Math.min(100, (((_value - _minimum) / (_maximum - _minimum)) * 100))));
}
public function setProgress(_arg1:Number, _arg2:Number):void{
if (_mode != ProgressBarMode.MANUAL){
return;
};
_setProgress(_arg1, _arg2);
}
protected function pollSource(_arg1:Event):void{
if (_source == null){
return;
};
_setProgress(_source.bytesLoaded, _source.bytesTotal, true);
if ((((_maximum > 0)) && ((_maximum == _value)))){
removeEventListener(Event.ENTER_FRAME, pollSource);
dispatchEvent(new Event(Event.COMPLETE));
};
}
public function get indeterminate():Boolean{
return (_indeterminate);
}
public function set value(_arg1:Number):void{
setProgress(_arg1, _maximum);
}
public function set direction(_arg1:String):void{
_direction = _arg1;
invalidate(InvalidationType.DATA);
}
protected function _setProgress(_arg1:Number, _arg2:Number, _arg3:Boolean=false):void{
if ((((_arg1 == _value)) && ((_arg2 == _maximum)))){
return;
};
_value = _arg1;
_maximum = _arg2;
if (((!((_value == _loaded))) && (_arg3))){
dispatchEvent(new ProgressEvent(ProgressEvent.PROGRESS, false, false, _value, _maximum));
_loaded = _value;
};
if (_mode != ProgressBarMode.MANUAL){
setIndeterminate((_arg2 == 0));
};
invalidate(InvalidationType.DATA);
}
public function set mode(_arg1:String):void{
if (_mode == _arg1){
return;
};
resetProgress();
_mode = _arg1;
if ((((_arg1 == ProgressBarMode.EVENT)) && (!((_source == null))))){
setupSourceEvents();
} else {
if (_arg1 == ProgressBarMode.POLLED){
addEventListener(Event.ENTER_FRAME, pollSource, false, 0, true);
};
};
setIndeterminate(!((_mode == ProgressBarMode.MANUAL)));
}
public function reset():void{
var _local1:Object;
_setProgress(0, 0);
_local1 = _source;
_source = null;
source = _local1;
}
override protected function draw():void{
if (isInvalid(InvalidationType.STYLES)){
drawTrack();
drawBars();
invalidate(InvalidationType.STATE, false);
invalidate(InvalidationType.SIZE, false);
};
if (isInvalid(InvalidationType.STATE)){
indeterminateBar.visible = _indeterminate;
determinateBar.visible = !(_indeterminate);
invalidate(InvalidationType.DATA, false);
};
if (isInvalid(InvalidationType.SIZE)){
drawLayout();
invalidate(InvalidationType.DATA, false);
};
if (((isInvalid(InvalidationType.DATA)) && (!(_indeterminate)))){
drawDeterminateBar();
};
super.draw();
}
override protected function configUI():void{
super.configUI();
}
protected function drawDeterminateBar():void{
var _local1:Number;
var _local2:Number;
_local1 = (percentComplete / 100);
_local2 = Number(getStyleValue("barPadding"));
determinateBar.width = Math.round(((width - (_local2 * 2)) * _local1));
determinateBar.x = ((_direction)==ProgressBarDirection.LEFT) ? ((width - _local2) - determinateBar.width) : _local2;
}
public function get value():Number{
return (_value);
}
public function set indeterminate(_arg1:Boolean):void{
if (((!((_mode == ProgressBarMode.MANUAL))) || ((_indeterminate == _arg1)))){
return;
};
setIndeterminate(_arg1);
}
protected function setIndeterminate(_arg1:Boolean):void{
if (_indeterminate == _arg1){
return;
};
_indeterminate = _arg1;
invalidate(InvalidationType.STATE);
}
protected function handleComplete(_arg1:Event):void{
_setProgress(_maximum, _maximum, true);
dispatchEvent(_arg1);
}
protected function drawLayout():void{
var _local1:Number;
_local1 = Number(getStyleValue("barPadding"));
track.width = width;
track.height = height;
indeterminateBar.setSize((width - (_local1 * 2)), (height - (_local1 * 2)));
indeterminateBar.move(_local1, _local1);
indeterminateBar.drawNow();
determinateBar.height = (height - (_local1 * 2));
determinateBar.y = _local1;
}
public function get direction():String{
return (_direction);
}
public function get mode():String{
return (_mode);
}
protected function cleanupSourceEvents():void{
_source.removeEventListener(ProgressEvent.PROGRESS, handleProgress);
_source.removeEventListener(Event.COMPLETE, handleComplete);
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
}
}//package fl.controls
Section 91
//ProgressBarDirection (fl.controls.ProgressBarDirection)
package fl.controls {
public class ProgressBarDirection {
public static const RIGHT:String = "right";
public static const LEFT:String = "left";
}
}//package fl.controls
Section 92
//ProgressBarMode (fl.controls.ProgressBarMode)
package fl.controls {
public class ProgressBarMode {
public static const MANUAL:String = "manual";
public static const EVENT:String = "event";
public static const POLLED:String = "polled";
}
}//package fl.controls
Section 93
//ScrollBar (fl.controls.ScrollBar)
package fl.controls {
import flash.events.*;
import fl.core.*;
import fl.events.*;
public class ScrollBar extends UIComponent {
private var _direction:String;// = "vertical"
protected var inDrag:Boolean;// = false
protected var upArrow:BaseButton;
private var _pageScrollSize:Number;// = 0
protected var downArrow:BaseButton;
private var _pageSize:Number;// = 10
private var thumbScrollOffset:Number;
private var _maxScrollPosition:Number;// = 0
private var _scrollPosition:Number;// = 0
protected var track:BaseButton;
private var _minScrollPosition:Number;// = 0
private var _lineScrollSize:Number;// = 1
protected var thumb:LabelButton;
protected static const THUMB_STYLES:Object = {disabledSkin:"thumbDisabledSkin", downSkin:"thumbDownSkin", overSkin:"thumbOverSkin", upSkin:"thumbUpSkin", icon:"thumbIcon", textPadding:0};
public static const WIDTH:Number = 15;
protected static const DOWN_ARROW_STYLES:Object = {disabledSkin:"downArrowDisabledSkin", downSkin:"downArrowDownSkin", overSkin:"downArrowOverSkin", upSkin:"downArrowUpSkin", repeatDelay:"repeatDelay", repeatInterval:"repeatInterval"};
protected static const UP_ARROW_STYLES:Object = {disabledSkin:"upArrowDisabledSkin", downSkin:"upArrowDownSkin", overSkin:"upArrowOverSkin", upSkin:"upArrowUpSkin", repeatDelay:"repeatDelay", repeatInterval:"repeatInterval"};
protected static const TRACK_STYLES:Object = {disabledSkin:"trackDisabledSkin", downSkin:"trackDownSkin", overSkin:"trackOverSkin", upSkin:"trackUpSkin", repeatDelay:"repeatDelay", repeatInterval:"repeatInterval"};
private static var defaultStyles:Object = {downArrowDisabledSkin:"ScrollArrowDown_disabledSkin", downArrowDownSkin:"ScrollArrowDown_downSkin", downArrowOverSkin:"ScrollArrowDown_overSkin", downArrowUpSkin:"ScrollArrowDown_upSkin", thumbDisabledSkin:"ScrollThumb_upSkin", thumbDownSkin:"ScrollThumb_downSkin", thumbOverSkin:"ScrollThumb_overSkin", thumbUpSkin:"ScrollThumb_upSkin", trackDisabledSkin:"ScrollTrack_skin", trackDownSkin:"ScrollTrack_skin", trackOverSkin:"ScrollTrack_skin", trackUpSkin:"ScrollTrack_skin", upArrowDisabledSkin:"ScrollArrowUp_disabledSkin", upArrowDownSkin:"ScrollArrowUp_downSkin", upArrowOverSkin:"ScrollArrowUp_overSkin", upArrowUpSkin:"ScrollArrowUp_upSkin", thumbIcon:"ScrollBar_thumbIcon", repeatDelay:500, repeatInterval:35};
public function ScrollBar(){
_pageSize = 10;
_pageScrollSize = 0;
_lineScrollSize = 1;
_minScrollPosition = 0;
_maxScrollPosition = 0;
_scrollPosition = 0;
_direction = ScrollBarDirection.VERTICAL;
inDrag = false;
super();
setStyles();
focusEnabled = false;
}
public function get minScrollPosition():Number{
return (_minScrollPosition);
}
public function set minScrollPosition(_arg1:Number):void{
setScrollProperties(_pageSize, _arg1, _maxScrollPosition);
}
public function setScrollPosition(_arg1:Number, _arg2:Boolean=true):void{
var _local3:Number;
_local3 = scrollPosition;
_scrollPosition = Math.max(_minScrollPosition, Math.min(_maxScrollPosition, _arg1));
if (_local3 == _scrollPosition){
return;
};
if (_arg2){
dispatchEvent(new ScrollEvent(_direction, (scrollPosition - _local3), scrollPosition));
};
updateThumb();
}
public function set scrollPosition(_arg1:Number):void{
setScrollPosition(_arg1, true);
}
public function get pageScrollSize():Number{
return (((_pageScrollSize)==0) ? _pageSize : _pageScrollSize);
}
public function set pageSize(_arg1:Number):void{
if (_arg1 > 0){
_pageSize = _arg1;
};
}
public function setScrollProperties(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number=0):void{
this.pageSize = _arg1;
_minScrollPosition = _arg2;
_maxScrollPosition = _arg3;
if (_arg4 >= 0){
_pageScrollSize = _arg4;
};
enabled = (_maxScrollPosition > _minScrollPosition);
setScrollPosition(_scrollPosition, false);
updateThumb();
}
override public function set enabled(_arg1:Boolean):void{
super.enabled = _arg1;
downArrow.enabled = (track.enabled = (thumb.enabled = (upArrow.enabled = ((enabled) && ((_maxScrollPosition > _minScrollPosition))))));
updateThumb();
}
protected function updateThumb():void{
var _local1:Number;
_local1 = ((_maxScrollPosition - _minScrollPosition) + _pageSize);
if ((((((track.height <= 12)) || ((_maxScrollPosition <= _minScrollPosition)))) || ((((_local1 == 0)) || (isNaN(_local1)))))){
thumb.height = 12;
thumb.visible = false;
} else {
thumb.height = Math.max(13, ((_pageSize / _local1) * track.height));
thumb.y = (track.y + ((track.height - thumb.height) * ((_scrollPosition - _minScrollPosition) / (_maxScrollPosition - _minScrollPosition))));
thumb.visible = enabled;
};
}
protected function thumbPressHandler(_arg1:MouseEvent):void{
inDrag = true;
thumbScrollOffset = (mouseY - thumb.y);
thumb.mouseStateLocked = true;
mouseChildren = false;
stage.addEventListener(MouseEvent.MOUSE_MOVE, handleThumbDrag, false, 0, true);
stage.addEventListener(MouseEvent.MOUSE_UP, thumbReleaseHandler, false, 0, true);
}
protected function thumbReleaseHandler(_arg1:MouseEvent):void{
inDrag = false;
mouseChildren = true;
thumb.mouseStateLocked = false;
stage.removeEventListener(MouseEvent.MOUSE_MOVE, handleThumbDrag);
stage.removeEventListener(MouseEvent.MOUSE_UP, thumbReleaseHandler);
}
public function set pageScrollSize(_arg1:Number):void{
if (_arg1 >= 0){
_pageScrollSize = _arg1;
};
}
protected function handleThumbDrag(_arg1:MouseEvent):void{
var _local2:Number;
_local2 = Math.max(0, Math.min((track.height - thumb.height), ((mouseY - track.y) - thumbScrollOffset)));
setScrollPosition((((_local2 / (track.height - thumb.height)) * (_maxScrollPosition - _minScrollPosition)) + _minScrollPosition));
}
public function set direction(_arg1:String):void{
var _local2:Boolean;
if (_direction == _arg1){
return;
};
_direction = _arg1;
if (isLivePreview){
return;
};
setScaleY(1);
_local2 = (_direction == ScrollBarDirection.HORIZONTAL);
if (((_local2) && (componentInspectorSetting))){
if (rotation == 90){
return;
};
setScaleX(-1);
rotation = -90;
};
if (!componentInspectorSetting){
if (((_local2) && ((rotation == 0)))){
rotation = -90;
setScaleX(-1);
} else {
if (((!(_local2)) && ((rotation == -90)))){
rotation = 0;
setScaleX(1);
};
};
};
invalidate(InvalidationType.SIZE);
}
public function set lineScrollSize(_arg1:Number):void{
if (_arg1 > 0){
_lineScrollSize = _arg1;
};
}
override public function get height():Number{
return (((_direction)==ScrollBarDirection.HORIZONTAL) ? super.width : super.height);
}
protected function scrollPressHandler(_arg1:ComponentEvent):void{
var _local2:Number;
var _local3:Number;
_arg1.stopImmediatePropagation();
if (_arg1.currentTarget == upArrow){
setScrollPosition((_scrollPosition - _lineScrollSize));
} else {
if (_arg1.currentTarget == downArrow){
setScrollPosition((_scrollPosition + _lineScrollSize));
} else {
_local2 = (((track.mouseY / track.height) * (_maxScrollPosition - _minScrollPosition)) + _minScrollPosition);
_local3 = ((pageScrollSize)==0) ? pageSize : pageScrollSize;
if (_scrollPosition < _local2){
setScrollPosition(Math.min(_local2, (_scrollPosition + _local3)));
} else {
if (_scrollPosition > _local2){
setScrollPosition(Math.max(_local2, (_scrollPosition - _local3)));
};
};
};
};
}
public function get pageSize():Number{
return (_pageSize);
}
public function set maxScrollPosition(_arg1:Number):void{
setScrollProperties(_pageSize, _minScrollPosition, _arg1);
}
public function get scrollPosition():Number{
return (_scrollPosition);
}
override public function get enabled():Boolean{
return (super.enabled);
}
override protected function draw():void{
var _local1:Number;
if (isInvalid(InvalidationType.SIZE)){
_local1 = super.height;
downArrow.move(0, Math.max(upArrow.height, (_local1 - downArrow.height)));
track.setSize(WIDTH, Math.max(0, (_local1 - (downArrow.height + upArrow.height))));
updateThumb();
};
if (isInvalid(InvalidationType.STYLES, InvalidationType.STATE)){
setStyles();
};
downArrow.drawNow();
upArrow.drawNow();
track.drawNow();
thumb.drawNow();
validate();
}
override protected function configUI():void{
super.configUI();
track = new BaseButton();
track.move(0, 14);
track.useHandCursor = false;
track.autoRepeat = true;
track.focusEnabled = false;
addChild(track);
thumb = new LabelButton();
thumb.label = "";
thumb.setSize(WIDTH, 15);
thumb.move(0, 15);
thumb.focusEnabled = false;
addChild(thumb);
downArrow = new BaseButton();
downArrow.setSize(WIDTH, 14);
downArrow.autoRepeat = true;
downArrow.focusEnabled = false;
addChild(downArrow);
upArrow = new BaseButton();
upArrow.setSize(WIDTH, 14);
upArrow.move(0, 0);
upArrow.autoRepeat = true;
upArrow.focusEnabled = false;
addChild(upArrow);
upArrow.addEventListener(ComponentEvent.BUTTON_DOWN, scrollPressHandler, false, 0, true);
downArrow.addEventListener(ComponentEvent.BUTTON_DOWN, scrollPressHandler, false, 0, true);
track.addEventListener(ComponentEvent.BUTTON_DOWN, scrollPressHandler, false, 0, true);
thumb.addEventListener(MouseEvent.MOUSE_DOWN, thumbPressHandler, false, 0, true);
enabled = false;
}
public function get direction():String{
return (_direction);
}
public function get lineScrollSize():Number{
return (_lineScrollSize);
}
override public function setSize(_arg1:Number, _arg2:Number):void{
if (_direction == ScrollBarDirection.HORIZONTAL){
super.setSize(_arg2, _arg1);
} else {
super.setSize(_arg1, _arg2);
};
}
public function get maxScrollPosition():Number{
return (_maxScrollPosition);
}
override public function get width():Number{
return (((_direction)==ScrollBarDirection.HORIZONTAL) ? super.height : super.width);
}
protected function setStyles():void{
copyStylesToChild(downArrow, DOWN_ARROW_STYLES);
copyStylesToChild(thumb, THUMB_STYLES);
copyStylesToChild(track, TRACK_STYLES);
copyStylesToChild(upArrow, UP_ARROW_STYLES);
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
}
}//package fl.controls
Section 94
//ScrollBarDirection (fl.controls.ScrollBarDirection)
package fl.controls {
public class ScrollBarDirection {
public static const HORIZONTAL:String = "horizontal";
public static const VERTICAL:String = "vertical";
}
}//package fl.controls
Section 95
//ScrollPolicy (fl.controls.ScrollPolicy)
package fl.controls {
public class ScrollPolicy {
public static const OFF:String = "off";
public static const ON:String = "on";
public static const AUTO:String = "auto";
}
}//package fl.controls
Section 96
//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 97
//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 98
//ComponentShim (fl.core.ComponentShim)
package fl.core {
import flash.display.*;
public dynamic class ComponentShim extends MovieClip {
}
}//package fl.core
Section 99
//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 100
//UIComponent (fl.core.UIComponent)
package fl.core {
import flash.events.*;
import flash.display.*;
import flash.text.*;
import fl.managers.*;
import fl.events.*;
import flash.system.*;
import flash.utils.*;
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 101
//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 102
//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 103
//ScrollEvent (fl.events.ScrollEvent)
package fl.events {
import flash.events.*;
public class ScrollEvent extends Event {
private var _position:Number;
private var _direction:String;
private var _delta:Number;
public static const SCROLL:String = "scroll";
public function ScrollEvent(_arg1:String, _arg2:Number, _arg3:Number){
super(ScrollEvent.SCROLL, false, false);
_direction = _arg1;
_delta = _arg2;
_position = _arg3;
}
override public function clone():Event{
return (new ScrollEvent(_direction, _delta, _position));
}
public function get position():Number{
return (_position);
}
override public function toString():String{
return (formatToString("ScrollEvent", "type", "bubbles", "cancelable", "direction", "delta", "position"));
}
public function get delta():Number{
return (_delta);
}
public function get direction():String{
return (_direction);
}
}
}//package fl.events
Section 104
//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 105
//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 106
//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 107
//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 108
//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 109
//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 110
//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 111
//AddMoneyInternal_69 (gardentd_fla.AddMoneyInternal_69)
package gardentd_fla {
import flash.display.*;
import flash.text.*;
public dynamic class AddMoneyInternal_69 extends MovieClip {
public var txt:TextField;
}
}//package gardentd_fla
Section 112
//AssetsBibb_6 (gardentd_fla.AssetsBibb_6)
package gardentd_fla {
import flash.display.*;
public dynamic class AssetsBibb_6 extends MovieClip {
public function AssetsBibb_6(){
addFrameScript(0, frame1, 6, frame7);
}
function frame7(){
stop();
}
function frame1(){
stop();
}
}
}//package gardentd_fla
Section 113
//BombExplosionInner_205 (gardentd_fla.BombExplosionInner_205)
package gardentd_fla {
import flash.display.*;
public dynamic class BombExplosionInner_205 extends MovieClip {
public function BombExplosionInner_205(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package gardentd_fla
Section 114
//BuildButtonMCBackSel_56 (gardentd_fla.BuildButtonMCBackSel_56)
package gardentd_fla {
import flash.display.*;
public dynamic class BuildButtonMCBackSel_56 extends MovieClip {
public function BuildButtonMCBackSel_56(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package gardentd_fla
Section 115
//CornerBonuses_79 (gardentd_fla.CornerBonuses_79)
package gardentd_fla {
import flash.display.*;
public dynamic class CornerBonuses_79 extends MovieClip {
public function CornerBonuses_79(){
addFrameScript(49, frame50, 99, frame100, 149, frame150, 199, frame200, 249, frame250);
}
function frame200(){
visible = false;
stop();
}
function frame100(){
visible = false;
stop();
}
function frame50(){
visible = false;
stop();
}
function frame250(){
visible = false;
stop();
}
function frame150(){
visible = false;
stop();
}
}
}//package gardentd_fla
Section 116
//fb_head_mc_14 (gardentd_fla.fb_head_mc_14)
package gardentd_fla {
import flash.display.*;
public dynamic class fb_head_mc_14 extends MovieClip {
public function fb_head_mc_14(){
addFrameScript(0, frame1, 12, frame13, 22, frame23);
}
function frame1(){
stop();
}
function frame13(){
stop();
}
function frame23(){
gotoAndStop("turnhead_stop");
}
}
}//package gardentd_fla
Section 117
//fb_head_mc_369 (gardentd_fla.fb_head_mc_369)
package gardentd_fla {
import flash.display.*;
public dynamic class fb_head_mc_369 extends MovieClip {
public function fb_head_mc_369(){
addFrameScript(0, frame1, 12, frame13, 22, frame23);
}
function frame1(){
stop();
}
function frame13(){
stop();
}
function frame23(){
gotoAndStop("turnhead_stop");
}
}
}//package gardentd_fla
Section 118
//flonga_button3_112 (gardentd_fla.flonga_button3_112)
package gardentd_fla {
import flash.display.*;
public dynamic class flonga_button3_112 extends MovieClip {
public var fButton:SimpleButton;
}
}//package gardentd_fla
Section 119
//flongabot_12 (gardentd_fla.flongabot_12)
package gardentd_fla {
import flash.display.*;
public dynamic class flongabot_12 extends MovieClip {
public var fbHead:MovieClip;
public function flongabot_12(){
addFrameScript(0, frame1, 75, frame76, 88, frame89, 99, frame100);
}
public function doEndFly(){
this.gotoAndPlay("flying_end");
}
function frame76(){
gotoAndPlay("normal");
}
function frame89(){
gotoAndPlay("flying");
}
public function doNormal(){
this.gotoAndPlay("normal");
}
function frame1(){
}
function frame100(){
gotoAndPlay("normal");
}
public function doTurnhead(){
this.fbHead.gotoAndPlay("turnhead");
}
public function doNormalHead(){
this.fbHead.gotoAndPlay("normal");
}
public function doWink(){
this.fbHead.gotoAndPlay("wink_start");
}
public function doFly(){
this.gotoAndPlay("flying_start");
}
}
}//package gardentd_fla
Section 120
//flongabot_367 (gardentd_fla.flongabot_367)
package gardentd_fla {
import flash.display.*;
public dynamic class flongabot_367 extends MovieClip {
public var fbHead:MovieClip;
public function flongabot_367(){
addFrameScript(0, frame1, 75, frame76, 88, frame89, 99, frame100);
}
public function doEndFly(){
this.gotoAndPlay("flying_end");
}
function frame76(){
gotoAndPlay("normal");
}
function frame89(){
gotoAndPlay("flying");
}
public function doNormal(){
this.gotoAndPlay("normal");
}
function frame1(){
}
function frame100(){
gotoAndPlay("normal");
}
public function doTurnhead(){
this.fbHead.gotoAndPlay("turnhead");
}
public function doNormalHead(){
this.fbHead.gotoAndPlay("normal");
}
public function doWink(){
this.fbHead.gotoAndPlay("wink_start");
}
public function doFly(){
this.gotoAndPlay("flying_start");
}
}
}//package gardentd_fla
Section 121
//FlongaIntro_365 (gardentd_fla.FlongaIntro_365)
package gardentd_fla {
import flash.media.*;
import flash.events.*;
import flash.display.*;
import flash.text.*;
import flash.filters.*;
import flash.net.*;
import flash.system.*;
import flash.utils.*;
import flash.geom.*;
import flash.ui.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.xml.*;
public dynamic class FlongaIntro_365 extends MovieClip {
public var flobot:MovieClip;
public function FlongaIntro_365(){
addFrameScript(0, frame1, 29, frame30, 62, frame63, 72, frame73, 92, frame93, 200, frame201, 0xFF, frame256);
}
function frame73(){
flobot.doTurnhead();
}
function frame201(){
flobot.doWink();
}
function frame93(){
flobot.doWink();
}
function frame1(){
}
function frame30(){
flobot.doFly();
}
function frame256(){
stop();
GameStage.itself.flongaFinished();
}
function frame63(){
flobot.doEndFly();
}
}
}//package gardentd_fla
Section 122
//GameMessageBlackMC_52 (gardentd_fla.GameMessageBlackMC_52)
package gardentd_fla {
import flash.display.*;
import flash.text.*;
public dynamic class GameMessageBlackMC_52 extends MovieClip {
public var message_txt:TextField;
public function GameMessageBlackMC_52(){
addFrameScript(44, frame45);
}
function frame45(){
visible = false;
stop();
}
}
}//package gardentd_fla
Section 123
//GasCloudInner_94 (gardentd_fla.GasCloudInner_94)
package gardentd_fla {
import flash.display.*;
public dynamic class GasCloudInner_94 extends MovieClip {
public function GasCloudInner_94(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package gardentd_fla
Section 124
//GasSprayerInner_96 (gardentd_fla.GasSprayerInner_96)
package gardentd_fla {
import flash.display.*;
public dynamic class GasSprayerInner_96 extends MovieClip {
public function GasSprayerInner_96(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package gardentd_fla
Section 125
//HostileUnitInfo_25 (gardentd_fla.HostileUnitInfo_25)
package gardentd_fla {
import flash.display.*;
import flash.text.*;
public dynamic class HostileUnitInfo_25 extends MovieClip {
public var health_txt:TextField;
}
}//package gardentd_fla
Section 126
//LaserTowersInner_98 (gardentd_fla.LaserTowersInner_98)
package gardentd_fla {
import flash.display.*;
public dynamic class LaserTowersInner_98 extends MovieClip {
public function LaserTowersInner_98(){
addFrameScript(0, frame1, 14, frame15, 43, frame44);
}
function frame15(){
gotoAndStop("steady_state");
}
function frame1(){
stop();
}
function frame44(){
gotoAndStop("steady_state");
}
}
}//package gardentd_fla
Section 127
//LevelClosedMessageMC_216 (gardentd_fla.LevelClosedMessageMC_216)
package gardentd_fla {
import flash.display.*;
import flash.text.*;
public dynamic class LevelClosedMessageMC_216 extends MovieClip {
public var msg:TextField;
}
}//package gardentd_fla
Section 128
//SellButton_19 (gardentd_fla.SellButton_19)
package gardentd_fla {
import flash.display.*;
import flash.text.*;
public dynamic class SellButton_19 extends MovieClip {
public var caption:TextField;
}
}//package gardentd_fla
Section 129
//SendNextAddMoneyMC_68 (gardentd_fla.SendNextAddMoneyMC_68)
package gardentd_fla {
import flash.display.*;
public dynamic class SendNextAddMoneyMC_68 extends MovieClip {
public var internal_mc:MovieClip;
public function SendNextAddMoneyMC_68(){
addFrameScript(29, frame30);
}
function frame30(){
stop();
visible = false;
}
}
}//package gardentd_fla
Section 130
//SoundsBibb_122 (gardentd_fla.SoundsBibb_122)
package gardentd_fla {
import flash.display.*;
public dynamic class SoundsBibb_122 extends MovieClip {
public function SoundsBibb_122(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package gardentd_fla
Section 131
//SpittingCactusInner_106 (gardentd_fla.SpittingCactusInner_106)
package gardentd_fla {
import flash.display.*;
public dynamic class SpittingCactusInner_106 extends MovieClip {
public function SpittingCactusInner_106(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package gardentd_fla
Section 132
//UnitParams_21 (gardentd_fla.UnitParams_21)
package gardentd_fla {
import flash.display.*;
import flash.text.*;
public dynamic class UnitParams_21 extends MovieClip {
public var description:TextField;
public var money_txt:TextField;
public var range_txt:TextField;
public var attack_txt:TextField;
}
}//package gardentd_fla
Section 133
//UpgradeButtonBacks_28 (gardentd_fla.UpgradeButtonBacks_28)
package gardentd_fla {
import flash.display.*;
public dynamic class UpgradeButtonBacks_28 extends MovieClip {
public function UpgradeButtonBacks_28(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package gardentd_fla
Section 134
//UpgradeButtons_26 (gardentd_fla.UpgradeButtons_26)
package gardentd_fla {
import flash.display.*;
public dynamic class UpgradeButtons_26 extends MovieClip {
public var button1:MovieClip;
public var button2:MovieClip;
}
}//package gardentd_fla
Section 135
//UpgradesPanel_27 (gardentd_fla.UpgradesPanel_27)
package gardentd_fla {
import flash.display.*;
import flash.text.*;
public dynamic class UpgradesPanel_27 extends MovieClip {
public var notenough_txt:TextField;
public var buy_txt:TextField;
public var button_back:MovieClip;
public var green_button:MovieClip;
public function UpgradesPanel_27(){
addFrameScript(0, frame1, 10, frame11, 11, frame12, 12, frame13, 13, frame14);
}
function frame14(){
notenough_txt.visible = false;
green_button.visible = false;
buy_txt.visible = false;
}
function frame12(){
notenough_txt.visible = false;
green_button.visible = false;
buy_txt.visible = false;
}
function frame1(){
stop();
}
function frame13(){
notenough_txt.visible = false;
green_button.visible = false;
buy_txt.visible = false;
}
function frame11(){
notenough_txt.visible = false;
green_button.visible = false;
buy_txt.visible = false;
}
}
}//package gardentd_fla
Section 136
//BombExplosion (BombExplosion)
package {
import flash.display.*;
public dynamic class BombExplosion extends MovieClip {
public var inner:MovieClip;
}
}//package
Section 137
//BombGnomeButton (BombGnomeButton)
package {
import fai.ui.*;
public dynamic class BombGnomeButton extends ButtonSprite {
}
}//package
Section 138
//Boomerang (Boomerang)
package {
import flash.display.*;
public dynamic class Boomerang extends MovieClip {
public var inner:MovieClip;
}
}//package
Section 139
//BoomerangGnomeButton (BoomerangGnomeButton)
package {
import fai.ui.*;
public dynamic class BoomerangGnomeButton extends ButtonSprite {
}
}//package
Section 140
//BuildButtonMC (BuildButtonMC)
package {
import fai.ui.*;
public dynamic class BuildButtonMC extends ButtonSprite {
}
}//package
Section 141
//BuildingMC (BuildingMC)
package {
import flash.display.*;
public dynamic class BuildingMC extends MovieClip {
}
}//package
Section 142
//Carrot (Carrot)
package {
import fai.ui.*;
public dynamic class Carrot extends GardenItem {
}
}//package
Section 143
//ChewingGumButton (ChewingGumButton)
package {
import fai.ui.*;
public dynamic class ChewingGumButton extends ButtonSprite {
}
}//package
Section 144
//focusRectSkin (focusRectSkin)
package {
import flash.display.*;
public dynamic class focusRectSkin extends MovieClip {
}
}//package
Section 145
//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 146
//GameStage (GameStage)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.net.*;
import flash.system.*;
import flash.ui.*;
public class GameStage extends MovieClip {
public var sponsor_games:SimpleButton;
private var atimer:Timer;// = null
public var wscreen:MovieClip;
public var loadingMC:MovieClip;
private var initialized:Boolean;// = false
public var flonga_clip:MovieClip;
private static var linkTimer:Timer = null;
private static var goto_window:String;
private static var goto_url:String;
private static var link1Timer:Timer = null;
public static var play_holder = null;
public static var main_stage = null;
public static var welcomeScreen;
public static var itself = null;
public function GameStage():void{
initialized = false;
atimer = null;
super();
addFrameScript(0, frame1, 1, frame2, 6, frame7);
Security.allowDomain("*");
itself = this;
}
public function progressUpdate(_arg1:Event):void{
var _local2:Number;
_local2 = Math.round(((this.loaderInfo.bytesLoaded / this.loaderInfo.bytesTotal) * 100));
if ((loadingMC is MovieClip)){
loadingMC.progress_mc.gotoAndStop(_local2);
loadingMC.loaded_txt.text = (("Game is loading: " + _local2.toString()) + "%");
};
if (!!((this.loaderInfo.bytesLoaded == this.loaderInfo.bytesTotal))){
loadingMC.removeEventListener(Event.ENTER_FRAME, progressUpdate);
loadingMC.progress_mc.stop();
loadingMC.progress_mc.visible = false;
removeChild(loadingMC);
loadingMC = null;
gotoAndStop("start_game");
};
}
private function handleUnload(_arg1:Event):void{
welcomeScreen.clear();
}
public function flongaFinished():void{
flonga_clip.visible = false;
this.removeChild(flonga_clip);
}
function frame7(){
flonga_clip.addEventListener(MouseEvent.MOUSE_DOWN, sponsorClick);
this.initTheGame();
stop();
}
function frame1(){
loadingMC.addEventListener(Event.ENTER_FRAME, progressUpdate);
sponsor_games.addEventListener(MouseEvent.MOUSE_DOWN, sponsorClick);
stop();
if (initialized){
loadingMC.removeEventListener(Event.ENTER_FRAME, progressUpdate);
sponsor_games.removeEventListener(MouseEvent.MOUSE_DOWN, sponsorClick);
gotoAndStop(7);
};
}
public function loadEnded():void{
wscreen.loadEnded();
}
function frame2(){
}
public function initTheGame():void{
var _local1:ContextMenu;
if (initialized){
return;
};
main_stage = this.stage;
welcomeScreen = wscreen;
_local1 = new ContextMenu();
_local1.hideBuiltInItems();
contextMenu = _local1;
initialized = true;
wscreen.initialize();
root.loaderInfo.addEventListener(Event.UNLOAD, handleUnload);
}
public static function sponsorClick(_arg1:MouseEvent):void{
var _local2:URLRequest;
_local2 = new URLRequest("http://www.flonga.com");
navigateToURL(_local2, "_blank");
}
}
}//package
Section 147
//GasCloud (GasCloud)
package {
import flash.display.*;
public dynamic class GasCloud extends MovieClip {
public var inner:MovieClip;
}
}//package
Section 148
//GasSprayer (GasSprayer)
package {
import flash.display.*;
public dynamic class GasSprayer extends MovieClip {
public var inner:MovieClip;
}
}//package
Section 149
//GasSprayerButton (GasSprayerButton)
package {
import fai.ui.*;
public dynamic class GasSprayerButton extends ButtonSprite {
}
}//package
Section 150
//GreenButton (GreenButton)
package {
import flash.display.*;
public dynamic class GreenButton extends SimpleButton {
}
}//package
Section 151
//Hedge1 (Hedge1)
package {
import fai.ui.*;
public dynamic class Hedge1 extends Hedge {
}
}//package
Section 152
//Hedge10 (Hedge10)
package {
import fai.ui.*;
public dynamic class Hedge10 extends Hedge {
}
}//package
Section 153
//Hedge11 (Hedge11)
package {
import fai.ui.*;
public dynamic class Hedge11 extends Hedge {
}
}//package
Section 154
//Hedge2 (Hedge2)
package {
import fai.ui.*;
public dynamic class Hedge2 extends Hedge {
}
}//package
Section 155
//Hedge3 (Hedge3)
package {
import fai.ui.*;
public dynamic class Hedge3 extends Hedge {
}
}//package
Section 156
//Hedge4 (Hedge4)
package {
import fai.ui.*;
public dynamic class Hedge4 extends Hedge {
}
}//package
Section 157
//Hedge5 (Hedge5)
package {
import fai.ui.*;
public dynamic class Hedge5 extends Hedge {
}
}//package
Section 158
//Hedge6 (Hedge6)
package {
import fai.ui.*;
public dynamic class Hedge6 extends Hedge {
}
}//package
Section 159
//Hedge7 (Hedge7)
package {
import fai.ui.*;
public dynamic class Hedge7 extends Hedge {
}
}//package
Section 160
//Hedge8 (Hedge8)
package {
import fai.ui.*;
public dynamic class Hedge8 extends Hedge {
}
}//package
Section 161
//Hedge9 (Hedge9)
package {
import fai.ui.*;
public dynamic class Hedge9 extends Hedge {
}
}//package
Section 162
//Image_beetle_body (Image_beetle_body)
package {
import flash.display.*;
public dynamic class Image_beetle_body extends BitmapData {
public function Image_beetle_body(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 163
//Image_beetle_status (Image_beetle_status)
package {
import flash.display.*;
public dynamic class Image_beetle_status extends BitmapData {
public function Image_beetle_status(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 164
//Image_boomerang_gnome_body (Image_boomerang_gnome_body)
package {
import flash.display.*;
public dynamic class Image_boomerang_gnome_body extends BitmapData {
public function Image_boomerang_gnome_body(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 165
//Image_boomerang_gnome_status (Image_boomerang_gnome_status)
package {
import flash.display.*;
public dynamic class Image_boomerang_gnome_status extends BitmapData {
public function Image_boomerang_gnome_status(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 166
//Image_bumblebee_body (Image_bumblebee_body)
package {
import flash.display.*;
public dynamic class Image_bumblebee_body extends BitmapData {
public function Image_bumblebee_body(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 167
//Image_bumblebee_status (Image_bumblebee_status)
package {
import flash.display.*;
public dynamic class Image_bumblebee_status extends BitmapData {
public function Image_bumblebee_status(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 168
//Image_cactus_body (Image_cactus_body)
package {
import flash.display.*;
public dynamic class Image_cactus_body extends BitmapData {
public function Image_cactus_body(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 169
//Image_caterpillar_body (Image_caterpillar_body)
package {
import flash.display.*;
public dynamic class Image_caterpillar_body extends BitmapData {
public function Image_caterpillar_body(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 170
//Image_caterpillar_status (Image_caterpillar_status)
package {
import flash.display.*;
public dynamic class Image_caterpillar_status extends BitmapData {
public function Image_caterpillar_status(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 171
//Image_chewing_gum_body (Image_chewing_gum_body)
package {
import flash.display.*;
public dynamic class Image_chewing_gum_body extends BitmapData {
public function Image_chewing_gum_body(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 172
//Image_chewing_gum_status (Image_chewing_gum_status)
package {
import flash.display.*;
public dynamic class Image_chewing_gum_status extends BitmapData {
public function Image_chewing_gum_status(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 173
//Image_colorado_beetle_body (Image_colorado_beetle_body)
package {
import flash.display.*;
public dynamic class Image_colorado_beetle_body extends BitmapData {
public function Image_colorado_beetle_body(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 174
//Image_colorado_beetle_status (Image_colorado_beetle_status)
package {
import flash.display.*;
public dynamic class Image_colorado_beetle_status extends BitmapData {
public function Image_colorado_beetle_status(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 175
//Image_danimation (Image_danimation)
package {
import flash.display.*;
public dynamic class Image_danimation extends BitmapData {
public function Image_danimation(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 176
//Image_debris (Image_debris)
package {
import flash.display.*;
public dynamic class Image_debris extends BitmapData {
public function Image_debris(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 177
//Image_dragonfly_body (Image_dragonfly_body)
package {
import flash.display.*;
public dynamic class Image_dragonfly_body extends BitmapData {
public function Image_dragonfly_body(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 178
//Image_dragonfly_status (Image_dragonfly_status)
package {
import flash.display.*;
public dynamic class Image_dragonfly_status extends BitmapData {
public function Image_dragonfly_status(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 179
//Image_gas_sprayer_body (Image_gas_sprayer_body)
package {
import flash.display.*;
public dynamic class Image_gas_sprayer_body extends BitmapData {
public function Image_gas_sprayer_body(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 180
//Image_gas_sprayer_status (Image_gas_sprayer_status)
package {
import flash.display.*;
public dynamic class Image_gas_sprayer_status extends BitmapData {
public function Image_gas_sprayer_status(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 181
//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 182
//Image_laser_gnome_be (Image_laser_gnome_be)
package {
import flash.display.*;
public dynamic class Image_laser_gnome_be extends BitmapData {
public function Image_laser_gnome_be(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 183
//Image_laser_gnome_body (Image_laser_gnome_body)
package {
import flash.display.*;
public dynamic class Image_laser_gnome_body extends BitmapData {
public function Image_laser_gnome_body(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 184
//Image_laser_gnome_bullet (Image_laser_gnome_bullet)
package {
import flash.display.*;
public dynamic class Image_laser_gnome_bullet extends BitmapData {
public function Image_laser_gnome_bullet(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 185
//Image_laser_gnome_status (Image_laser_gnome_status)
package {
import flash.display.*;
public dynamic class Image_laser_gnome_status extends BitmapData {
public function Image_laser_gnome_status(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 186
//Image_laser_towers_body (Image_laser_towers_body)
package {
import flash.display.*;
public dynamic class Image_laser_towers_body extends BitmapData {
public function Image_laser_towers_body(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 187
//Image_laser_towers_status (Image_laser_towers_status)
package {
import flash.display.*;
public dynamic class Image_laser_towers_status extends BitmapData {
public function Image_laser_towers_status(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 188
//Image_moth_body (Image_moth_body)
package {
import flash.display.*;
public dynamic class Image_moth_body extends BitmapData {
public function Image_moth_body(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 189
//Image_moth_status (Image_moth_status)
package {
import flash.display.*;
public dynamic class Image_moth_status extends BitmapData {
public function Image_moth_status(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 190
//Image_mouse_move (Image_mouse_move)
package {
import flash.display.*;
public dynamic class Image_mouse_move extends BitmapData {
public function Image_mouse_move(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 191
//Image_mouse_status (Image_mouse_status)
package {
import flash.display.*;
public dynamic class Image_mouse_status extends BitmapData {
public function Image_mouse_status(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 192
//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 193
//Image_poisoned_balls_body (Image_poisoned_balls_body)
package {
import flash.display.*;
public dynamic class Image_poisoned_balls_body extends BitmapData {
public function Image_poisoned_balls_body(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 194
//Image_poisoned_balls_status (Image_poisoned_balls_status)
package {
import flash.display.*;
public dynamic class Image_poisoned_balls_status extends BitmapData {
public function Image_poisoned_balls_status(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 195
//Image_rat_move (Image_rat_move)
package {
import flash.display.*;
public dynamic class Image_rat_move extends BitmapData {
public function Image_rat_move(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 196
//Image_rat_status (Image_rat_status)
package {
import flash.display.*;
public dynamic class Image_rat_status extends BitmapData {
public function Image_rat_status(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 197
//Image_razor_gnome_bullet (Image_razor_gnome_bullet)
package {
import flash.display.*;
public dynamic class Image_razor_gnome_bullet extends BitmapData {
public function Image_razor_gnome_bullet(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 198
//Image_razor_gnome_move (Image_razor_gnome_move)
package {
import flash.display.*;
public dynamic class Image_razor_gnome_move extends BitmapData {
public function Image_razor_gnome_move(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 199
//Image_razor_gnome_status (Image_razor_gnome_status)
package {
import flash.display.*;
public dynamic class Image_razor_gnome_status extends BitmapData {
public function Image_razor_gnome_status(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 200
//Image_rocket_gnome_be (Image_rocket_gnome_be)
package {
import flash.display.*;
public dynamic class Image_rocket_gnome_be extends BitmapData {
public function Image_rocket_gnome_be(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 201
//Image_rocket_gnome_body (Image_rocket_gnome_body)
package {
import flash.display.*;
public dynamic class Image_rocket_gnome_body extends BitmapData {
public function Image_rocket_gnome_body(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 202
//Image_rocket_gnome_bullet (Image_rocket_gnome_bullet)
package {
import flash.display.*;
public dynamic class Image_rocket_gnome_bullet extends BitmapData {
public function Image_rocket_gnome_bullet(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 203
//Image_rocket_gnome_status (Image_rocket_gnome_status)
package {
import flash.display.*;
public dynamic class Image_rocket_gnome_status extends BitmapData {
public function Image_rocket_gnome_status(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 204
//Image_small_worm_body (Image_small_worm_body)
package {
import flash.display.*;
public dynamic class Image_small_worm_body extends BitmapData {
public function Image_small_worm_body(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 205
//Image_small_worm_status (Image_small_worm_status)
package {
import flash.display.*;
public dynamic class Image_small_worm_status extends BitmapData {
public function Image_small_worm_status(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 206
//Image_spear_gnome_be (Image_spear_gnome_be)
package {
import flash.display.*;
public dynamic class Image_spear_gnome_be extends BitmapData {
public function Image_spear_gnome_be(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 207
//Image_spear_gnome_bullet (Image_spear_gnome_bullet)
package {
import flash.display.*;
public dynamic class Image_spear_gnome_bullet extends BitmapData {
public function Image_spear_gnome_bullet(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 208
//Image_spear_gnome_move (Image_spear_gnome_move)
package {
import flash.display.*;
public dynamic class Image_spear_gnome_move extends BitmapData {
public function Image_spear_gnome_move(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 209
//Image_spear_gnome_status (Image_spear_gnome_status)
package {
import flash.display.*;
public dynamic class Image_spear_gnome_status extends BitmapData {
public function Image_spear_gnome_status(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 210
//Image_spitting_cactus_status (Image_spitting_cactus_status)
package {
import flash.display.*;
public dynamic class Image_spitting_cactus_status extends BitmapData {
public function Image_spitting_cactus_status(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 211
//Image_timer_bomb_body (Image_timer_bomb_body)
package {
import flash.display.*;
public dynamic class Image_timer_bomb_body extends BitmapData {
public function Image_timer_bomb_body(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 212
//Image_timer_bomb_status (Image_timer_bomb_status)
package {
import flash.display.*;
public dynamic class Image_timer_bomb_status extends BitmapData {
public function Image_timer_bomb_status(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 213
//Image_Urocket_gnome_bullet (Image_Urocket_gnome_bullet)
package {
import flash.display.*;
public dynamic class Image_Urocket_gnome_bullet extends BitmapData {
public function Image_Urocket_gnome_bullet(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 214
//Image_Urocket_gnome_move (Image_Urocket_gnome_move)
package {
import flash.display.*;
public dynamic class Image_Urocket_gnome_move extends BitmapData {
public function Image_Urocket_gnome_move(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 215
//Image_Urocket_gnome_status (Image_Urocket_gnome_status)
package {
import flash.display.*;
public dynamic class Image_Urocket_gnome_status extends BitmapData {
public function Image_Urocket_gnome_status(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 216
//Image_worm_body (Image_worm_body)
package {
import flash.display.*;
public dynamic class Image_worm_body extends BitmapData {
public function Image_worm_body(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 217
//Image_worm_status (Image_worm_status)
package {
import flash.display.*;
public dynamic class Image_worm_status extends BitmapData {
public function Image_worm_status(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 218
//LaserTowers (LaserTowers)
package {
import flash.display.*;
public dynamic class LaserTowers extends MovieClip {
public var inner:MovieClip;
}
}//package
Section 219
//LaserTowersBuildTutorial (LaserTowersBuildTutorial)
package {
import flash.display.*;
public dynamic class LaserTowersBuildTutorial extends MovieClip {
}
}//package
Section 220
//LaserTowersButton (LaserTowersButton)
package {
import fai.ui.*;
public dynamic class LaserTowersButton extends ButtonSprite {
}
}//package
Section 221
//Level1 (Level1)
package {
import flash.display.*;
public dynamic class Level1 extends MovieClip {
public var invader_road:MovieClip;
}
}//package
Section 222
//Level10 (Level10)
package {
import flash.display.*;
public dynamic class Level10 extends MovieClip {
public var invader_road:MovieClip;
}
}//package
Section 223
//Level11 (Level11)
package {
import flash.display.*;
public dynamic class Level11 extends MovieClip {
public var invader_road:MovieClip;
}
}//package
Section 224
//Level12 (Level12)
package {
import flash.display.*;
public dynamic class Level12 extends MovieClip {
public var invader_road:MovieClip;
}
}//package
Section 225
//Level13 (Level13)
package {
import flash.display.*;
public dynamic class Level13 extends MovieClip {
public var invader_road:MovieClip;
}
}//package
Section 226
//Level14 (Level14)
package {
import flash.display.*;
public dynamic class Level14 extends MovieClip {
public var invader_road:MovieClip;
}
}//package
Section 227
//Level15 (Level15)
package {
import flash.display.*;
public dynamic class Level15 extends MovieClip {
public var invader_road:MovieClip;
}
}//package
Section 228
//Level16 (Level16)
package {
import flash.display.*;
public dynamic class Level16 extends MovieClip {
public var invader_road:MovieClip;
}
}//package
Section 229
//Level17 (Level17)
package {
import flash.display.*;
public dynamic class Level17 extends MovieClip {
public var invader_road:MovieClip;
}
}//package
Section 230
//Level18 (Level18)
package {
import flash.display.*;
public dynamic class Level18 extends MovieClip {
public var invader_road:MovieClip;
}
}//package
Section 231
//Level19 (Level19)
package {
import flash.display.*;
public dynamic class Level19 extends MovieClip {
public var invader_road:MovieClip;
}
}//package
Section 232
//Level2 (Level2)
package {
import flash.display.*;
public dynamic class Level2 extends MovieClip {
public var invader_road:MovieClip;
}
}//package
Section 233
//Level20 (Level20)
package {
import flash.display.*;
public dynamic class Level20 extends MovieClip {
public var invader_road:MovieClip;
}
}//package
Section 234
//Level3 (Level3)
package {
import flash.display.*;
public dynamic class Level3 extends MovieClip {
public var invader_road:MovieClip;
}
}//package
Section 235
//Level4 (Level4)
package {
import flash.display.*;
public dynamic class Level4 extends MovieClip {
public var invader_road:MovieClip;
}
}//package
Section 236
//Level5 (Level5)
package {
import flash.display.*;
public dynamic class Level5 extends MovieClip {
public var invader_road:MovieClip;
}
}//package
Section 237
//Level6 (Level6)
package {
import flash.display.*;
public dynamic class Level6 extends MovieClip {
public var invader_road:MovieClip;
}
}//package
Section 238
//Level7 (Level7)
package {
import flash.display.*;
public dynamic class Level7 extends MovieClip {
public var invader_road:MovieClip;
}
}//package
Section 239
//Level8 (Level8)
package {
import flash.display.*;
public dynamic class Level8 extends MovieClip {
public var invader_road:MovieClip;
}
}//package
Section 240
//Level9 (Level9)
package {
import flash.display.*;
public dynamic class Level9 extends MovieClip {
public var invader_road:MovieClip;
}
}//package
Section 241
//LevelClosedMC (LevelClosedMC)
package {
import flash.display.*;
public dynamic class LevelClosedMC extends Sprite {
}
}//package
Section 242
//LevelPlayMC (LevelPlayMC)
package {
import flash.display.*;
public dynamic class LevelPlayMC extends MovieClip {
}
}//package
Section 243
//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 244
//MoneyAddPopupMC (MoneyAddPopupMC)
package {
import flash.display.*;
import flash.text.*;
public dynamic class MoneyAddPopupMC extends MovieClip {
public var txt:TextField;
}
}//package
Section 245
//MoneyPopupMC (MoneyPopupMC)
package {
import flash.display.*;
import flash.text.*;
public dynamic class MoneyPopupMC extends MovieClip {
public var txt:TextField;
}
}//package
Section 246
//PauseMC (PauseMC)
package {
import flash.display.*;
public dynamic class PauseMC extends MovieClip {
public function PauseMC(){
addFrameScript(9, frame10);
}
function frame10(){
stop();
}
}
}//package
Section 247
//PelletGnomeButton (PelletGnomeButton)
package {
import fai.ui.*;
public dynamic class PelletGnomeButton extends ButtonSprite {
}
}//package
Section 248
//PoisonedBalls (PoisonedBalls)
package {
import flash.display.*;
public dynamic class PoisonedBalls extends MovieClip {
public var ball1:MovieClip;
public var ball6:MovieClip;
public var ball2:MovieClip;
public var ball3:MovieClip;
public var ball4:MovieClip;
public var ball5:MovieClip;
public var ball9:MovieClip;
public var ball7:MovieClip;
public var ball8:MovieClip;
}
}//package
Section 249
//PoisonedBallsButton (PoisonedBallsButton)
package {
import fai.ui.*;
public dynamic class PoisonedBallsButton extends ButtonSprite {
}
}//package
Section 250
//ProgressBar_barSkin (ProgressBar_barSkin)
package {
import flash.display.*;
public dynamic class ProgressBar_barSkin extends MovieClip {
}
}//package
Section 251
//ProgressBar_indeterminateSkin (ProgressBar_indeterminateSkin)
package {
import flash.display.*;
public dynamic class ProgressBar_indeterminateSkin extends MovieClip {
}
}//package
Section 252
//ProgressBar_trackSkin (ProgressBar_trackSkin)
package {
import flash.display.*;
public dynamic class ProgressBar_trackSkin extends MovieClip {
}
}//package
Section 253
//Pumpkin (Pumpkin)
package {
import fai.ui.*;
public dynamic class Pumpkin extends GardenItem {
}
}//package
Section 254
//RepairSign (RepairSign)
package {
import flash.display.*;
public dynamic class RepairSign extends MovieClip {
}
}//package
Section 255
//RoadPath1 (RoadPath1)
package {
import fai.ui.*;
public dynamic class RoadPath1 extends RoadPath {
}
}//package
Section 256
//RoadPath10 (RoadPath10)
package {
import fai.ui.*;
public dynamic class RoadPath10 extends RoadPath {
}
}//package
Section 257
//RoadPath101 (RoadPath101)
package {
import fai.ui.*;
public dynamic class RoadPath101 extends RoadPath {
}
}//package
Section 258
//RoadPath11 (RoadPath11)
package {
import fai.ui.*;
public dynamic class RoadPath11 extends RoadPath {
}
}//package
Section 259
//RoadPath111 (RoadPath111)
package {
import fai.ui.*;
public dynamic class RoadPath111 extends RoadPath {
}
}//package
Section 260
//RoadPath12 (RoadPath12)
package {
import fai.ui.*;
public dynamic class RoadPath12 extends RoadPath {
}
}//package
Section 261
//RoadPath13 (RoadPath13)
package {
import fai.ui.*;
public dynamic class RoadPath13 extends RoadPath {
}
}//package
Section 262
//RoadPath131 (RoadPath131)
package {
import fai.ui.*;
public dynamic class RoadPath131 extends RoadPath {
}
}//package
Section 263
//RoadPath14 (RoadPath14)
package {
import fai.ui.*;
public dynamic class RoadPath14 extends RoadPath {
}
}//package
Section 264
//RoadPath141 (RoadPath141)
package {
import fai.ui.*;
public dynamic class RoadPath141 extends RoadPath {
}
}//package
Section 265
//RoadPath15 (RoadPath15)
package {
import fai.ui.*;
public dynamic class RoadPath15 extends RoadPath {
}
}//package
Section 266
//RoadPath16 (RoadPath16)
package {
import fai.ui.*;
public dynamic class RoadPath16 extends RoadPath {
}
}//package
Section 267
//RoadPath161 (RoadPath161)
package {
import fai.ui.*;
public dynamic class RoadPath161 extends RoadPath {
}
}//package
Section 268
//RoadPath17 (RoadPath17)
package {
import fai.ui.*;
public dynamic class RoadPath17 extends RoadPath {
}
}//package
Section 269
//RoadPath171 (RoadPath171)
package {
import fai.ui.*;
public dynamic class RoadPath171 extends RoadPath {
}
}//package
Section 270
//RoadPath18 (RoadPath18)
package {
import fai.ui.*;
public dynamic class RoadPath18 extends RoadPath {
}
}//package
Section 271
//RoadPath181 (RoadPath181)
package {
import fai.ui.*;
public dynamic class RoadPath181 extends RoadPath {
}
}//package
Section 272
//RoadPath19 (RoadPath19)
package {
import fai.ui.*;
public dynamic class RoadPath19 extends RoadPath {
}
}//package
Section 273
//RoadPath191 (RoadPath191)
package {
import fai.ui.*;
public dynamic class RoadPath191 extends RoadPath {
}
}//package
Section 274
//RoadPath2 (RoadPath2)
package {
import fai.ui.*;
public dynamic class RoadPath2 extends RoadPath {
}
}//package
Section 275
//RoadPath20 (RoadPath20)
package {
import fai.ui.*;
public dynamic class RoadPath20 extends RoadPath {
}
}//package
Section 276
//RoadPath201 (RoadPath201)
package {
import fai.ui.*;
public dynamic class RoadPath201 extends RoadPath {
}
}//package
Section 277
//RoadPath202 (RoadPath202)
package {
import fai.ui.*;
public dynamic class RoadPath202 extends RoadPath {
}
}//package
Section 278
//RoadPath3 (RoadPath3)
package {
import fai.ui.*;
public dynamic class RoadPath3 extends RoadPath {
}
}//package
Section 279
//RoadPath4 (RoadPath4)
package {
import fai.ui.*;
public dynamic class RoadPath4 extends RoadPath {
}
}//package
Section 280
//RoadPath5 (RoadPath5)
package {
import fai.ui.*;
public dynamic class RoadPath5 extends RoadPath {
}
}//package
Section 281
//RoadPath6 (RoadPath6)
package {
import fai.ui.*;
public dynamic class RoadPath6 extends RoadPath {
}
}//package
Section 282
//RoadPath7 (RoadPath7)
package {
import fai.ui.*;
public dynamic class RoadPath7 extends RoadPath {
}
}//package
Section 283
//RoadPath71 (RoadPath71)
package {
import fai.ui.*;
public dynamic class RoadPath71 extends RoadPath {
}
}//package
Section 284
//RoadPath8 (RoadPath8)
package {
import fai.ui.*;
public dynamic class RoadPath8 extends RoadPath {
}
}//package
Section 285
//RoadPath81 (RoadPath81)
package {
import fai.ui.*;
public dynamic class RoadPath81 extends RoadPath {
}
}//package
Section 286
//RoadPath82 (RoadPath82)
package {
import fai.ui.*;
public dynamic class RoadPath82 extends RoadPath {
}
}//package
Section 287
//RoadPath9 (RoadPath9)
package {
import fai.ui.*;
public dynamic class RoadPath9 extends RoadPath {
}
}//package
Section 288
//RoadPath91 (RoadPath91)
package {
import fai.ui.*;
public dynamic class RoadPath91 extends RoadPath {
}
}//package
Section 289
//RoadPoint (RoadPoint)
package {
import flash.display.*;
public dynamic class RoadPoint extends Sprite {
}
}//package
Section 290
//ScrollArrowDown_disabledSkin (ScrollArrowDown_disabledSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowDown_disabledSkin extends MovieClip {
}
}//package
Section 291
//ScrollArrowDown_downSkin (ScrollArrowDown_downSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowDown_downSkin extends MovieClip {
}
}//package
Section 292
//ScrollArrowDown_overSkin (ScrollArrowDown_overSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowDown_overSkin extends MovieClip {
}
}//package
Section 293
//ScrollArrowDown_upSkin (ScrollArrowDown_upSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowDown_upSkin extends MovieClip {
}
}//package
Section 294
//ScrollArrowUp_disabledSkin (ScrollArrowUp_disabledSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowUp_disabledSkin extends MovieClip {
}
}//package
Section 295
//ScrollArrowUp_downSkin (ScrollArrowUp_downSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowUp_downSkin extends MovieClip {
}
}//package
Section 296
//ScrollArrowUp_overSkin (ScrollArrowUp_overSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowUp_overSkin extends MovieClip {
}
}//package
Section 297
//ScrollArrowUp_upSkin (ScrollArrowUp_upSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowUp_upSkin extends MovieClip {
}
}//package
Section 298
//ScrollBar_thumbIcon (ScrollBar_thumbIcon)
package {
import flash.display.*;
public dynamic class ScrollBar_thumbIcon extends MovieClip {
}
}//package
Section 299
//ScrollPane_disabledSkin (ScrollPane_disabledSkin)
package {
import flash.display.*;
public dynamic class ScrollPane_disabledSkin extends MovieClip {
}
}//package
Section 300
//ScrollPane_upSkin (ScrollPane_upSkin)
package {
import flash.display.*;
public dynamic class ScrollPane_upSkin extends MovieClip {
}
}//package
Section 301
//ScrollThumb_downSkin (ScrollThumb_downSkin)
package {
import flash.display.*;
public dynamic class ScrollThumb_downSkin extends MovieClip {
}
}//package
Section 302
//ScrollThumb_overSkin (ScrollThumb_overSkin)
package {
import flash.display.*;
public dynamic class ScrollThumb_overSkin extends MovieClip {
}
}//package
Section 303
//ScrollThumb_upSkin (ScrollThumb_upSkin)
package {
import flash.display.*;
public dynamic class ScrollThumb_upSkin extends MovieClip {
}
}//package
Section 304
//ScrollTrack_skin (ScrollTrack_skin)
package {
import flash.display.*;
public dynamic class ScrollTrack_skin extends MovieClip {
}
}//package
Section 305
//SelectedSpriteTooltip (SelectedSpriteTooltip)
package {
import flash.display.*;
public dynamic class SelectedSpriteTooltip extends Sprite {
}
}//package
Section 306
//SliderThumb_disabledSkin (SliderThumb_disabledSkin)
package {
import flash.display.*;
public dynamic class SliderThumb_disabledSkin extends MovieClip {
}
}//package
Section 307
//SliderThumb_downSkin (SliderThumb_downSkin)
package {
import flash.display.*;
public dynamic class SliderThumb_downSkin extends MovieClip {
}
}//package
Section 308
//SliderThumb_overSkin (SliderThumb_overSkin)
package {
import flash.display.*;
public dynamic class SliderThumb_overSkin extends MovieClip {
}
}//package
Section 309
//SliderThumb_upSkin (SliderThumb_upSkin)
package {
import flash.display.*;
public dynamic class SliderThumb_upSkin extends MovieClip {
}
}//package
Section 310
//SliderTick_skin (SliderTick_skin)
package {
import flash.display.*;
public dynamic class SliderTick_skin extends MovieClip {
}
}//package
Section 311
//SliderTrack_disabledSkin (SliderTrack_disabledSkin)
package {
import flash.display.*;
public dynamic class SliderTrack_disabledSkin extends MovieClip {
}
}//package
Section 312
//SliderTrack_skin (SliderTrack_skin)
package {
import flash.display.*;
public dynamic class SliderTrack_skin extends MovieClip {
}
}//package
Section 313
//Sound_bomb_explosion (Sound_bomb_explosion)
package {
import flash.media.*;
public dynamic class Sound_bomb_explosion extends Sound {
}
}//package
Section 314
//Sound_boom (Sound_boom)
package {
import flash.media.*;
public dynamic class Sound_boom extends Sound {
}
}//package
Section 315
//Sound_boomerang (Sound_boomerang)
package {
import flash.media.*;
public dynamic class Sound_boomerang extends Sound {
}
}//package
Section 316
//Sound_click (Sound_click)
package {
import flash.media.*;
public dynamic class Sound_click extends Sound {
}
}//package
Section 317
//Sound_failed (Sound_failed)
package {
import flash.media.*;
public dynamic class Sound_failed extends Sound {
}
}//package
Section 318
//Sound_game_over (Sound_game_over)
package {
import flash.media.*;
public dynamic class Sound_game_over extends Sound {
}
}//package
Section 319
//Sound_gas (Sound_gas)
package {
import flash.media.*;
public dynamic class Sound_gas extends Sound {
}
}//package
Section 320
//Sound_invader_killed (Sound_invader_killed)
package {
import flash.media.*;
public dynamic class Sound_invader_killed extends Sound {
}
}//package
Section 321
//Sound_lasers (Sound_lasers)
package {
import flash.media.*;
public dynamic class Sound_lasers extends Sound {
}
}//package
Section 322
//Sound_level_music (Sound_level_music)
package {
import flash.media.*;
public dynamic class Sound_level_music extends Sound {
}
}//package
Section 323
//Sound_level_selection (Sound_level_selection)
package {
import flash.media.*;
public dynamic class Sound_level_selection extends Sound {
}
}//package
Section 324
//Sound_next_wave (Sound_next_wave)
package {
import flash.media.*;
public dynamic class Sound_next_wave extends Sound {
}
}//package
Section 325
//Sound_pellet (Sound_pellet)
package {
import flash.media.*;
public dynamic class Sound_pellet extends Sound {
}
}//package
Section 326
//Sound_placing (Sound_placing)
package {
import flash.media.*;
public dynamic class Sound_placing extends Sound {
}
}//package
Section 327
//Sound_poison_ball (Sound_poison_ball)
package {
import flash.media.*;
public dynamic class Sound_poison_ball extends Sound {
}
}//package
Section 328
//Sound_rocket (Sound_rocket)
package {
import flash.media.*;
public dynamic class Sound_rocket extends Sound {
}
}//package
Section 329
//Sound_sell_turret (Sound_sell_turret)
package {
import flash.media.*;
public dynamic class Sound_sell_turret extends Sound {
}
}//package
Section 330
//Sound_spear (Sound_spear)
package {
import flash.media.*;
public dynamic class Sound_spear extends Sound {
}
}//package
Section 331
//Sound_spitting (Sound_spitting)
package {
import flash.media.*;
public dynamic class Sound_spitting extends Sound {
}
}//package
Section 332
//Sound_unpause (Sound_unpause)
package {
import flash.media.*;
public dynamic class Sound_unpause extends Sound {
}
}//package
Section 333
//Sound_upgrade (Sound_upgrade)
package {
import flash.media.*;
public dynamic class Sound_upgrade extends Sound {
}
}//package
Section 334
//Sound_victory (Sound_victory)
package {
import flash.media.*;
public dynamic class Sound_victory extends Sound {
}
}//package
Section 335
//SpittingCactus (SpittingCactus)
package {
import flash.display.*;
public dynamic class SpittingCactus extends MovieClip {
public var inner:MovieClip;
}
}//package
Section 336
//SpittingCactusButton (SpittingCactusButton)
package {
import fai.ui.*;
public dynamic class SpittingCactusButton extends ButtonSprite {
}
}//package
Section 337
//Sunflower (Sunflower)
package {
import fai.ui.*;
public dynamic class Sunflower extends GardenItem {
}
}//package
Section 338
//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 339
//TimerBomb (TimerBomb)
package {
import flash.display.*;
import flash.text.*;
public dynamic class TimerBomb extends MovieClip {
public var timer_txt:TextField;
}
}//package
Section 340
//TimerBombButton (TimerBombButton)
package {
import fai.ui.*;
public dynamic class TimerBombButton extends ButtonSprite {
}
}//package
Section 341
//UnitLevelOrder (UnitLevelOrder)
package {
import flash.display.*;
public dynamic class UnitLevelOrder extends Sprite {
}
}//package
Section 342
//WaterMelon (WaterMelon)
package {
import fai.ui.*;
public dynamic class WaterMelon extends GardenItem {
}
}//package