Section 1
//KongregateEvent (com.kongregate.as3.client.events.KongregateEvent)
package com.kongregate.as3.client.events {
import flash.events.*;
public class KongregateEvent extends Event {
public static const COMPLETE:String = "component_api_available";
public function KongregateEvent(_arg1:String){
super(_arg1);
}
}
}//package com.kongregate.as3.client.events
Section 2
//AbstractShadowService (com.kongregate.as3.client.services.AbstractShadowService)
package com.kongregate.as3.client.services {
import flash.events.*;
public class AbstractShadowService extends EventDispatcher {
protected function alert(_arg1:String, _arg2:String, _arg3="", _arg4:String=""):void{
trace(((((((("Kongregate API: " + _arg1) + ".") + _arg2) + "(") + _arg3) + ") ") + _arg4));
}
}
}//package com.kongregate.as3.client.services
Section 3
//HighScoreServiceShadow (com.kongregate.as3.client.services.HighScoreServiceShadow)
package com.kongregate.as3.client.services {
public class HighScoreServiceShadow extends AbstractShadowService implements IHighScoreServices {
private var mode:String;
public function HighScoreServiceShadow(){
mode = "";
}
public function submit(_arg1:Number, _arg2:String=null):void{
alert("IHighScoreServices", "submit", arguments);
}
public function connect():Boolean{
alert("IKongregateServices", "connect");
return (true);
}
public function requestList(_arg1:Function):void{
alert("IHighScoreServices", "requestList", "", (("[Mode: " + mode) + "]"));
_arg1({success:false});
}
public function setMode(_arg1:String):void{
alert("IHighScoreServices", "setMode", arguments);
this.mode = _arg1;
}
}
}//package com.kongregate.as3.client.services
Section 4
//IHighScoreServices (com.kongregate.as3.client.services.IHighScoreServices)
package com.kongregate.as3.client.services {
public interface IHighScoreServices {
function setMode(_arg1:String):void;
function submit(_arg1:Number, _arg2:String=null):void;
function requestList(_arg1:Function):void;
}
}//package com.kongregate.as3.client.services
Section 5
//IKongregateServices (com.kongregate.as3.client.services.IKongregateServices)
package com.kongregate.as3.client.services {
import flash.events.*;
public interface IKongregateServices extends IEventDispatcher {
function getPlayerInfo(_arg1:Function):void;
function connect(_arg1:Number=-1):Boolean;
}
}//package com.kongregate.as3.client.services
Section 6
//IStatServices (com.kongregate.as3.client.services.IStatServices)
package com.kongregate.as3.client.services {
public interface IStatServices {
function submitArray(_arg1:Array):void;
function submit(_arg1:String, _arg2:Number):void;
}
}//package com.kongregate.as3.client.services
Section 7
//IUserServices (com.kongregate.as3.client.services.IUserServices)
package com.kongregate.as3.client.services {
public interface IUserServices {
function getName():String;
function getPlayerInfo(_arg1:Function):void;
}
}//package com.kongregate.as3.client.services
Section 8
//KongregateServiceShadow (com.kongregate.as3.client.services.KongregateServiceShadow)
package com.kongregate.as3.client.services {
public class KongregateServiceShadow extends AbstractShadowService implements IKongregateServices {
public function getName():String{
alert("IKongregateServices", "getName");
return ("Guest");
}
public function connect(_arg1:Number=-1):Boolean{
alert("IKongregateServices", "connect", arguments);
return (true);
}
public function getPlayerInfo(_arg1:Function):void{
alert("IKongregateServices", "getPlayerInfo");
_arg1(new Object());
}
}
}//package com.kongregate.as3.client.services
Section 9
//StatServiceShadow (com.kongregate.as3.client.services.StatServiceShadow)
package com.kongregate.as3.client.services {
public class StatServiceShadow extends AbstractShadowService implements IStatServices {
public function submitArray(_arg1:Array):void{
alert("IStatServices", "submitArray", arguments);
}
public function submit(_arg1:String, _arg2:Number):void{
alert("IStatServices", "submitStat", arguments);
}
}
}//package com.kongregate.as3.client.services
Section 10
//UserServiceShadow (com.kongregate.as3.client.services.UserServiceShadow)
package com.kongregate.as3.client.services {
public class UserServiceShadow extends AbstractShadowService implements IUserServices {
public function getName():String{
alert("UserService", "getName");
return ("Guest");
}
public function getPlayerInfo(_arg1:Function):void{
alert("UserService", "getPlayerInfo");
_arg1({isGuest:true, name:"Guest", points:0, level:0, isMode:false, isAdmin:false, isDeveloper:false, avatarPath:"", chatAvatarPath:""});
}
}
}//package com.kongregate.as3.client.services
Section 11
//IAPIBootstrap (com.kongregate.as3.client.IAPIBootstrap)
package com.kongregate.as3.client {
import flash.events.*;
import flash.display.*;
public interface IAPIBootstrap {
function init(_arg1:Event=null, _arg2:Stage=null):void;
function hideLog():void;
function showLog(_arg1:int=0):void;
}
}//package com.kongregate.as3.client
Section 12
//KongregateAPI (com.kongregate.as3.client.KongregateAPI)
package com.kongregate.as3.client {
import flash.events.*;
import flash.display.*;
import com.kongregate.as3.client.events.*;
import com.kongregate.as3.client.services.*;
import flash.utils.*;
import flash.system.*;
import flash.net.*;
import flash.errors.*;
public class KongregateAPI extends Sprite {
private const VERSION:Number = 1;
private var loader:Loader;
private var loadedDomain:ApplicationDomain;
private static const CLASS_USER:String = "com.kongregate.as3.client.services.UserServices";
private static const CLASS_STATS:String = "com.kongregate.as3.client.services.StatServices";
private static const CLASS_SERVICES:String = "com.kongregate.as3.client.services.KongregateServices";
private static const CLASS_SCORES:String = "com.kongregate.as3.client.services.HighScoreServices";
private static const DEBUG_API_URL:String = "//Linuxpc/kongregate/public/flash/API_AS3.swf";
private static var _connected:Boolean;
private static var kUser:IUserServices;
private static var _loaded:Boolean;
private static var kServices:IKongregateServices;
private static var kScores:IHighScoreServices;
private static var mInstance:KongregateAPI;
private static var kStats:IStatServices;
private static var kAPI:IAPIBootstrap;
public function KongregateAPI(){
if (mInstance != null){
throw (new Error("Warning: KongregateAPI has been added to stage more than once or accessed improperly. Use getInstance() or a stage reference to access."));
};
mInstance = this;
this.addEventListener(Event.ADDED_TO_STAGE, init, false, 0, true);
}
public function get loaded():Boolean{
return (_loaded);
}
public function get connected():Boolean{
return (_connected);
}
private function alertConnected(_arg1:TimerEvent=null):void{
var _local2:KongregateEvent;
var _local3:Boolean;
_local2 = new KongregateEvent(KongregateEvent.COMPLETE);
_local3 = this.dispatchEvent(_local2);
}
private function init(_arg1:Event):void{
var _local2:Object;
var _local3:String;
var _local4:URLRequest;
var _local5:LoaderContext;
this.removeEventListener(Event.ADDED_TO_STAGE, init);
_loaded = false;
_connected = false;
_local2 = LoaderInfo(root.loaderInfo).parameters;
_local3 = _local2.api_path;
if (_local3 == null){
trace("Alert: Kongregate API could not be loaded, due to local testing. API will load when the game is uploaded.");
createShadowServices();
return;
};
Security.allowDomain("*.kongregate.com");
Security.allowDomain("kongregatetrunk.com");
_local4 = new URLRequest(_local3);
_local5 = new LoaderContext(false);
_local5.applicationDomain = ApplicationDomain.currentDomain;
_local5.securityDomain = SecurityDomain.currentDomain;
loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadComplete);
loader.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
loader.load(_local4, _local5);
}
public function get api():IAPIBootstrap{
return (kAPI);
}
private function loadComplete(_arg1:Event):void{
getServices();
}
public function get scores():IHighScoreServices{
return (kScores);
}
private function ioErrorHandler(_arg1:IOErrorEvent):void{
throw (new IOError(("API file not found. " + _arg1)));
}
public function get services():IKongregateServices{
return (kServices);
}
public function get stats():IStatServices{
return (kStats);
}
private function createShadowServices():void{
var _local1:Timer;
trace(">>> Kongregate Shadow Services instantiated for local development..");
kServices = new KongregateServiceShadow();
kScores = new HighScoreServiceShadow();
kStats = new StatServiceShadow();
kUser = new UserServiceShadow();
_local1 = new Timer(200, 1);
_local1.addEventListener(TimerEvent.TIMER_COMPLETE, alertConnected);
_local1.start();
_connected = true;
}
public function get user():IUserServices{
return (kUser);
}
private function getServices():void{
var _local1:ApplicationDomain;
var _local2:*;
var _local3:*;
var _local4:*;
var _local5:*;
_local1 = ApplicationDomain.currentDomain;
kAPI = IAPIBootstrap(loader.getChildAt(0));
this.addChild(loader);
_local2 = _local1.getDefinition(CLASS_SERVICES);
trace(_local2);
kServices = _local2.getInstance();
_local3 = _local1.getDefinition(CLASS_SCORES);
kScores = _local3.getInstance();
_local4 = _local1.getDefinition(CLASS_STATS);
kStats = _local4.getInstance();
_local5 = _local1.getDefinition(CLASS_USER);
kUser = _local5.getInstance();
kServices.connect(VERSION);
_loaded = true;
_connected = true;
alertConnected();
}
public static function getInstance():KongregateAPI{
if (!mInstance){
throw (new IllegalOperationError("You must add the Kongregate API component to the stage before attempting to access it."));
};
return (mInstance);
}
}
}//package com.kongregate.as3.client
Section 13
//ability_barier_mc_46 (Defender_fla.ability_barier_mc_46)
package Defender_fla {
import flash.display.*;
public dynamic class ability_barier_mc_46 extends MovieClip {
public var bar:MovieClip;
public function ability_barier_mc_46(){
super();
addFrameScript(0, frame1, 1, frame2, 2, frame3);
}
function frame3(){
stop();
}
function frame1(){
stop();
}
function frame2(){
stop();
}
}
}//package Defender_fla
Section 14
//ability_mana_mc_48 (Defender_fla.ability_mana_mc_48)
package Defender_fla {
import flash.display.*;
public dynamic class ability_mana_mc_48 extends MovieClip {
public var bar:MovieClip;
public function ability_mana_mc_48(){
super();
addFrameScript(0, frame1, 1, frame2, 2, frame3);
}
function frame3(){
stop();
}
function frame1(){
stop();
}
function frame2(){
stop();
}
}
}//package Defender_fla
Section 15
//ability_parit_mc_47 (Defender_fla.ability_parit_mc_47)
package Defender_fla {
import flash.display.*;
public dynamic class ability_parit_mc_47 extends MovieClip {
public var bar:MovieClip;
public function ability_parit_mc_47(){
super();
addFrameScript(0, frame1, 1, frame2, 2, frame3);
}
function frame3(){
stop();
}
function frame1(){
stop();
}
function frame2(){
stop();
}
}
}//package Defender_fla
Section 16
//ability_turret_mc_45 (Defender_fla.ability_turret_mc_45)
package Defender_fla {
import flash.display.*;
public dynamic class ability_turret_mc_45 extends MovieClip {
public var bar:MovieClip;
public function ability_turret_mc_45(){
super();
addFrameScript(0, frame1, 1, frame2, 2, frame3);
}
function frame3(){
stop();
}
function frame1(){
stop();
}
function frame2(){
stop();
}
}
}//package Defender_fla
Section 17
//ads_kongai_mc_4 (Defender_fla.ads_kongai_mc_4)
package Defender_fla {
import flash.display.*;
public dynamic class ads_kongai_mc_4 extends MovieClip {
public function ads_kongai_mc_4(){
super();
addFrameScript(123, frame124);
}
function frame124(){
stop();
}
}
}//package Defender_fla
Section 18
//arrow_electric_mc_43 (Defender_fla.arrow_electric_mc_43)
package Defender_fla {
import flash.display.*;
public dynamic class arrow_electric_mc_43 extends MovieClip {
public var bar:MovieClip;
public function arrow_electric_mc_43(){
super();
addFrameScript(0, frame1, 1, frame2, 2, frame3);
}
function frame3(){
stop();
}
function frame1(){
stop();
}
function frame2(){
stop();
}
}
}//package Defender_fla
Section 19
//arrow_fire_mc_42 (Defender_fla.arrow_fire_mc_42)
package Defender_fla {
import flash.display.*;
public dynamic class arrow_fire_mc_42 extends MovieClip {
public var bar:MovieClip;
public function arrow_fire_mc_42(){
super();
addFrameScript(0, frame1, 1, frame2, 2, frame3);
}
function frame3(){
stop();
}
function frame1(){
stop();
}
function frame2(){
stop();
}
}
}//package Defender_fla
Section 20
//arrow_ice_mc_44 (Defender_fla.arrow_ice_mc_44)
package Defender_fla {
import flash.display.*;
public dynamic class arrow_ice_mc_44 extends MovieClip {
public var bar:MovieClip;
public function arrow_ice_mc_44(){
super();
addFrameScript(0, frame1, 1, frame2, 2, frame3);
}
function frame3(){
stop();
}
function frame1(){
stop();
}
function frame2(){
stop();
}
}
}//package Defender_fla
Section 21
//arrow_normal_mc_41 (Defender_fla.arrow_normal_mc_41)
package Defender_fla {
import flash.display.*;
public dynamic class arrow_normal_mc_41 extends MovieClip {
public var bar:MovieClip;
public function arrow_normal_mc_41(){
super();
addFrameScript(0, frame1, 1, frame2, 2, frame3);
}
function frame3(){
stop();
}
function frame1(){
stop();
}
function frame2(){
stop();
}
}
}//package Defender_fla
Section 22
//avatar_angel_mc_39 (Defender_fla.avatar_angel_mc_39)
package Defender_fla {
import flash.display.*;
public dynamic class avatar_angel_mc_39 extends MovieClip {
public var bar:MovieClip;
public function avatar_angel_mc_39(){
super();
addFrameScript(0, frame1, 1, frame2, 2, frame3);
}
function frame3(){
stop();
}
function frame1(){
stop();
}
function frame2(){
stop();
}
}
}//package Defender_fla
Section 23
//avatar_dragon_mc_40 (Defender_fla.avatar_dragon_mc_40)
package Defender_fla {
import flash.display.*;
public dynamic class avatar_dragon_mc_40 extends MovieClip {
public var bar:MovieClip;
public function avatar_dragon_mc_40(){
super();
addFrameScript(0, frame1, 1, frame2, 2, frame3);
}
function frame3(){
stop();
}
function frame1(){
stop();
}
function frame2(){
stop();
}
}
}//package Defender_fla
Section 24
//avatar_dwarf_mc_36 (Defender_fla.avatar_dwarf_mc_36)
package Defender_fla {
import flash.display.*;
public dynamic class avatar_dwarf_mc_36 extends MovieClip {
public var bar:MovieClip;
public function avatar_dwarf_mc_36(){
super();
addFrameScript(0, frame1, 1, frame2, 2, frame3);
}
function frame3(){
stop();
}
function frame1(){
stop();
}
function frame2(){
stop();
}
}
}//package Defender_fla
Section 25
//avatar_elven_mc_35 (Defender_fla.avatar_elven_mc_35)
package Defender_fla {
import flash.display.*;
public dynamic class avatar_elven_mc_35 extends MovieClip {
public var bar:MovieClip;
public function avatar_elven_mc_35(){
super();
addFrameScript(0, frame1, 1, frame2, 2, frame3);
}
function frame3(){
stop();
}
function frame1(){
stop();
}
function frame2(){
stop();
}
}
}//package Defender_fla
Section 26
//avatar_hobbit_mc_33 (Defender_fla.avatar_hobbit_mc_33)
package Defender_fla {
import flash.display.*;
public dynamic class avatar_hobbit_mc_33 extends MovieClip {
public var bar:MovieClip;
public function avatar_hobbit_mc_33(){
super();
addFrameScript(0, frame1, 1, frame2, 2, frame3);
}
function frame3(){
stop();
}
function frame1(){
stop();
}
function frame2(){
stop();
}
}
}//package Defender_fla
Section 27
//avatar_shaman_mc_38 (Defender_fla.avatar_shaman_mc_38)
package Defender_fla {
import flash.display.*;
public dynamic class avatar_shaman_mc_38 extends MovieClip {
public var bar:MovieClip;
public function avatar_shaman_mc_38(){
super();
addFrameScript(0, frame1, 1, frame2, 2, frame3);
}
function frame3(){
stop();
}
function frame1(){
stop();
}
function frame2(){
stop();
}
}
}//package Defender_fla
Section 28
//avatar_titan_mc_37 (Defender_fla.avatar_titan_mc_37)
package Defender_fla {
import flash.display.*;
public dynamic class avatar_titan_mc_37 extends MovieClip {
public var bar:MovieClip;
public function avatar_titan_mc_37(){
super();
addFrameScript(0, frame1, 1, frame2, 2, frame3);
}
function frame3(){
stop();
}
function frame1(){
stop();
}
function frame2(){
stop();
}
}
}//package Defender_fla
Section 29
//info_graph_209 (Defender_fla.info_graph_209)
package Defender_fla {
import flash.display.*;
import flash.text.*;
public dynamic class info_graph_209 extends MovieClip {
public var title_map:TextField;
public var best_score:TextField;
public var your_score:TextField;
public function info_graph_209(){
super();
}
}
}//package Defender_fla
Section 30
//info_unit_mc_49 (Defender_fla.info_unit_mc_49)
package Defender_fla {
import flash.display.*;
import flash.text.*;
public dynamic class info_unit_mc_49 extends MovieClip {
public var power:TextField;
public var mana:TextField;
public var health:TextField;
public var title:TextField;
public var desc:TextField;
public function info_unit_mc_49(){
super();
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4, 4, frame5, 5, frame6);
}
function frame3(){
stop();
}
function frame6(){
stop();
}
function frame1(){
stop();
}
function frame4(){
stop();
}
function frame5(){
stop();
}
function frame2(){
stop();
}
}
}//package Defender_fla
Section 31
//instruct_movie_mc_215 (Defender_fla.instruct_movie_mc_215)
package Defender_fla {
import flash.display.*;
public dynamic class instruct_movie_mc_215 extends MovieClip {
public function instruct_movie_mc_215(){
super();
addFrameScript(134, frame135);
}
function frame135(){
stop();
}
}
}//package Defender_fla
Section 32
//interface_loading_mc_1 (Defender_fla.interface_loading_mc_1)
package Defender_fla {
import flash.display.*;
public dynamic class interface_loading_mc_1 extends MovieClip {
public var kongai:MovieClip;
public var artLogicLink:MovieClip;
public var kongregateLink:MovieClip;
public var load_bar:MovieClip;
public var bPlay:SimpleButton;
public function interface_loading_mc_1(){
super();
addFrameScript(0, frame1, 1, frame2);
}
function frame1(){
stop();
}
function frame2(){
stop();
}
}
}//package Defender_fla
Section 33
//MainTimeline (Defender_fla.MainTimeline)
package Defender_fla {
import flash.events.*;
import flash.display.*;
import DefX.*;
import flash.media.*;
import flash.utils.*;
import flash.system.*;
import flash.text.*;
import flash.net.*;
import flash.errors.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.external.*;
import flash.filters.*;
import flash.geom.*;
import flash.printing.*;
import flash.ui.*;
import flash.xml.*;
public dynamic class MainTimeline extends MovieClip {
public var percent:int;
public var preloader:MovieClip;
public var test;
public function MainTimeline(){
super();
addFrameScript(0, frame1, 2, frame3);
}
function frame3(){
stop();
test = new DefXDoc();
test.initialise(this);
}
function frame1(){
stop();
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.showDefaultContextMenu = false;
preloader.addEventListener(Event.ENTER_FRAME, showProgress);
preloader.kongregateLink.addEventListener(MouseEvent.CLICK, kongregateClick);
preloader.artLogicLink.addEventListener(MouseEvent.CLICK, artLogicClick);
preloader.kongai.addEventListener(MouseEvent.CLICK, kongaiClick);
}
public function kongregateClick(event:MouseEvent):void{
var targetURL:URLRequest;
targetURL = new URLRequest("http://www.kongregate.com/?gamereferral=epic-war");
navigateToURL(targetURL, "_blank");
}
public function showProgress(evtObj:Event):void{
percent = Math.round(((this.loaderInfo.bytesLoaded / this.loaderInfo.bytesTotal) * 100));
preloader.load_bar.scaleX = (percent / 100);
trace((("Loading... " + percent) + "%"));
if (this.loaderInfo.bytesLoaded == this.loaderInfo.bytesTotal){
trace("Done loading");
preloader.removeEventListener(Event.ENTER_FRAME, showProgress);
preloader.gotoAndStop(2);
preloader.bPlay.addEventListener(MouseEvent.CLICK, playClick);
};
}
public function kongaiClick(event:MouseEvent):void{
var targetURL:URLRequest;
targetURL = new URLRequest("http://www.kongregate.com/games/Kongregate/kongai/?gamereferral=epic-war");
navigateToURL(targetURL, "_blank");
}
public function artLogicClick(event:MouseEvent):void{
var targetURL:URLRequest;
targetURL = new URLRequest("http://www.artlogicgames.com");
navigateToURL(targetURL, "_blank");
}
public function playClick(event:MouseEvent):void{
preloader.removeEventListener(Event.ENTER_FRAME, showProgress);
preloader.kongai.removeEventListener(MouseEvent.CLICK, kongaiClick);
preloader.kongregateLink.removeEventListener(MouseEvent.CLICK, kongregateClick);
preloader.artLogicLink.removeEventListener(MouseEvent.CLICK, artLogicClick);
preloader.bPlay.removeEventListener(MouseEvent.CLICK, playClick);
gotoAndPlay(2);
}
}
}//package Defender_fla
Section 34
//mana_complete_mc_30 (Defender_fla.mana_complete_mc_30)
package Defender_fla {
import flash.display.*;
import flash.text.*;
public dynamic class mana_complete_mc_30 extends MovieClip {
public var mana_total:TextField;
public var mana_bar_mc:MovieClip;
public var mana_now:TextField;
public function mana_complete_mc_30(){
super();
}
}
}//package Defender_fla
Section 35
//menu_army_angel_mc_192 (Defender_fla.menu_army_angel_mc_192)
package Defender_fla {
import flash.display.*;
public dynamic class menu_army_angel_mc_192 extends MovieClip {
public function menu_army_angel_mc_192(){
super();
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4, 4, frame5, 5, frame6);
}
function frame3(){
stop();
}
function frame6(){
stop();
}
function frame1(){
stop();
}
function frame4(){
stop();
}
function frame5(){
stop();
}
function frame2(){
stop();
}
}
}//package Defender_fla
Section 36
//menu_army_dragon_mc_185 (Defender_fla.menu_army_dragon_mc_185)
package Defender_fla {
import flash.display.*;
public dynamic class menu_army_dragon_mc_185 extends MovieClip {
public function menu_army_dragon_mc_185(){
super();
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4, 4, frame5, 5, frame6);
}
function frame3(){
stop();
}
function frame6(){
stop();
}
function frame1(){
stop();
}
function frame4(){
stop();
}
function frame5(){
stop();
}
function frame2(){
stop();
}
}
}//package Defender_fla
Section 37
//menu_army_dwarf_mc_66 (Defender_fla.menu_army_dwarf_mc_66)
package Defender_fla {
import flash.display.*;
public dynamic class menu_army_dwarf_mc_66 extends MovieClip {
public function menu_army_dwarf_mc_66(){
super();
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4, 4, frame5, 5, frame6);
}
function frame3(){
stop();
}
function frame6(){
stop();
}
function frame1(){
stop();
}
function frame4(){
stop();
}
function frame5(){
stop();
}
function frame2(){
stop();
}
}
}//package Defender_fla
Section 38
//menu_army_elven_mc_73 (Defender_fla.menu_army_elven_mc_73)
package Defender_fla {
import flash.display.*;
public dynamic class menu_army_elven_mc_73 extends MovieClip {
public function menu_army_elven_mc_73(){
super();
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4, 4, frame5, 5, frame6);
}
function frame3(){
stop();
}
function frame6(){
stop();
}
function frame1(){
stop();
}
function frame4(){
stop();
}
function frame5(){
stop();
}
function frame2(){
stop();
}
}
}//package Defender_fla
Section 39
//menu_army_hobbit_mc_136 (Defender_fla.menu_army_hobbit_mc_136)
package Defender_fla {
import flash.display.*;
public dynamic class menu_army_hobbit_mc_136 extends MovieClip {
public function menu_army_hobbit_mc_136(){
super();
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4, 4, frame5, 5, frame6);
}
function frame3(){
stop();
}
function frame6(){
stop();
}
function frame1(){
stop();
}
function frame4(){
stop();
}
function frame5(){
stop();
}
function frame2(){
stop();
}
}
}//package Defender_fla
Section 40
//menu_army_shaman_mc_94 (Defender_fla.menu_army_shaman_mc_94)
package Defender_fla {
import flash.display.*;
public dynamic class menu_army_shaman_mc_94 extends MovieClip {
public function menu_army_shaman_mc_94(){
super();
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4, 4, frame5, 5, frame6);
}
function frame3(){
stop();
}
function frame6(){
stop();
}
function frame1(){
stop();
}
function frame4(){
stop();
}
function frame5(){
stop();
}
function frame2(){
stop();
}
}
}//package Defender_fla
Section 41
//menu_army_titan_mc_164 (Defender_fla.menu_army_titan_mc_164)
package Defender_fla {
import flash.display.*;
public dynamic class menu_army_titan_mc_164 extends MovieClip {
public function menu_army_titan_mc_164(){
super();
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4, 4, frame5, 5, frame6);
}
function frame3(){
stop();
}
function frame6(){
stop();
}
function frame1(){
stop();
}
function frame4(){
stop();
}
function frame5(){
stop();
}
function frame2(){
stop();
}
}
}//package Defender_fla
Section 42
//menu_arrow_electric_mc_157 (Defender_fla.menu_arrow_electric_mc_157)
package Defender_fla {
import flash.display.*;
public dynamic class menu_arrow_electric_mc_157 extends MovieClip {
public function menu_arrow_electric_mc_157(){
super();
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4, 4, frame5, 5, frame6);
}
function frame3(){
stop();
}
function frame6(){
stop();
}
function frame1(){
stop();
}
function frame4(){
stop();
}
function frame5(){
stop();
}
function frame2(){
stop();
}
}
}//package Defender_fla
Section 43
//menu_arrow_fire_mc_178 (Defender_fla.menu_arrow_fire_mc_178)
package Defender_fla {
import flash.display.*;
public dynamic class menu_arrow_fire_mc_178 extends MovieClip {
public function menu_arrow_fire_mc_178(){
super();
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4, 4, frame5, 5, frame6);
}
function frame3(){
stop();
}
function frame6(){
stop();
}
function frame1(){
stop();
}
function frame4(){
stop();
}
function frame5(){
stop();
}
function frame2(){
stop();
}
}
}//package Defender_fla
Section 44
//menu_arrow_ice_mc_171 (Defender_fla.menu_arrow_ice_mc_171)
package Defender_fla {
import flash.display.*;
public dynamic class menu_arrow_ice_mc_171 extends MovieClip {
public function menu_arrow_ice_mc_171(){
super();
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4, 4, frame5, 5, frame6);
}
function frame3(){
stop();
}
function frame6(){
stop();
}
function frame1(){
stop();
}
function frame4(){
stop();
}
function frame5(){
stop();
}
function frame2(){
stop();
}
}
}//package Defender_fla
Section 45
//menu_arrow_mc_150 (Defender_fla.menu_arrow_mc_150)
package Defender_fla {
import flash.display.*;
public dynamic class menu_arrow_mc_150 extends MovieClip {
public function menu_arrow_mc_150(){
super();
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4, 4, frame5, 5, frame6);
}
function frame3(){
stop();
}
function frame6(){
stop();
}
function frame1(){
stop();
}
function frame4(){
stop();
}
function frame5(){
stop();
}
function frame2(){
stop();
}
}
}//package Defender_fla
Section 46
//menu_barrier_mc_129 (Defender_fla.menu_barrier_mc_129)
package Defender_fla {
import flash.display.*;
public dynamic class menu_barrier_mc_129 extends MovieClip {
public function menu_barrier_mc_129(){
super();
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4, 4, frame5, 5, frame6);
}
function frame3(){
stop();
}
function frame6(){
stop();
}
function frame1(){
stop();
}
function frame4(){
stop();
}
function frame5(){
stop();
}
function frame2(){
stop();
}
}
}//package Defender_fla
Section 47
//menu_castle_health_mc_108 (Defender_fla.menu_castle_health_mc_108)
package Defender_fla {
import flash.display.*;
public dynamic class menu_castle_health_mc_108 extends MovieClip {
public function menu_castle_health_mc_108(){
super();
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4, 4, frame5, 5, frame6);
}
function frame3(){
stop();
}
function frame6(){
stop();
}
function frame1(){
stop();
}
function frame4(){
stop();
}
function frame5(){
stop();
}
function frame2(){
stop();
}
}
}//package Defender_fla
Section 48
//menu_mana_gain_mc_80 (Defender_fla.menu_mana_gain_mc_80)
package Defender_fla {
import flash.display.*;
public dynamic class menu_mana_gain_mc_80 extends MovieClip {
public function menu_mana_gain_mc_80(){
super();
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4, 4, frame5, 5, frame6);
}
function frame3(){
stop();
}
function frame6(){
stop();
}
function frame1(){
stop();
}
function frame4(){
stop();
}
function frame5(){
stop();
}
function frame2(){
stop();
}
}
}//package Defender_fla
Section 49
//menu_mana_regenerate_mc_122 (Defender_fla.menu_mana_regenerate_mc_122)
package Defender_fla {
import flash.display.*;
public dynamic class menu_mana_regenerate_mc_122 extends MovieClip {
public function menu_mana_regenerate_mc_122(){
super();
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4, 4, frame5, 5, frame6);
}
function frame3(){
stop();
}
function frame6(){
stop();
}
function frame1(){
stop();
}
function frame4(){
stop();
}
function frame5(){
stop();
}
function frame2(){
stop();
}
}
}//package Defender_fla
Section 50
//menu_mana_stock_mc_143 (Defender_fla.menu_mana_stock_mc_143)
package Defender_fla {
import flash.display.*;
public dynamic class menu_mana_stock_mc_143 extends MovieClip {
public function menu_mana_stock_mc_143(){
super();
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4, 4, frame5, 5, frame6);
}
function frame3(){
stop();
}
function frame6(){
stop();
}
function frame1(){
stop();
}
function frame4(){
stop();
}
function frame5(){
stop();
}
function frame2(){
stop();
}
}
}//package Defender_fla
Section 51
//menu_money_gain_87 (Defender_fla.menu_money_gain_87)
package Defender_fla {
import flash.display.*;
public dynamic class menu_money_gain_87 extends MovieClip {
public function menu_money_gain_87(){
super();
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4, 4, frame5, 5, frame6);
}
function frame3(){
stop();
}
function frame6(){
stop();
}
function frame1(){
stop();
}
function frame4(){
stop();
}
function frame5(){
stop();
}
function frame2(){
stop();
}
}
}//package Defender_fla
Section 52
//menu_parit_mc_115 (Defender_fla.menu_parit_mc_115)
package Defender_fla {
import flash.display.*;
public dynamic class menu_parit_mc_115 extends MovieClip {
public function menu_parit_mc_115(){
super();
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4, 4, frame5, 5, frame6);
}
function frame3(){
stop();
}
function frame6(){
stop();
}
function frame1(){
stop();
}
function frame4(){
stop();
}
function frame5(){
stop();
}
function frame2(){
stop();
}
}
}//package Defender_fla
Section 53
//menu_special_mc_199 (Defender_fla.menu_special_mc_199)
package Defender_fla {
import flash.display.*;
public dynamic class menu_special_mc_199 extends MovieClip {
public function menu_special_mc_199(){
super();
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4, 4, frame5, 5, frame6);
}
function frame3(){
stop();
}
function frame6(){
stop();
}
function frame1(){
stop();
}
function frame4(){
stop();
}
function frame5(){
stop();
}
function frame2(){
stop();
}
}
}//package Defender_fla
Section 54
//menu_turret_mc_101 (Defender_fla.menu_turret_mc_101)
package Defender_fla {
import flash.display.*;
public dynamic class menu_turret_mc_101 extends MovieClip {
public function menu_turret_mc_101(){
super();
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4, 4, frame5, 5, frame6);
}
function frame3(){
stop();
}
function frame6(){
stop();
}
function frame1(){
stop();
}
function frame4(){
stop();
}
function frame5(){
stop();
}
function frame2(){
stop();
}
}
}//package Defender_fla
Section 55
//node_grp_208 (Defender_fla.node_grp_208)
package Defender_fla {
import flash.display.*;
public dynamic class node_grp_208 extends MovieClip {
public function node_grp_208(){
super();
addFrameScript(0, frame1, 1, frame2, 2, frame3);
}
function frame3(){
stop();
}
function frame1(){
stop();
}
function frame2(){
stop();
}
}
}//package Defender_fla
Section 56
//pause_mc_24 (Defender_fla.pause_mc_24)
package Defender_fla {
import flash.display.*;
public dynamic class pause_mc_24 extends MovieClip {
public function pause_mc_24(){
super();
addFrameScript(0, frame1, 1, frame2);
}
function frame1(){
stop();
}
function frame2(){
stop();
}
}
}//package Defender_fla
Section 57
//SND_LOADER_278 (Defender_fla.SND_LOADER_278)
package Defender_fla {
import flash.display.*;
public dynamic class SND_LOADER_278 extends MovieClip {
public function SND_LOADER_278(){
super();
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package Defender_fla
Section 58
//sound_btn_27 (Defender_fla.sound_btn_27)
package Defender_fla {
import flash.display.*;
public dynamic class sound_btn_27 extends MovieClip {
public function sound_btn_27(){
super();
addFrameScript(0, frame1, 1, frame2);
}
function frame1(){
stop();
}
function frame2(){
stop();
}
}
}//package Defender_fla
Section 59
//special_mc_32 (Defender_fla.special_mc_32)
package Defender_fla {
import flash.display.*;
public dynamic class special_mc_32 extends MovieClip {
public function special_mc_32(){
super();
addFrameScript(0, frame1, 1, frame2);
}
function frame1(){
stop();
}
function frame2(){
stop();
}
}
}//package Defender_fla
Section 60
//CreatureRace (DefX.Army.CreatureRace)
package DefX.Army {
import flash.events.*;
import flash.display.*;
import DefX.Effect.*;
import FZBase.Vector.*;
public class CreatureRace extends MovieClip {
const ST_MOVING = 1;
const ST_FLYING = 4;
const ST_DEAD = 5;
const ST_HIT = 3;
const ST_ATTACK = 2;
const ST_IDLE = 0;
private var isPaused:Boolean;// = false
public var statDef;
private var mState:int;// = 0
private var dispCont;
public var hitBox:MovieClip;
public var attackBox:MovieClip;
private var vecPos;
private var mGUI;
private var defSys;
private var mBase;
private var mOver:Boolean;// = false
private var enableFly:Boolean;// = false
public function CreatureRace(){
enableFly = false;
mOver = false;
mState = 0;
isPaused = false;
super();
}
public function destroy(){
var exp_mult:Number;
var mana_mult:Number;
if (((statDef.isEnemy()) && ((mBase.battle_state == 0)))){
exp_mult = 1;
if (defSys.dat.moneyGainLv == 2){
exp_mult = 1.2;
};
if (defSys.dat.moneyGainLv == 3){
exp_mult = 1.4;
};
if (defSys.dat.moneyGainLv == 4){
exp_mult = 1.7;
};
if (defSys.dat.moneyGainLv == 5){
exp_mult = 2;
};
mana_mult = 1;
if (defSys.dat.manaGainLv == 2){
mana_mult = 1.2;
};
if (defSys.dat.manaGainLv == 3){
mana_mult = 1.4;
};
if (defSys.dat.manaGainLv == 4){
mana_mult = 1.7;
};
if (defSys.dat.manaGainLv == 5){
mana_mult = 2;
};
defSys.tmpExp = Math.min((defSys.tmpExp + (statDef.exp_gain * exp_mult)), 9999999);
defSys.tmpScore = Math.min((defSys.tmpScore + ((statDef.exp_gain * exp_mult) * 1.2)), 9999999);
mBase.mana = Math.min((mBase.mana + (statDef.mana_gain * mana_mult)), mBase.max_mana);
};
if (((statDef.isBoss()) && ((mBase.battle_state == 0)))){
mBase.battle_state = 1;
mBase.mArmy.forceEnemyArmyDead();
};
this.removeEventListener(Event.ENTER_FRAME, objectHandle);
dispCont.removeChild(this);
dispCont = null;
statDef = null;
defSys = null;
mBase = null;
}
public function isEnableHit():Boolean{
if (this.currentLabel == "dead"){
return (false);
};
return (true);
}
private function playWalk(){
if (statDef.isEnemy()){
if (statDef.type == statDef._GOBLIN){
if ((((this.currentFrame >= 10)) && ((this.currentFrame < 20)))){
vecPos.setMoving(-(statDef.speed));
};
} else {
vecPos.setMoving(-(statDef.speed));
};
} else {
vecPos.setMoving(statDef.speed);
};
this.x = vecPos._X;
this.y = vecPos._Y;
this.rotation = vecPos._ANGLE;
getAction();
}
private function getAction(){
var container:*;
var numChild:int;
var children:Array;
var i:int;
container = defSys.contArmy;
numChild = container.numChildren;
children = new Array(numChild);
i = 0;
i = 0;
while (i < numChild) {
children[i] = container.getChildAt(i);
i++;
};
i = 0;
for (;i < numChild;i++) {
if ((((children[i].currentLabel == "dead")) || ((statDef.health <= 0)))){
} else {
if (this == children[i]){
} else {
if (statDef.isAlly()){
if (children[i].statDef.isAlly()){
continue;
};
if (this.attackBox.hitTestObject(children[i].hitBox)){
gotoAndPlay("attack");
mState = ST_ATTACK;
return;
};
};
if (statDef.isEnemy()){
if (children[i].statDef.isEnemy()){
} else {
if (this.attackBox.hitTestObject(children[i].hitBox)){
gotoAndPlay("attack");
mState = ST_ATTACK;
return;
};
};
};
};
};
};
if (statDef.isAlly()){
if (((mBase.objDCastleMC) && ((mBase.dark_castle_health > 0)))){
if (this.attackBox.hitTestObject(mBase.objDCastleMC.hitBox)){
gotoAndPlay("attack");
mState = ST_ATTACK;
return;
};
};
};
if (statDef.isEnemy()){
if (((mBase.objLCastleMC) && ((mBase.light_castle_health > 0)))){
if (this.attackBox.hitTestObject(mBase.objLCastleMC.hitBox)){
gotoAndPlay("attack");
mState = ST_ATTACK;
return;
};
};
};
if (this.currentLabel != "walk"){
gotoAndPlay("walk");
};
mState = ST_MOVING;
}
public function forceDeath(){
statDef.health = 0;
mState = ST_DEAD;
}
private function objectHandle(event:Event):void{
var min_x:int;
var max_x:int;
var min_y:int;
var max_y:int;
if (defSys.isPaused != isPaused){
if (defSys.isPaused == true){
isPaused = true;
this.stop();
} else {
isPaused = false;
if (this.currentLabel != "fly"){
this.play();
};
};
};
if (isPaused){
this.stop();
return;
};
if (((statDef.isEnemy()) && ((this.x < defSys.leftBorder)))){
destroy();
return;
};
if (((statDef.isAlly()) && ((this.x > defSys.rightBorder)))){
destroy();
return;
};
if (mState != ST_DEAD){
min_x = -(this.hitBox.width);
max_x = this.hitBox.width;
min_y = -(this.height);
max_y = 0;
if ((((((this.mouseX > min_x)) && ((this.mouseX < max_x)))) && ((((this.mouseY > min_y)) && ((this.mouseY < max_y)))))){
if (mOver == false){
mGUI.objPOP.showPopUp(this, 99);
};
mOver = true;
} else {
if (mOver == true){
mGUI.objPOP.inactive();
};
mOver = false;
};
};
if (mState == ST_MOVING){
playWalk();
} else {
if (mState == ST_ATTACK){
playAttack();
} else {
if (mState == ST_FLYING){
playFly();
} else {
if (mState == ST_HIT){
playHit();
} else {
if (mState == ST_DEAD){
playDead();
};
};
};
};
};
}
private function playFly(){
var bloodSplat:*;
var bloodShoot:*;
var effect:*;
vecPos.setMoveFly();
this.x = vecPos._X;
this.y = vecPos._Y;
this.rotation = vecPos._ANGLE;
if (vecPos.isFlying() == false){
bloodSplat = new blood_splat1();
bloodSplat.init(defSys.contBloodSplat, this.x, this.y);
bloodShoot = new ParticleBurst(defSys.contBlood, this.x, this.y, this.rotation, 6, 15, defSys.landBorder);
bloodShoot.BloodShootEffect();
if (statDef.health <= 0){
mState = ST_DEAD;
} else {
getAction();
};
};
if (Math.random() < 0.5){
effect = new ParticleBurst(defSys.contBlood, this.x, this.y, this.rotation, 1, 20, defSys.landBorder);
effect.BloodTrailEffect();
};
}
public function initialise(_defSys, _mBase, _mGUI, _statDef, _enableFly:Boolean=false){
enableFly = _enableFly;
defSys = _defSys;
mBase = _mBase;
mGUI = _mGUI;
statDef = _statDef;
dispCont = defSys.contArmy;
dispCont.addChild(this);
if (statDef.isEnemy()){
vecPos = new Vector2dArmy(defSys.rightBorder, defSys.landBorder);
} else {
vecPos = new Vector2dArmy(defSys.leftBorder, defSys.landBorder);
};
this.x = vecPos._X;
this.y = vecPos._Y;
getAction();
this.addEventListener(Event.ENTER_FRAME, objectHandle, false, 0, true);
}
public function setBloodHit(_X, _Y, _RT){
var effect:*;
effect = new ParticleBurst(defSys.contBlood, _X, _Y, _RT, 6, 15, defSys.landBorder);
effect.BloodShootEffect();
}
private function playAttack(){
var sndHit:*;
var container:*;
var numChild:int;
var children:Array;
var i:int;
if ((((((((((((((((((((((((((((((((statDef.type == statDef._HOBBIT)) && ((this.currentFrame == 41)))) || ((((statDef.type == statDef._ELF)) && ((this.currentFrame == 52)))))) || ((((statDef.type == statDef._DWARF)) && ((this.currentFrame == 47)))))) || ((((statDef.type == statDef._WIZARD)) && ((((((((this.currentFrame == 59)) || ((this.currentFrame == 64)))) || ((this.currentFrame == 69)))) || ((this.currentFrame == 70)))))))) || ((((statDef.type == statDef._GOLEM)) && ((this.currentFrame == 64)))))) || ((((statDef.type == statDef._DRAGON)) && ((this.currentFrame == 42)))))) || ((((statDef.type == statDef._ANGEL)) && ((((((((this.currentFrame == 36)) || ((this.currentFrame == 42)))) || ((this.currentFrame == 44)))) || ((this.currentFrame == 46)))))))) || ((((statDef.type == statDef._GOBLIN)) && ((this.currentFrame == 41)))))) || ((((statDef.type == statDef._ORC)) && ((this.currentFrame == 46)))))) || ((((statDef.type == statDef._OGRE)) && ((this.currentFrame == 41)))))) || ((((statDef.type == statDef._TROLL)) && ((this.currentFrame == 46)))))) || ((((statDef.type == statDef._CENTAUR)) && ((this.currentFrame == 41)))))) || ((((statDef.type == statDef._BAHAMUT)) && ((this.currentFrame == 50)))))) || ((((statDef.type == statDef._DEVIL)) && ((((((((this.currentFrame == 76)) || ((this.currentFrame == 80)))) || ((this.currentFrame == 82)))) || ((this.currentFrame == 85)))))))) || ((((statDef.type == statDef._BOSS)) && ((this.currentFrame == 77)))))){
container = defSys.contArmy;
numChild = container.numChildren;
children = new Array(numChild);
i = 0;
i = 0;
while (i < numChild) {
children[i] = container.getChildAt(i);
i++;
};
i = 0;
for (;i < numChild;i++) {
if ((((children[i].currentLabel == "dead")) || ((statDef.health <= 0)))){
} else {
if (this == children[i]){
} else {
if (statDef.isAlly()){
if (children[i].statDef.isAlly()){
continue;
};
if (this.attackBox.hitTestObject(children[i].hitBox)){
if (statDef.type == statDef._HOBBIT){
children[i].setBloodHit((this.x + 30), (this.y - 20), this.rotation);
if ((((Math.random() < 0.5)) && ((children[i].statDef.type == children[i].statDef._GOBLIN)))){
children[i].setHit(1, statDef.power);
} else {
children[i].setHit(0, statDef.power);
};
sndHit = new knife_attack();
sndHit.playSound();
};
if (statDef.type == statDef._ELF){
children[i].setBloodHit((this.x + 35), (this.y - 25), this.rotation);
if ((((Math.random() < 0.5)) && ((children[i].statDef.type == children[i].statDef._ORC)))){
children[i].setHit(1, statDef.power);
} else {
if (children[i].statDef.type < children[i].statDef._ORC){
children[i].setHit(1, statDef.power);
} else {
children[i].setHit(0, statDef.power);
};
};
sndHit = new sword_slash();
sndHit.playSound();
};
if (statDef.type == statDef._DWARF){
children[i].setBloodHit((this.x + 35), (this.y - 25), this.rotation);
if ((((Math.random() < 0.5)) && ((children[i].statDef.type == children[i].statDef._OGRE)))){
children[i].setHit(1, statDef.power);
} else {
if (children[i].statDef.type < children[i].statDef._OGRE){
if (Math.random() < 0.5){
children[i].setHit(2, statDef.power);
} else {
children[i].setHit(1, statDef.power);
};
} else {
children[i].setHit(0, statDef.power);
};
};
};
if (statDef.type == statDef._WIZARD){
children[i].setBloodHit((children[i].x + 10), (this.y - 15), this.rotation);
if ((((Math.random() < 0.5)) && ((children[i].statDef.type == children[i].statDef._TROLL)))){
children[i].setHit(1, statDef.power);
} else {
if (children[i].statDef.type < children[i].statDef._TROLL){
children[i].setHit(1, statDef.power);
} else {
children[i].setHit(0, statDef.power);
};
};
};
if (statDef.type == statDef._GOLEM){
children[i].setBloodHit((this.x + 35), (this.y - 25), this.rotation);
if ((((Math.random() < 0.5)) && ((children[i].statDef.type == children[i].statDef._CENTAUR)))){
children[i].setHit(1, statDef.power);
} else {
if (children[i].statDef.type < children[i].statDef._CENTAUR){
children[i].setHit(1, statDef.power);
} else {
children[i].setHit(0, statDef.power);
};
};
};
if (statDef.type == statDef._DRAGON){
children[i].setBloodHit((children[i].x + 10), (this.y - 25), this.rotation);
if (children[i].statDef.type < children[i].statDef._BAHAMUT){
if (Math.random() < 0.5){
children[i].setHit(1, statDef.power);
} else {
children[i].setHit(3, statDef.power);
};
} else {
children[i].setHit(0, statDef.power);
};
};
if (statDef.type == statDef._ANGEL){
children[i].setBloodHit((children[i].x + 10), (this.y - 25), this.rotation);
if (children[i].statDef.type < children[i].statDef._BAHAMUT){
if (children[i].statDef.type < children[i].statDef._CENTAUR){
children[i].setHit(4, statDef.power, 2, -10, -5);
} else {
children[i].setHit(1, statDef.power, 2, -10, -5);
};
} else {
children[i].setHit(0, statDef.power);
};
if (this.currentFrame == 36){
sndHit = new hard_hit();
} else {
sndHit = new sword_slash();
};
sndHit.playSound();
};
};
};
if (statDef.isEnemy()){
if (children[i].statDef.isEnemy()){
} else {
if (this.attackBox.hitTestObject(children[i].hitBox)){
if (statDef.type == statDef._GOBLIN){
children[i].setBloodHit((this.x - 30), (this.y - 20), 90);
if ((((Math.random() < 0.5)) && ((children[i].statDef.type == children[i].statDef._HOBBIT)))){
children[i].setHit(1, statDef.power);
} else {
children[i].setHit(0, statDef.power);
};
sndHit = new knife_attack();
sndHit.playSound();
};
if (statDef.type == statDef._ORC){
children[i].setBloodHit((this.x - 36), (this.y - 20), 90);
if ((((Math.random() < 0.5)) && ((children[i].statDef.type == children[i].statDef._ELF)))){
children[i].setHit(1, statDef.power);
} else {
if (children[i].statDef.type < children[i].statDef._ELF){
children[i].setHit(1, statDef.power);
} else {
children[i].setHit(0, statDef.power);
};
};
};
if (statDef.type == statDef._OGRE){
children[i].setBloodHit((this.x - 40), (this.y - 20), 90);
if ((((Math.random() < 0.5)) && ((children[i].statDef.type == children[i].statDef._DWARF)))){
children[i].setHit(1, statDef.power);
} else {
if (children[i].statDef.type < children[i].statDef._DWARF){
children[i].setHit(1, statDef.power);
} else {
children[i].setHit(0, statDef.power);
};
};
};
if (statDef.type == statDef._TROLL){
children[i].setBloodHit((this.x - 40), (this.y - 25), 90);
if ((((Math.random() < 0.5)) && ((children[i].statDef.type == children[i].statDef._WIZARD)))){
children[i].setHit(1, statDef.power);
} else {
if (children[i].statDef.type < children[i].statDef._WIZARD){
children[i].setHit(1, statDef.power);
} else {
children[i].setHit(0, statDef.power);
};
};
};
if (statDef.type == statDef._CENTAUR){
children[i].setBloodHit((this.x - 45), (this.y - 25), 90);
if ((((Math.random() < 0.5)) && ((children[i].statDef.type == children[i].statDef._GOLEM)))){
children[i].setHit(1, statDef.power);
} else {
if (children[i].statDef.type < children[i].statDef._GOLEM){
if (Math.random() < 0.5){
children[i].setHit(1, statDef.power);
} else {
children[i].setHit(2, statDef.power);
};
} else {
children[i].setHit(0, statDef.power);
};
};
};
if (statDef.type == statDef._BAHAMUT){
children[i].setBloodHit((children[i].x - 10), (this.y - 25), 90);
if (children[i].statDef.type < children[i].statDef._DRAGON){
children[i].setHit(1, statDef.power);
} else {
children[i].setHit(0, statDef.power);
};
};
if (statDef.type == statDef._DEVIL){
children[i].setBloodHit((children[i].x - 10), (this.y - 25), 90);
if (children[i].statDef.type < children[i].statDef._DRAGON){
if (children[i].statDef.type < children[i].statDef._GOLEM){
children[i].setHit(4, statDef.power, -2, -10, 5);
} else {
children[i].setHit(1, statDef.power);
};
} else {
children[i].setHit(0, statDef.power);
};
if (this.currentFrame == 76){
sndHit = new hard_hit();
} else {
sndHit = new sword_slash();
};
sndHit.playSound();
};
if (statDef.type == statDef._BOSS){
children[i].setBloodHit((children[i].x - 10), (this.y - 25), 90);
if (children[i].statDef.type < children[i].statDef._DRAGON){
if (children[i].statDef.type < children[i].statDef._GOLEM){
children[i].setHit(4, statDef.power, -2, -15, 5);
} else {
children[i].setHit(1, statDef.power);
};
} else {
children[i].setHit(0, statDef.power);
};
};
};
};
};
};
};
};
if (statDef.isAlly()){
if (((mBase.objDCastleMC) && ((mBase.dark_castle_health > 0)))){
if (this.attackBox.hitTestObject(mBase.objDCastleMC.hitBox)){
mBase.damageEnemyCastle(statDef.power);
sndHit = new building_smash();
sndHit.playSound();
};
};
};
if (statDef.isEnemy()){
if (((mBase.objLCastleMC) && ((mBase.light_castle_health > 0)))){
if (this.attackBox.hitTestObject(mBase.objLCastleMC.hitBox)){
mBase.damagePlayerCastle(statDef.power);
sndHit = new building_smash();
sndHit.playSound();
};
};
};
};
if (this.currentLabel != "attack"){
getAction();
};
}
private function playHit(){
if (this.currentLabel == "walk"){
getAction();
};
}
private function playDead(){
var bloodSplat:*;
var effect:*;
if (this.currentLabel != "dead"){
gotoAndPlay("dead");
};
if ((((((((((((statDef.type == statDef._GOBLIN)) && ((this.currentFrame == 138)))) || ((((statDef.type == statDef._ORC)) && ((this.currentFrame == 151)))))) || ((((statDef.type == statDef._OGRE)) && ((this.currentFrame == 137)))))) || ((((statDef.type == statDef._TROLL)) && ((this.currentFrame == 136)))))) || ((((statDef.type == statDef._ELF)) && ((this.currentFrame == 155)))))){
bloodSplat = new blood_splat1();
bloodSplat.init(defSys.contBloodSplat, this.x, this.y);
};
if ((((statDef.type == statDef._CENTAUR)) && ((this.currentFrame == 116)))){
bloodSplat = new blood_splat2();
bloodSplat.init(defSys.contBloodSplat, this.x, this.y);
};
if ((((((statDef.type == statDef._HOBBIT)) && ((this.currentFrame == 133)))) || ((((statDef.type == statDef._DWARF)) && ((this.currentFrame == 136)))))){
bloodSplat = new blood_splat1();
bloodSplat.init(defSys.contBloodSplat, (this.x - 30), this.y);
};
if ((((statDef.type == statDef._OGRE)) && ((this.currentFrame == 146)))){
effect = new ParticleBurst(defSys.contBlood, (this.x + 20), (this.y - 20), 0, 20, 200, defSys.landBorder);
effect.BloodBurstEffect();
};
if (this.currentFrame == this.totalFrames){
destroy();
};
}
public function setHit(type:int=0, dmg:int=0, VX:Number=0, VY:Number=0, VR:Number=0){
var effect:*;
if (this.currentLabel == "dead"){
return;
};
statDef.health = Math.max((statDef.health - dmg), 0);
if (type == 0){
if (statDef.health <= 0){
this.gotoAndPlay("dead");
mState = ST_DEAD;
};
return;
};
if (mState == ST_FLYING){
this.gotoAndStop("fly");
vecPos.comboFlying(1, -1);
mState = ST_FLYING;
if (statDef.health <= 0){
effect = new ParticleBurst(defSys.contBlood, this.x, this.y, 0, 20, 200, defSys.landBorder);
effect.BloodBurstEffect();
destroy();
};
} else {
if ((((type == 4)) && (enableFly))){
this.gotoAndStop("fly");
if (statDef.type == statDef._ORC){
vecPos.setFlying(VX, (VY * 0.9), VR, defSys.landBorder);
} else {
if (statDef.type == statDef._OGRE){
vecPos.setFlying(VX, (VY * 0.8), (VR * 0.8), defSys.landBorder);
} else {
if (statDef.type == statDef._TROLL){
vecPos.setFlying((VX * 0.8), (VY * 0.7), (VR * 0.7), defSys.landBorder);
} else {
if (statDef.type == statDef._ELF){
vecPos.setFlying(VX, (VY * 0.9), VR, defSys.landBorder);
} else {
if (statDef.type == statDef._DWARF){
vecPos.setFlying((VX * 0.8), (VY * 0.7), (VR * 0.7), defSys.landBorder);
} else {
if (statDef.type == statDef._WIZARD){
vecPos.setFlying((VX * 0.9), (VY * 0.9), (VR * 0.9), defSys.landBorder);
} else {
vecPos.setFlying(VX, VY, VR, defSys.landBorder);
};
};
};
};
};
};
mState = ST_FLYING;
} else {
if (statDef.health > 0){
if (statDef.isBoss() == false){
if (type == 1){
this.gotoAndPlay("hit_1");
};
if (type == 2){
this.gotoAndPlay("hit_2");
};
if (type == 3){
this.gotoAndPlay("hit_3");
};
mState = ST_HIT;
};
} else {
this.gotoAndPlay("dead");
mState = ST_DEAD;
};
};
};
}
public function isEnableHitPierce():Boolean{
if ((((((((this.currentLabel == "dead")) || ((this.currentLabel == "hit_1")))) || ((this.currentLabel == "hit_2")))) || ((this.currentLabel == "hit_3")))){
return (false);
};
return (true);
}
}
}//package DefX.Army
Section 61
//CreatureStatDef (DefX.Army.CreatureStatDef)
package DefX.Army {
public class CreatureStatDef {
const _ORC = 2;
const _WIZARD = 23;
const _GOLEM = 24;
const _HOBBIT = 20;
const _CENTAUR = 5;
const _DRAGON = 25;
const _ELF = 21;
const _DWARF = 22;
const _BOSS = 8;
const _TROLL = 4;
const _DEVIL = 7;
const _ANGEL = 26;
const _OGRE = 3;
const _BAHAMUT = 6;
const _GOBLIN = 1;
public var power:int;// = 0
public var max_health:int;// = 1
public var vecPos;
public var type:int;// = 0
public var mana_cost:int;// = 0
public var speed:Number;// = 0
public var health:int;// = 0
public var exp_gain:int;// = 0
public var fire_resistance:int;// = 0
public var ice_resistance:int;// = 0
public var mana_gain:int;// = 0
public var thunder_resistance:int;// = 0
public function CreatureStatDef(_type, _upgrade:int=0){
var mult:Number;
type = 0;
max_health = 1;
health = 0;
power = 0;
speed = 0;
fire_resistance = 0;
ice_resistance = 0;
thunder_resistance = 0;
mana_cost = 0;
mana_gain = 0;
exp_gain = 0;
super();
mult = 1;
if (_upgrade == 1){
mult = 1;
} else {
if (_upgrade == 2){
mult = 1.2;
} else {
if (_upgrade == 3){
mult = 1.4;
} else {
if (_upgrade == 4){
mult = 1.7;
} else {
if (_upgrade == 5){
mult = 2;
};
};
};
};
};
type = _type;
switch (type){
case _GOBLIN:
max_health = (health = (50 * mult));
power = (10 * mult);
speed = (2 + Math.random());
fire_resistance = 0;
ice_resistance = 0;
thunder_resistance = 0;
mana_cost = 0;
mana_gain = 2;
exp_gain = (30 * mult);
break;
case _ORC:
max_health = (health = (70 * mult));
power = (15 * mult);
speed = (0.7 + (Math.random() * 0.5));
fire_resistance = 0;
ice_resistance = 0;
thunder_resistance = 0;
mana_cost = 0;
mana_gain = 5;
exp_gain = (50 * mult);
break;
case _OGRE:
max_health = (health = (120 * mult));
power = (20 * mult);
speed = (0.6 + (Math.random() * 0.5));
fire_resistance = 0;
ice_resistance = 0;
thunder_resistance = 0;
mana_cost = 0;
mana_gain = 10;
exp_gain = (75 * mult);
break;
case _TROLL:
max_health = (health = (300 * mult));
power = (35 * mult);
speed = (0.5 + (Math.random() * 0.5));
fire_resistance = 0;
ice_resistance = 10;
thunder_resistance = 0;
mana_cost = 0;
mana_gain = 20;
exp_gain = (120 * mult);
break;
case _CENTAUR:
max_health = (health = (600 * mult));
power = (50 * mult);
speed = (0.6 + (Math.random() * 0.5));
fire_resistance = 0;
ice_resistance = 0;
thunder_resistance = 20;
mana_cost = 0;
mana_gain = 40;
exp_gain = (150 * mult);
break;
case _BAHAMUT:
max_health = (health = (1500 * mult));
power = (80 * mult);
speed = (0.5 + (Math.random() * 0.4));
fire_resistance = 50;
ice_resistance = 0;
thunder_resistance = 0;
mana_cost = 0;
mana_gain = 150;
exp_gain = (500 * mult);
break;
case _DEVIL:
max_health = (health = (2600 * mult));
power = (30 * mult);
speed = (0.5 + (Math.random() * 0.3));
fire_resistance = 50;
ice_resistance = 20;
thunder_resistance = 20;
mana_cost = 0;
mana_gain = 500;
exp_gain = (1000 * mult);
break;
case _BOSS:
max_health = (health = 250000);
power = 666;
speed = 0.35;
fire_resistance = 50;
ice_resistance = 50;
thunder_resistance = 50;
mana_cost = 0;
mana_gain = 10000;
exp_gain = 10000;
break;
case _HOBBIT:
max_health = (health = (60 * mult));
power = (10 * mult);
speed = (1.7 + Math.random());
fire_resistance = 0;
ice_resistance = 0;
thunder_resistance = 0;
mana_cost = 5;
mana_gain = 15;
exp_gain = (25 * mult);
break;
case _ELF:
max_health = (health = (75 * mult));
power = (20 * mult);
speed = (1.5 + (Math.random() * 0.5));
fire_resistance = 0;
ice_resistance = 0;
thunder_resistance = 0;
mana_cost = 10;
mana_gain = 25;
exp_gain = (40 * mult);
break;
case _DWARF:
max_health = (health = (150 * mult));
power = (25 * mult);
speed = (0.7 + (Math.random() * 0.5));
fire_resistance = 0;
ice_resistance = 0;
thunder_resistance = 0;
mana_cost = 20;
mana_gain = 30;
exp_gain = (60 * mult);
break;
case _WIZARD:
max_health = (health = (200 * mult));
power = (6 * mult);
speed = (0.5 + (Math.random() * 0.5));
fire_resistance = 0;
ice_resistance = 10;
thunder_resistance = 0;
mana_cost = 50;
mana_gain = 80;
exp_gain = (100 * mult);
break;
case _GOLEM:
max_health = (health = (700 * mult));
power = (70 * mult);
speed = (0.5 + (Math.random() * 0.5));
fire_resistance = 70;
ice_resistance = 0;
thunder_resistance = 0;
mana_cost = 300;
mana_gain = 150;
exp_gain = (150 * mult);
break;
case _DRAGON:
max_health = (health = (1300 * mult));
power = (120 * mult);
speed = (0.5 + (Math.random() * 0.4));
fire_resistance = 0;
ice_resistance = 50;
thunder_resistance = 0;
mana_cost = 2500;
mana_gain = 350;
exp_gain = (500 * mult);
break;
case _ANGEL:
max_health = (health = (2100 * mult));
power = (50 * mult);
speed = (0.4 + (Math.random() * 0.3));
fire_resistance = 50;
ice_resistance = 50;
thunder_resistance = 50;
mana_cost = 4000;
mana_gain = 500;
exp_gain = (1000 * mult);
break;
default:
break;
};
}
public function isWeakCreature():Boolean{
if ((((((((((((((((((((type == _GOBLIN)) || ((type == _ORC)))) || ((type == _OGRE)))) || ((type == _TROLL)))) || ((type == _CENTAUR)))) || ((type == _HOBBIT)))) || ((type == _ELF)))) || ((type == _DWARF)))) || ((type == _WIZARD)))) || ((type == _GOLEM)))){
return (true);
};
return (false);
}
public function isBoss():Boolean{
if (type == _BOSS){
return (true);
};
return (false);
}
public function isAlly():Boolean{
if ((((((((((((((type == _HOBBIT)) || ((type == _ELF)))) || ((type == _DWARF)))) || ((type == _WIZARD)))) || ((type == _GOLEM)))) || ((type == _DRAGON)))) || ((type == _ANGEL)))){
return (true);
};
return (false);
}
public function isEnemy():Boolean{
if ((((((((((((((((type == _GOBLIN)) || ((type == _ORC)))) || ((type == _OGRE)))) || ((type == _TROLL)))) || ((type == _CENTAUR)))) || ((type == _BAHAMUT)))) || ((type == _DEVIL)))) || ((type == _BOSS)))){
return (true);
};
return (false);
}
}
}//package DefX.Army
Section 62
//SpawnArmy (DefX.Army.SpawnArmy)
package DefX.Army {
public class SpawnArmy {
private var dwarfLv:int;// = 1
private var ogreFrameTime:int;// = 0
private var hobbitLv:int;// = 1
private var orcFrameTimeSet:int;// = 2400
private var devilTotal:int;// = 0
private var centaurLv:int;// = 1
private var devilFrameTimeSet:int;// = 2400
private var orcTotal:int;// = 0
private var wizardLv:int;// = 1
private var bahamutTotal:int;// = 0
private var trollLv:int;// = 1
private var centaurFrameTimeSet:int;// = 2400
private var centaurFrameTime:int;// = 0
private var angelLv:int;// = 1
private var defSys;
private var elfLv:int;// = 1
private var orcLv:int;// = 1
private var mGUI;
private var goblinFrameTimeSet:int;// = 2400
private var devilLv:int;// = 1
private var bahamutFrameTimeSet:int;// = 2400
private var goblinTotal:int;// = 0
private var trollFrameTimeSet:int;// = 2400
private var goblinLv:int;// = 1
private var devilFrameTime:int;// = 0
private var goblinFrameTime:int;// = 0
private var centaurTotal:int;// = 0
private var ogreFrameTimeSet:int;// = 2400
private var golemLv:int;// = 1
private var orcFrameTime:int;// = 0
private var mBase;
private var trollTotal:int;// = 0
private var bahamutFrameTime:int;// = 0
private var trollFrameTime:int;// = 0
private var ogreLv:int;// = 1
private var ogreTotal:int;// = 0
private var dragonLv:int;// = 1
private var bahamutLv:int;// = 1
public function SpawnArmy(_DefSys, _mBase, _mGUI){
goblinLv = 1;
orcLv = 1;
ogreLv = 1;
trollLv = 1;
centaurLv = 1;
bahamutLv = 1;
devilLv = 1;
hobbitLv = 1;
elfLv = 1;
dwarfLv = 1;
wizardLv = 1;
golemLv = 1;
dragonLv = 1;
angelLv = 1;
goblinTotal = 0;
goblinFrameTime = 0;
goblinFrameTimeSet = 2400;
orcTotal = 0;
orcFrameTime = 0;
orcFrameTimeSet = 2400;
ogreTotal = 0;
ogreFrameTime = 0;
ogreFrameTimeSet = 2400;
trollTotal = 0;
trollFrameTime = 0;
trollFrameTimeSet = 2400;
centaurTotal = 0;
centaurFrameTime = 0;
centaurFrameTimeSet = 2400;
bahamutTotal = 0;
bahamutFrameTime = 0;
bahamutFrameTimeSet = 2400;
devilTotal = 0;
devilFrameTime = 0;
devilFrameTimeSet = 2400;
super();
defSys = _DefSys;
mBase = _mBase;
mGUI = _mGUI;
}
public function createElf(lv:int=1){
var objMC:*;
objMC = new elf_mc();
objMC.initialise(defSys, mBase, mGUI, new CreatureStatDef(21, lv), true);
}
public function createHobbit(lv:int=1){
var objMC:*;
objMC = new hobbit_mc();
objMC.initialise(defSys, mBase, mGUI, new CreatureStatDef(20, lv), true);
}
public function setupBahamut(spawnDelay:int=1000, total:int=100, lv:int=1){
bahamutFrameTime = (bahamutFrameTimeSet = (spawnDelay * 0.024));
bahamutTotal = total;
bahamutLv = lv;
trace((((((("init bahamut [delay:" + String(spawnDelay)) + "] [total:") + String(total)) + "] [lv:") + String(lv)) + "] "));
}
public function setupOrc(spawnDelay:int=1000, total:int=100, lv:int=1){
orcFrameTime = (orcFrameTimeSet = (spawnDelay * 0.024));
orcTotal = total;
orcLv = lv;
trace((((((("init orc [delay:" + String(spawnDelay)) + "] [total:") + String(total)) + "] [lv:") + String(lv)) + "] "));
}
public function setupOgre(spawnDelay:int=1000, total:int=100, lv:int=1){
ogreFrameTime = (ogreFrameTimeSet = (spawnDelay * 0.024));
ogreTotal = total;
ogreLv = lv;
trace((((((("init ogre [delay:" + String(spawnDelay)) + "] [total:") + String(total)) + "] [lv:") + String(lv)) + "] "));
}
public function updateSpawn(){
var goblin:*;
var orc:*;
var ogre:*;
var troll:*;
var centaur:*;
var bahamut:*;
var devil:*;
if (defSys.isPaused){
return;
};
if (goblinTotal > 0){
if (goblinFrameTime <= 0){
goblin = new goblin_mc();
goblin.initialise(defSys, mBase, mGUI, new CreatureStatDef(1, goblinLv), true);
goblinTotal = Math.max((goblinTotal - 1), 0);
goblinFrameTime = goblinFrameTimeSet;
};
goblinFrameTime = Math.max((goblinFrameTime - 1), 0);
};
if (orcTotal > 0){
if (orcFrameTime <= 0){
orc = new orc_mc();
orc.initialise(defSys, mBase, mGUI, new CreatureStatDef(2, orcLv), true);
orcTotal = Math.max((orcTotal - 1), 0);
orcFrameTime = orcFrameTimeSet;
};
orcFrameTime = Math.max((orcFrameTime - 1), 0);
};
if (ogreTotal > 0){
if (ogreFrameTime <= 0){
ogre = new ogre_mc();
ogre.initialise(defSys, mBase, mGUI, new CreatureStatDef(3, ogreLv), true);
ogreTotal = Math.max((ogreTotal - 1), 0);
ogreFrameTime = ogreFrameTimeSet;
};
ogreFrameTime = Math.max((ogreFrameTime - 1), 0);
};
if (trollTotal > 0){
if (trollFrameTime <= 0){
troll = new troll_mc();
troll.initialise(defSys, mBase, mGUI, new CreatureStatDef(4, trollLv), true);
trollTotal = Math.max((trollTotal - 1), 0);
trollFrameTime = trollFrameTimeSet;
};
trollFrameTime = Math.max((trollFrameTime - 1), 0);
};
if (centaurTotal > 0){
if (centaurFrameTime <= 0){
centaur = new centaur_mc();
centaur.initialise(defSys, mBase, mGUI, new CreatureStatDef(5, centaurLv), false);
centaurTotal = Math.max((centaurTotal - 1), 0);
centaurFrameTime = centaurFrameTimeSet;
};
centaurFrameTime = Math.max((centaurFrameTime - 1), 0);
};
if (bahamutTotal > 0){
if (bahamutFrameTime <= 0){
bahamut = new bahamut_mc();
bahamut.initialise(defSys, mBase, mGUI, new CreatureStatDef(6, bahamutLv), false);
bahamutTotal = Math.max((bahamutTotal - 1), 0);
bahamutFrameTime = bahamutFrameTimeSet;
};
bahamutFrameTime = Math.max((bahamutFrameTime - 1), 0);
};
if (devilTotal > 0){
if (devilFrameTime <= 0){
devil = new devil_mc();
devil.initialise(defSys, mBase, mGUI, new CreatureStatDef(7, devilLv), false);
devilTotal = Math.max((devilTotal - 1), 0);
devilFrameTime = devilFrameTimeSet;
};
devilFrameTime = Math.max((devilFrameTime - 1), 0);
};
}
public function createDragon(lv:int=1){
var objMC:*;
objMC = new dragon_mc();
objMC.initialise(defSys, mBase, mGUI, new CreatureStatDef(25, lv), false);
}
public function InitStage1(){
setupGoblin(5000, 60, 1);
setupOrc(50000, 5, 1);
}
public function InitStage3(){
setupGoblin(5000, 200, 2);
setupOrc(30000, 50, 1);
setupOgre(70000, 6, 1);
setupTroll(250000, 1, 1);
}
public function createDwarf(lv:int=1){
var objMC:*;
objMC = new dwarf_mc();
objMC.initialise(defSys, mBase, mGUI, new CreatureStatDef(22, lv), true);
}
public function InitStage6(){
setupGoblin(3000, 600, 3);
setupOrc(10000, 300, 3);
setupOgre(15000, 50, 2);
setupTroll(60000, 10, 1);
setupCentaur(150000, 5, 1);
setupBahamut(400000, 1, 1);
}
public function InitStage7(){
setupGoblin(2000, 700, 4);
setupOrc(6000, 300, 4);
setupOgre(10000, 100, 3);
setupTroll(30000, 30, 2);
setupCentaur(100000, 20, 1);
setupBahamut(350000, 3, 1);
}
public function InitStage8(){
setupGoblin(2000, 1000, 5);
setupOrc(6000, 500, 5);
setupOgre(10000, 200, 4);
setupTroll(30000, 100, 3);
setupCentaur(70000, 30, 2);
setupBahamut(300000, 5, 2);
}
public function InitStage4(){
setupGoblin(4000, 200, 2);
setupOrc(8000, 80, 2);
setupOgre(30000, 20, 1);
setupTroll(100000, 3, 1);
}
public function InitStage5(){
setupGoblin(4000, 500, 3);
setupOrc(15000, 150, 2);
setupOgre(30000, 40, 1);
setupTroll(70000, 10, 1);
}
public function InitStage12(){
setupGoblin(2000, 2000, 5);
setupOrc(5000, 2000, 5);
setupOgre(10000, 1500, 5);
setupTroll(20000, 200, 5);
setupCentaur(30000, 100, 5);
setupBahamut(80000, 50, 5);
setupDevil(100000, 20, 4);
}
public function InitStage14(){
setupGoblin(2000, 999999, 5);
setupOrc(3000, 999999, 5);
setupOgre(6000, 999999, 5);
setupTroll(25000, 999999, 5);
setupCentaur(30000, 999999, 5);
setupBahamut(50000, 999999, 5);
setupDevil(70000, 999999, 5);
}
public function InitStage9(){
setupGoblin(2000, 1200, 5);
setupOrc(6000, 600, 5);
setupOgre(10000, 400, 5);
setupTroll(30000, 150, 4);
setupCentaur(60000, 40, 3);
setupBahamut(250000, 10, 2);
setupDevil(400000, 1, 1);
}
public function InitStage2(){
setupGoblin(5000, 120, 1);
setupOrc(40000, 20, 1);
setupOgre(90000, 4, 1);
}
public function InitStage10(){
setupGoblin(2000, 2000, 5);
setupOrc(6000, 1000, 5);
setupOgre(10000, 500, 5);
setupTroll(30000, 200, 5);
setupCentaur(50000, 100, 4);
setupBahamut(200000, 10, 3);
setupDevil(300000, 5, 2);
}
public function InitStage15(){
setupGoblin(2000, 999999, 5);
setupOrc(2500, 999999, 5);
setupOgre(5000, 999999, 5);
setupTroll(20000, 999999, 5);
setupCentaur(30000, 999999, 5);
setupBahamut(40000, 999999, 5);
setupDevil(60000, 999999, 5);
}
public function InitStage11(){
setupGoblin(2000, 2000, 5);
setupOrc(6000, 1500, 5);
setupOgre(10000, 1000, 5);
setupTroll(25000, 200, 5);
setupCentaur(40000, 100, 5);
setupBahamut(90000, 30, 4);
setupDevil(120000, 10, 3);
}
public function InitStage13(){
setupGoblin(2000, 20000, 5);
setupOrc(4000, 10000, 5);
setupOgre(10000, 5000, 5);
setupTroll(18000, 3000, 5);
setupCentaur(25000, 2000, 5);
setupBahamut(70000, 300, 5);
setupDevil(90000, 100, 5);
}
public function createAngel(lv:int=1){
var objMC:*;
objMC = new angel_mc();
objMC.initialise(defSys, mBase, mGUI, new CreatureStatDef(26, lv), false);
}
public function setupTroll(spawnDelay:int=1000, total:int=100, lv:int=1){
trollFrameTime = (trollFrameTimeSet = (spawnDelay * 0.024));
trollTotal = total;
trollLv = lv;
trace((((((("init troll [delay:" + String(spawnDelay)) + "] [total:") + String(total)) + "] [lv:") + String(lv)) + "] "));
}
public function setupDevil(spawnDelay:int=1000, total:int=100, lv:int=1){
devilFrameTime = (devilFrameTimeSet = (spawnDelay * 0.024));
devilTotal = total;
devilLv = lv;
trace((((((("init devil [delay:" + String(spawnDelay)) + "] [total:") + String(total)) + "] [lv:") + String(lv)) + "] "));
}
public function createWizard(lv:int=1){
var objMC:*;
objMC = new wizard_mc();
objMC.initialise(defSys, mBase, mGUI, new CreatureStatDef(23, lv), true);
}
public function createGolem(lv:int=1){
var objMC:*;
objMC = new golem_mc();
objMC.initialise(defSys, mBase, mGUI, new CreatureStatDef(24, lv), false);
}
public function setupBoss(){
var boss:*;
boss = new boss_mc();
boss.initialise(defSys, mBase, mGUI, new CreatureStatDef(8, 1), false);
trace("init FINAL BOSS ");
}
public function stopSpawn(){
goblinTotal = 0;
orcTotal = 0;
ogreTotal = 0;
trollTotal = 0;
centaurTotal = 0;
bahamutTotal = 0;
devilTotal = 0;
}
public function setupGoblin(spawnDelay:int=1000, total:int=100, lv:int=1){
goblinFrameTime = (goblinFrameTimeSet = (spawnDelay * 0.024));
goblinTotal = total;
goblinLv = lv;
trace((((((("init goblin [delay:" + String(spawnDelay)) + "] [total:") + String(total)) + "] [lv:") + String(lv)) + "] "));
}
public function setupCentaur(spawnDelay:int=1000, total:int=100, lv:int=1){
centaurFrameTime = (centaurFrameTimeSet = (spawnDelay * 0.024));
centaurTotal = total;
centaurLv = lv;
trace((((((("init centaur [delay:" + String(spawnDelay)) + "] [total:") + String(total)) + "] [lv:") + String(lv)) + "] "));
}
public function destroy(){
stopSpawn();
defSys = null;
}
}
}//package DefX.Army
Section 63
//Arrow (DefX.Bullet.Arrow)
package DefX.Bullet {
import flash.events.*;
import flash.display.*;
import DefX.Effect.*;
import FZBase.Sound.*;
public class Arrow extends Sprite {
private var statDef;
private var dispCont;
private var fadeFrame:int;// = 48
private var defSys;
public function Arrow(){
fadeFrame = 48;
super();
}
private function arrowHandle(event:Event):void{
var container:*;
var numChild:int;
var children:Array;
var i:int;
var effect:*;
var sndHit:*;
var arrowPow:int;
var tx_effect:*;
if (defSys.isPaused){
return;
};
if ((((((this.x < defSys.leftBorder)) || ((this.x > defSys.rightBorder)))) || ((this.y > defSys.downBorder)))){
destroy();
return;
};
statDef.vecPos.setMoveArrow();
this.x = statDef.vecPos._X;
this.y = statDef.vecPos._Y;
this.rotation = statDef.vecPos._ANGLE;
container = defSys.contArmy;
numChild = container.numChildren;
children = new Array(numChild);
i = 0;
i = 0;
while (i < numChild) {
children[i] = container.getChildAt(i);
i++;
};
i = 0;
for (;i < numChild;i++) {
if (children[i].isEnableHit()){
if (this.hitTestObject(children[i].hitBox)){
arrowPow = 1;
if (statDef.arrowType == 1){
arrowPow = statDef.arrowPow;
if (children[i].statDef.isAlly()){
arrowPow = (arrowPow * 0.2);
};
if (children[i].statDef.isWeakCreature()){
children[i].setHit(1, arrowPow);
} else {
children[i].setHit(0, arrowPow);
};
effect = new ParticleBurst(defSys.contBlood, this.x, this.y, this.rotation, 6, 15, defSys.landBorder);
effect.BloodShootEffect();
sndHit = new arrow_hit();
sndHit.playSound();
destroy();
return;
} else {
if (statDef.arrowType == 2){
if (children[i].isEnableHitPierce()){
arrowPow = statDef.arrowPow;
if (children[i].statDef.isAlly()){
arrowPow = (arrowPow * 0.2);
};
children[i].setHit(1, arrowPow);
effect = new ParticleBurst(defSys.contBlood, this.x, this.y, this.rotation, 6, 15, defSys.landBorder);
effect.BloodShootEffect();
sndHit = new arrow_hit();
sndHit.playSound();
};
} else {
if (statDef.arrowType == 3){
if (children[i].isEnableHitPierce()){
arrowPow = statDef.arrowPow;
if (children[i].statDef.isAlly()){
arrowPow = (arrowPow * 0.2);
};
children[i].setHit(2, arrowPow);
effect = new ParticleBurst(defSys.contBlood, this.x, this.y, this.rotation, 6, 15, defSys.landBorder);
effect.BloodShootEffect();
sndHit = new arrow_hit();
sndHit.playSound();
};
} else {
if (statDef.arrowType == 4){
if (children[i].isEnableHitPierce()){
arrowPow = statDef.arrowPow;
if (children[i].statDef.isAlly()){
arrowPow = (arrowPow * 0.2);
};
children[i].setHit(3, arrowPow);
effect = new ParticleBurst(defSys.contBlood, this.x, this.y, this.rotation, 6, 15, defSys.landBorder);
effect.BloodShootEffect();
sndHit = new arrow_hit();
sndHit.playSound();
};
} else {
if (statDef.arrowType == 5){
if (children[i].statDef.isEnemy()){
children[i].setHit(1, statDef.arrowPow);
effect = new ParticleBurst(defSys.contBlood, this.x, this.y, this.rotation, 6, 15, defSys.landBorder);
effect.BloodShootEffect();
sndHit = new arrow_hit();
sndHit.playSound();
destroy();
return;
};
};
};
};
};
};
if (statDef.arrowType == 10){
if (children[i].statDef.isAlly()){
continue;
};
if (children[i].statDef.isWeakCreature()){
children[i].setHit(1, statDef.arrowPow);
} else {
children[i].setHit(0, statDef.arrowPow);
};
effect = new ParticleBurst(defSys.contBlood, this.x, this.y, this.rotation, 6, 15, defSys.landBorder);
effect.BloodShootEffect();
sndHit = new arrow_hit();
sndHit.playSound();
destroy();
return;
};
if (statDef.arrowType == 11){
if (children[i].statDef.isEnemy()){
} else {
if (children[i].statDef.isWeakCreature()){
children[i].setHit(1, statDef.arrowPow);
} else {
children[i].setHit(0, statDef.arrowPow);
};
effect = new ParticleBurst(defSys.contBlood, this.x, this.y, this.rotation, 6, 15, defSys.landBorder);
effect.BloodShootEffect();
sndHit = new arrow_hit();
sndHit.playSound();
destroy();
return;
};
};
};
};
};
if (this.statDef.isSpecialArrow()){
if (Math.random() < 0.9){
tx_effect = new ParticleBurst(defSys.contBlood, this.x, this.y, this.rotation, 1, 20, defSys.landBorder);
if (statDef.arrowType == 2){
tx_effect.ArrowTrailEffect(1);
} else {
if (statDef.arrowType == 3){
tx_effect.ArrowTrailEffect(2);
} else {
tx_effect.ArrowTrailEffect(3);
};
};
};
};
if (this.y > defSys.landBorder){
this.y = defSys.landBorder;
if (statDef.arrowType == 1){
this.x = ((this.x - 5) - (Math.random() * 10));
this.y = ((defSys.landBorder - 5) + (Math.random() * 10));
};
this.removeEventListener(Event.ENTER_FRAME, arrowHandle);
arrowAction();
};
}
private function arrowAction(){
var splashExplo:*;
if (statDef.isFireArrowEXPLO()){
splashExplo = new fire_explode_mc();
defSys.contEffect.addChild(splashExplo);
splashExplo.initialise(defSys, 60, 10, this.x, this.y, 4);
destroy();
return;
};
if (statDef.isIceArrowEXPLO()){
splashExplo = new es_explode_mc();
defSys.contEffect.addChild(splashExplo);
splashExplo.initialise(defSys, 40, 10, this.x, this.y, 3);
destroy();
return;
};
if (statDef.isThunderArrowEXPLO()){
splashExplo = new electric_explode_mc();
defSys.contEffect.addChild(splashExplo);
splashExplo.initialise(defSys, 50, 10, this.x, this.y, 2);
destroy();
return;
};
if ((((statDef.arrowType == 10)) || ((statDef.arrowType == 11)))){
destroy();
return;
};
this.addEventListener(Event.ENTER_FRAME, arrowHandle2, false, 0, true);
}
public function launch(_defSys, _statDef){
defSys = _defSys;
statDef = _statDef;
dispCont = defSys.contArrow;
dispCont.addChild(this);
this.cacheAsBitmap = true;
this.x = statDef.vecPos._X;
this.y = statDef.vecPos._Y;
this.rotation = statDef.vecPos._ANGLE;
this.addEventListener(Event.ENTER_FRAME, arrowHandle, false, 0, true);
fadeFrame = (48 + (Math.random() * 50));
}
private function arrowHandle2(event:Event):void{
fadeFrame = (fadeFrame - 1);
if (fadeFrame <= 0){
destroy();
};
}
public function destroy(){
this.removeEventListener(Event.ENTER_FRAME, arrowHandle);
this.removeEventListener(Event.ENTER_FRAME, arrowHandle2);
dispCont.removeChild(this);
dispCont = null;
statDef = null;
defSys = null;
}
}
}//package DefX.Bullet
Section 64
//ArrowStatDef (DefX.Bullet.ArrowStatDef)
package DefX.Bullet {
import FZBase.Vector.*;
public class ArrowStatDef {
const _SPECIAL_ARROW = 5;
const _ENEMY_BULLET = 11;
const _ICE_ARROW = 4;
const _PLAYER_BULLET = 10;
const _THUNDER_ARROW = 3;
const _BASIC_ARROW = 1;
const _FIRE_ARROW = 2;
public var arrowPow:int;// = 1
public var arrowState:int;// = 0
public var vecPos;
public var arrowType:int;// = 0
public var arrowSpd:int;// = 15
public var arrowLv:int;// = 1
public function ArrowStatDef(_type, _vPosInit, _lv:int=1, _distance:int=0){
arrowLv = 1;
arrowPow = 1;
arrowSpd = 15;
arrowType = 0;
arrowState = 0;
super();
arrowType = _type;
arrowState = 0;
arrowLv = _lv;
vecPos = _vPosInit;
vecPos.setMove(_distance);
switch (arrowType){
case _BASIC_ARROW:
if (arrowLv == 1){
arrowPow = 22;
};
if (arrowLv == 2){
arrowPow = 27;
};
if (arrowLv == 3){
arrowPow = 23;
};
if (arrowLv == 4){
arrowPow = 25;
};
if (arrowLv == 5){
arrowPow = 18;
};
arrowSpd = 20;
break;
case _FIRE_ARROW:
if (arrowLv == 1){
arrowPow = 30;
};
if (arrowLv == 2){
arrowPow = 35;
};
if (arrowLv == 3){
arrowPow = 40;
};
if (arrowLv == 4){
arrowPow = 45;
};
if (arrowLv == 5){
arrowPow = 70;
};
arrowSpd = 20;
break;
case _ICE_ARROW:
if (arrowLv == 1){
arrowPow = 25;
};
if (arrowLv == 2){
arrowPow = 30;
};
if (arrowLv == 3){
arrowPow = 35;
};
if (arrowLv == 4){
arrowPow = 40;
};
if (arrowLv == 5){
arrowPow = 50;
};
arrowSpd = 20;
break;
case _THUNDER_ARROW:
if (arrowLv == 1){
arrowPow = 25;
};
if (arrowLv == 2){
arrowPow = 30;
};
if (arrowLv == 3){
arrowPow = 35;
};
if (arrowLv == 4){
arrowPow = 40;
};
if (arrowLv == 5){
arrowPow = 60;
};
arrowSpd = 20;
break;
case _SPECIAL_ARROW:
if (arrowLv == 1){
arrowPow = 20;
};
if (arrowLv == 2){
arrowPow = 40;
};
if (arrowLv == 3){
arrowPow = 60;
};
if (arrowLv == 4){
arrowPow = 80;
};
if (arrowLv == 5){
arrowPow = 100;
};
arrowSpd = 15;
break;
case _PLAYER_BULLET:
if (arrowLv == 1){
arrowPow = 20;
};
if (arrowLv == 2){
arrowPow = 25;
};
if (arrowLv == 3){
arrowPow = 30;
};
if (arrowLv == 4){
arrowPow = 40;
};
if (arrowLv == 5){
arrowPow = 50;
};
arrowSpd = 30;
break;
case _ENEMY_BULLET:
if (arrowLv == 1){
arrowPow = 20;
};
if (arrowLv == 2){
arrowPow = 25;
};
if (arrowLv == 3){
arrowPow = 30;
};
if (arrowLv == 4){
arrowPow = 40;
};
if (arrowLv == 5){
arrowPow = 50;
};
arrowSpd = 30;
break;
default:
arrowType = _BASIC_ARROW;
arrowPow = 10;
arrowSpd = 15;
break;
};
vecPos.setVelocity(arrowSpd);
}
public function isBasicArrow():Boolean{
if (arrowType == _BASIC_ARROW){
return (true);
};
return (false);
}
public function isEnemy():Boolean{
return (false);
}
public function isThunderArrowEXPLO():Boolean{
if ((((arrowType == _THUNDER_ARROW)) && ((arrowLv == 5)))){
return (true);
};
return (false);
}
public function isSpecialArrow():Boolean{
if ((((((arrowType == _FIRE_ARROW)) || ((arrowType == _ICE_ARROW)))) || ((arrowType == _THUNDER_ARROW)))){
return (true);
};
return (false);
}
public function isPlayer():Boolean{
return (false);
}
public function isFireArrowEXPLO():Boolean{
if ((((arrowType == _FIRE_ARROW)) && ((arrowLv == 5)))){
return (true);
};
return (false);
}
public function isIceArrowEXPLO():Boolean{
if ((((arrowType == _ICE_ARROW)) && ((arrowLv == 5)))){
return (true);
};
return (false);
}
}
}//package DefX.Bullet
Section 65
//ParticleBurst (DefX.Effect.ParticleBurst)
package DefX.Effect {
import FZBase.Vector.*;
import FZBase.Effect.*;
public class ParticleBurst {
private var lifeSpan:int;// = 15
private var particleCount:int;// = 5
private var shootAngle:Number;// = 0
private var landBorder:int;// = 500
private var _X:Number;// = 0
private var _Y:Number;// = 0
private var dispCont;
public function ParticleBurst(_DispCont, _XPOS, _YPOS, _Angle:Number=0, _count:int=10, _lifespan:int=15, _land:int=500){
particleCount = 5;
shootAngle = 0;
lifeSpan = 15;
landBorder = 500;
_X = 0;
_Y = 0;
super();
particleCount = (_count + ((Math.random() * _count) * 0.5));
lifeSpan = _lifespan;
landBorder = _land;
shootAngle = (_Angle * -1);
dispCont = _DispCont;
_X = _XPOS;
_Y = _YPOS;
}
public function ArrowTrailEffect(val:int=1){
var i:int;
var objBlood:Array;
i = 0;
objBlood = new Array(particleCount);
i = 0;
while (i < particleCount) {
if (val == 1){
objBlood[i] = new sprite_fire();
} else {
if (val == 3){
objBlood[i] = new sprite_ice();
} else {
objBlood[i] = new sprite_thunder();
};
};
objBlood[i].create(dispCont, new Vector2dParticle(_X, _Y, 0, 0), lifeSpan, landBorder);
i++;
};
}
public function BloodShootEffect(){
var i:int;
var objBlood:Array;
i = 0;
objBlood = new Array(particleCount);
i = 0;
while (i < particleCount) {
objBlood[i] = new blood_red();
objBlood[i].create(dispCont, new Vector2dParticle(_X, _Y, (shootAngle - (Math.random() * 30)), (2 + Math.random())), lifeSpan, landBorder);
i++;
};
}
public function BloodTrailEffect(){
var i:int;
var objBlood:Array;
i = 0;
objBlood = new Array(particleCount);
i = 0;
while (i < particleCount) {
objBlood[i] = new blood_red();
objBlood[i].create(dispCont, new Vector2dParticle(_X, _Y, 0, (2 + Math.random())), lifeSpan, landBorder);
i++;
};
}
public function BloodBurstEffect(){
var i:int;
var objBlood:Array;
i = 0;
objBlood = new Array(particleCount);
i = 0;
while (i < particleCount) {
objBlood[i] = new blood_red2();
objBlood[i].create(dispCont, new Vector2dParticle(_X, _Y, (Math.random() * 360), (2 + Math.random())), lifeSpan, landBorder);
i++;
};
}
}
}//package DefX.Effect
Section 66
//SplashEffect (DefX.Effect.SplashEffect)
package DefX.Effect {
import flash.events.*;
import flash.display.*;
public class SplashEffect extends MovieClip {
private var dmg:int;// = 0
private var dispCont;
public var attackBox:MovieClip;
private var hitType:int;// = 0
private var defSys;
private var VX:Number;// = 0
private var VY:Number;// = 0
private var objMC;
private var VR:Number;// = 0
private var isPaused:Boolean;// = false
public function SplashEffect(){
dmg = 0;
VX = 0;
VY = 0;
VR = 0;
hitType = 0;
isPaused = false;
super();
}
public function destroy(){
this.removeEventListener(Event.ENTER_FRAME, splatEffectHandle);
dispCont.removeChild(this);
dispCont = null;
defSys = null;
}
private function splatEffectHandle(event:Event):void{
var container:*;
var numChild:int;
var children:Array;
var i:int;
if (defSys.isPaused != isPaused){
if (defSys.isPaused == true){
isPaused = true;
this.stop();
} else {
isPaused = false;
this.play();
};
};
if (this.currentFrame == this.totalFrames){
destroy();
};
if (this.currentLabel == "hit"){
container = defSys.contArmy;
numChild = container.numChildren;
children = new Array(numChild);
i = 0;
i = 0;
while (i < numChild) {
children[i] = container.getChildAt(i);
i++;
};
i = 0;
while (i < numChild) {
if (children[i].isEnableHit()){
if (this.attackBox.hitTestObject(children[i].hitBox)){
if (this.x < children[i].x){
VX = VX;
VR = -(VR);
} else {
VX = -(VX);
VR = VR;
};
VY = -(VY);
children[i].setHit(hitType, dmg, VX, VY, VR);
};
};
i++;
};
};
}
public function initialise(_defSys, _dmg, _pow, _X, _Y, _hitType:int=0){
defSys = _defSys;
dispCont = defSys.contEffect;
dispCont.addChild(this);
this.cacheAsBitmap = true;
this.x = _X;
this.y = _Y;
this.gotoAndPlay(1);
VX = (Math.random() * (_pow * 0.5));
VY = _pow;
VR = ((_pow * 2) + ((Math.random() * _pow) * 2));
dmg = _dmg;
hitType = _hitType;
this.addEventListener(Event.ENTER_FRAME, splatEffectHandle, false, 0, true);
}
}
}//package DefX.Effect
Section 67
//LogoUI (DefX.GUI.LogoUI)
package DefX.GUI {
import flash.events.*;
import flash.net.*;
public class LogoUI {
private var defSys;
private var objArtLogic;
private var dispCont;
private var objKongregate;
public function LogoUI(_defSys){
super();
defSys = _defSys;
dispCont = defSys.contMenu;
}
private function kongregateHandle(event:Event):void{
if (objKongregate.currentFrame == objKongregate.totalFrames){
objKongregate.removeEventListener(Event.ENTER_FRAME, kongregateHandle);
objKongregate.removeEventListener(MouseEvent.CLICK, kongregateClick);
dispCont.removeChild(objKongregate);
objKongregate = null;
objArtLogic = new logo_anim_artlogicgames_mc();
dispCont.addChild(objArtLogic);
objArtLogic.x = 0;
objArtLogic.y = 0;
objArtLogic.gotoAndPlay(1);
objArtLogic.addEventListener(Event.ENTER_FRAME, artlogicHandle, false, 0, true);
};
}
private function artlogicHandle(event:Event):void{
if (objArtLogic.currentFrame == objArtLogic.totalFrames){
destroy();
defSys.gmState = 1;
};
}
private function kongregateClick(event:MouseEvent):void{
var targetURL:URLRequest;
targetURL = new URLRequest("http://www.kongregate.com/?gamereferral=epic-war");
navigateToURL(targetURL, "_blank");
}
public function initialise(){
objKongregate = new Kongintro30fps();
dispCont = defSys.contMenu;
dispCont.addChild(objKongregate);
objKongregate.x = 400;
objKongregate.y = 300;
objKongregate.gotoAndPlay(1);
objKongregate.addEventListener(Event.ENTER_FRAME, kongregateHandle, false, 0, true);
objKongregate.addEventListener(MouseEvent.CLICK, kongregateClick, false, 0, true);
}
public function destroy(){
objArtLogic.removeEventListener(Event.ENTER_FRAME, artlogicHandle);
dispCont.removeChild(objArtLogic);
objArtLogic = null;
}
}
}//package DefX.GUI
Section 68
//MainMenuUI (DefX.GUI.MainMenuUI)
package DefX.GUI {
import flash.events.*;
import flash.net.*;
public class MainMenuUI {
private var defSys;
private var objMainMenu;
private var page:int;// = 1
private var objCredit;
private var objInstruction;
private var dispCont;
public function MainMenuUI(_defSys){
page = 1;
super();
defSys = _defSys;
dispCont = defSys.contMenu;
}
private function logoKongClick(event:MouseEvent):void{
var targetURL:URLRequest;
targetURL = new URLRequest("http://www.kongregate.com/?gamereferral=epic-war");
navigateToURL(targetURL, "_blank");
}
private function startClick(event:MouseEvent):void{
destroy();
defSys.gmState = 3;
defSys.dat.initialise();
if (defSys.specialContent){
defSys.dat.moneyGainLv = 1;
};
}
private function prevClick(event:MouseEvent):void{
page = Math.max((page - 1), 1);
if (objInstruction){
objInstruction.gotoAndStop(page);
};
}
private function instructionClick(event:MouseEvent):void{
objInstruction = new instruct_mc();
dispCont.addChild(objInstruction);
objInstruction.x = 0;
objInstruction.y = 0;
objInstruction.gotoAndStop(1);
page = 1;
objInstruction.bClose.addEventListener(MouseEvent.CLICK, closeClick, false, 0, true);
objInstruction.bPrev.addEventListener(MouseEvent.CLICK, prevClick, false, 0, true);
objInstruction.bNext.addEventListener(MouseEvent.CLICK, nextClick, false, 0, true);
}
private function nextClick(event:MouseEvent):void{
page = Math.min((page + 1), 6);
if (objInstruction){
objInstruction.gotoAndStop(page);
};
}
private function playMoreClick(event:MouseEvent):void{
var targetURL:URLRequest;
targetURL = new URLRequest("http://www.kongregate.com/?gamereferral=epic-war");
navigateToURL(targetURL, "_blank");
}
private function continueClick(event:MouseEvent):void{
var so:SharedObject;
so = SharedObject.getLocal("DEFX_SAVE");
if (((so) && (so.data.is_saved))){
destroy();
defSys.gmState = 3;
defSys.dat.initialise();
defSys.dat.loadData();
};
}
private function closeClick(event:MouseEvent):void{
objInstruction.bClose.removeEventListener(MouseEvent.CLICK, closeClick);
objInstruction.bPrev.removeEventListener(MouseEvent.CLICK, prevClick);
objInstruction.bNext.removeEventListener(MouseEvent.CLICK, nextClick);
if (objInstruction){
dispCont.removeChild(objInstruction);
objInstruction = null;
};
}
private function creditClick(event:MouseEvent):void{
objCredit = new credits_mc();
dispCont.addChild(objCredit);
objCredit.x = 0;
objCredit.y = 0;
objCredit.bClose.addEventListener(MouseEvent.CLICK, closeCreditClick, false, 0, true);
}
private function newsClick(event:MouseEvent):void{
var targetURL:URLRequest;
targetURL = new URLRequest("http://www.kongregate.com/?gamereferral=epic-war");
navigateToURL(targetURL, "_blank");
}
public function initialise(){
objMainMenu = new cover_mc();
dispCont = defSys.contMenu;
dispCont.addChild(objMainMenu);
objMainMenu.x = 0;
objMainMenu.y = 0;
objMainMenu.bStart.addEventListener(MouseEvent.CLICK, startClick, false, 0, true);
objMainMenu.bContinue.addEventListener(MouseEvent.CLICK, continueClick, false, 0, true);
objMainMenu.bInstruction.addEventListener(MouseEvent.CLICK, instructionClick, false, 0, true);
objMainMenu.bPlayMore.addEventListener(MouseEvent.CLICK, playMoreClick, false, 0, true);
objMainMenu.bNews.addEventListener(MouseEvent.CLICK, newsClick, false, 0, true);
objMainMenu.bCredit.addEventListener(MouseEvent.CLICK, creditClick, false, 0, true);
objMainMenu.logoKong.addEventListener(MouseEvent.CLICK, logoKongClick, false, 0, true);
}
public function destroy(){
if (objMainMenu.bStart){
objMainMenu.bStart.removeEventListener(MouseEvent.CLICK, startClick);
};
if (objMainMenu.bContinue){
objMainMenu.bContinue.removeEventListener(MouseEvent.CLICK, continueClick);
};
if (objMainMenu.bInstruction){
objMainMenu.bInstruction.removeEventListener(MouseEvent.CLICK, instructionClick);
};
if (objMainMenu.bPlayMore){
objMainMenu.bPlayMore.removeEventListener(MouseEvent.CLICK, playMoreClick);
};
if (objMainMenu.bNews){
objMainMenu.bNews.removeEventListener(MouseEvent.CLICK, newsClick);
};
if (objMainMenu.logoKong){
objMainMenu.logoKong.removeEventListener(MouseEvent.CLICK, logoKongClick);
};
if (objInstruction){
if (objInstruction.bClose){
objInstruction.bClose.removeEventListener(MouseEvent.CLICK, closeClick);
};
if (objInstruction.bPrev){
objInstruction.bPrev.removeEventListener(MouseEvent.CLICK, prevClick);
};
if (objInstruction.bNext){
objInstruction.bNext.removeEventListener(MouseEvent.CLICK, nextClick);
};
};
if (objInstruction){
dispCont.removeChild(objInstruction);
objInstruction = null;
};
dispCont.removeChild(objMainMenu);
objMainMenu = null;
}
private function closeCreditClick(event:MouseEvent):void{
objCredit.bClose.removeEventListener(MouseEvent.CLICK, closeCreditClick);
if (objCredit){
dispCont.removeChild(objCredit);
objCredit = null;
};
}
}
}//package DefX.GUI
Section 69
//UpgradeUI (DefX.GUI.UpgradeUI)
package DefX.GUI {
import flash.events.*;
import flash.net.*;
public class UpgradeUI {
private var defSys;
private var objConfirm;
private var objMap;
private var objKong;
private var dispCont;
public function UpgradeUI(_defSys){
super();
defSys = _defSys;
dispCont = defSys.contMenu;
}
private function armyWizardClick(event:MouseEvent):void{
defSys.dat.upgradeSlot4();
updateGrid();
}
private function manaGainClick(event:MouseEvent):void{
defSys.dat.upgradeManaGain();
updateGrid();
}
private function armyDwarfClick(event:MouseEvent):void{
defSys.dat.upgradeSlot3();
updateGrid();
}
private function armyAngelClick(event:MouseEvent):void{
defSys.dat.upgradeSlot7();
updateGrid();
}
private function no2Click(event:MouseEvent):void{
if (objKong){
objKong.removeEventListener(MouseEvent.CLICK, yes2Click);
objKong.removeEventListener(MouseEvent.CLICK, no2Click);
defSys.contMenu.removeChild(objKong);
objKong = null;
};
}
private function saveClick(event:MouseEvent):void{
defSys.dat.saveData();
defSys.submitStat();
}
private function noClick(event:MouseEvent):void{
if (objConfirm){
objConfirm.removeEventListener(MouseEvent.CLICK, yesClick);
objConfirm.removeEventListener(MouseEvent.CLICK, noClick);
defSys.contMenu.removeChild(objConfirm);
objConfirm = null;
};
}
private function armyGolemClick(event:MouseEvent):void{
defSys.dat.upgradeSlot5();
updateGrid();
}
private function specialClick(event:MouseEvent):void{
defSys.dat.upgradeSpecial();
updateGrid();
}
private function armyDragonClick(event:MouseEvent):void{
defSys.dat.upgradeSlot6();
updateGrid();
}
private function armyHobbitClick(event:MouseEvent):void{
defSys.dat.upgradeSlot1();
updateGrid();
}
private function manaStockClick(event:MouseEvent):void{
defSys.dat.upgradeManaStock();
updateGrid();
}
private function yes2Click(event:MouseEvent):void{
var targetURL:URLRequest;
targetURL = new URLRequest("http://www.kongregate.com/games/rudy_sudarto/epic-war/?gamereferral=epic-war");
navigateToURL(targetURL, "_blank");
if (objKong){
objKong.removeEventListener(MouseEvent.CLICK, yes2Click);
objKong.removeEventListener(MouseEvent.CLICK, no2Click);
defSys.contMenu.removeChild(objKong);
objKong = null;
};
}
private function playMoreClick(event:MouseEvent):void{
var targetURL:URLRequest;
targetURL = new URLRequest("http://www.kongregate.com/?gamereferral=epic-war");
navigateToURL(targetURL, "_blank");
}
private function barrierClick(event:MouseEvent):void{
defSys.dat.upgradeBarrier();
updateGrid();
}
private function yesClick(event:MouseEvent):void{
destroy();
defSys.gmState = 1;
}
private function trapClick(event:MouseEvent):void{
defSys.dat.upgradeTrap();
updateGrid();
}
private function arrowBasicClick(event:MouseEvent):void{
defSys.dat.upgradeArrowBasic();
updateGrid();
}
private function armyElfClick(event:MouseEvent):void{
defSys.dat.upgradeSlot2();
updateGrid();
}
private function arrowFireClick(event:MouseEvent):void{
defSys.dat.upgradeArrowFire();
updateGrid();
}
private function expGainClick(event:MouseEvent):void{
if (defSys.specialContent){
defSys.dat.upgradeMoneyGain();
} else {
if (objKong == null){
objKong = new play_on_kongregate_mc();
defSys.contMenu.addChild(objKong);
objKong.bYes.addEventListener(MouseEvent.CLICK, yes2Click, false, 0, true);
objKong.bNo.addEventListener(MouseEvent.CLICK, no2Click, false, 0, true);
};
};
updateGrid();
}
private function arrowIceClick(event:MouseEvent):void{
defSys.dat.upgradeArrowIce();
updateGrid();
}
public function updateGrid(){
objMap.exp.htmlText = String(defSys.dat.money);
objMap.mArmyHobbit.gotoAndStop((defSys.dat.slot1Lv + 1));
objMap.mArmyElf.gotoAndStop((defSys.dat.slot2Lv + 1));
objMap.mArmyDwarf.gotoAndStop((defSys.dat.slot3Lv + 1));
objMap.mArmyWizard.gotoAndStop((defSys.dat.slot4Lv + 1));
objMap.mArmyGolem.gotoAndStop((defSys.dat.slot5Lv + 1));
objMap.mArmyDragon.gotoAndStop((defSys.dat.slot6Lv + 1));
objMap.mArmyAngel.gotoAndStop((defSys.dat.slot7Lv + 1));
objMap.mArrowBasic.gotoAndStop((defSys.dat.arrowBasicLv + 1));
objMap.mArrowFire.gotoAndStop((defSys.dat.arrowFireLv + 1));
objMap.mArrowIce.gotoAndStop((defSys.dat.arrowIceLv + 1));
objMap.mArrowThunder.gotoAndStop((defSys.dat.arrowThunderLv + 1));
objMap.mManaStock.gotoAndStop((defSys.dat.manaStockLv + 1));
objMap.mManaRegen.gotoAndStop((defSys.dat.manaRegenLv + 1));
objMap.mManaGain.gotoAndStop((defSys.dat.manaGainLv + 1));
objMap.mExpGain.gotoAndStop((defSys.dat.moneyGainLv + 1));
objMap.mBarrier.gotoAndStop((defSys.dat.barrierLv + 1));
objMap.mTrap.gotoAndStop((defSys.dat.trapLv + 1));
objMap.mTurret.gotoAndStop((defSys.dat.turretLv + 1));
objMap.mCastle.gotoAndStop((defSys.dat.castleLv + 1));
objMap.mSpecial.gotoAndStop((defSys.dat.specialLv + 1));
}
private function backClick(event:MouseEvent):void{
destroy();
defSys.gmState = 3;
}
private function manaRegenClick(event:MouseEvent):void{
defSys.dat.upgradeManaRegen();
updateGrid();
}
private function turretClick(event:MouseEvent):void{
defSys.dat.upgradeTurret();
updateGrid();
}
private function quitClick(event:MouseEvent):void{
if (objConfirm == null){
objConfirm = new exit_confirm_mc();
defSys.contMenu.addChild(objConfirm);
objConfirm.bYes.addEventListener(MouseEvent.CLICK, yesClick, false, 0, true);
objConfirm.bNo.addEventListener(MouseEvent.CLICK, noClick, false, 0, true);
};
}
public function destroy(){
if (objKong){
objKong.removeEventListener(MouseEvent.CLICK, yes2Click);
objKong.removeEventListener(MouseEvent.CLICK, no2Click);
defSys.contMenu.removeChild(objKong);
objKong = null;
};
if (objConfirm){
objConfirm.removeEventListener(MouseEvent.CLICK, yesClick);
objConfirm.removeEventListener(MouseEvent.CLICK, noClick);
defSys.contMenu.removeChild(objConfirm);
objConfirm = null;
};
objMap.bQuit.removeEventListener(MouseEvent.CLICK, quitClick);
objMap.bSave.removeEventListener(MouseEvent.CLICK, saveClick);
objMap.bPlayMore.removeEventListener(MouseEvent.CLICK, playMoreClick);
objMap.bBack.removeEventListener(MouseEvent.CLICK, backClick);
objMap.mArmyHobbit.removeEventListener(MouseEvent.CLICK, armyHobbitClick);
objMap.mArmyElf.removeEventListener(MouseEvent.CLICK, armyElfClick);
objMap.mArmyDwarf.removeEventListener(MouseEvent.CLICK, armyDwarfClick);
objMap.mArmyWizard.removeEventListener(MouseEvent.CLICK, armyWizardClick);
objMap.mArmyGolem.removeEventListener(MouseEvent.CLICK, armyGolemClick);
objMap.mArmyDragon.removeEventListener(MouseEvent.CLICK, armyDragonClick);
objMap.mArmyAngel.removeEventListener(MouseEvent.CLICK, armyAngelClick);
objMap.mArrowBasic.removeEventListener(MouseEvent.CLICK, arrowBasicClick);
objMap.mArrowFire.removeEventListener(MouseEvent.CLICK, arrowFireClick);
objMap.mArrowIce.removeEventListener(MouseEvent.CLICK, arrowIceClick);
objMap.mArrowThunder.removeEventListener(MouseEvent.CLICK, arrowThunderClick);
objMap.mManaStock.removeEventListener(MouseEvent.CLICK, manaStockClick);
objMap.mManaRegen.removeEventListener(MouseEvent.CLICK, manaRegenClick);
objMap.mManaGain.removeEventListener(MouseEvent.CLICK, manaGainClick);
objMap.mExpGain.removeEventListener(MouseEvent.CLICK, expGainClick);
objMap.mBarrier.removeEventListener(MouseEvent.CLICK, barrierClick);
objMap.mTrap.removeEventListener(MouseEvent.CLICK, trapClick);
objMap.mTurret.removeEventListener(MouseEvent.CLICK, turretClick);
objMap.mCastle.removeEventListener(MouseEvent.CLICK, castleClick);
objMap.mSpecial.removeEventListener(MouseEvent.CLICK, specialClick);
dispCont.removeChild(objMap);
objMap = null;
}
private function arrowThunderClick(event:MouseEvent):void{
defSys.dat.upgradeArrowThunder();
updateGrid();
}
public function initialise(){
objMap = new upgrade_menu_mc();
dispCont = defSys.contMenu;
dispCont.addChild(objMap);
objMap.x = 0;
objMap.y = 0;
objMap.bQuit.addEventListener(MouseEvent.CLICK, quitClick, false, 0, true);
objMap.bSave.addEventListener(MouseEvent.CLICK, saveClick, false, 0, true);
objMap.bPlayMore.addEventListener(MouseEvent.CLICK, playMoreClick, false, 0, true);
objMap.bBack.addEventListener(MouseEvent.CLICK, backClick, false, 0, true);
objMap.mArmyHobbit.addEventListener(MouseEvent.CLICK, armyHobbitClick, false, 0, true);
objMap.mArmyElf.addEventListener(MouseEvent.CLICK, armyElfClick, false, 0, true);
objMap.mArmyDwarf.addEventListener(MouseEvent.CLICK, armyDwarfClick, false, 0, true);
objMap.mArmyWizard.addEventListener(MouseEvent.CLICK, armyWizardClick, false, 0, true);
objMap.mArmyGolem.addEventListener(MouseEvent.CLICK, armyGolemClick, false, 0, true);
objMap.mArmyDragon.addEventListener(MouseEvent.CLICK, armyDragonClick, false, 0, true);
objMap.mArmyAngel.addEventListener(MouseEvent.CLICK, armyAngelClick, false, 0, true);
objMap.mArrowBasic.addEventListener(MouseEvent.CLICK, arrowBasicClick, false, 0, true);
objMap.mArrowFire.addEventListener(MouseEvent.CLICK, arrowFireClick, false, 0, true);
objMap.mArrowIce.addEventListener(MouseEvent.CLICK, arrowIceClick, false, 0, true);
objMap.mArrowThunder.addEventListener(MouseEvent.CLICK, arrowThunderClick, false, 0, true);
objMap.mManaStock.addEventListener(MouseEvent.CLICK, manaStockClick, false, 0, true);
objMap.mManaRegen.addEventListener(MouseEvent.CLICK, manaRegenClick, false, 0, true);
objMap.mManaGain.addEventListener(MouseEvent.CLICK, manaGainClick, false, 0, true);
objMap.mExpGain.addEventListener(MouseEvent.CLICK, expGainClick, false, 0, true);
objMap.mBarrier.addEventListener(MouseEvent.CLICK, barrierClick, false, 0, true);
objMap.mTrap.addEventListener(MouseEvent.CLICK, trapClick, false, 0, true);
objMap.mTurret.addEventListener(MouseEvent.CLICK, turretClick, false, 0, true);
objMap.mCastle.addEventListener(MouseEvent.CLICK, castleClick, false, 0, true);
objMap.mSpecial.addEventListener(MouseEvent.CLICK, specialClick, false, 0, true);
updateGrid();
}
private function castleClick(event:MouseEvent):void{
defSys.dat.upgradeCastle();
updateGrid();
}
}
}//package DefX.GUI
Section 70
//WorldMapUI (DefX.GUI.WorldMapUI)
package DefX.GUI {
import flash.events.*;
import flash.net.*;
public class WorldMapUI {
private var dispCont;
private var defSys;
private var typePop:int;// = 0
private var objConfirm;
private var objSelect;
private var objMap;
private var objMenuPop;
public function WorldMapUI(_defSys){
typePop = 0;
super();
defSys = _defSys;
dispCont = defSys.contMenu;
}
private function stage15Click(event:MouseEvent):void{
destroy();
defSys.game_lv = 15;
defSys.gmState = 2;
}
private function stage11Click(event:MouseEvent):void{
destroy();
defSys.game_lv = 11;
defSys.gmState = 2;
}
private function saveClick(event:MouseEvent):void{
defSys.dat.saveData();
defSys.submitStat();
}
public function inactive(){
if (objSelect){
objSelect.removeEventListener(MouseEvent.MOUSE_OUT, objectInfoOUT);
objSelect = null;
};
objMenuPop.visible = false;
}
private function stage10Over(event:MouseEvent):void{
showPopUp(objMap.stage10, 10);
}
private function stage3Click(event:MouseEvent):void{
destroy();
defSys.game_lv = 3;
defSys.gmState = 2;
}
private function stage13Over(event:MouseEvent):void{
showPopUp(objMap.stage13, 13);
}
private function stage14Over(event:MouseEvent):void{
showPopUp(objMap.stage14, 14);
}
private function stage7Click(event:MouseEvent):void{
destroy();
defSys.game_lv = 7;
defSys.gmState = 2;
}
private function stage11Over(event:MouseEvent):void{
showPopUp(objMap.stage11, 11);
}
private function stage12Over(event:MouseEvent):void{
showPopUp(objMap.stage12, 12);
}
private function stage15Over(event:MouseEvent):void{
showPopUp(objMap.stage15, 15);
}
private function objectInfoOUT(event:MouseEvent):void{
inactive();
trace("i m leave");
}
private function stage12Click(event:MouseEvent):void{
destroy();
defSys.game_lv = 12;
defSys.gmState = 2;
}
private function stage8Click(event:MouseEvent):void{
destroy();
defSys.game_lv = 8;
defSys.gmState = 2;
}
private function stage4Click(event:MouseEvent):void{
destroy();
defSys.game_lv = 4;
defSys.gmState = 2;
}
private function skillClick(event:MouseEvent):void{
destroy();
defSys.gmState = 4;
}
public function initialise(){
objMap = new world_menu_mc();
dispCont = defSys.contMenu;
dispCont.addChild(objMap);
objMap.x = 0;
objMap.y = 0;
objMap.bQuit.addEventListener(MouseEvent.CLICK, quitClick, false, 0, true);
objMap.bSave.addEventListener(MouseEvent.CLICK, saveClick, false, 0, true);
objMap.bPlayMore.addEventListener(MouseEvent.CLICK, playMoreClick, false, 0, true);
objMap.bSkill.addEventListener(MouseEvent.CLICK, skillClick, false, 0, true);
if (defSys.dat.level_01_Play > 0){
objMap.stage1.gotoAndStop(2);
if (defSys.dat.level_01_Play > 1){
objMap.stage1.gotoAndStop(3);
};
objMap.stage1.addEventListener(MouseEvent.CLICK, stage1Click, false, 0, true);
objMap.stage1.addEventListener(MouseEvent.MOUSE_OVER, stage1Over, false, 0, true);
};
if (defSys.dat.level_02_Play > 0){
objMap.stage2.gotoAndStop(2);
if (defSys.dat.level_02_Play > 1){
objMap.stage2.gotoAndStop(3);
};
objMap.stage2.addEventListener(MouseEvent.CLICK, stage2Click, false, 0, true);
objMap.stage2.addEventListener(MouseEvent.MOUSE_OVER, stage2Over, false, 0, true);
};
if (defSys.dat.level_03_Play > 0){
objMap.stage3.gotoAndStop(2);
if (defSys.dat.level_03_Play > 1){
objMap.stage3.gotoAndStop(3);
};
objMap.stage3.addEventListener(MouseEvent.CLICK, stage3Click, false, 0, true);
objMap.stage3.addEventListener(MouseEvent.MOUSE_OVER, stage3Over, false, 0, true);
};
if (defSys.dat.level_04_Play > 0){
objMap.stage4.gotoAndStop(2);
if (defSys.dat.level_04_Play > 1){
objMap.stage4.gotoAndStop(3);
};
objMap.stage4.addEventListener(MouseEvent.CLICK, stage4Click, false, 0, true);
objMap.stage4.addEventListener(MouseEvent.MOUSE_OVER, stage4Over, false, 0, true);
};
if (defSys.dat.level_05_Play > 0){
objMap.stage5.gotoAndStop(2);
if (defSys.dat.level_05_Play > 1){
objMap.stage5.gotoAndStop(3);
};
objMap.stage5.addEventListener(MouseEvent.CLICK, stage5Click, false, 0, true);
objMap.stage5.addEventListener(MouseEvent.MOUSE_OVER, stage5Over, false, 0, true);
};
if (defSys.dat.level_06_Play > 0){
objMap.stage6.gotoAndStop(2);
if (defSys.dat.level_06_Play > 1){
objMap.stage6.gotoAndStop(3);
};
objMap.stage6.addEventListener(MouseEvent.CLICK, stage6Click, false, 0, true);
objMap.stage6.addEventListener(MouseEvent.MOUSE_OVER, stage6Over, false, 0, true);
};
if (defSys.dat.level_07_Play > 0){
objMap.stage7.gotoAndStop(2);
if (defSys.dat.level_07_Play > 1){
objMap.stage7.gotoAndStop(3);
};
objMap.stage7.addEventListener(MouseEvent.CLICK, stage7Click, false, 0, true);
objMap.stage7.addEventListener(MouseEvent.MOUSE_OVER, stage7Over, false, 0, true);
};
if (defSys.dat.level_08_Play > 0){
objMap.stage8.gotoAndStop(2);
if (defSys.dat.level_08_Play > 1){
objMap.stage8.gotoAndStop(3);
};
objMap.stage8.addEventListener(MouseEvent.CLICK, stage8Click, false, 0, true);
objMap.stage8.addEventListener(MouseEvent.MOUSE_OVER, stage8Over, false, 0, true);
};
if (defSys.dat.level_09_Play > 0){
objMap.stage9.gotoAndStop(2);
if (defSys.dat.level_09_Play > 1){
objMap.stage9.gotoAndStop(3);
};
objMap.stage9.addEventListener(MouseEvent.CLICK, stage9Click, false, 0, true);
objMap.stage9.addEventListener(MouseEvent.MOUSE_OVER, stage9Over, false, 0, true);
};
if (defSys.dat.level_10_Play > 0){
objMap.stage10.gotoAndStop(2);
if (defSys.dat.level_10_Play > 1){
objMap.stage10.gotoAndStop(3);
};
objMap.stage10.addEventListener(MouseEvent.CLICK, stage10Click, false, 0, true);
objMap.stage10.addEventListener(MouseEvent.MOUSE_OVER, stage10Over, false, 0, true);
};
if (defSys.dat.level_11_Play > 0){
objMap.stage11.gotoAndStop(2);
if (defSys.dat.level_11_Play > 1){
objMap.stage11.gotoAndStop(3);
};
objMap.stage11.addEventListener(MouseEvent.CLICK, stage11Click, false, 0, true);
objMap.stage11.addEventListener(MouseEvent.MOUSE_OVER, stage11Over, false, 0, true);
};
if (defSys.dat.level_12_Play > 0){
objMap.stage12.gotoAndStop(2);
if (defSys.dat.level_12_Play > 1){
objMap.stage12.gotoAndStop(3);
};
objMap.stage12.addEventListener(MouseEvent.CLICK, stage12Click, false, 0, true);
objMap.stage12.addEventListener(MouseEvent.MOUSE_OVER, stage12Over, false, 0, true);
};
if (defSys.dat.level_13_Play > 0){
objMap.stage13.gotoAndStop(2);
if (defSys.dat.level_13_Play > 1){
objMap.stage13.gotoAndStop(3);
};
objMap.stage13.addEventListener(MouseEvent.CLICK, stage13Click, false, 0, true);
objMap.stage13.addEventListener(MouseEvent.MOUSE_OVER, stage13Over, false, 0, true);
};
if (defSys.dat.level_14_Play > 0){
objMap.stage14.gotoAndStop(2);
if (defSys.dat.level_14_Play > 1){
objMap.stage14.gotoAndStop(3);
};
objMap.stage14.addEventListener(MouseEvent.CLICK, stage14Click, false, 0, true);
objMap.stage14.addEventListener(MouseEvent.MOUSE_OVER, stage14Over, false, 0, true);
};
if (defSys.dat.level_15_Play > 0){
objMap.stage15.gotoAndStop(2);
if (defSys.dat.level_15_Play > 1){
objMap.stage15.gotoAndStop(3);
};
objMap.stage15.addEventListener(MouseEvent.CLICK, stage15Click, false, 0, true);
objMap.stage15.addEventListener(MouseEvent.MOUSE_OVER, stage15Over, false, 0, true);
};
objMenuPop = objMap.info;
objMenuPop.visible = false;
}
private function noClick(event:MouseEvent):void{
if (objConfirm){
objConfirm.removeEventListener(MouseEvent.CLICK, yesClick);
objConfirm.removeEventListener(MouseEvent.CLICK, noClick);
defSys.contMenu.removeChild(objConfirm);
objConfirm = null;
};
}
private function stage13Click(event:MouseEvent):void{
destroy();
defSys.game_lv = 13;
defSys.gmState = 2;
}
private function stage9Click(event:MouseEvent):void{
destroy();
defSys.game_lv = 9;
defSys.gmState = 2;
}
public function showPopUp(_objSelect, _type:int=0){
inactive();
objSelect = _objSelect;
typePop = _type;
objMenuPop.visible = true;
objSelect.addEventListener(MouseEvent.MOUSE_OUT, objectInfoOUT, false, 0, true);
if (_type == 1){
objMenuPop.title_map.htmlText = String(" Battle 1");
objMenuPop.your_score.htmlText = String(defSys.dat.level_01_BestScore);
objMenuPop.best_score.htmlText = String(defSys.dat.level_01_PerfectScore);
} else {
if (_type == 2){
objMenuPop.title_map.htmlText = String(" Battle 2");
objMenuPop.your_score.htmlText = String(defSys.dat.level_02_BestScore);
objMenuPop.best_score.htmlText = String(defSys.dat.level_02_PerfectScore);
} else {
if (_type == 3){
objMenuPop.title_map.htmlText = String(" Battle 3");
objMenuPop.your_score.htmlText = String(defSys.dat.level_03_BestScore);
objMenuPop.best_score.htmlText = String(defSys.dat.level_03_PerfectScore);
} else {
if (_type == 4){
objMenuPop.title_map.htmlText = String(" Battle 4");
objMenuPop.your_score.htmlText = String(defSys.dat.level_04_BestScore);
objMenuPop.best_score.htmlText = String(defSys.dat.level_04_PerfectScore);
} else {
if (_type == 5){
objMenuPop.title_map.htmlText = String(" Battle 5");
objMenuPop.your_score.htmlText = String(defSys.dat.level_05_BestScore);
objMenuPop.best_score.htmlText = String(defSys.dat.level_05_PerfectScore);
} else {
if (_type == 6){
objMenuPop.title_map.htmlText = String(" Battle 6");
objMenuPop.your_score.htmlText = String(defSys.dat.level_06_BestScore);
objMenuPop.best_score.htmlText = String(defSys.dat.level_06_PerfectScore);
} else {
if (_type == 7){
objMenuPop.title_map.htmlText = String(" Battle 7");
objMenuPop.your_score.htmlText = String(defSys.dat.level_07_BestScore);
objMenuPop.best_score.htmlText = String(defSys.dat.level_07_PerfectScore);
} else {
if (_type == 8){
objMenuPop.title_map.htmlText = String(" Battle 8");
objMenuPop.your_score.htmlText = String(defSys.dat.level_08_BestScore);
objMenuPop.best_score.htmlText = String(defSys.dat.level_08_PerfectScore);
} else {
if (_type == 9){
objMenuPop.title_map.htmlText = String(" Battle 9");
objMenuPop.your_score.htmlText = String(defSys.dat.level_09_BestScore);
objMenuPop.best_score.htmlText = String(defSys.dat.level_09_PerfectScore);
} else {
if (_type == 10){
objMenuPop.title_map.htmlText = String(" Battle 10");
objMenuPop.your_score.htmlText = String(defSys.dat.level_10_BestScore);
objMenuPop.best_score.htmlText = String(defSys.dat.level_10_PerfectScore);
} else {
if (_type == 11){
objMenuPop.title_map.htmlText = String(" Battle 11");
objMenuPop.your_score.htmlText = String(defSys.dat.level_11_BestScore);
objMenuPop.best_score.htmlText = String(defSys.dat.level_11_PerfectScore);
} else {
if (_type == 12){
objMenuPop.title_map.htmlText = String(" Battle 12");
objMenuPop.your_score.htmlText = String(defSys.dat.level_12_BestScore);
objMenuPop.best_score.htmlText = String(defSys.dat.level_12_PerfectScore);
} else {
if (_type == 13){
objMenuPop.title_map.htmlText = String(" Battle 13");
objMenuPop.your_score.htmlText = String(defSys.dat.level_13_BestScore);
objMenuPop.best_score.htmlText = String(defSys.dat.level_13_PerfectScore);
} else {
if (_type == 14){
objMenuPop.title_map.htmlText = String(" Battle 14");
objMenuPop.your_score.htmlText = String(defSys.dat.level_14_BestScore);
objMenuPop.best_score.htmlText = String(defSys.dat.level_14_PerfectScore);
} else {
if (_type == 15){
objMenuPop.title_map.htmlText = String(" Final Battle");
objMenuPop.your_score.htmlText = String(defSys.dat.level_15_BestScore);
objMenuPop.best_score.htmlText = String(defSys.dat.level_15_PerfectScore);
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
trace("i m in");
}
private function stage5Click(event:MouseEvent):void{
destroy();
defSys.game_lv = 5;
defSys.gmState = 2;
}
private function stage1Click(event:MouseEvent):void{
destroy();
defSys.game_lv = 1;
defSys.gmState = 2;
}
private function playMoreClick(event:MouseEvent):void{
var targetURL:URLRequest;
targetURL = new URLRequest(defSys.playMoreLink);
navigateToURL(targetURL, "_blank");
}
private function yesClick(event:MouseEvent):void{
destroy();
defSys.gmState = 1;
}
private function stage14Click(event:MouseEvent):void{
destroy();
defSys.game_lv = 14;
defSys.gmState = 2;
}
private function stage3Over(event:MouseEvent):void{
showPopUp(objMap.stage3, 3);
}
private function stage4Over(event:MouseEvent):void{
showPopUp(objMap.stage4, 4);
}
private function stage10Click(event:MouseEvent):void{
destroy();
defSys.game_lv = 10;
defSys.gmState = 2;
}
private function stage6Over(event:MouseEvent):void{
showPopUp(objMap.stage6, 6);
}
private function stage7Over(event:MouseEvent):void{
showPopUp(objMap.stage7, 7);
}
private function stage1Over(event:MouseEvent):void{
showPopUp(objMap.stage1, 1);
}
private function stage9Over(event:MouseEvent):void{
showPopUp(objMap.stage9, 9);
}
private function stage6Click(event:MouseEvent):void{
destroy();
defSys.game_lv = 6;
defSys.gmState = 2;
}
private function stage5Over(event:MouseEvent):void{
showPopUp(objMap.stage5, 5);
}
private function stage2Click(event:MouseEvent):void{
destroy();
defSys.game_lv = 2;
defSys.gmState = 2;
}
private function stage8Over(event:MouseEvent):void{
showPopUp(objMap.stage8, 8);
}
private function stage2Over(event:MouseEvent):void{
showPopUp(objMap.stage2, 2);
}
private function quitClick(event:MouseEvent):void{
if (objConfirm == null){
objConfirm = new exit_confirm_mc();
defSys.contMenu.addChild(objConfirm);
objConfirm.bYes.addEventListener(MouseEvent.CLICK, yesClick, false, 0, true);
objConfirm.bNo.addEventListener(MouseEvent.CLICK, noClick, false, 0, true);
};
}
public function destroy(){
if (objConfirm){
objConfirm.removeEventListener(MouseEvent.CLICK, yesClick);
objConfirm.removeEventListener(MouseEvent.CLICK, noClick);
defSys.contMenu.removeChild(objConfirm);
objConfirm = null;
};
inactive();
objMap.stage1.removeEventListener(MouseEvent.CLICK, stage1Click);
objMap.stage1.removeEventListener(MouseEvent.MOUSE_OVER, stage1Over);
objMap.stage2.removeEventListener(MouseEvent.CLICK, stage2Click);
objMap.stage2.removeEventListener(MouseEvent.MOUSE_OVER, stage2Over);
objMap.stage3.removeEventListener(MouseEvent.CLICK, stage3Click);
objMap.stage3.removeEventListener(MouseEvent.MOUSE_OVER, stage3Over);
objMap.stage4.removeEventListener(MouseEvent.CLICK, stage4Click);
objMap.stage4.removeEventListener(MouseEvent.MOUSE_OVER, stage4Over);
objMap.stage5.removeEventListener(MouseEvent.CLICK, stage5Click);
objMap.stage5.removeEventListener(MouseEvent.MOUSE_OVER, stage5Over);
objMap.stage6.removeEventListener(MouseEvent.CLICK, stage6Click);
objMap.stage6.removeEventListener(MouseEvent.MOUSE_OVER, stage6Over);
objMap.stage7.removeEventListener(MouseEvent.CLICK, stage7Click);
objMap.stage7.removeEventListener(MouseEvent.MOUSE_OVER, stage7Over);
objMap.stage8.removeEventListener(MouseEvent.CLICK, stage8Click);
objMap.stage8.removeEventListener(MouseEvent.MOUSE_OVER, stage8Over);
objMap.stage9.removeEventListener(MouseEvent.CLICK, stage9Click);
objMap.stage9.removeEventListener(MouseEvent.MOUSE_OVER, stage9Over);
objMap.stage10.removeEventListener(MouseEvent.CLICK, stage10Click);
objMap.stage10.removeEventListener(MouseEvent.MOUSE_OVER, stage10Over);
objMap.stage11.removeEventListener(MouseEvent.CLICK, stage11Click);
objMap.stage11.removeEventListener(MouseEvent.MOUSE_OVER, stage11Over);
objMap.stage12.removeEventListener(MouseEvent.CLICK, stage12Click);
objMap.stage12.removeEventListener(MouseEvent.MOUSE_OVER, stage12Over);
objMap.stage13.removeEventListener(MouseEvent.CLICK, stage13Click);
objMap.stage13.removeEventListener(MouseEvent.MOUSE_OVER, stage13Over);
objMap.stage14.removeEventListener(MouseEvent.CLICK, stage14Click);
objMap.stage14.removeEventListener(MouseEvent.MOUSE_OVER, stage14Over);
objMap.stage15.removeEventListener(MouseEvent.CLICK, stage15Click);
objMap.stage15.removeEventListener(MouseEvent.MOUSE_OVER, stage15Over);
objMap.bQuit.removeEventListener(MouseEvent.CLICK, quitClick);
objMap.bSave.removeEventListener(MouseEvent.CLICK, saveClick);
objMap.bPlayMore.removeEventListener(MouseEvent.CLICK, playMoreClick);
objMap.bSkill.removeEventListener(MouseEvent.CLICK, skillClick);
dispCont.removeChild(objMap);
objMap = null;
}
}
}//package DefX.GUI
Section 71
//BattleArmy (DefX.System.BattleArmy)
package DefX.System {
import DefX.Army.*;
public class BattleArmy {
public var unit;
private var defSys;
private var mGUI;
private var mBase;
public function BattleArmy(_DefSys, _mBase, _mGUI){
super();
defSys = _DefSys;
mBase = _mBase;
mGUI = _mGUI;
unit = new SpawnArmy(defSys, mBase, mGUI);
}
public function forceEnemyArmyDead(){
var container:*;
var numChild:int;
var children:Array;
var i:int;
container = defSys.contArmy;
numChild = container.numChildren;
children = new Array(numChild);
i = 0;
i = 0;
while (i < numChild) {
children[i] = container.getChildAt(i);
i++;
};
i = 0;
while (i < numChild) {
if (children[i].statDef.isEnemy()){
children[i].forceDeath();
};
i++;
};
unit.stopSpawn();
}
public function update(){
if (unit){
unit.updateSpawn();
};
}
public function forcePlayerArmyDead(){
var container:*;
var numChild:int;
var children:Array;
var i:int;
container = defSys.contArmy;
numChild = container.numChildren;
children = new Array(numChild);
i = 0;
i = 0;
while (i < numChild) {
children[i] = container.getChildAt(i);
i++;
};
i = 0;
while (i < numChild) {
if (children[i].statDef.isAlly()){
children[i].forceDeath();
};
i++;
};
unit.stopSpawn();
}
public function initialise(){
}
public function destroy(){
terminateAllArmy();
unit.destroy();
defSys = null;
}
public function terminateAllArmy(){
var container:*;
var numChild:int;
var children:Array;
var i:int;
container = defSys.contArmy;
numChild = container.numChildren;
children = new Array(numChild);
i = 0;
i = 0;
while (i < numChild) {
children[i] = container.getChildAt(i);
i++;
};
i = 0;
while (i < numChild) {
children[i].destroy();
i++;
};
unit.stopSpawn();
}
}
}//package DefX.System
Section 72
//BattleBaseBG (DefX.System.BattleBaseBG)
package DefX.System {
import flash.events.*;
import FZBase.Vector.*;
import DefX.Army.*;
import DefX.Bullet.*;
public class BattleBaseBG {
const _COST_BARRIER = 1500;
const _COST_DRAGON = 2500;
const _COST_WIZARD = 100;
const _COST_ELF = 10;
const _COST_DWARF = 25;
const _COST_ANGEL = 4000;
const _COST_GOLEM = 300;
const _COST_TRAP = 1000;
const _COST_TURRET = 1000;
const _COST_HOBBIT = 5;
public var angelTimerMax:int;// = 600
public var manaBoostTimer:int;// = 0
public var specialTimer:int;// = 0
public var dragonTimerMax:int;// = 400
public var light_castle_health:int;// = 5000
public var manaBoostFlag:Boolean;// = false
public var golemTimerMax:int;// = 200
private var objTurret2MC;
public var trapFlag:Boolean;// = false
public var max_mana:int;// = 50
public var mana_regen:Number;// = 0.5
public var mana:Number;// = 50
public var battle_state:int;// = 0
private var objInfo;
public var light_castle_max_health:int;// = 5000
private var objTrapMC;
private var objBarrierMC;
public var wizardTimerMax:int;// = 100
public var hobbitTimer:int;// = 0
public var golemTimer:int;// = 0
public var dark_castle_health:int;// = 5000
public var turretFlag:Boolean;// = false
public var dwarfTimer:int;// = 0
public var arrowThunderTimer:int;// = 0
public var enemyTurretTimer:int;// = 0
private var defSys;
public var playerTurretTimer:int;// = 0
private var objCannonMC;
public var arrowThunderTimerMax:int;// = 24
public var manaBoostTimerMax:int;// = 24
private var objBg;
private var objTurretMC;
public var elfTimerMax:int;// = 30
public var arrowBasicTimer:int;// = 0
public var wizardTimer:int;// = 0
public var arrowIceTimer:int;// = 0
public var arrowBasicTimerMax:int;// = 24
public var arrowFireTimer:int;// = 0
public var mArmy;
public var dark_castle_max_health:int;// = 5000
public var specialTimerMax:int;// = 3000
public var arrowIceTimerMax:int;// = 24
public var barrierFlag:Boolean;// = false
public var angelTimer:int;// = 0
public var _COST_MANABOOST;// = 200
public var dwarfTimerMax:int;// = 50
public var objLCastleMC;
public var elfTimer:int;// = 0
public var hobbitTimerMax:int;// = 12
public var objDCastleMC;
public var arrowFireTimerMax:int;// = 24
public var dragonTimer:int;// = 0
public function BattleBaseBG(_defSys){
_COST_MANABOOST = 200;
light_castle_max_health = 5000;
light_castle_health = 5000;
max_mana = 50;
mana = 50;
mana_regen = 0.5;
dark_castle_max_health = 5000;
dark_castle_health = 5000;
turretFlag = false;
trapFlag = false;
barrierFlag = false;
manaBoostFlag = false;
manaBoostTimer = 0;
manaBoostTimerMax = 24;
specialTimer = 0;
specialTimerMax = 3000;
arrowBasicTimer = 0;
arrowBasicTimerMax = 24;
arrowFireTimer = 0;
arrowFireTimerMax = 24;
arrowThunderTimer = 0;
arrowThunderTimerMax = 24;
arrowIceTimer = 0;
arrowIceTimerMax = 24;
hobbitTimer = 0;
hobbitTimerMax = 12;
elfTimer = 0;
elfTimerMax = 30;
dwarfTimer = 0;
dwarfTimerMax = 50;
wizardTimer = 0;
wizardTimerMax = 100;
golemTimer = 0;
golemTimerMax = 200;
dragonTimer = 0;
dragonTimerMax = 400;
angelTimer = 0;
angelTimerMax = 600;
playerTurretTimer = 0;
enemyTurretTimer = 0;
battle_state = 0;
super();
defSys = _defSys;
}
public function shootBasicArrow():Boolean{
var arrow1:*;
var arrow2:*;
var arrow3:*;
if (arrowBasicTimer > 0){
return (false);
};
if (defSys.dat.arrowBasicLv == 1){
arrow1 = new basic_arrow();
arrow1.launch(defSys, new ArrowStatDef(1, new Vector2dArrow(objCannonMC.x, objCannonMC.y, objCannonMC.rotation, 12), defSys.dat.arrowBasicLv, 50));
arrowBasicTimerMax = 36;
} else {
if (defSys.dat.arrowBasicLv == 2){
arrow1 = new basic_arrow();
arrow1.launch(defSys, new ArrowStatDef(1, new Vector2dArrow(objCannonMC.x, objCannonMC.y, objCannonMC.rotation, 12), defSys.dat.arrowBasicLv, 50));
arrowBasicTimerMax = 24;
} else {
if (defSys.dat.arrowBasicLv == 3){
arrow1 = new basic_arrow();
arrow1.launch(defSys, new ArrowStatDef(1, new Vector2dArrow(objCannonMC.x, objCannonMC.y, objCannonMC.rotation, 6), defSys.dat.arrowBasicLv, 50));
arrow2 = new basic_arrow();
arrow2.launch(defSys, new ArrowStatDef(1, new Vector2dArrow(objCannonMC.x, objCannonMC.y, objCannonMC.rotation, 18), defSys.dat.arrowBasicLv, 50));
arrowBasicTimerMax = 16;
} else {
if (defSys.dat.arrowBasicLv == 4){
arrow1 = new basic_arrow();
arrow1.launch(defSys, new ArrowStatDef(1, new Vector2dArrow(objCannonMC.x, objCannonMC.y, objCannonMC.rotation, 6), defSys.dat.arrowBasicLv, 50));
arrow2 = new basic_arrow();
arrow2.launch(defSys, new ArrowStatDef(1, new Vector2dArrow(objCannonMC.x, objCannonMC.y, objCannonMC.rotation, 18), defSys.dat.arrowBasicLv, 50));
arrowBasicTimerMax = 12;
} else {
if (defSys.dat.arrowBasicLv == 5){
arrow1 = new basic_arrow();
arrow1.launch(defSys, new ArrowStatDef(1, new Vector2dArrow(objCannonMC.x, objCannonMC.y, objCannonMC.rotation, -8), defSys.dat.arrowBasicLv, 50));
arrow2 = new basic_arrow();
arrow2.launch(defSys, new ArrowStatDef(1, new Vector2dArrow(objCannonMC.x, objCannonMC.y, objCannonMC.rotation, 12), defSys.dat.arrowBasicLv, 50));
arrow3 = new basic_arrow();
arrow3.launch(defSys, new ArrowStatDef(1, new Vector2dArrow(objCannonMC.x, objCannonMC.y, objCannonMC.rotation, 32), defSys.dat.arrowBasicLv, 50));
arrowBasicTimerMax = 7;
};
};
};
};
};
arrowBasicTimer = arrowBasicTimerMax;
return (true);
}
public function setTurret():Boolean{
if (defSys.dat.turretLv <= 0){
return (false);
};
if (((turretFlag) || ((mana < _COST_TURRET)))){
return (false);
};
mana = Math.max((mana - _COST_TURRET), 0);
objTurretMC = new pro_turret_mc();
defSys.contCannon.addChild(objTurretMC);
objTurretMC.cacheAsBitmap = true;
objTurretMC.x = 120;
objTurretMC.y = 270;
turretFlag = true;
return (true);
}
public function shootFireArrow():Boolean{
var arrow1:*;
if (arrowFireTimer > 0){
return (false);
};
if (defSys.dat.arrowFireLv == 1){
arrow1 = new fire_arrow();
arrow1.launch(defSys, new ArrowStatDef(2, new Vector2dArrow(objCannonMC.x, objCannonMC.y, objCannonMC.rotation, 12), defSys.dat.arrowFireLv, 50));
arrowFireTimerMax = 160;
} else {
if (defSys.dat.arrowFireLv == 2){
arrow1 = new fire_arrow();
arrow1.launch(defSys, new ArrowStatDef(2, new Vector2dArrow(objCannonMC.x, objCannonMC.y, objCannonMC.rotation, 12), defSys.dat.arrowFireLv, 50));
arrowFireTimerMax = 130;
} else {
if (defSys.dat.arrowFireLv == 3){
arrow1 = new fire_arrow();
arrow1.launch(defSys, new ArrowStatDef(2, new Vector2dArrow(objCannonMC.x, objCannonMC.y, objCannonMC.rotation, 12), defSys.dat.arrowFireLv, 50));
arrowFireTimerMax = 110;
} else {
if (defSys.dat.arrowFireLv == 4){
arrow1 = new fire_arrow();
arrow1.launch(defSys, new ArrowStatDef(2, new Vector2dArrow(objCannonMC.x, objCannonMC.y, objCannonMC.rotation, 12), defSys.dat.arrowFireLv, 50));
arrowFireTimerMax = 100;
} else {
if (defSys.dat.arrowFireLv == 5){
arrow1 = new fire_arrow();
arrow1.launch(defSys, new ArrowStatDef(2, new Vector2dArrow(objCannonMC.x, objCannonMC.y, objCannonMC.rotation, 12), defSys.dat.arrowFireLv, 50));
arrowFireTimerMax = 100;
};
};
};
};
};
arrowFireTimer = arrowFireTimerMax;
return (true);
}
public function detectTarget(type:int=1):Object{
var target:*;
var container:*;
var numChild:int;
var children:Array;
var i:int;
target = null;
container = defSys.contArmy;
numChild = container.numChildren;
children = new Array(numChild);
i = 0;
i = 0;
while (i < numChild) {
children[i] = container.getChildAt(i);
i++;
};
i = 0;
while (i < numChild) {
if (type == 1){
if (((((children[i].isEnableHit()) && (children[i].statDef.isAlly()))) && ((children[i].x > 700)))){
target = children[i];
break;
};
} else {
if (((((children[i].isEnableHit()) && (children[i].statDef.isEnemy()))) && ((children[i].x < 500)))){
target = children[i];
break;
};
};
i++;
};
return (target);
}
public function getAngle(AX, AY, BX, BY):Number{
var dx:Number;
var dy:Number;
var angle:Number;
dx = (BX - AX);
dy = (BY - AY);
angle = (Math.atan2(dy, dx) * (180 / Math.PI));
return (angle);
}
public function init2(_mArmy){
mArmy = _mArmy;
if (defSys.game_lv == 1){
mArmy.unit.InitStage1();
};
if ((((defSys.game_lv == 1)) && ((defSys.dat.level_01_Play == 1)))){
objInfo = new instruct2_mc();
defSys.contMenu.addChild(objInfo);
objInfo.cacheAsBitmap = true;
objInfo.gotoAndPlay(1);
objInfo.addEventListener(Event.ENTER_FRAME, infoHandle, false, 0, true);
};
if (defSys.game_lv == 2){
mArmy.unit.InitStage2();
};
if (defSys.game_lv == 3){
mArmy.unit.InitStage3();
};
if (defSys.game_lv == 4){
mArmy.unit.InitStage4();
};
if (defSys.game_lv == 5){
mArmy.unit.InitStage5();
};
if (defSys.game_lv == 6){
mArmy.unit.InitStage6();
};
if (defSys.game_lv == 7){
mArmy.unit.InitStage7();
};
if (defSys.game_lv == 8){
mArmy.unit.InitStage8();
};
if (defSys.game_lv == 9){
mArmy.unit.InitStage9();
};
if (defSys.game_lv == 10){
mArmy.unit.InitStage10();
};
if (defSys.game_lv == 11){
mArmy.unit.InitStage11();
};
if (defSys.game_lv == 12){
mArmy.unit.InitStage12();
};
if (defSys.game_lv == 13){
mArmy.unit.InitStage13();
};
if (defSys.game_lv == 14){
mArmy.unit.InitStage14();
};
if (defSys.game_lv == 15){
mArmy.unit.InitStage15();
};
defSys.isPaused = false;
}
public function shootPlayerTurretHandle(){
var target:*;
var angle:*;
var bullet:*;
playerTurretTimer = Math.max((playerTurretTimer - 1), 0);
if (objTurretMC == null){
return;
};
if (playerTurretTimer > 0){
return;
};
target = detectTarget(2);
if (target == null){
return;
};
angle = getAngle(objTurretMC.x, objTurretMC.y, target.x, (target.y - Math.min(target.height, 50)));
bullet = new turret_player_bullet();
if (defSys.dat.turretLv == 1){
bullet.launch(defSys, new ArrowStatDef(10, new Vector2dArrow(objTurretMC.x, objTurretMC.y, angle, 0), defSys.dat.turretLv));
playerTurretTimer = 180;
} else {
if (defSys.dat.turretLv == 2){
bullet.launch(defSys, new ArrowStatDef(10, new Vector2dArrow(objTurretMC.x, objTurretMC.y, angle, 0), defSys.dat.turretLv));
playerTurretTimer = 120;
} else {
if (defSys.dat.turretLv == 3){
bullet.launch(defSys, new ArrowStatDef(10, new Vector2dArrow(objTurretMC.x, objTurretMC.y, angle, 0), defSys.dat.turretLv));
playerTurretTimer = 96;
} else {
if (defSys.dat.turretLv == 4){
bullet.launch(defSys, new ArrowStatDef(10, new Vector2dArrow(objTurretMC.x, objTurretMC.y, angle, 0), defSys.dat.turretLv));
playerTurretTimer = 64;
} else {
if (defSys.dat.turretLv == 5){
bullet.launch(defSys, new ArrowStatDef(10, new Vector2dArrow(objTurretMC.x, objTurretMC.y, angle, 0), defSys.dat.turretLv));
playerTurretTimer = 48;
};
};
};
};
};
}
public function shootThunderArrow():Boolean{
var arrow1:*;
if (arrowThunderTimer > 0){
return (false);
};
if (defSys.dat.arrowThunderLv == 1){
arrow1 = new thunder_arrow();
arrow1.launch(defSys, new ArrowStatDef(3, new Vector2dArrow(objCannonMC.x, objCannonMC.y, objCannonMC.rotation, 12), defSys.dat.arrowThunderLv, 50));
arrowThunderTimerMax = 160;
} else {
if (defSys.dat.arrowThunderLv == 2){
arrow1 = new thunder_arrow();
arrow1.launch(defSys, new ArrowStatDef(3, new Vector2dArrow(objCannonMC.x, objCannonMC.y, objCannonMC.rotation, 12), defSys.dat.arrowThunderLv, 50));
arrowThunderTimerMax = 130;
} else {
if (defSys.dat.arrowThunderLv == 3){
arrow1 = new thunder_arrow();
arrow1.launch(defSys, new ArrowStatDef(3, new Vector2dArrow(objCannonMC.x, objCannonMC.y, objCannonMC.rotation, 12), defSys.dat.arrowThunderLv, 50));
arrowThunderTimerMax = 110;
} else {
if (defSys.dat.arrowThunderLv == 4){
arrow1 = new thunder_arrow();
arrow1.launch(defSys, new ArrowStatDef(3, new Vector2dArrow(objCannonMC.x, objCannonMC.y, objCannonMC.rotation, 12), defSys.dat.arrowThunderLv, 50));
arrowThunderTimerMax = 100;
} else {
if (defSys.dat.arrowThunderLv == 5){
arrow1 = new thunder_arrow();
arrow1.launch(defSys, new ArrowStatDef(3, new Vector2dArrow(objCannonMC.x, objCannonMC.y, objCannonMC.rotation, 12), defSys.dat.arrowThunderLv, 50));
arrowThunderTimerMax = 100;
};
};
};
};
};
arrowThunderTimer = arrowThunderTimerMax;
return (true);
}
public function summonHobbit():Boolean{
if (defSys.dat.slot1Lv <= 0){
return (false);
};
if ((((mana < _COST_HOBBIT)) || ((hobbitTimer > 0)))){
return (false);
};
mana = Math.max((mana - _COST_HOBBIT), 0);
hobbitTimer = hobbitTimerMax;
mArmy.unit.createHobbit(defSys.dat.slot1Lv);
return (true);
}
public function damagePlayerCastle(val:int=0){
var dmg:int;
dmg = val;
if (barrierFlag){
if (defSys.dat.barrierLv == 1){
dmg = (dmg * 0.8);
} else {
if (defSys.dat.barrierLv == 2){
dmg = (dmg * 0.7);
} else {
if (defSys.dat.barrierLv == 3){
dmg = (dmg * 0.6);
} else {
if (defSys.dat.barrierLv == 4){
dmg = (dmg * 0.5);
} else {
if (defSys.dat.barrierLv == 5){
dmg = (dmg * 0.4);
};
};
};
};
};
};
light_castle_health = Math.max((light_castle_health - dmg), 0);
objLCastleMC.health.scaleY = (light_castle_health / light_castle_max_health);
if ((((objLCastleMC.health.scaleY < 0.6)) && ((objLCastleMC.currentFrame == 1)))){
objLCastleMC.gotoAndPlay("state2");
};
if ((((objLCastleMC.health.scaleY < 0.3)) && ((objLCastleMC.currentLabel == "state2")))){
objLCastleMC.gotoAndPlay("state3");
};
if ((((objLCastleMC.health.scaleY <= 0)) && ((objLCastleMC.currentLabel == "state3")))){
objLCastleMC.gotoAndPlay("destroy");
if (objTurretMC){
defSys.contCannon.removeChild(objTurretMC);
objTurretMC = null;
};
if (objBarrierMC){
defSys.contCannon.removeChild(objBarrierMC);
objBarrierMC = null;
};
if (objTrapMC){
defSys.contCannon.removeChild(objTrapMC);
objTrapMC = null;
};
if (objCannonMC){
defSys.contCastle.removeChild(objCannonMC);
objCannonMC = null;
};
battle_state = 2;
mArmy.forcePlayerArmyDead();
};
}
public function summonDragon():Boolean{
if (defSys.dat.slot6Lv <= 0){
return (false);
};
if ((((mana < _COST_DRAGON)) || ((dragonTimer > 0)))){
return (false);
};
mana = Math.max((mana - _COST_DRAGON), 0);
dragonTimer = dragonTimerMax;
mArmy.unit.createDragon(defSys.dat.slot6Lv);
return (true);
}
public function trapAttackHandle(){
var sndHit:*;
var container:*;
var numChild:int;
var children:Array;
var i:int;
var power:int;
if (objTrapMC == null){
return;
};
if (objTrapMC.currentFrame == 81){
sndHit = new trap_shoot();
sndHit.playSound();
};
if (objTrapMC.currentLabel == "hit"){
container = defSys.contArmy;
numChild = container.numChildren;
children = new Array(numChild);
i = 0;
i = 0;
while (i < numChild) {
children[i] = container.getChildAt(i);
i++;
};
i = 0;
while (i < numChild) {
if (children[i].statDef.isEnemy()){
if (objTrapMC.attackBox.hitTestObject(children[i].hitBox)){
power = 20;
if (defSys.dat.trapLv == 2){
power = 30;
} else {
if (defSys.dat.trapLv == 3){
power = 40;
} else {
if (defSys.dat.trapLv == 4){
power = 50;
} else {
if (defSys.dat.trapLv == 5){
power = 70;
};
};
};
};
if (children[i].statDef.isWeakCreature()){
children[i].setHit(1, power);
} else {
children[i].setHit(0, power);
};
};
};
i++;
};
};
}
private function infoHandle(event:Event):void{
if (objInfo.currentFrame == objInfo.totalFrames){
objInfo.removeEventListener(Event.ENTER_FRAME, infoHandle);
defSys.contMenu.removeChild(objInfo);
objInfo = null;
};
}
public function shootIceArrow():Boolean{
var arrow1:*;
if (arrowIceTimer > 0){
return (false);
};
if (defSys.dat.arrowIceLv == 1){
arrow1 = new ice_arrow();
arrow1.launch(defSys, new ArrowStatDef(4, new Vector2dArrow(objCannonMC.x, objCannonMC.y, objCannonMC.rotation, 12), defSys.dat.arrowIceLv, 50));
arrowIceTimerMax = 160;
} else {
if (defSys.dat.arrowIceLv == 2){
arrow1 = new ice_arrow();
arrow1.launch(defSys, new ArrowStatDef(4, new Vector2dArrow(objCannonMC.x, objCannonMC.y, objCannonMC.rotation, 12), defSys.dat.arrowIceLv, 50));
arrowIceTimerMax = 130;
} else {
if (defSys.dat.arrowIceLv == 3){
arrow1 = new ice_arrow();
arrow1.launch(defSys, new ArrowStatDef(4, new Vector2dArrow(objCannonMC.x, objCannonMC.y, objCannonMC.rotation, 12), defSys.dat.arrowIceLv, 50));
arrowIceTimerMax = 110;
} else {
if (defSys.dat.arrowIceLv == 4){
arrow1 = new ice_arrow();
arrow1.launch(defSys, new ArrowStatDef(4, new Vector2dArrow(objCannonMC.x, objCannonMC.y, objCannonMC.rotation, 12), defSys.dat.arrowIceLv, 50));
arrowIceTimerMax = 100;
} else {
if (defSys.dat.arrowIceLv == 5){
arrow1 = new ice_arrow();
arrow1.launch(defSys, new ArrowStatDef(4, new Vector2dArrow(objCannonMC.x, objCannonMC.y, objCannonMC.rotation, 12), defSys.dat.arrowIceLv, 50));
arrowIceTimerMax = 100;
};
};
};
};
};
arrowIceTimer = arrowIceTimerMax;
return (true);
}
public function setTurret2():Boolean{
if (objTurret2MC){
return (false);
};
objTurret2MC = new enemy_turret_mc();
defSys.contCannon.addChild(objTurret2MC);
objTurret2MC.cacheAsBitmap = true;
objTurret2MC.x = 1050;
objTurret2MC.y = 270;
return (true);
}
public function castSpecial():Boolean{
var arrowSp:Array;
var i:int;
var dx:int;
var dy:int;
if (specialTimer > 0){
return (false);
};
arrowSp = new Array(100);
i = 0;
dx = 100;
dy = -100;
if (defSys.dat.specialLv == 1){
i = 0;
while (i < 40) {
arrowSp[i] = new special_arrow();
arrowSp[i].launch(defSys, new ArrowStatDef(5, new Vector2dArrow(dx, dy, 90), defSys.dat.specialLv, 0));
dx = (dx + 25);
dy = (-100 + (Math.random() * -1000));
i++;
};
} else {
if (defSys.dat.specialLv == 2){
i = 0;
while (i < 50) {
arrowSp[i] = new special_arrow();
arrowSp[i].launch(defSys, new ArrowStatDef(5, new Vector2dArrow(dx, dy, 90), defSys.dat.specialLv, 0));
dx = (dx + 20);
dy = (-100 + (Math.random() * -1000));
i++;
};
} else {
if (defSys.dat.specialLv == 3){
i = 0;
while (i < 62) {
arrowSp[i] = new special_arrow();
arrowSp[i].launch(defSys, new ArrowStatDef(5, new Vector2dArrow(dx, dy, 90), defSys.dat.specialLv, 0));
dx = (dx + 16);
dy = (-100 + (Math.random() * -1000));
i++;
};
} else {
if (defSys.dat.specialLv == 4){
i = 0;
while (i < 71) {
arrowSp[i] = new special_arrow();
arrowSp[i].launch(defSys, new ArrowStatDef(5, new Vector2dArrow(dx, dy, 90), defSys.dat.specialLv, 0));
dx = (dx + 14);
dy = (-100 + (Math.random() * -1000));
i++;
};
} else {
i = 0;
while (i < 100) {
arrowSp[i] = new special_arrow();
arrowSp[i].launch(defSys, new ArrowStatDef(5, new Vector2dArrow(dx, dy, 90), defSys.dat.specialLv, 0));
dx = (dx + 10);
dy = (-100 + (Math.random() * -1000));
i++;
};
};
};
};
};
specialTimer = specialTimerMax;
return (true);
}
public function summonDwarf():Boolean{
if (defSys.dat.slot3Lv <= 0){
return (false);
};
if ((((mana < _COST_DWARF)) || ((dwarfTimer > 0)))){
return (false);
};
mana = Math.max((mana - _COST_DWARF), 0);
dwarfTimer = dwarfTimerMax;
mArmy.unit.createDwarf(defSys.dat.slot3Lv);
return (true);
}
public function shootEnemyTurretHandle(){
var target:*;
var angle:*;
var powerLv:int;
var bullet:*;
enemyTurretTimer = Math.max((enemyTurretTimer - 1), 0);
if (objTurret2MC == null){
return;
};
if (enemyTurretTimer > 0){
return;
};
target = detectTarget(1);
if (target == null){
return;
};
angle = getAngle(objTurret2MC.x, objTurret2MC.y, target.x, (target.y - Math.min(target.height, 50)));
powerLv = 1;
if ((((defSys.game_lv > 10)) && ((defSys.game_lv <= 14)))){
powerLv = 2;
};
if ((((defSys.game_lv > 14)) && ((defSys.game_lv <= 16)))){
powerLv = 3;
};
if ((((defSys.game_lv > 16)) && ((defSys.game_lv <= 18)))){
powerLv = 4;
};
if (defSys.game_lv > 18){
powerLv = 5;
};
bullet = new turret_enemy_bullet();
bullet.launch(defSys, new ArrowStatDef(11, new Vector2dArrow(objTurret2MC.x, objTurret2MC.y, angle, 0), powerLv));
enemyTurretTimer = 50;
}
public function summonAngel():Boolean{
if (defSys.dat.slot7Lv <= 0){
return (false);
};
if ((((mana < _COST_ANGEL)) || ((angelTimer > 0)))){
return (false);
};
mana = Math.max((mana - _COST_ANGEL), 0);
angelTimer = angelTimerMax;
mArmy.unit.createAngel(defSys.dat.slot7Lv);
return (true);
}
public function setTrap():Boolean{
if (defSys.dat.trapLv <= 0){
return (false);
};
if (((trapFlag) || ((mana < _COST_TRAP)))){
return (false);
};
mana = Math.max((mana - _COST_TRAP), 0);
objTrapMC = new trap_mc();
defSys.contCannon.addChild(objTrapMC);
objTrapMC.cacheAsBitmap = true;
objTrapMC.x = 700;
objTrapMC.y = 400;
trapFlag = true;
return (true);
}
public function initialise(){
battle_state = 0;
defSys.tmpScore = 0;
defSys.tmpExp = 0;
objBg = new background();
defSys.contBg.addChild(objBg);
objBg.cacheAsBitmap = true;
objBg.x = 0;
objBg.y = 0;
objLCastleMC = new pro_tower_mc();
defSys.contCastle.addChild(objLCastleMC);
objLCastleMC.cacheAsBitmap = true;
objLCastleMC.x = 0;
objLCastleMC.y = 150;
objLCastleMC.gotoAndStop(1);
objDCastleMC = new enemy_tower_mc();
defSys.contCastle.addChild(objDCastleMC);
objDCastleMC.cacheAsBitmap = true;
objDCastleMC.x = 1060;
objDCastleMC.y = 155;
objDCastleMC.gotoAndStop(1);
objCannonMC = new pro_arrow_mc();
defSys.contCastle.addChild(objCannonMC);
objCannonMC.cacheAsBitmap = true;
objCannonMC.x = 100;
objCannonMC.y = 340;
light_castle_max_health = 4000;
if (defSys.dat.castleLv == 1){
light_castle_max_health = 5000;
} else {
if (defSys.dat.castleLv == 2){
light_castle_max_health = 5500;
} else {
if (defSys.dat.castleLv == 3){
light_castle_max_health = 6000;
} else {
if (defSys.dat.castleLv == 4){
light_castle_max_health = 7000;
} else {
if (defSys.dat.castleLv == 5){
light_castle_max_health = 8000;
};
};
};
};
};
light_castle_health = light_castle_max_health;
max_mana = 50;
if (defSys.dat.manaStockLv == 1){
max_mana = 100;
} else {
if (defSys.dat.manaStockLv == 2){
max_mana = 200;
} else {
if (defSys.dat.manaStockLv == 3){
max_mana = 400;
} else {
if (defSys.dat.manaStockLv == 4){
max_mana = 600;
} else {
if (defSys.dat.manaStockLv == 5){
max_mana = 1000;
};
};
};
};
};
mana = 0;
mana_regen = 0.0002;
if (defSys.dat.manaRegenLv == 1){
mana_regen = 0.0003;
} else {
if (defSys.dat.manaRegenLv == 2){
mana_regen = 0.0004;
} else {
if (defSys.dat.manaRegenLv == 3){
mana_regen = 0.0005;
} else {
if (defSys.dat.manaRegenLv == 4){
mana_regen = 0.0006;
} else {
if (defSys.dat.manaRegenLv == 5){
mana_regen = 0.0007;
};
};
};
};
};
_COST_MANABOOST = Math.round((max_mana * 0.4));
turretFlag = false;
trapFlag = false;
barrierFlag = false;
manaBoostFlag = false;
manaBoostTimer = 0;
specialTimer = 0;
arrowBasicTimer = 0;
arrowFireTimer = 0;
arrowThunderTimer = 0;
arrowIceTimer = 0;
hobbitTimer = 0;
elfTimer = 0;
dwarfTimer = 0;
wizardTimer = 0;
golemTimer = 0;
dragonTimer = 0;
angelTimer = 0;
if (defSys.game_lv == 1){
dark_castle_max_health = 3000;
} else {
if (defSys.game_lv == 2){
dark_castle_max_health = 5000;
} else {
if (defSys.game_lv == 3){
dark_castle_max_health = 6000;
} else {
if (defSys.game_lv == 4){
dark_castle_max_health = 7000;
} else {
if (defSys.game_lv == 5){
dark_castle_max_health = 8000;
} else {
if (defSys.game_lv == 6){
dark_castle_max_health = 9000;
} else {
if (defSys.game_lv == 7){
dark_castle_max_health = 10000;
setTurret2();
} else {
if (defSys.game_lv == 8){
dark_castle_max_health = 11000;
setTurret2();
} else {
if (defSys.game_lv == 9){
dark_castle_max_health = 12000;
setTurret2();
} else {
if (defSys.game_lv == 10){
dark_castle_max_health = 13000;
setTurret2();
} else {
if (defSys.game_lv == 11){
dark_castle_max_health = 14000;
setTurret2();
} else {
if (defSys.game_lv == 12){
dark_castle_max_health = 15000;
setTurret2();
} else {
if (defSys.game_lv == 13){
dark_castle_max_health = 16000;
setTurret2();
} else {
if (defSys.game_lv == 14){
dark_castle_max_health = 17000;
setTurret2();
} else {
if (defSys.game_lv == 15){
dark_castle_max_health = 20000;
setTurret2();
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
dark_castle_health = dark_castle_max_health;
playerTurretTimer = 100;
enemyTurretTimer = 100;
}
public function summonWizard():Boolean{
if (defSys.dat.slot4Lv <= 0){
return (false);
};
if ((((mana < _COST_WIZARD)) || ((wizardTimer > 0)))){
return (false);
};
mana = Math.max((mana - _COST_WIZARD), 0);
wizardTimer = wizardTimerMax;
mArmy.unit.createWizard(defSys.dat.slot4Lv);
return (true);
}
public function setMana():Boolean{
if ((((((mana < _COST_MANABOOST)) || ((manaBoostTimer > 0)))) || ((max_mana >= 9999)))){
return (false);
};
mana = Math.max((mana - _COST_MANABOOST), 0);
max_mana = Math.min((max_mana + (max_mana * 0.2)), 9999);
_COST_MANABOOST = Math.round((max_mana * 0.4));
manaBoostTimer = manaBoostTimerMax;
return (true);
}
public function summonGolem():Boolean{
if (defSys.dat.slot5Lv <= 0){
return (false);
};
if ((((mana < _COST_GOLEM)) || ((golemTimer > 0)))){
return (false);
};
mana = Math.max((mana - _COST_GOLEM), 0);
golemTimer = golemTimerMax;
mArmy.unit.createGolem(defSys.dat.slot5Lv);
return (true);
}
public function damageEnemyCastle(dmg:int=0){
dark_castle_health = Math.max((dark_castle_health - dmg), 0);
objDCastleMC.health.scaleY = (dark_castle_health / dark_castle_max_health);
if ((((objDCastleMC.health.scaleY < 0.8)) && ((objDCastleMC.currentFrame == 1)))){
objDCastleMC.gotoAndPlay("state2");
};
if ((((objDCastleMC.health.scaleY < 0.6)) && ((objDCastleMC.currentLabel == "state2")))){
objDCastleMC.gotoAndPlay("state3");
};
if ((((objDCastleMC.health.scaleY < 0.3)) && ((objDCastleMC.currentLabel == "state3")))){
objDCastleMC.gotoAndPlay("state4");
};
if ((((objDCastleMC.health.scaleY <= 0)) && ((objDCastleMC.currentLabel == "state4")))){
objDCastleMC.gotoAndPlay("destroy");
if (objTurret2MC){
defSys.contCannon.removeChild(objTurret2MC);
objTurret2MC = null;
};
if (defSys.game_lv == 15){
mArmy.unit.stopSpawn();
mArmy.unit.setupBoss();
mArmy.unit.setupGoblin(2000, 999999, 5);
mArmy.unit.setupOrc(3000, 999999, 5);
mArmy.unit.setupOgre(6000, 999999, 5);
mArmy.unit.setupTroll(12000, 999999, 5);
defSys.playBgmFinal();
} else {
battle_state = 1;
mArmy.forceEnemyArmyDead();
};
};
}
public function update(){
if (battle_state != 0){
return;
};
if (defSys.isPaused){
return;
};
if (objCannonMC){
if (defSys.getCtrl().getKeyHold().KEY_UP){
if (objCannonMC.rotation > -60){
objCannonMC.rotation = (objCannonMC.rotation - 1.5);
};
};
if (defSys.getCtrl().getKeyHold().KEY_DOWN){
if (objCannonMC.rotation < 60){
objCannonMC.rotation = (objCannonMC.rotation + 1.5);
};
};
if (defSys.getCtrl().getKeyHold().KEY_A){
shootBasicArrow();
};
if (defSys.getCtrl().getKeyHold().KEY_S){
shootFireArrow();
};
if (defSys.getCtrl().getKeyHold().KEY_D){
shootThunderArrow();
};
if (defSys.getCtrl().getKeyHold().KEY_F){
shootIceArrow();
};
};
if (defSys.getCtrl().getKeyHold().KEY_LEFT){
defSys.scrollX(8);
};
if (defSys.getCtrl().getKeyHold().KEY_RIGHT){
defSys.scrollX(-8);
};
if (defSys.getCtrl().getKeyPress().KEY_SPACE){
castSpecial();
};
if (defSys.getCtrl().getKeyHold().KEY_Q){
setTurret();
};
if (defSys.getCtrl().getKeyHold().KEY_W){
setBarrier();
};
if (defSys.getCtrl().getKeyHold().KEY_E){
setTrap();
};
if (defSys.getCtrl().getKeyHold().KEY_R){
setMana();
};
if (defSys.getCtrl().getKeyPress().KEY_1){
summonHobbit();
};
if (defSys.getCtrl().getKeyPress().KEY_2){
summonElf();
};
if (defSys.getCtrl().getKeyPress().KEY_3){
summonDwarf();
};
if (defSys.getCtrl().getKeyPress().KEY_4){
summonWizard();
};
if (defSys.getCtrl().getKeyPress().KEY_5){
summonGolem();
};
if (defSys.getCtrl().getKeyPress().KEY_6){
summonDragon();
};
if (defSys.getCtrl().getKeyPress().KEY_7){
summonAngel();
};
mana = Math.min((mana + (max_mana * mana_regen)), max_mana);
if (max_mana < 9999){
manaBoostTimer = Math.max((manaBoostTimer - 1), 0);
};
specialTimer = Math.max((specialTimer - 1), 0);
arrowBasicTimer = Math.max((arrowBasicTimer - 1), 0);
arrowFireTimer = Math.max((arrowFireTimer - 1), 0);
arrowThunderTimer = Math.max((arrowThunderTimer - 1), 0);
arrowIceTimer = Math.max((arrowIceTimer - 1), 0);
hobbitTimer = Math.max((hobbitTimer - 1), 0);
elfTimer = Math.max((elfTimer - 1), 0);
dwarfTimer = Math.max((dwarfTimer - 1), 0);
wizardTimer = Math.max((wizardTimer - 1), 0);
golemTimer = Math.max((golemTimer - 1), 0);
dragonTimer = Math.max((dragonTimer - 1), 0);
angelTimer = Math.max((angelTimer - 1), 0);
shootPlayerTurretHandle();
shootEnemyTurretHandle();
trapAttackHandle();
}
public function setBarrier():Boolean{
if (defSys.dat.barrierLv <= 0){
return (false);
};
if (((barrierFlag) || ((mana < _COST_BARRIER)))){
return (false);
};
mana = Math.max((mana - _COST_BARRIER), 0);
objBarrierMC = new barrier_mc();
defSys.contCannon.addChild(objBarrierMC);
objBarrierMC.cacheAsBitmap = true;
objBarrierMC.x = 150;
objBarrierMC.y = 400;
barrierFlag = true;
return (true);
}
public function destroy(){
if (objInfo){
objInfo.removeEventListener(Event.ENTER_FRAME, infoHandle);
defSys.contMenu.removeChild(objInfo);
objInfo = null;
};
if (objBg){
defSys.contBg.removeChild(objBg);
objBg = null;
};
if (objCannonMC){
defSys.contCastle.removeChild(objCannonMC);
objCannonMC = null;
};
if (objLCastleMC){
defSys.contCastle.removeChild(objLCastleMC);
objLCastleMC = null;
};
if (objDCastleMC){
defSys.contCastle.removeChild(objDCastleMC);
objDCastleMC = null;
};
if (objTurretMC){
defSys.contCannon.removeChild(objTurretMC);
objTurretMC = null;
};
if (objTurret2MC){
defSys.contCannon.removeChild(objTurret2MC);
objTurret2MC = null;
};
if (objBarrierMC){
defSys.contCannon.removeChild(objBarrierMC);
objBarrierMC = null;
};
if (objTrapMC){
defSys.contCannon.removeChild(objTrapMC);
objTrapMC = null;
};
mArmy = null;
defSys = null;
}
public function summonElf():Boolean{
if (defSys.dat.slot2Lv <= 0){
return (false);
};
if ((((mana < _COST_ELF)) || ((elfTimer > 0)))){
return (false);
};
mana = Math.max((mana - _COST_ELF), 0);
elfTimer = elfTimerMax;
mArmy.unit.createElf(defSys.dat.slot2Lv);
return (true);
}
}
}//package DefX.System
Section 73
//BattleGUI (DefX.System.BattleGUI)
package DefX.System {
import flash.events.*;
import flash.net.*;
public class BattleGUI {
private var defSys;
private var rightScroll:Boolean;// = false
private var frameSkip:Number;// = 0
private var delayCtr:int;// = 100
private var leftScroll:Boolean;// = false
private var objFINISH;
private var objUI;
public var objPOP;
private var mBase;
private var withSound:Boolean;// = true
private var winFlag:Boolean;// = false
private var showFinish:Boolean;// = false
public function BattleGUI(_defSys){
showFinish = false;
withSound = true;
leftScroll = false;
rightScroll = false;
frameSkip = 0;
delayCtr = 100;
winFlag = false;
super();
defSys = _defSys;
}
private function expMouseOver(event:MouseEvent):void{
objPOP.showPopUp(objUI.tExp, objPOP._EXP_INFO);
}
private function playMoreMouseClick(event:MouseEvent):void{
var targetURL:URLRequest;
targetURL = new URLRequest(defSys.playMoreLink);
navigateToURL(targetURL, "_blank");
}
private function manaMouseClick(event:MouseEvent):void{
if (defSys.isPaused == false){
mBase.setMana();
};
}
public function showConclusion(win:Boolean=false){
if (showFinish == false){
delayCtr = 100;
winFlag = win;
showFinish = true;
defSys.contMenu.addEventListener(Event.ENTER_FRAME, conclusionHandle, false, 0, true);
};
}
private function frameHandle(event:Event):void{
var player_unit:int;
var enemy_unit:int;
var container:*;
var numChild:int;
var children:Array;
var i:int;
if (leftScroll){
defSys.scrollX(8);
};
if (rightScroll){
defSys.scrollX(-8);
};
if ((frameSkip % 6) == 0){
if (objUI.mManaBar){
objUI.mManaBar.mana_now.htmlText = String(Math.round(mBase.mana));
objUI.mManaBar.mana_total.htmlText = String(mBase.max_mana);
objUI.mManaBar.mana_bar_mc.scaleX = (Math.round(mBase.mana) / mBase.max_mana);
};
if (defSys.dat.arrowBasicLv > 0){
objUI.mBasicArrow.bar.scaleX = ((mBase.arrowBasicTimerMax - mBase.arrowBasicTimer) / mBase.arrowBasicTimerMax);
if (mBase.arrowBasicTimer == 0){
objUI.mBasicArrow.bar.visible = false;
objUI.mBasicArrow.gotoAndStop(3);
} else {
objUI.mBasicArrow.bar.visible = true;
objUI.mBasicArrow.gotoAndStop(2);
};
};
if (defSys.dat.arrowFireLv > 0){
objUI.mFireArrow.bar.scaleX = ((mBase.arrowFireTimerMax - mBase.arrowFireTimer) / mBase.arrowFireTimerMax);
if (mBase.arrowFireTimer == 0){
objUI.mFireArrow.bar.visible = false;
objUI.mFireArrow.gotoAndStop(3);
} else {
objUI.mFireArrow.bar.visible = true;
objUI.mFireArrow.gotoAndStop(2);
};
};
if (defSys.dat.arrowIceLv > 0){
objUI.mIceArrow.bar.scaleX = ((mBase.arrowIceTimerMax - mBase.arrowIceTimer) / mBase.arrowIceTimerMax);
if (mBase.arrowIceTimer == 0){
objUI.mIceArrow.bar.visible = false;
objUI.mIceArrow.gotoAndStop(3);
} else {
objUI.mIceArrow.bar.visible = true;
objUI.mIceArrow.gotoAndStop(2);
};
};
if (defSys.dat.arrowThunderLv > 0){
objUI.mThunderArrow.bar.scaleX = ((mBase.arrowThunderTimerMax - mBase.arrowThunderTimer) / mBase.arrowThunderTimerMax);
if (mBase.arrowThunderTimer == 0){
objUI.mThunderArrow.bar.visible = false;
objUI.mThunderArrow.gotoAndStop(3);
} else {
objUI.mThunderArrow.bar.visible = true;
objUI.mThunderArrow.gotoAndStop(2);
};
};
if (defSys.dat.turretLv > 0){
if ((((mBase.mana >= mBase._COST_TURRET)) && ((mBase.turretFlag == false)))){
objUI.mTurret.gotoAndStop(3);
} else {
objUI.mTurret.gotoAndStop(2);
};
};
if (defSys.dat.barrierLv > 0){
if ((((mBase.mana >= mBase._COST_BARRIER)) && ((mBase.barrierFlag == false)))){
objUI.mBarrier.gotoAndStop(3);
} else {
objUI.mBarrier.gotoAndStop(2);
};
};
if (defSys.dat.trapLv > 0){
if ((((mBase.mana >= mBase._COST_TRAP)) && ((mBase.trapFlag == false)))){
objUI.mTrap.gotoAndStop(3);
} else {
objUI.mTrap.gotoAndStop(2);
};
};
objUI.mMana.bar.scaleX = ((mBase.manaBoostTimerMax - mBase.manaBoostTimer) / mBase.manaBoostTimerMax);
if (mBase.manaBoostTimer == 0){
objUI.mMana.bar.visible = false;
objUI.mMana.gotoAndStop(3);
} else {
objUI.mMana.bar.visible = true;
objUI.mMana.gotoAndStop(2);
};
if (mBase.mana < mBase._COST_MANABOOST){
objUI.mMana.gotoAndStop(2);
};
if (defSys.dat.slot1Lv > 0){
objUI.mHobbit.bar.scaleX = ((mBase.hobbitTimerMax - mBase.hobbitTimer) / mBase.hobbitTimerMax);
if (mBase.hobbitTimer == 0){
objUI.mHobbit.bar.visible = false;
objUI.mHobbit.gotoAndStop(3);
} else {
objUI.mHobbit.bar.visible = true;
objUI.mHobbit.gotoAndStop(2);
};
if (mBase.mana < mBase._COST_HOBBIT){
objUI.mHobbit.gotoAndStop(2);
};
};
if (defSys.dat.slot2Lv > 0){
objUI.mElf.bar.scaleX = ((mBase.elfTimerMax - mBase.elfTimer) / mBase.elfTimerMax);
if (mBase.elfTimer == 0){
objUI.mElf.bar.visible = false;
objUI.mElf.gotoAndStop(3);
} else {
objUI.mElf.bar.visible = true;
objUI.mElf.gotoAndStop(2);
};
if (mBase.mana < mBase._COST_ELF){
objUI.mElf.gotoAndStop(2);
};
};
if (defSys.dat.slot3Lv > 0){
objUI.mDwarf.bar.scaleX = ((mBase.dwarfTimerMax - mBase.dwarfTimer) / mBase.dwarfTimerMax);
if (mBase.dwarfTimer == 0){
objUI.mDwarf.bar.visible = false;
objUI.mDwarf.gotoAndStop(3);
} else {
objUI.mDwarf.bar.visible = true;
objUI.mDwarf.gotoAndStop(2);
};
if (mBase.mana < mBase._COST_DWARF){
objUI.mDwarf.gotoAndStop(2);
};
};
if (defSys.dat.slot4Lv > 0){
objUI.mWizard.bar.scaleX = ((mBase.wizardTimerMax - mBase.wizardTimer) / mBase.wizardTimerMax);
if (mBase.wizardTimer == 0){
objUI.mWizard.bar.visible = false;
objUI.mWizard.gotoAndStop(3);
} else {
objUI.mWizard.bar.visible = true;
objUI.mWizard.gotoAndStop(2);
};
if (mBase.mana < mBase._COST_WIZARD){
objUI.mWizard.gotoAndStop(2);
};
};
if (defSys.dat.slot5Lv > 0){
objUI.mGolem.bar.scaleX = ((mBase.golemTimerMax - mBase.golemTimer) / mBase.golemTimerMax);
if (mBase.golemTimer == 0){
objUI.mGolem.bar.visible = false;
objUI.mGolem.gotoAndStop(3);
} else {
objUI.mGolem.bar.visible = true;
objUI.mGolem.gotoAndStop(2);
};
if (mBase.mana < mBase._COST_GOLEM){
objUI.mGolem.gotoAndStop(2);
};
};
if (defSys.dat.slot6Lv > 0){
objUI.mDragon.bar.scaleX = ((mBase.dragonTimerMax - mBase.dragonTimer) / mBase.dragonTimerMax);
if (mBase.dragonTimer == 0){
objUI.mDragon.bar.visible = false;
objUI.mDragon.gotoAndStop(3);
} else {
objUI.mDragon.bar.visible = true;
objUI.mDragon.gotoAndStop(2);
};
if (mBase.mana < mBase._COST_DRAGON){
objUI.mDragon.gotoAndStop(2);
};
};
if (defSys.dat.slot7Lv > 0){
objUI.mAngel.bar.scaleX = ((mBase.angelTimerMax - mBase.angelTimer) / mBase.angelTimerMax);
if (mBase.angelTimer == 0){
objUI.mAngel.bar.visible = false;
objUI.mAngel.gotoAndStop(3);
} else {
objUI.mAngel.bar.visible = true;
objUI.mAngel.gotoAndStop(2);
};
if (mBase.mana < mBase._COST_ANGEL){
objUI.mAngel.gotoAndStop(2);
};
};
if (defSys.dat.specialLv > 0){
objUI.mSpecial.scaleY = ((mBase.specialTimerMax - mBase.specialTimer) / mBase.specialTimerMax);
if (objUI.mSpecial.scaleY >= 1){
if (objUI.mSpecial.currentFrame == 1){
objUI.mSpecial.gotoAndStop(2);
};
} else {
if (objUI.mSpecial.currentFrame == 2){
objUI.mSpecial.gotoAndStop(1);
};
};
};
if (frameSkip == 24){
if (objUI.tScore){
objUI.tScore.htmlText = String(defSys.tmpScore);
};
if (objUI.tExp){
objUI.tExp.htmlText = String(defSys.tmpExp);
};
player_unit = 0;
enemy_unit = 0;
container = defSys.contArmy;
numChild = container.numChildren;
children = new Array(numChild);
i = 0;
i = 0;
while (i < numChild) {
children[i] = container.getChildAt(i);
i++;
};
i = 0;
while (i < numChild) {
if (children[i].statDef.isAlly()){
player_unit++;
};
if (children[i].statDef.isEnemy()){
enemy_unit++;
};
i++;
};
if (objUI.player_units){
objUI.player_units.htmlText = String(player_unit);
};
if (objUI.enemy_units){
objUI.enemy_units.htmlText = String(enemy_unit);
};
if (objUI.player_health){
objUI.player_health.htmlText = String(((String(mBase.light_castle_health) + "/") + String(mBase.light_castle_max_health)));
};
if (objUI.enemy_health){
objUI.enemy_health.htmlText = String(((String(mBase.dark_castle_health) + "/") + String(mBase.dark_castle_max_health)));
};
};
};
frameSkip++;
if (frameSkip > 24){
frameSkip = 0;
};
}
public function destroyUI(){
if (objPOP){
objPOP.destroy();
objPOP = null;
};
if (objUI){
objUI.removeEventListener(Event.ENTER_FRAME, frameHandle);
objUI.LB.removeEventListener(MouseEvent.MOUSE_OVER, leftScrollMouseOver);
objUI.LB.removeEventListener(MouseEvent.MOUSE_OUT, leftScrollMouseOut);
objUI.RB.removeEventListener(MouseEvent.MOUSE_OVER, rightScrollMouseOver);
objUI.RB.removeEventListener(MouseEvent.MOUSE_OUT, rightScrollMouseOut);
objUI.mBasicArrow.removeEventListener(MouseEvent.CLICK, basicArrowMouseClick);
objUI.mBasicArrow.removeEventListener(MouseEvent.MOUSE_OVER, basicArrowMouseOver);
objUI.mFireArrow.removeEventListener(MouseEvent.CLICK, fireArrowMouseClick);
objUI.mFireArrow.removeEventListener(MouseEvent.MOUSE_OVER, fireArrowMouseOver);
objUI.mIceArrow.removeEventListener(MouseEvent.CLICK, iceArrowMouseClick);
objUI.mIceArrow.removeEventListener(MouseEvent.MOUSE_OVER, iceArrowMouseOver);
objUI.mThunderArrow.removeEventListener(MouseEvent.CLICK, thunderArrowMouseClick);
objUI.mThunderArrow.removeEventListener(MouseEvent.MOUSE_OVER, thunderArrowMouseOver);
objUI.mMana.removeEventListener(MouseEvent.CLICK, manaMouseClick);
objUI.mMana.removeEventListener(MouseEvent.MOUSE_OVER, manaMouseOver);
objUI.mTurret.removeEventListener(MouseEvent.CLICK, turretMouseClick);
objUI.mTurret.removeEventListener(MouseEvent.MOUSE_OVER, turretMouseOver);
objUI.mTrap.removeEventListener(MouseEvent.CLICK, trapMouseClick);
objUI.mTrap.removeEventListener(MouseEvent.MOUSE_OVER, trapMouseOver);
objUI.mBarrier.removeEventListener(MouseEvent.CLICK, barrierMouseClick);
objUI.mBarrier.removeEventListener(MouseEvent.MOUSE_OVER, barrierMouseOver);
objUI.mHobbit.removeEventListener(MouseEvent.CLICK, hobbitMouseClick);
objUI.mHobbit.removeEventListener(MouseEvent.MOUSE_OVER, hobbitMouseOver);
objUI.mDwarf.removeEventListener(MouseEvent.CLICK, dwarfMouseClick);
objUI.mDwarf.removeEventListener(MouseEvent.MOUSE_OVER, dwarfMouseOver);
objUI.mElf.removeEventListener(MouseEvent.CLICK, elfMouseClick);
objUI.mElf.removeEventListener(MouseEvent.MOUSE_OVER, elfMouseOver);
objUI.mWizard.removeEventListener(MouseEvent.CLICK, wizardMouseClick);
objUI.mWizard.removeEventListener(MouseEvent.MOUSE_OVER, wizardMouseOver);
objUI.mGolem.removeEventListener(MouseEvent.CLICK, golemMouseClick);
objUI.mGolem.removeEventListener(MouseEvent.MOUSE_OVER, golemMouseOver);
objUI.mDragon.removeEventListener(MouseEvent.CLICK, dragonMouseClick);
objUI.mDragon.removeEventListener(MouseEvent.MOUSE_OVER, dragonMouseOver);
objUI.mAngel.removeEventListener(MouseEvent.CLICK, angelMouseClick);
objUI.mAngel.removeEventListener(MouseEvent.MOUSE_OVER, angelMouseOver);
objUI.mSpecial.removeEventListener(MouseEvent.CLICK, specialMouseClick);
objUI.mSpecial.removeEventListener(MouseEvent.MOUSE_OVER, specialMouseOver);
objUI.tScore.removeEventListener(MouseEvent.MOUSE_OVER, scoreMouseOver);
objUI.tExp.removeEventListener(MouseEvent.MOUSE_OVER, expMouseOver);
objUI.mSound.removeEventListener(MouseEvent.CLICK, soundMouseClick);
objUI.mSound.removeEventListener(MouseEvent.MOUSE_OVER, soundMouseOver);
objUI.mPlayMore.removeEventListener(MouseEvent.CLICK, playMoreMouseClick);
objUI.mQuit.removeEventListener(MouseEvent.CLICK, quitMouseClick);
objUI.mQuit.removeEventListener(MouseEvent.MOUSE_OVER, quitMouseOver);
objUI.mPause.removeEventListener(MouseEvent.CLICK, pauseMouseClick);
defSys.contMenu.removeChild(objUI);
objUI = null;
};
}
private function quitMouseOver(event:MouseEvent):void{
objPOP.showPopUp(objUI.mQuit, objPOP._QUIT_INFO);
}
private function rightScrollMouseOver(event:MouseEvent):void{
rightScroll = true;
}
private function rightScrollMouseOut(event:MouseEvent):void{
rightScroll = false;
}
private function thunderArrowMouseOver(event:MouseEvent):void{
objPOP.showPopUp(objUI.mThunderArrow, objPOP._THUNDER_ARROW_ICO);
}
public function destroy(){
destroyFinish();
destroyUI();
mBase = null;
defSys = null;
}
private function angelMouseOver(event:MouseEvent):void{
objPOP.showPopUp(objUI.mAngel, objPOP._ARMY_ANGEL_ICO);
}
private function turretMouseOver(event:MouseEvent):void{
objPOP.showPopUp(objUI.mTurret, objPOP._BUILD_TURRET_ICO);
}
private function barrierMouseOver(event:MouseEvent):void{
objPOP.showPopUp(objUI.mBarrier, objPOP._BUILD_BARRIER_ICO);
}
private function scoreMouseOver(event:MouseEvent):void{
objPOP.showPopUp(objUI.tScore, objPOP._SCORE_INFO);
}
private function continueClick(event:MouseEvent):void{
if (winFlag){
defSys.dat.money = Math.min((defSys.dat.money + defSys.tmpExp), 9999999);
if (defSys.game_lv == 1){
if (defSys.dat.level_01_BestScore < defSys.tmpScore){
defSys.dat.level_01_BestScore = defSys.tmpScore;
};
if (defSys.dat.level_02_Play <= 0){
defSys.dat.level_02_Play = 1;
};
defSys.dat.level_01_Play = Math.min((defSys.dat.level_01_Play + 1), 9);
} else {
if (defSys.game_lv == 2){
if (defSys.dat.level_02_BestScore < defSys.tmpScore){
defSys.dat.level_02_BestScore = defSys.tmpScore;
};
if (defSys.dat.level_03_Play <= 0){
defSys.dat.level_03_Play = 1;
};
defSys.dat.level_02_Play = Math.min((defSys.dat.level_02_Play + 1), 9);
} else {
if (defSys.game_lv == 3){
if (defSys.dat.level_03_BestScore < defSys.tmpScore){
defSys.dat.level_03_BestScore = defSys.tmpScore;
};
if (defSys.dat.level_04_Play <= 0){
defSys.dat.level_04_Play = 1;
};
defSys.dat.level_03_Play = Math.min((defSys.dat.level_03_Play + 1), 9);
} else {
if (defSys.game_lv == 4){
if (defSys.dat.level_04_BestScore < defSys.tmpScore){
defSys.dat.level_04_BestScore = defSys.tmpScore;
};
if (defSys.dat.level_05_Play <= 0){
defSys.dat.level_05_Play = 1;
};
defSys.dat.level_04_Play = Math.min((defSys.dat.level_04_Play + 1), 9);
} else {
if (defSys.game_lv == 5){
if (defSys.dat.level_05_BestScore < defSys.tmpScore){
defSys.dat.level_05_BestScore = defSys.tmpScore;
};
if (defSys.dat.level_06_Play <= 0){
defSys.dat.level_06_Play = 1;
};
defSys.dat.level_05_Play = Math.min((defSys.dat.level_05_Play + 1), 9);
} else {
if (defSys.game_lv == 6){
if (defSys.dat.level_06_BestScore < defSys.tmpScore){
defSys.dat.level_06_BestScore = defSys.tmpScore;
};
if (defSys.dat.level_07_Play <= 0){
defSys.dat.level_07_Play = 1;
};
defSys.dat.level_06_Play = Math.min((defSys.dat.level_06_Play + 1), 9);
} else {
if (defSys.game_lv == 7){
if (defSys.dat.level_07_BestScore < defSys.tmpScore){
defSys.dat.level_07_BestScore = defSys.tmpScore;
};
if (defSys.dat.level_08_Play <= 0){
defSys.dat.level_08_Play = 1;
};
defSys.dat.level_07_Play = Math.min((defSys.dat.level_07_Play + 1), 9);
} else {
if (defSys.game_lv == 8){
if (defSys.dat.level_08_BestScore < defSys.tmpScore){
defSys.dat.level_08_BestScore = defSys.tmpScore;
};
if (defSys.dat.level_09_Play <= 0){
defSys.dat.level_09_Play = 1;
};
defSys.dat.level_08_Play = Math.min((defSys.dat.level_08_Play + 1), 9);
} else {
if (defSys.game_lv == 9){
if (defSys.dat.level_09_BestScore < defSys.tmpScore){
defSys.dat.level_09_BestScore = defSys.tmpScore;
};
if (defSys.dat.level_10_Play <= 0){
defSys.dat.level_10_Play = 1;
};
defSys.dat.level_09_Play = Math.min((defSys.dat.level_09_Play + 1), 9);
} else {
if (defSys.game_lv == 10){
if (defSys.dat.level_10_BestScore < defSys.tmpScore){
defSys.dat.level_10_BestScore = defSys.tmpScore;
};
if (defSys.dat.level_11_Play <= 0){
defSys.dat.level_11_Play = 1;
};
defSys.dat.level_10_Play = Math.min((defSys.dat.level_10_Play + 1), 9);
} else {
if (defSys.game_lv == 11){
if (defSys.dat.level_11_BestScore < defSys.tmpScore){
defSys.dat.level_11_BestScore = defSys.tmpScore;
};
if (defSys.dat.level_12_Play <= 0){
defSys.dat.level_12_Play = 1;
};
defSys.dat.level_11_Play = Math.min((defSys.dat.level_11_Play + 1), 9);
} else {
if (defSys.game_lv == 12){
if (defSys.dat.level_12_BestScore < defSys.tmpScore){
defSys.dat.level_12_BestScore = defSys.tmpScore;
};
if (defSys.dat.level_13_Play <= 0){
defSys.dat.level_13_Play = 1;
};
defSys.dat.level_12_Play = Math.min((defSys.dat.level_12_Play + 1), 9);
} else {
if (defSys.game_lv == 13){
if (defSys.dat.level_13_BestScore < defSys.tmpScore){
defSys.dat.level_13_BestScore = defSys.tmpScore;
};
if (defSys.dat.level_14_Play <= 0){
defSys.dat.level_14_Play = 1;
};
defSys.dat.level_13_Play = Math.min((defSys.dat.level_13_Play + 1), 9);
} else {
if (defSys.game_lv == 14){
if (defSys.dat.level_14_BestScore < defSys.tmpScore){
defSys.dat.level_14_BestScore = defSys.tmpScore;
};
if (defSys.dat.level_15_Play <= 0){
defSys.dat.level_15_Play = 1;
};
defSys.dat.level_14_Play = Math.min((defSys.dat.level_14_Play + 1), 9);
} else {
if (defSys.game_lv == 15){
if (defSys.dat.level_15_BestScore < defSys.tmpScore){
defSys.dat.level_15_BestScore = defSys.tmpScore;
};
defSys.dat.level_15_Play = Math.min((defSys.dat.level_15_Play + 1), 9);
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
} else {
defSys.dat.money = Math.min((defSys.dat.money + (defSys.tmpExp * 0.5)), 9999999);
};
objFINISH.bContinue.removeEventListener(MouseEvent.CLICK, continueClick);
mBase.battle_state = 99;
}
private function manaMouseOver(event:MouseEvent):void{
objPOP.showPopUp(objUI.mMana, objPOP._BUILD_MANA_ICO);
}
public function destroyFinish(){
defSys.contMenu.removeEventListener(Event.ENTER_FRAME, conclusionHandle);
defSys.contMenu.removeEventListener(Event.ENTER_FRAME, conclusionButtonHandle);
if (objFINISH){
objFINISH.bContinue.removeEventListener(MouseEvent.CLICK, continueClick);
defSys.contMenu.removeChild(objFINISH);
objFINISH = null;
};
}
private function wizardMouseClick(event:MouseEvent):void{
if (defSys.isPaused == false){
mBase.summonWizard();
};
}
private function golemMouseClick(event:MouseEvent):void{
if (defSys.isPaused == false){
mBase.summonGolem();
};
}
private function fireArrowMouseClick(event:MouseEvent):void{
if (defSys.isPaused == false){
mBase.shootFireArrow();
};
}
public function initialise(_mBase){
showFinish = false;
withSound = true;
mBase = _mBase;
leftScroll = false;
rightScroll = false;
objUI = new interface_mc();
defSys.contMenu.addChild(objUI);
objUI.cacheAsBitmap = true;
objUI.x = 400;
objUI.y = 300;
objPOP = new BattlePopGUI(defSys, mBase, objUI.mInfo);
objUI.addEventListener(Event.ENTER_FRAME, frameHandle, false, 0, true);
objUI.LB.addEventListener(MouseEvent.MOUSE_OVER, leftScrollMouseOver, false, 0, true);
objUI.LB.addEventListener(MouseEvent.MOUSE_OUT, leftScrollMouseOut, false, 0, true);
objUI.RB.addEventListener(MouseEvent.MOUSE_OVER, rightScrollMouseOver, false, 0, true);
objUI.RB.addEventListener(MouseEvent.MOUSE_OUT, rightScrollMouseOut, false, 0, true);
objUI.mBasicArrow.bar.visible = false;
objUI.mFireArrow.bar.visible = false;
objUI.mIceArrow.bar.visible = false;
objUI.mThunderArrow.bar.visible = false;
if (defSys.dat.arrowBasicLv > 0){
objUI.mBasicArrow.gotoAndStop(2);
objUI.mBasicArrow.addEventListener(MouseEvent.CLICK, basicArrowMouseClick, false, 0, true);
objUI.mBasicArrow.addEventListener(MouseEvent.MOUSE_OVER, basicArrowMouseOver, false, 0, true);
};
if (defSys.dat.arrowFireLv > 0){
objUI.mFireArrow.gotoAndStop(2);
objUI.mFireArrow.addEventListener(MouseEvent.CLICK, fireArrowMouseClick, false, 0, true);
objUI.mFireArrow.addEventListener(MouseEvent.MOUSE_OVER, fireArrowMouseOver, false, 0, true);
};
if (defSys.dat.arrowIceLv > 0){
objUI.mIceArrow.gotoAndStop(2);
objUI.mIceArrow.addEventListener(MouseEvent.CLICK, iceArrowMouseClick, false, 0, true);
objUI.mIceArrow.addEventListener(MouseEvent.MOUSE_OVER, iceArrowMouseOver, false, 0, true);
};
if (defSys.dat.arrowThunderLv > 0){
objUI.mThunderArrow.gotoAndStop(2);
objUI.mThunderArrow.addEventListener(MouseEvent.CLICK, thunderArrowMouseClick, false, 0, true);
objUI.mThunderArrow.addEventListener(MouseEvent.MOUSE_OVER, thunderArrowMouseOver, false, 0, true);
};
objUI.mTurret.bar.visible = false;
objUI.mTrap.bar.visible = false;
objUI.mBarrier.bar.visible = false;
objUI.mMana.bar.visible = false;
objUI.mMana.gotoAndStop(2);
objUI.mMana.addEventListener(MouseEvent.CLICK, manaMouseClick, false, 0, true);
objUI.mMana.addEventListener(MouseEvent.MOUSE_OVER, manaMouseOver, false, 0, true);
if (defSys.dat.turretLv > 0){
objUI.mTurret.gotoAndStop(2);
objUI.mTurret.addEventListener(MouseEvent.CLICK, turretMouseClick, false, 0, true);
objUI.mTurret.addEventListener(MouseEvent.MOUSE_OVER, turretMouseOver, false, 0, true);
};
if (defSys.dat.trapLv > 0){
objUI.mTrap.gotoAndStop(2);
objUI.mTrap.addEventListener(MouseEvent.CLICK, trapMouseClick, false, 0, true);
objUI.mTrap.addEventListener(MouseEvent.MOUSE_OVER, trapMouseOver, false, 0, true);
};
if (defSys.dat.barrierLv > 0){
objUI.mBarrier.gotoAndStop(2);
objUI.mBarrier.addEventListener(MouseEvent.CLICK, barrierMouseClick, false, 0, true);
objUI.mBarrier.addEventListener(MouseEvent.MOUSE_OVER, barrierMouseOver, false, 0, true);
};
objUI.mHobbit.bar.visible = false;
objUI.mDwarf.bar.visible = false;
objUI.mElf.bar.visible = false;
objUI.mWizard.bar.visible = false;
objUI.mGolem.bar.visible = false;
objUI.mDragon.bar.visible = false;
objUI.mAngel.bar.visible = false;
if (defSys.dat.slot1Lv > 0){
objUI.mHobbit.gotoAndStop(2);
objUI.mHobbit.addEventListener(MouseEvent.CLICK, hobbitMouseClick, false, 0, true);
objUI.mHobbit.addEventListener(MouseEvent.MOUSE_OVER, hobbitMouseOver, false, 0, true);
};
if (defSys.dat.slot2Lv > 0){
objUI.mElf.gotoAndStop(2);
objUI.mElf.addEventListener(MouseEvent.CLICK, elfMouseClick, false, 0, true);
objUI.mElf.addEventListener(MouseEvent.MOUSE_OVER, elfMouseOver, false, 0, true);
};
if (defSys.dat.slot3Lv > 0){
objUI.mDwarf.gotoAndStop(2);
objUI.mDwarf.addEventListener(MouseEvent.CLICK, dwarfMouseClick, false, 0, true);
objUI.mDwarf.addEventListener(MouseEvent.MOUSE_OVER, dwarfMouseOver, false, 0, true);
};
if (defSys.dat.slot4Lv > 0){
objUI.mWizard.gotoAndStop(2);
objUI.mWizard.addEventListener(MouseEvent.CLICK, wizardMouseClick, false, 0, true);
objUI.mWizard.addEventListener(MouseEvent.MOUSE_OVER, wizardMouseOver, false, 0, true);
};
if (defSys.dat.slot5Lv > 0){
objUI.mGolem.gotoAndStop(2);
objUI.mGolem.addEventListener(MouseEvent.CLICK, golemMouseClick, false, 0, true);
objUI.mGolem.addEventListener(MouseEvent.MOUSE_OVER, golemMouseOver, false, 0, true);
};
if (defSys.dat.slot6Lv > 0){
objUI.mDragon.gotoAndStop(2);
objUI.mDragon.addEventListener(MouseEvent.CLICK, dragonMouseClick, false, 0, true);
objUI.mDragon.addEventListener(MouseEvent.MOUSE_OVER, dragonMouseOver, false, 0, true);
};
if (defSys.dat.slot7Lv > 0){
objUI.mAngel.gotoAndStop(2);
objUI.mAngel.addEventListener(MouseEvent.CLICK, angelMouseClick, false, 0, true);
objUI.mAngel.addEventListener(MouseEvent.MOUSE_OVER, angelMouseOver, false, 0, true);
};
if (defSys.dat.specialLv > 0){
objUI.mSpecial.gotoAndStop(2);
objUI.mSpecial.addEventListener(MouseEvent.CLICK, specialMouseClick, false, 0, true);
objUI.mSpecial.addEventListener(MouseEvent.MOUSE_OVER, specialMouseOver, false, 0, true);
};
objUI.tScore.addEventListener(MouseEvent.MOUSE_OVER, scoreMouseOver, false, 0, true);
objUI.tExp.addEventListener(MouseEvent.MOUSE_OVER, expMouseOver, false, 0, true);
objUI.mSound.addEventListener(MouseEvent.CLICK, soundMouseClick, false, 0, true);
objUI.mSound.addEventListener(MouseEvent.MOUSE_OVER, soundMouseOver, false, 0, true);
objUI.mPlayMore.addEventListener(MouseEvent.CLICK, playMoreMouseClick, false, 0, true);
objUI.mQuit.addEventListener(MouseEvent.CLICK, quitMouseClick, false, 0, true);
objUI.mQuit.addEventListener(MouseEvent.MOUSE_OVER, quitMouseOver, false, 0, true);
objUI.mPause.addEventListener(MouseEvent.CLICK, pauseMouseClick, false, 0, true);
frameSkip = 0;
}
private function conclusionButtonHandle(event:Event):void{
if (objFINISH){
if (winFlag){
if (((((objFINISH.bContinue) && (objFINISH.score))) && (objFINISH.exp))){
objFINISH.score.htmlText = String(defSys.tmpScore);
objFINISH.exp.htmlText = String(defSys.tmpExp);
objFINISH.bContinue.addEventListener(MouseEvent.CLICK, continueClick, false, 0, true);
defSys.contMenu.removeEventListener(Event.ENTER_FRAME, conclusionButtonHandle);
};
} else {
if (((objFINISH.bContinue) && (objFINISH.exp))){
objFINISH.exp.htmlText = String((defSys.tmpExp * 0.5));
objFINISH.bContinue.addEventListener(MouseEvent.CLICK, continueClick, false, 0, true);
defSys.contMenu.removeEventListener(Event.ENTER_FRAME, conclusionButtonHandle);
};
};
};
}
private function elfMouseOver(event:MouseEvent):void{
objPOP.showPopUp(objUI.mElf, objPOP._ARMY_ELF_ICO);
}
private function leftScrollMouseOut(event:MouseEvent):void{
leftScroll = false;
}
private function basicArrowMouseClick(event:MouseEvent):void{
if (defSys.isPaused == false){
mBase.shootBasicArrow();
};
}
private function quitMouseClick(event:MouseEvent):void{
mBase.battle_state = 99;
}
private function iceArrowMouseClick(event:MouseEvent):void{
if (defSys.isPaused == false){
mBase.shootIceArrow();
};
}
private function angelMouseClick(event:MouseEvent):void{
if (defSys.isPaused == false){
mBase.summonAngel();
};
}
private function leftScrollMouseOver(event:MouseEvent):void{
leftScroll = true;
}
private function dragonMouseOver(event:MouseEvent):void{
objPOP.showPopUp(objUI.mDragon, objPOP._ARMY_DRAGON_ICO);
}
private function hobbitMouseOver(event:MouseEvent):void{
objPOP.showPopUp(objUI.mHobbit, objPOP._ARMY_HOBBIT_ICO);
}
private function thunderArrowMouseClick(event:MouseEvent):void{
if (defSys.isPaused == false){
mBase.shootThunderArrow();
};
}
private function conclusionHandle(event:Event):void{
delayCtr = Math.max((delayCtr - 1), 0);
if (delayCtr <= 0){
objFINISH = new win_lose_mc();
defSys.contMenu.addChild(objFINISH);
objFINISH.cacheAsBitmap = true;
if (winFlag){
if (defSys.game_lv == 15){
objFINISH.gotoAndStop(3);
} else {
objFINISH.gotoAndStop(1);
};
} else {
objFINISH.gotoAndStop(2);
};
defSys.contMenu.removeEventListener(Event.ENTER_FRAME, conclusionHandle);
defSys.contMenu.addEventListener(Event.ENTER_FRAME, conclusionButtonHandle, false, 0, true);
};
}
private function golemMouseOver(event:MouseEvent):void{
objPOP.showPopUp(objUI.mGolem, objPOP._ARMY_GOLEM_ICO);
}
private function soundMouseOver(event:MouseEvent):void{
objPOP.showPopUp(objUI.mSound, objPOP._SOUND_INFO);
}
private function dragonMouseClick(event:MouseEvent):void{
if (defSys.isPaused == false){
mBase.summonDragon();
};
}
private function dwarfMouseOver(event:MouseEvent):void{
objPOP.showPopUp(objUI.mDwarf, objPOP._ARMY_DWARF_ICO);
}
private function soundMouseClick(event:MouseEvent):void{
if (withSound){
defSys.toggleSoundOFF();
withSound = false;
objUI.mSound.gotoAndStop(2);
} else {
defSys.toggleSoundON();
withSound = true;
objUI.mSound.gotoAndStop(1);
};
}
private function elfMouseClick(event:MouseEvent):void{
if (defSys.isPaused == false){
mBase.summonElf();
};
}
private function basicArrowMouseOver(event:MouseEvent):void{
objPOP.showPopUp(objUI.mBasicArrow, objPOP._BASIC_ARROW_ICO);
}
private function fireArrowMouseOver(event:MouseEvent):void{
objPOP.showPopUp(objUI.mFireArrow, objPOP._FIRE_ARROW_ICO);
}
private function specialMouseOver(event:MouseEvent):void{
objPOP.showPopUp(objUI.mSpecial, objPOP._SPECIAL_INFO);
}
private function trapMouseOver(event:MouseEvent):void{
objPOP.showPopUp(objUI.mTrap, objPOP._BUILD_TRAP_ICO);
}
private function wizardMouseOver(event:MouseEvent):void{
objPOP.showPopUp(objUI.mWizard, objPOP._ARMY_WIZARD_ICO);
}
private function turretMouseClick(event:MouseEvent):void{
if (defSys.isPaused == false){
mBase.setTurret();
};
}
private function dwarfMouseClick(event:MouseEvent):void{
if (defSys.isPaused == false){
mBase.summonDwarf();
};
}
private function hobbitMouseClick(event:MouseEvent):void{
if (defSys.isPaused == false){
mBase.summonHobbit();
};
}
private function trapMouseClick(event:MouseEvent):void{
if (defSys.isPaused == false){
mBase.setTrap();
};
}
private function pauseMouseClick(event:MouseEvent):void{
if (defSys.isPaused == true){
defSys.isPaused = false;
objUI.mPause.gotoAndStop(1);
} else {
defSys.isPaused = true;
objUI.mPause.gotoAndStop(2);
};
}
private function barrierMouseClick(event:MouseEvent):void{
if (defSys.isPaused == false){
mBase.setBarrier();
};
}
private function iceArrowMouseOver(event:MouseEvent):void{
objPOP.showPopUp(objUI.mIceArrow, objPOP._ICE_ARROW_ICO);
}
private function specialMouseClick(event:MouseEvent):void{
if (defSys.isPaused == false){
mBase.castSpecial();
};
}
}
}//package DefX.System
Section 74
//BattlePopGUI (DefX.System.BattlePopGUI)
package DefX.System {
import flash.events.*;
import flash.net.*;
public class BattlePopGUI {
const _ARMY_ANGEL_ICO = 27;
const _NONE = 0;
const _SOUND_INFO = 94;
const _EXP_INFO = 93;
const _QUIT_INFO = 95;
const _ARMY_BATTLE_STAT = 99;
const _ARMY_GOLEM_ICO = 25;
const _BUILD_TURRET_ICO = 10;
const _ARMY_WIZARD_ICO = 24;
const _ARMY_HOBBIT_ICO = 21;
const _ICE_ARROW_ICO = 3;
const _BUILD_TRAP_ICO = 12;
const _BUILD_BARRIER_ICO = 11;
const _THUNDER_ARROW_ICO = 4;
const _BUILD_MANA_ICO = 13;
const _BASIC_ARROW_ICO = 1;
const _ARMY_ELF_ICO = 22;
const _SPECIAL_INFO = 91;
const _FIRE_ARROW_ICO = 2;
const _SCORE_INFO = 92;
const _ARMY_DRAGON_ICO = 26;
const _ARMY_DWARF_ICO = 23;
private var objMenuPop;
private var defSys;
private var type:int;// = 0
private var mBase;
private var objSelect;// = null
public function BattlePopGUI(_defSys, _mBase, _objMenuPop){
objSelect = null;
type = 0;
super();
defSys = _defSys;
mBase = _mBase;
objMenuPop = _objMenuPop;
}
public function destroy(){
inactive();
objMenuPop = null;
defSys = null;
mBase = null;
}
private function objectInfoOUT(event:MouseEvent):void{
inactive();
}
private function frameMenuHandle(event:Event):void{
var health:int;
var power:int;
if (objSelect == null){
inactive();
return;
};
if (objMenuPop == null){
destroy();
return;
};
if (type == _BASIC_ARROW_ICO){
if (objMenuPop.title){
objMenuPop.title.htmlText = String("Basic Arrow");
};
if (objMenuPop.power){
if (defSys.dat.arrowBasicLv == 1){
objMenuPop.power.htmlText = String("25");
};
if (defSys.dat.arrowBasicLv == 2){
objMenuPop.power.htmlText = String("30");
};
if (defSys.dat.arrowBasicLv == 3){
objMenuPop.power.htmlText = String("25 x 2");
};
if (defSys.dat.arrowBasicLv == 4){
objMenuPop.power.htmlText = String("30 x 2");
};
if (defSys.dat.arrowBasicLv == 5){
objMenuPop.power.htmlText = String("30 x 3");
};
};
if (objMenuPop.desc){
objMenuPop.desc.htmlText = String("Standard Arrow <br>Hotkey A");
};
};
if (type == _FIRE_ARROW_ICO){
if (objMenuPop.title){
objMenuPop.title.htmlText = String("Fire Arrow");
};
if (objMenuPop.power){
if (defSys.dat.arrowFireLv == 1){
objMenuPop.power.htmlText = String("30");
};
if (defSys.dat.arrowFireLv == 2){
objMenuPop.power.htmlText = String("35");
};
if (defSys.dat.arrowFireLv == 3){
objMenuPop.power.htmlText = String("40");
};
if (defSys.dat.arrowFireLv == 4){
objMenuPop.power.htmlText = String("45");
};
if (defSys.dat.arrowFireLv == 5){
objMenuPop.power.htmlText = String("70");
};
};
if (objMenuPop.desc){
objMenuPop.desc.htmlText = String("Add Fire Element <br>Hotkey S");
};
};
if (type == _ICE_ARROW_ICO){
if (objMenuPop.title){
objMenuPop.title.htmlText = String("Ice Arrow");
};
if (objMenuPop.power){
if (defSys.dat.arrowIceLv == 1){
objMenuPop.power.htmlText = String("25");
};
if (defSys.dat.arrowIceLv == 2){
objMenuPop.power.htmlText = String("30");
};
if (defSys.dat.arrowIceLv == 3){
objMenuPop.power.htmlText = String("35");
};
if (defSys.dat.arrowIceLv == 4){
objMenuPop.power.htmlText = String("40");
};
if (defSys.dat.arrowIceLv == 5){
objMenuPop.power.htmlText = String("50");
};
};
if (objMenuPop.desc){
objMenuPop.desc.htmlText = String("Add Freeze to Target <br>Hotkey F");
};
};
if (type == _THUNDER_ARROW_ICO){
if (objMenuPop.title){
objMenuPop.title.htmlText = String("Thunder Arrow");
};
if (objMenuPop.power){
if (defSys.dat.arrowBasicLv == 1){
objMenuPop.power.htmlText = String("25");
};
if (defSys.dat.arrowBasicLv == 2){
objMenuPop.power.htmlText = String("30");
};
if (defSys.dat.arrowBasicLv == 3){
objMenuPop.power.htmlText = String("35");
};
if (defSys.dat.arrowBasicLv == 4){
objMenuPop.power.htmlText = String("40");
};
if (defSys.dat.arrowBasicLv == 5){
objMenuPop.power.htmlText = String("60");
};
};
if (objMenuPop.desc){
objMenuPop.desc.htmlText = String("Add Shock to Target <br>Hotkey D");
};
};
if (type == _BUILD_TURRET_ICO){
if (objMenuPop.title){
objMenuPop.title.htmlText = String("Build Turret");
};
if (objMenuPop.mana){
if (mBase.turretFlag == false){
objMenuPop.mana.htmlText = String(mBase._COST_TURRET);
} else {
objMenuPop.mana.htmlText = String("-");
};
trace(String(mBase.turretFlag));
};
if (objMenuPop.desc){
objMenuPop.desc.htmlText = String("Extra Turret <br>Hotkey Q");
};
};
if (type == _BUILD_BARRIER_ICO){
if (objMenuPop.title){
objMenuPop.title.htmlText = String("Build Barrier");
};
if (objMenuPop.mana){
if (mBase.barrierFlag == false){
objMenuPop.mana.htmlText = String(mBase._COST_BARRIER);
} else {
objMenuPop.mana.htmlText = String("-");
};
};
if (objMenuPop.desc){
objMenuPop.desc.htmlText = String("Upgrade Castle Defense <br>Hotkey W");
};
};
if (type == _BUILD_TRAP_ICO){
if (objMenuPop.title){
objMenuPop.title.htmlText = String("Build Trap");
};
if (objMenuPop.mana){
if (mBase.trapFlag == false){
objMenuPop.mana.htmlText = String(mBase._COST_TRAP);
} else {
objMenuPop.mana.htmlText = String("-");
};
};
if (objMenuPop.desc){
objMenuPop.desc.htmlText = String("Damage enemy <br>Hotkey E");
};
};
if (type == _BUILD_MANA_ICO){
if (objMenuPop.title){
objMenuPop.title.htmlText = String("Mana Growth");
};
if (objMenuPop.mana){
if (mBase.max_mana < 9999){
objMenuPop.mana.htmlText = String(mBase._COST_MANABOOST);
} else {
objMenuPop.mana.htmlText = String("-");
};
};
if (objMenuPop.desc){
objMenuPop.desc.htmlText = String("Boost Max Mana <br>Hotkey R");
};
};
health = 0;
power = 0;
if (type == _ARMY_HOBBIT_ICO){
if (objMenuPop.title){
objMenuPop.title.htmlText = String("Summon Hobbit");
};
if (objMenuPop.mana){
objMenuPop.mana.htmlText = String(mBase._COST_HOBBIT);
};
health = 60;
power = 10;
if (defSys.dat.slot1Lv == 2){
health = (health * 1.2);
power = (power * 1.2);
};
if (defSys.dat.slot1Lv == 3){
health = (health * 1.4);
power = (power * 1.4);
};
if (defSys.dat.slot1Lv == 4){
health = (health * 1.6);
power = (power * 1.6);
};
if (defSys.dat.slot1Lv == 5){
health = (health * 2);
power = (power * 2);
};
if (objMenuPop.health){
objMenuPop.health.htmlText = String(health);
};
if (objMenuPop.power){
objMenuPop.power.htmlText = String(power);
};
if (objMenuPop.desc){
objMenuPop.desc.htmlText = String("Hotkey 1");
};
};
if (type == _ARMY_ELF_ICO){
if (objMenuPop.title){
objMenuPop.title.htmlText = String("Summon Warrior Elf");
};
if (objMenuPop.mana){
objMenuPop.mana.htmlText = String(mBase._COST_ELF);
};
health = 75;
power = 20;
if (defSys.dat.slot2Lv == 2){
health = (health * 1.2);
power = (power * 1.2);
};
if (defSys.dat.slot2Lv == 3){
health = (health * 1.4);
power = (power * 1.4);
};
if (defSys.dat.slot2Lv == 4){
health = (health * 1.6);
power = (power * 1.6);
};
if (defSys.dat.slot2Lv == 5){
health = (health * 2);
power = (power * 2);
};
if (objMenuPop.health){
objMenuPop.health.htmlText = String(health);
};
if (objMenuPop.power){
objMenuPop.power.htmlText = String(power);
};
if (objMenuPop.desc){
objMenuPop.desc.htmlText = String("Hotkey 2");
};
};
if (type == _ARMY_DWARF_ICO){
if (objMenuPop.title){
objMenuPop.title.htmlText = String("Summon Dwarf Elder");
};
if (objMenuPop.mana){
objMenuPop.mana.htmlText = String(mBase._COST_DWARF);
};
health = 150;
power = 25;
if (defSys.dat.slot3Lv == 2){
health = (health * 1.2);
power = (power * 1.2);
};
if (defSys.dat.slot3Lv == 3){
health = (health * 1.4);
power = (power * 1.4);
};
if (defSys.dat.slot3Lv == 4){
health = (health * 1.6);
power = (power * 1.6);
};
if (defSys.dat.slot3Lv == 5){
health = (health * 2);
power = (power * 2);
};
if (objMenuPop.health){
objMenuPop.health.htmlText = String(health);
};
if (objMenuPop.power){
objMenuPop.power.htmlText = String(power);
};
if (objMenuPop.desc){
objMenuPop.desc.htmlText = String("Hotkey 3");
};
};
if (type == _ARMY_WIZARD_ICO){
if (objMenuPop.title){
objMenuPop.title.htmlText = String("Summon Wizard");
};
if (objMenuPop.mana){
objMenuPop.mana.htmlText = String(mBase._COST_WIZARD);
};
health = 200;
power = 6;
if (defSys.dat.slot4Lv == 2){
health = (health * 1.2);
power = (power * 1.2);
};
if (defSys.dat.slot4Lv == 3){
health = (health * 1.4);
power = (power * 1.4);
};
if (defSys.dat.slot4Lv == 4){
health = (health * 1.6);
power = (power * 1.6);
};
if (defSys.dat.slot4Lv == 5){
health = (health * 2);
power = (power * 2);
};
if (objMenuPop.health){
objMenuPop.health.htmlText = String(health);
};
if (objMenuPop.power){
objMenuPop.power.htmlText = String((power + " x4"));
};
if (objMenuPop.desc){
objMenuPop.desc.htmlText = String("Hotkey 4");
};
};
if (type == _ARMY_GOLEM_ICO){
if (objMenuPop.title){
objMenuPop.title.htmlText = String("Summon Golem");
};
if (objMenuPop.mana){
objMenuPop.mana.htmlText = String(mBase._COST_GOLEM);
};
health = 700;
power = 70;
if (defSys.dat.slot5Lv == 2){
health = (health * 1.2);
power = (power * 1.2);
};
if (defSys.dat.slot5Lv == 3){
health = (health * 1.4);
power = (power * 1.4);
};
if (defSys.dat.slot5Lv == 4){
health = (health * 1.6);
power = (power * 1.6);
};
if (defSys.dat.slot5Lv == 5){
health = (health * 2);
power = (power * 2);
};
if (objMenuPop.health){
objMenuPop.health.htmlText = String(health);
};
if (objMenuPop.power){
objMenuPop.power.htmlText = String(power);
};
if (objMenuPop.desc){
objMenuPop.desc.htmlText = String("Hotkey 5");
};
};
if (type == _ARMY_DRAGON_ICO){
if (objMenuPop.title){
objMenuPop.title.htmlText = String("Summon Blue Dragon");
};
if (objMenuPop.mana){
objMenuPop.mana.htmlText = String(mBase._COST_DRAGON);
};
health = 1300;
power = 120;
if (defSys.dat.slot6Lv == 2){
health = (health * 1.2);
power = (power * 1.2);
};
if (defSys.dat.slot6Lv == 3){
health = (health * 1.4);
power = (power * 1.4);
};
if (defSys.dat.slot6Lv == 4){
health = (health * 1.6);
power = (power * 1.6);
};
if (defSys.dat.slot6Lv == 5){
health = (health * 2);
power = (power * 2);
};
if (objMenuPop.health){
objMenuPop.health.htmlText = String(health);
};
if (objMenuPop.power){
objMenuPop.power.htmlText = String(power);
};
if (objMenuPop.desc){
objMenuPop.desc.htmlText = String("Hotkey 6");
};
};
if (type == _ARMY_ANGEL_ICO){
if (objMenuPop.title){
objMenuPop.title.htmlText = String("Summon Arch Angel");
};
if (objMenuPop.mana){
objMenuPop.mana.htmlText = String(mBase._COST_ANGEL);
};
health = 2100;
power = 50;
if (defSys.dat.slot7Lv == 2){
health = (health * 1.2);
power = (power * 1.2);
};
if (defSys.dat.slot7Lv == 3){
health = (health * 1.4);
power = (power * 1.4);
};
if (defSys.dat.slot7Lv == 4){
health = (health * 1.6);
power = (power * 1.6);
};
if (defSys.dat.slot7Lv == 5){
health = (health * 2);
power = (power * 2);
};
if (objMenuPop.health){
objMenuPop.health.htmlText = String(health);
};
if (objMenuPop.power){
objMenuPop.power.htmlText = String((power + " x4"));
};
if (objMenuPop.desc){
objMenuPop.desc.htmlText = String("Hotkey 7");
};
};
if (type == _SPECIAL_INFO){
if (objMenuPop.title){
objMenuPop.title.htmlText = String("Cast Special Attack");
};
if (objMenuPop.desc){
objMenuPop.desc.htmlText = String("Deadly Multiple Shoot <br>Hotkey SPACE");
};
};
if (type == _SCORE_INFO){
if (objMenuPop.title){
objMenuPop.title.htmlText = String("");
};
if (objMenuPop.desc){
objMenuPop.desc.htmlText = String("Current Score Info");
};
};
if (type == _EXP_INFO){
if (objMenuPop.title){
objMenuPop.title.htmlText = String("");
};
if (objMenuPop.desc){
objMenuPop.desc.htmlText = String("Current Exp Info");
};
};
if (type == _SOUND_INFO){
if (objMenuPop.title){
objMenuPop.title.htmlText = String("");
};
if (objMenuPop.desc){
objMenuPop.desc.htmlText = String("Turn ON OFF BGM Sound");
};
};
if (type == _QUIT_INFO){
if (objMenuPop.title){
objMenuPop.title.htmlText = String("");
};
if (objMenuPop.desc){
objMenuPop.desc.htmlText = String("Quit to Map");
};
};
if (type == _ARMY_BATTLE_STAT){
if ((((((((objSelect == null)) || ((objMenuPop == null)))) || ((objSelect.statDef == null)))) || ((objMenuPop.title == null)))){
inactive();
return;
};
if (objSelect.statDef.type == 20){
objMenuPop.title.htmlText = String("Hobbit");
};
if (objSelect.statDef.type == 21){
objMenuPop.title.htmlText = String("Warrior Elf");
};
if (objSelect.statDef.type == 22){
objMenuPop.title.htmlText = String("Dwarf Elder");
};
if (objSelect.statDef.type == 23){
objMenuPop.title.htmlText = String("Wizard");
};
if (objSelect.statDef.type == 24){
objMenuPop.title.htmlText = String("Golem");
};
if (objSelect.statDef.type == 25){
objMenuPop.title.htmlText = String("Blue Dragon");
};
if (objSelect.statDef.type == 26){
objMenuPop.title.htmlText = String("Arch Angel");
};
if (objSelect.statDef.type == 1){
objMenuPop.title.htmlText = String("Goblin");
};
if (objSelect.statDef.type == 2){
objMenuPop.title.htmlText = String("Orc");
};
if (objSelect.statDef.type == 3){
objMenuPop.title.htmlText = String("Ogre");
};
if (objSelect.statDef.type == 4){
objMenuPop.title.htmlText = String("Troll");
};
if (objSelect.statDef.type == 5){
objMenuPop.title.htmlText = String("Centaur");
};
if (objSelect.statDef.type == 6){
objMenuPop.title.htmlText = String("Red Dragon");
};
if (objSelect.statDef.type == 7){
objMenuPop.title.htmlText = String("Arch Devil");
};
if (objSelect.statDef.type == 8){
objMenuPop.title.htmlText = String("The End");
};
if (objMenuPop.health){
objMenuPop.health.htmlText = String(((String(objSelect.statDef.health) + " / ") + String(objSelect.statDef.max_health)));
};
if (objMenuPop.power){
if ((((((objSelect.statDef.type == 23)) || ((objSelect.statDef.type == 26)))) || ((objSelect.statDef.type == 7)))){
objMenuPop.power.htmlText = String((String(objSelect.statDef.power) + " x 4"));
} else {
objMenuPop.power.htmlText = String(objSelect.statDef.power);
};
};
};
}
public function showPopUp(_objSelect, _type:int=0){
inactive();
objSelect = _objSelect;
type = _type;
if (objSelect == null){
return;
};
if ((((((((type == _BASIC_ARROW_ICO)) || ((type == _FIRE_ARROW_ICO)))) || ((type == _ICE_ARROW_ICO)))) || ((type == _THUNDER_ARROW_ICO)))){
objMenuPop.gotoAndStop(2);
};
if ((((((((type == _BUILD_TURRET_ICO)) || ((type == _BUILD_BARRIER_ICO)))) || ((type == _BUILD_TRAP_ICO)))) || ((type == _BUILD_MANA_ICO)))){
objMenuPop.gotoAndStop(3);
};
if ((((((((((((((type == _ARMY_HOBBIT_ICO)) || ((type == _ARMY_ELF_ICO)))) || ((type == _ARMY_DWARF_ICO)))) || ((type == _ARMY_WIZARD_ICO)))) || ((type == _ARMY_GOLEM_ICO)))) || ((type == _ARMY_DRAGON_ICO)))) || ((type == _ARMY_ANGEL_ICO)))){
objMenuPop.gotoAndStop(4);
};
if (type == _ARMY_BATTLE_STAT){
objMenuPop.gotoAndStop(5);
};
if ((((((((((type == _SPECIAL_INFO)) || ((type == _SCORE_INFO)))) || ((type == _EXP_INFO)))) || ((type == _SOUND_INFO)))) || ((type == _QUIT_INFO)))){
objMenuPop.gotoAndStop(6);
};
defSys.contMenu.addEventListener(Event.ENTER_FRAME, frameMenuHandle, false, 0, true);
objSelect.addEventListener(MouseEvent.MOUSE_OUT, objectInfoOUT, false, 0, true);
}
public function inactive(){
if (objSelect){
objSelect.removeEventListener(MouseEvent.MOUSE_OUT, objectInfoOUT);
objSelect = null;
};
defSys.contMenu.removeEventListener(Event.ENTER_FRAME, frameMenuHandle);
objMenuPop.gotoAndStop(1);
}
}
}//package DefX.System
Section 75
//DEFBattle (DefX.System.DEFBattle)
package DefX.System {
import DefX.GUI.*;
import DefX.Bullet.*;
public class DEFBattle {
private var testUI;
private var defSys;
private var mArmy;
private var mStatUI;
private var areaLv:int;// = 1
private var mBattleUI;
public var is_active:Boolean;// = false
private var mBase;
public function DEFBattle(_DefSys){
areaLv = 1;
is_active = false;
super();
defSys = _DefSys;
}
public function keyboardListener(){
if (mBase){
mBase.update();
};
}
public function initialise(_areaLv:int=1){
areaLv = _areaLv;
mBase = new BattleBaseBG(defSys);
mBase.initialise();
mBattleUI = new BattleGUI(defSys);
mBattleUI.initialise(mBase);
mArmy = new BattleArmy(defSys, mBase, mBattleUI);
mArmy.initialise();
mBase.init2(mArmy);
is_active = true;
}
public function update(){
if (is_active){
if (mBase.battle_state == 0){
keyboardListener();
} else {
if (mBase.battle_state == 1){
mBattleUI.showConclusion(true);
} else {
if (mBase.battle_state == 2){
mBattleUI.showConclusion(false);
} else {
if (mBase.battle_state == 99){
destroy();
defSys.gmState = 3;
};
};
};
};
};
if (mArmy){
mArmy.update();
};
}
public function destroy(){
if (mStatUI){
mStatUI.destroy();
mStatUI = null;
};
if (mBattleUI){
mBattleUI.destroy();
mBattleUI = null;
};
if (mArmy){
mArmy.destroy();
mArmy = null;
};
if (mBase){
mBase.destroy();
mBase = null;
};
while (defSys.contArrow.numChildren > 0) {
defSys.contArrow.getChildAt(0).destroy();
};
while (defSys.contBloodSplat.numChildren > 0) {
defSys.contBloodSplat.getChildAt(0).destroy();
};
is_active = false;
}
}
}//package DefX.System
Section 76
//DEFSystem (DefX.System.DEFSystem)
package DefX.System {
import flash.display.*;
import com.kongregate.as3.client.events.*;
import com.kongregate.as3.client.*;
import FZBase.Control.*;
import FZBase.Sound.*;
import FZBase.Menu.*;
public class DEFSystem {
public var stageRoot;
public var tmpExp:int;// = 0
public var rightBorder:int;// = 1300
public var siteLock:Boolean;// = false
public var leftBorder:int;// = -100
public var ST_WORLD;// = 3
public var contBg:Sprite;
public var specialContent:Boolean;// = false
public var game_lv:int;// = 1
public var contBloodSplat:Sprite;
private var sndBgm;// = null
var kongregateServiceLoaded:Boolean;// = false
public var ST_UPGRADE;// = 4
public var upBorder:int;// = 0
public var dat;
public var contMenu:Sprite;
public var ST_MAINMENU;// = 1
public var ST_LOADER;// = 5
public var TOTAL_SCORE:int;// = 0
public var tmpScore:int;// = 0
public var ALL_UPGRADES_COMPLETED:int;// = 0
public var UNITS_COMPLETED:int;// = 0
public var playMoreLink:String;// = "http://www.kongregate.com/?gamereferral=epic-war"
public var ALL_STAGE_PERFECT_SCORE:int;// = 0
public var contCastle:Sprite;
public var gmState:int;// = 0
public var contCannon:Sprite;
public var ST_BATTLE;// = 2
public var ARROWS_COMPLETED:int;// = 0
public var LEVELS_COMPLETED:int;// = 0
public var contEffect:Sprite;
public var contBlood:Sprite;
var kongregate:KongregateAPI;
public var contArmy:Sprite;
private var ctrlKey;
public var landBorder:int;// = 410
public var isPaused:Boolean;// = false
public var downBorder:int;// = 600
public var contArrow:Sprite;
public var contSCROLL:Sprite;
public function DEFSystem(){
ST_MAINMENU = 1;
ST_BATTLE = 2;
ST_WORLD = 3;
ST_UPGRADE = 4;
ST_LOADER = 5;
gmState = 0;
isPaused = false;
leftBorder = -100;
rightBorder = 1300;
upBorder = 0;
downBorder = 600;
landBorder = 410;
tmpScore = 0;
tmpExp = 0;
game_lv = 1;
playMoreLink = "http://www.kongregate.com/?gamereferral=epic-war";
sndBgm = null;
siteLock = false;
specialContent = false;
TOTAL_SCORE = 0;
LEVELS_COMPLETED = 0;
ARROWS_COMPLETED = 0;
UNITS_COMPLETED = 0;
ALL_UPGRADES_COMPLETED = 0;
ALL_STAGE_PERFECT_SCORE = 0;
kongregateServiceLoaded = false;
super();
}
public function playBgmWorld(){
if (sndBgm){
sndBgm.stopSound();
};
sndBgm = new menu();
sndBgm.playSoundLoop();
sndBgm.setVolume(1);
}
public function playBgmCover(){
if (sndBgm){
sndBgm.stopSound();
};
sndBgm = new coverTitle();
sndBgm.playSoundLoop();
sndBgm.setVolume(0.5);
}
private function serviceLoaded(e:KongregateEvent):void{
kongregate.services.connect();
kongregateServiceLoaded = true;
}
public function scrollX(val:int){
contSCROLL.x = Math.min(Math.max((contSCROLL.x + val), -400), 0);
}
function securityCheck():Boolean{
var domain_parts:*;
var real_domain:*;
var domain:*;
trace(stageRoot.loaderInfo.loaderURL);
domain_parts = stageRoot.loaderInfo.loaderURL.split("://");
real_domain = domain_parts[1].split("/");
domain = real_domain[0];
if (localCheck()){
specialContent = true;
return (true);
};
if (domain == "artlogicgames.com"){
specialContent = true;
return (true);
};
if (domain == "www.artlogicgames.com"){
specialContent = true;
return (true);
};
if (domain == "chat.kongregate.com"){
specialContent = true;
return (true);
};
if (domain == "kongregate.com"){
specialContent = true;
return (true);
};
if (domain == "www.kongregate.com"){
specialContent = true;
return (true);
};
if (domain == "games.kongregate.com"){
specialContent = true;
return (true);
};
if (domain == "kongregatetrunk.com"){
specialContent = true;
return (true);
};
if (domain == "www.kongregatetrunk.com"){
specialContent = true;
return (true);
};
if (domain == "uploads.ungrounded.net"){
specialContent = true;
return (true);
};
return (false);
}
public function toggleSoundON(){
if (sndBgm){
sndBgm.setVolume(0.5);
};
}
public function playBgmBattle(){
if (sndBgm){
sndBgm.stopSound();
};
sndBgm = new battleField();
sndBgm.playSoundLoop();
sndBgm.setVolume(0.5);
}
public function getStageRoot():Object{
if (stageRoot){
return (stageRoot);
};
return (null);
}
public function submitStat(){
TOTAL_SCORE = ((((((((((((((dat.level_01_BestScore + dat.level_02_BestScore) + dat.level_03_BestScore) + dat.level_04_BestScore) + dat.level_05_BestScore) + dat.level_06_BestScore) + dat.level_07_BestScore) + dat.level_08_BestScore) + dat.level_09_BestScore) + dat.level_10_BestScore) + dat.level_11_BestScore) + dat.level_12_BestScore) + dat.level_13_BestScore) + dat.level_14_BestScore) + dat.level_15_BestScore);
LEVELS_COMPLETED = 0;
if (dat.level_01_Play > 1){
LEVELS_COMPLETED = 1;
};
if (dat.level_02_Play > 1){
LEVELS_COMPLETED = 2;
};
if (dat.level_03_Play > 1){
LEVELS_COMPLETED = 3;
};
if (dat.level_04_Play > 1){
LEVELS_COMPLETED = 4;
};
if (dat.level_05_Play > 1){
LEVELS_COMPLETED = 5;
};
if (dat.level_06_Play > 1){
LEVELS_COMPLETED = 6;
};
if (dat.level_07_Play > 1){
LEVELS_COMPLETED = 7;
};
if (dat.level_08_Play > 1){
LEVELS_COMPLETED = 8;
};
if (dat.level_09_Play > 1){
LEVELS_COMPLETED = 9;
};
if (dat.level_10_Play > 1){
LEVELS_COMPLETED = 10;
};
if (dat.level_11_Play > 1){
LEVELS_COMPLETED = 11;
};
if (dat.level_12_Play > 1){
LEVELS_COMPLETED = 12;
};
if (dat.level_13_Play > 1){
LEVELS_COMPLETED = 13;
};
if (dat.level_14_Play > 1){
LEVELS_COMPLETED = 14;
};
if (dat.level_15_Play > 1){
LEVELS_COMPLETED = 15;
};
if ((((((((dat.arrowBasicLv >= 5)) && ((dat.arrowFireLv >= 5)))) && ((dat.arrowIceLv >= 5)))) && ((dat.arrowThunderLv >= 5)))){
ARROWS_COMPLETED = 1;
} else {
ARROWS_COMPLETED = 0;
};
if ((((((((((dat.slot1Lv >= 5)) && ((dat.slot2Lv >= 5)))) && ((dat.slot3Lv >= 5)))) && ((dat.slot4Lv >= 5)))) && ((dat.slot5Lv >= 5)))){
UNITS_COMPLETED = 1;
} else {
UNITS_COMPLETED = 0;
};
if ((((((((((((((((((((((dat.manaStockLv >= 5)) && ((dat.manaRegenLv >= 5)))) && ((dat.manaGainLv >= 5)))) && ((dat.moneyGainLv >= 5)))) && ((dat.castleLv >= 5)))) && ((dat.turretLv >= 5)))) && ((dat.trapLv >= 5)))) && ((dat.barrierLv >= 5)))) && ((dat.specialLv >= 5)))) && ((ARROWS_COMPLETED == 1)))) && ((UNITS_COMPLETED == 1)))){
ALL_UPGRADES_COMPLETED = 1;
} else {
ALL_UPGRADES_COMPLETED = 0;
};
if ((((((((((((((((((((((((((((((dat.level_01_BestScore >= dat.level_01_PerfectScore)) && ((dat.level_02_BestScore >= dat.level_02_PerfectScore)))) && ((dat.level_03_BestScore >= dat.level_03_PerfectScore)))) && ((dat.level_04_BestScore >= dat.level_04_PerfectScore)))) && ((dat.level_05_BestScore >= dat.level_05_PerfectScore)))) && ((dat.level_06_BestScore >= dat.level_06_PerfectScore)))) && ((dat.level_07_BestScore >= dat.level_07_PerfectScore)))) && ((dat.level_08_BestScore >= dat.level_08_PerfectScore)))) && ((dat.level_09_BestScore >= dat.level_09_PerfectScore)))) && ((dat.level_10_BestScore >= dat.level_10_PerfectScore)))) && ((dat.level_11_BestScore >= dat.level_11_PerfectScore)))) && ((dat.level_12_BestScore >= dat.level_12_PerfectScore)))) && ((dat.level_13_BestScore >= dat.level_13_PerfectScore)))) && ((dat.level_14_BestScore >= dat.level_14_PerfectScore)))) && ((dat.level_15_BestScore >= dat.level_15_PerfectScore)))){
ALL_STAGE_PERFECT_SCORE = 1;
} else {
ALL_STAGE_PERFECT_SCORE = 0;
};
trace(("TOTAL_SCORE : " + String(TOTAL_SCORE)));
trace(("LEVELS_COMPLETED : " + String(LEVELS_COMPLETED)));
trace(("ARROWS_COMPLETED : " + String(ARROWS_COMPLETED)));
trace(("UNITS_COMPLETED : " + String(UNITS_COMPLETED)));
trace(("ALL_UPGRADES_COMPLETED : " + String(ALL_UPGRADES_COMPLETED)));
trace(("ALL_STAGE_PERFECT_SCORE : " + String(ALL_STAGE_PERFECT_SCORE)));
if (((kongregate) && (kongregateServiceLoaded))){
kongregate.stats.submit("TOTAL_SCORE", TOTAL_SCORE);
kongregate.stats.submit("LEVELS_COMPLETED", LEVELS_COMPLETED);
kongregate.stats.submit("ARROWS_COMPLETED", ARROWS_COMPLETED);
kongregate.stats.submit("UNITS_COMPLETED", UNITS_COMPLETED);
kongregate.stats.submit("ALL_UPGRADES_COMPLETED", ALL_UPGRADES_COMPLETED);
kongregate.stats.submit("ALL_STAGE_PERFECT_SCORE", ALL_STAGE_PERFECT_SCORE);
trace("data submitted !!");
};
}
public function toggleSoundOFF(){
if (sndBgm){
sndBgm.setVolume(0);
};
}
private function initKongregateAPI(){
kongregate = new KongregateAPI();
stageRoot.addChild(kongregate);
kongregate.addEventListener(KongregateEvent.COMPLETE, serviceLoaded);
}
public function initialise(_stageRoot):Boolean{
stageRoot = _stageRoot;
stageRoot.scaleX = 0.875;
stageRoot.scaleY = 0.875;
if ((((securityCheck() == false)) && (siteLock))){
return (false);
};
if (specialContent){
trace("special content ON");
} else {
trace("special content OFF");
};
contSCROLL = new Sprite();
stageRoot.addChild(contSCROLL);
contBg = new Sprite();
contSCROLL.addChild(contBg);
contCastle = new Sprite();
contSCROLL.addChild(contCastle);
contCannon = new Sprite();
contSCROLL.addChild(contCannon);
contBloodSplat = new Sprite();
contSCROLL.addChild(contBloodSplat);
contArmy = new Sprite();
contSCROLL.addChild(contArmy);
contArrow = new Sprite();
contSCROLL.addChild(contArrow);
contEffect = new Sprite();
contSCROLL.addChild(contEffect);
contBlood = new Sprite();
contSCROLL.addChild(contBlood);
contMenu = new Sprite();
stageRoot.addChild(contMenu);
trace("init container ... OK");
ctrlKey = new ControlKey();
ctrlKey.initialise(stageRoot);
dat = new GameData();
dat.initialise();
reset();
initKongregateAPI();
return (true);
}
function localCheck():Boolean{
if (stageRoot.loaderInfo.loaderURL == "file:///F|/ferry%20FLASH%20GAME%20DEV/08%2DDefender/Defender.swf"){
return (true);
};
return (false);
}
public function getCtrl():Object{
if (ctrlKey){
return (ctrlKey);
};
return (null);
}
public function reset(){
isPaused = false;
gmState = 0;
contSCROLL.x = 0;
}
public function playBgmFinal(){
if (sndBgm){
sndBgm.stopSound();
};
sndBgm = new finalBattleField();
sndBgm.playSoundLoop();
sndBgm.setVolume(0.5);
}
}
}//package DefX.System
Section 77
//GameData (DefX.System.GameData)
package DefX.System {
import flash.net.*;
public class GameData {
public var level_01_BestScore:int;// = 0
public var level_02_PerfectScore:int;// = 0
public var arrowBasicLv:int;// = 0
public var level_10_PerfectScore:int;// = 0
public var level_09_BestScore:int;// = 0
public var level_01_Play:int;// = 0
public var slot4Lv:int;// = 0
public var level_07_PerfectScore:int;// = 0
public var specialLv:int;// = 0
public var level_12_BestScore:int;// = 0
public var level_05_BestScore:int;// = 0
public var is_saved:Boolean;// = false
public var level_06_Play:int;// = 0
public var level_15_PerfectScore:int;// = 0
public var level_04_PerfectScore:int;// = 0
public var level_09_Play:int;// = 0
public var moneyGainLv:int;// = 0
public var level_14_Play:int;// = 0
public var level_04_BestScore:int;// = 0
public var level_12_PerfectScore:int;// = 0
public var level_08_BestScore:int;// = 0
public var level_03_Play:int;// = 0
public var level_11_Play:int;// = 0
public var slot3Lv:int;// = 0
public var manaRegenLv:int;// = 0
public var slot7Lv:int;// = 0
public var level_09_PerfectScore:int;// = 0
public var level_01_PerfectScore:int;// = 0
public var level_11_BestScore:int;// = 0
public var level_15_BestScore:int;// = 0
public var level_08_Play:int;// = 0
public var level_06_PerfectScore:int;// = 0
public var arrowThunderLv:int;// = 0
public var level_14_PerfectScore:int;// = 0
public var level_03_BestScore:int;// = 0
public var manaGainLv:int;// = 0
public var level_07_BestScore:int;// = 0
public var level_05_Play:int;// = 0
public var level_13_Play:int;// = 0
public var trapLv:int;// = 0
public var turretLv:int;// = 0
public var slot2Lv:int;// = 0
public var barrierLv:int;// = 0
public var slot6Lv:int;// = 0
public var level_03_PerfectScore:int;// = 0
public var castleLv:int;// = 0
public var level_14_BestScore:int;// = 0
public var level_10_BestScore:int;// = 0
public var level_02_Play:int;// = 0
public var level_11_PerfectScore:int;// = 0
public var level_10_Play:int;// = 0
public var money:int;// = 0
public var level_08_PerfectScore:int;// = 0
public var arrowFireLv:int;// = 0
public var level_02_BestScore:int;// = 0
public var level_07_Play:int;// = 0
public var level_06_BestScore:int;// = 0
public var level_15_Play:int;// = 0
public var slot1Lv:int;// = 0
public var slot5Lv:int;// = 0
public var level_05_PerfectScore:int;// = 0
public var level_13_PerfectScore:int;// = 0
public var arrowIceLv:int;// = 0
public var level_13_BestScore:int;// = 0
public var level_04_Play:int;// = 0
public var level_12_Play:int;// = 0
public var manaStockLv:int;// = 0
public function GameData(){
slot1Lv = 0;
slot2Lv = 0;
slot3Lv = 0;
slot4Lv = 0;
slot5Lv = 0;
slot6Lv = 0;
slot7Lv = 0;
arrowBasicLv = 0;
arrowFireLv = 0;
arrowIceLv = 0;
arrowThunderLv = 0;
manaStockLv = 0;
manaRegenLv = 0;
manaGainLv = 0;
moneyGainLv = 0;
castleLv = 0;
turretLv = 0;
trapLv = 0;
barrierLv = 0;
specialLv = 0;
money = 0;
is_saved = false;
level_01_Play = 0;
level_01_PerfectScore = 0;
level_01_BestScore = 0;
level_02_Play = 0;
level_02_PerfectScore = 0;
level_02_BestScore = 0;
level_03_Play = 0;
level_03_PerfectScore = 0;
level_03_BestScore = 0;
level_04_Play = 0;
level_04_PerfectScore = 0;
level_04_BestScore = 0;
level_05_Play = 0;
level_05_PerfectScore = 0;
level_05_BestScore = 0;
level_06_Play = 0;
level_06_PerfectScore = 0;
level_06_BestScore = 0;
level_07_Play = 0;
level_07_PerfectScore = 0;
level_07_BestScore = 0;
level_08_Play = 0;
level_08_PerfectScore = 0;
level_08_BestScore = 0;
level_09_Play = 0;
level_09_PerfectScore = 0;
level_09_BestScore = 0;
level_10_Play = 0;
level_10_PerfectScore = 0;
level_10_BestScore = 0;
level_11_Play = 0;
level_11_PerfectScore = 0;
level_11_BestScore = 0;
level_12_Play = 0;
level_12_PerfectScore = 0;
level_12_BestScore = 0;
level_13_Play = 0;
level_13_PerfectScore = 0;
level_13_BestScore = 0;
level_14_Play = 0;
level_14_PerfectScore = 0;
level_14_BestScore = 0;
level_15_Play = 0;
level_15_PerfectScore = 0;
level_15_BestScore = 0;
super();
}
public function testing(){
money = 5000000;
level_01_Play = 1;
level_02_Play = 1;
level_03_Play = 1;
level_04_Play = 1;
level_05_Play = 1;
level_06_Play = 1;
level_07_Play = 1;
level_08_Play = 1;
level_09_Play = 1;
level_10_Play = 1;
level_11_Play = 1;
level_12_Play = 1;
level_13_Play = 1;
level_14_Play = 1;
level_15_Play = 1;
}
public function upgradeArrowFire():Boolean{
if ((((arrowFireLv == 0)) && ((money >= 2000)))){
money = (money - 2000);
arrowFireLv = 1;
return (true);
};
if ((((arrowFireLv == 1)) && ((money >= 3500)))){
money = (money - 3500);
arrowFireLv = 2;
return (true);
};
if ((((arrowFireLv == 2)) && ((money >= 8000)))){
money = (money - 8000);
arrowFireLv = 3;
return (true);
};
if ((((arrowFireLv == 3)) && ((money >= 16500)))){
money = (money - 16500);
arrowFireLv = 4;
return (true);
};
if ((((arrowFireLv == 4)) && ((money >= 30000)))){
money = (money - 30000);
arrowFireLv = 5;
return (true);
};
return (false);
}
public function upgradeTurret():Boolean{
if ((((turretLv == 0)) && ((money >= 3000)))){
money = (money - 3000);
turretLv = 1;
return (true);
};
if ((((turretLv == 1)) && ((money >= 5000)))){
money = (money - 5000);
turretLv = 2;
return (true);
};
if ((((turretLv == 2)) && ((money >= 7000)))){
money = (money - 7000);
turretLv = 3;
return (true);
};
if ((((turretLv == 3)) && ((money >= 9000)))){
money = (money - 9000);
turretLv = 4;
return (true);
};
if ((((turretLv == 4)) && ((money >= 11000)))){
money = (money - 11000);
turretLv = 5;
return (true);
};
return (false);
}
public function upgradeSlot1():Boolean{
if ((((slot1Lv == 0)) && ((money >= 1000)))){
money = (money - 1000);
slot1Lv = 1;
return (true);
};
if ((((slot1Lv == 1)) && ((money >= 1500)))){
money = (money - 1500);
slot1Lv = 2;
return (true);
};
if ((((slot1Lv == 2)) && ((money >= 3000)))){
money = (money - 3000);
slot1Lv = 3;
return (true);
};
if ((((slot1Lv == 3)) && ((money >= 4500)))){
money = (money - 4500);
slot1Lv = 4;
return (true);
};
if ((((slot1Lv == 4)) && ((money >= 6000)))){
money = (money - 6000);
slot1Lv = 5;
return (true);
};
return (false);
}
public function upgradeSlot2():Boolean{
if ((((slot2Lv == 0)) && ((money >= 1500)))){
money = (money - 1500);
slot2Lv = 1;
return (true);
};
if ((((slot2Lv == 1)) && ((money >= 3000)))){
money = (money - 3000);
slot2Lv = 2;
return (true);
};
if ((((slot2Lv == 2)) && ((money >= 4500)))){
money = (money - 4500);
slot2Lv = 3;
return (true);
};
if ((((slot2Lv == 3)) && ((money >= 6000)))){
money = (money - 6000);
slot2Lv = 4;
return (true);
};
if ((((slot2Lv == 4)) && ((money >= 7500)))){
money = (money - 7500);
slot2Lv = 5;
return (true);
};
return (false);
}
public function upgradeSlot4():Boolean{
if ((((slot4Lv == 0)) && ((money >= 4000)))){
money = (money - 4000);
slot4Lv = 1;
return (true);
};
if ((((slot4Lv == 1)) && ((money >= 5500)))){
money = (money - 5500);
slot4Lv = 2;
return (true);
};
if ((((slot4Lv == 2)) && ((money >= 7000)))){
money = (money - 7000);
slot4Lv = 3;
return (true);
};
if ((((slot4Lv == 3)) && ((money >= 9500)))){
money = (money - 9500);
slot4Lv = 4;
return (true);
};
if ((((slot4Lv == 4)) && ((money >= 11000)))){
money = (money - 11000);
slot4Lv = 5;
return (true);
};
return (false);
}
public function upgradeCastle():Boolean{
if ((((castleLv == 0)) && ((money >= 3000)))){
money = (money - 3000);
castleLv = 1;
return (true);
};
if ((((castleLv == 1)) && ((money >= 6000)))){
money = (money - 6000);
castleLv = 2;
return (true);
};
if ((((castleLv == 2)) && ((money >= 9000)))){
money = (money - 9000);
castleLv = 3;
return (true);
};
if ((((castleLv == 3)) && ((money >= 12000)))){
money = (money - 12000);
castleLv = 4;
return (true);
};
if ((((castleLv == 4)) && ((money >= 15000)))){
money = (money - 15000);
castleLv = 5;
return (true);
};
return (false);
}
public function upgradeSlot6():Boolean{
if ((((slot6Lv == 0)) && ((money >= 10000)))){
money = (money - 10000);
slot6Lv = 1;
return (true);
};
if ((((slot6Lv == 1)) && ((money >= 12000)))){
money = (money - 12000);
slot6Lv = 2;
return (true);
};
if ((((slot6Lv == 2)) && ((money >= 14000)))){
money = (money - 14000);
slot6Lv = 3;
return (true);
};
if ((((slot6Lv == 3)) && ((money >= 16000)))){
money = (money - 16000);
slot6Lv = 4;
return (true);
};
if ((((slot6Lv == 4)) && ((money >= 18000)))){
money = (money - 18000);
slot6Lv = 5;
return (true);
};
return (false);
}
public function upgradeSlot3():Boolean{
if ((((slot3Lv == 0)) && ((money >= 2000)))){
money = (money - 2000);
slot3Lv = 1;
return (true);
};
if ((((slot3Lv == 1)) && ((money >= 4500)))){
money = (money - 5000);
slot3Lv = 2;
return (true);
};
if ((((slot3Lv == 2)) && ((money >= 6000)))){
money = (money - 6000);
slot3Lv = 3;
return (true);
};
if ((((slot3Lv == 3)) && ((money >= 7500)))){
money = (money - 7500);
slot3Lv = 4;
return (true);
};
if ((((slot3Lv == 4)) && ((money >= 9000)))){
money = (money - 9000);
slot3Lv = 5;
return (true);
};
return (false);
}
public function upgradeSlot5():Boolean{
if ((((slot5Lv == 0)) && ((money >= 6000)))){
money = (money - 6000);
slot5Lv = 1;
return (true);
};
if ((((slot5Lv == 1)) && ((money >= 7500)))){
money = (money - 7500);
slot5Lv = 2;
return (true);
};
if ((((slot5Lv == 2)) && ((money >= 9000)))){
money = (money - 9000);
slot5Lv = 3;
return (true);
};
if ((((slot5Lv == 3)) && ((money >= 11000)))){
money = (money - 11000);
slot5Lv = 4;
return (true);
};
if ((((slot5Lv == 4)) && ((money >= 12500)))){
money = (money - 12500);
slot5Lv = 5;
return (true);
};
return (false);
}
public function upgradeManaStock():Boolean{
if ((((manaStockLv == 0)) && ((money >= 4000)))){
money = (money - 4000);
manaStockLv = 1;
return (true);
};
if ((((manaStockLv == 1)) && ((money >= 10000)))){
money = (money - 10000);
manaStockLv = 2;
return (true);
};
if ((((manaStockLv == 2)) && ((money >= 15000)))){
money = (money - 15000);
manaStockLv = 3;
return (true);
};
if ((((manaStockLv == 3)) && ((money >= 20000)))){
money = (money - 20000);
manaStockLv = 4;
return (true);
};
if ((((manaStockLv == 4)) && ((money >= 30000)))){
money = (money - 30000);
manaStockLv = 5;
return (true);
};
return (false);
}
public function upgradeTrap():Boolean{
if ((((trapLv == 0)) && ((money >= 2000)))){
money = (money - 2000);
trapLv = 1;
return (true);
};
if ((((trapLv == 1)) && ((money >= 3000)))){
money = (money - 3000);
trapLv = 2;
return (true);
};
if ((((trapLv == 2)) && ((money >= 6000)))){
money = (money - 6000);
trapLv = 3;
return (true);
};
if ((((trapLv == 3)) && ((money >= 8000)))){
money = (money - 8000);
trapLv = 4;
return (true);
};
if ((((trapLv == 4)) && ((money >= 10000)))){
money = (money - 10000);
trapLv = 5;
return (true);
};
return (false);
}
public function upgradeSlot7():Boolean{
if ((((slot7Lv == 0)) && ((money >= 20000)))){
money = (money - 20000);
slot7Lv = 1;
return (true);
};
if ((((slot7Lv == 1)) && ((money >= 24000)))){
money = (money - 24000);
slot7Lv = 2;
return (true);
};
if ((((slot7Lv == 2)) && ((money >= 28000)))){
money = (money - 28000);
slot7Lv = 3;
return (true);
};
if ((((slot7Lv == 3)) && ((money >= 35000)))){
money = (money - 35000);
slot7Lv = 4;
return (true);
};
if ((((slot7Lv == 4)) && ((money >= 40000)))){
money = (money - 40000);
slot7Lv = 5;
return (true);
};
return (false);
}
public function upgradeManaRegen():Boolean{
if ((((manaRegenLv == 0)) && ((money >= 3000)))){
money = (money - 3000);
manaRegenLv = 1;
return (true);
};
if ((((manaRegenLv == 1)) && ((money >= 4000)))){
money = (money - 4000);
manaRegenLv = 2;
return (true);
};
if ((((manaRegenLv == 2)) && ((money >= 5000)))){
money = (money - 5000);
manaRegenLv = 3;
return (true);
};
if ((((manaRegenLv == 3)) && ((money >= 6000)))){
money = (money - 6000);
manaRegenLv = 4;
return (true);
};
if ((((manaRegenLv == 4)) && ((money >= 7500)))){
money = (money - 7500);
manaRegenLv = 5;
return (true);
};
return (false);
}
public function upgradeMoneyGain():Boolean{
if ((((moneyGainLv == 0)) && ((money >= 3000)))){
money = (money - 3000);
moneyGainLv = 1;
return (true);
};
if ((((moneyGainLv == 1)) && ((money >= 4000)))){
money = (money - 4000);
moneyGainLv = 2;
return (true);
};
if ((((moneyGainLv == 2)) && ((money >= 5000)))){
money = (money - 5000);
moneyGainLv = 3;
return (true);
};
if ((((moneyGainLv == 3)) && ((money >= 6000)))){
money = (money - 6000);
moneyGainLv = 4;
return (true);
};
if ((((moneyGainLv == 4)) && ((money >= 7500)))){
money = (money - 7500);
moneyGainLv = 5;
return (true);
};
return (false);
}
public function loadData(mName:String="DEFX_SAVE"){
var so:SharedObject;
so = SharedObject.getLocal(mName);
is_saved = so.data.is_saved;
money = so.data.dat_money;
castleLv = so.data.dat_castleLv;
turretLv = so.data.dat_turretLv;
trapLv = so.data.dat_trapLv;
barrierLv = so.data.dat_barrierLv;
specialLv = so.data.dat_specialLv;
arrowBasicLv = so.data.dat_arrowBasicLv;
arrowFireLv = so.data.dat_arrowFireLv;
arrowIceLv = so.data.dat_arrowIceLv;
arrowThunderLv = so.data.dat_arrowThunderLv;
manaStockLv = so.data.dat_manaStockLv;
manaRegenLv = so.data.dat_manaRegenLv;
manaGainLv = so.data.dat_manaGainLv;
moneyGainLv = so.data.dat_moneyGainLv;
slot1Lv = so.data.dat_slot1Lv;
slot2Lv = so.data.dat_slot2Lv;
slot3Lv = so.data.dat_slot3Lv;
slot4Lv = so.data.dat_slot4Lv;
slot5Lv = so.data.dat_slot5Lv;
slot6Lv = so.data.dat_slot6Lv;
slot7Lv = so.data.dat_slot7Lv;
level_01_Play = so.data.dat_level_01_Play;
level_01_PerfectScore = so.data.dat_level_01_PerfectScore;
level_01_BestScore = so.data.dat_level_01_BestScore;
level_02_Play = so.data.dat_level_02_Play;
level_02_PerfectScore = so.data.dat_level_02_PerfectScore;
level_02_BestScore = so.data.dat_level_02_BestScore;
level_03_Play = so.data.dat_level_03_Play;
level_03_PerfectScore = so.data.dat_level_03_PerfectScore;
level_03_BestScore = so.data.dat_level_03_BestScore;
level_04_Play = so.data.dat_level_04_Play;
level_04_PerfectScore = so.data.dat_level_04_PerfectScore;
level_04_BestScore = so.data.dat_level_04_BestScore;
level_05_Play = so.data.dat_level_05_Play;
level_05_PerfectScore = so.data.dat_level_05_PerfectScore;
level_05_BestScore = so.data.dat_level_05_BestScore;
level_06_Play = so.data.dat_level_06_Play;
level_06_PerfectScore = so.data.dat_level_06_PerfectScore;
level_06_BestScore = so.data.dat_level_06_BestScore;
level_07_Play = so.data.dat_level_07_Play;
level_07_PerfectScore = so.data.dat_level_07_PerfectScore;
level_07_BestScore = so.data.dat_level_07_BestScore;
level_08_Play = so.data.dat_level_08_Play;
level_08_PerfectScore = so.data.dat_level_08_PerfectScore;
level_08_BestScore = so.data.dat_level_08_BestScore;
level_09_Play = so.data.dat_level_09_Play;
level_09_PerfectScore = so.data.dat_level_09_PerfectScore;
level_09_BestScore = so.data.dat_level_09_BestScore;
level_10_Play = so.data.dat_level_10_Play;
level_10_PerfectScore = so.data.dat_level_10_PerfectScore;
level_10_BestScore = so.data.dat_level_10_BestScore;
level_11_Play = so.data.dat_level_11_Play;
level_11_PerfectScore = so.data.dat_level_11_PerfectScore;
level_11_BestScore = so.data.dat_level_11_BestScore;
level_12_Play = so.data.dat_level_12_Play;
level_12_PerfectScore = so.data.dat_level_12_PerfectScore;
level_12_BestScore = so.data.dat_level_12_BestScore;
level_13_Play = so.data.dat_level_13_Play;
level_13_PerfectScore = so.data.dat_level_13_PerfectScore;
level_13_BestScore = so.data.dat_level_13_BestScore;
level_14_Play = so.data.dat_level_14_Play;
level_14_PerfectScore = so.data.dat_level_14_PerfectScore;
level_14_BestScore = so.data.dat_level_14_BestScore;
level_15_Play = so.data.dat_level_15_Play;
level_15_PerfectScore = so.data.dat_level_15_PerfectScore;
level_15_BestScore = so.data.dat_level_15_BestScore;
}
public function upgradeManaGain():Boolean{
if ((((manaGainLv == 0)) && ((money >= 3000)))){
money = (money - 3000);
manaGainLv = 1;
return (true);
};
if ((((manaGainLv == 1)) && ((money >= 4000)))){
money = (money - 4000);
manaGainLv = 2;
return (true);
};
if ((((manaGainLv == 2)) && ((money >= 5000)))){
money = (money - 5000);
manaGainLv = 3;
return (true);
};
if ((((manaGainLv == 3)) && ((money >= 6000)))){
money = (money - 6000);
manaGainLv = 4;
return (true);
};
if ((((manaGainLv == 4)) && ((money >= 7500)))){
money = (money - 7500);
manaGainLv = 5;
return (true);
};
return (false);
}
public function saveData(mName:String="DEFX_SAVE"){
var so:SharedObject;
so = SharedObject.getLocal(mName);
so.data.is_saved = new Boolean(true);
so.data.dat_money = new int(money);
so.data.dat_castleLv = new int(castleLv);
so.data.dat_turretLv = new int(turretLv);
so.data.dat_trapLv = new int(trapLv);
so.data.dat_barrierLv = new int(barrierLv);
so.data.dat_specialLv = new int(specialLv);
so.data.dat_arrowBasicLv = new int(arrowBasicLv);
so.data.dat_arrowFireLv = new int(arrowFireLv);
so.data.dat_arrowIceLv = new int(arrowIceLv);
so.data.dat_arrowThunderLv = new int(arrowThunderLv);
so.data.dat_manaStockLv = new int(manaStockLv);
so.data.dat_manaRegenLv = new int(manaRegenLv);
so.data.dat_manaGainLv = new int(manaGainLv);
so.data.dat_moneyGainLv = new int(moneyGainLv);
so.data.dat_slot1Lv = new int(slot1Lv);
so.data.dat_slot2Lv = new int(slot2Lv);
so.data.dat_slot3Lv = new int(slot3Lv);
so.data.dat_slot4Lv = new int(slot4Lv);
so.data.dat_slot5Lv = new int(slot5Lv);
so.data.dat_slot6Lv = new int(slot6Lv);
so.data.dat_slot7Lv = new int(slot7Lv);
so.data.dat_level_01_Play = new int(level_01_Play);
so.data.dat_level_01_PerfectScore = new int(level_01_PerfectScore);
so.data.dat_level_01_BestScore = new int(level_01_BestScore);
so.data.dat_level_02_Play = new int(level_02_Play);
so.data.dat_level_02_PerfectScore = new int(level_02_PerfectScore);
so.data.dat_level_02_BestScore = new int(level_02_BestScore);
so.data.dat_level_03_Play = new int(level_03_Play);
so.data.dat_level_03_PerfectScore = new int(level_03_PerfectScore);
so.data.dat_level_03_BestScore = new int(level_03_BestScore);
so.data.dat_level_04_Play = new int(level_04_Play);
so.data.dat_level_04_PerfectScore = new int(level_04_PerfectScore);
so.data.dat_level_04_BestScore = new int(level_04_BestScore);
so.data.dat_level_05_Play = new int(level_05_Play);
so.data.dat_level_05_PerfectScore = new int(level_05_PerfectScore);
so.data.dat_level_05_BestScore = new int(level_05_BestScore);
so.data.dat_level_06_Play = new int(level_06_Play);
so.data.dat_level_06_PerfectScore = new int(level_06_PerfectScore);
so.data.dat_level_06_BestScore = new int(level_06_BestScore);
so.data.dat_level_07_Play = new int(level_07_Play);
so.data.dat_level_07_PerfectScore = new int(level_07_PerfectScore);
so.data.dat_level_07_BestScore = new int(level_07_BestScore);
so.data.dat_level_08_Play = new int(level_08_Play);
so.data.dat_level_08_PerfectScore = new int(level_08_PerfectScore);
so.data.dat_level_08_BestScore = new int(level_08_BestScore);
so.data.dat_level_09_Play = new int(level_09_Play);
so.data.dat_level_09_PerfectScore = new int(level_09_PerfectScore);
so.data.dat_level_09_BestScore = new int(level_09_BestScore);
so.data.dat_level_10_Play = new int(level_10_Play);
so.data.dat_level_10_PerfectScore = new int(level_10_PerfectScore);
so.data.dat_level_10_BestScore = new int(level_10_BestScore);
so.data.dat_level_11_Play = new int(level_11_Play);
so.data.dat_level_11_PerfectScore = new int(level_11_PerfectScore);
so.data.dat_level_11_BestScore = new int(level_11_BestScore);
so.data.dat_level_12_Play = new int(level_12_Play);
so.data.dat_level_12_PerfectScore = new int(level_12_PerfectScore);
so.data.dat_level_12_BestScore = new int(level_12_BestScore);
so.data.dat_level_13_Play = new int(level_13_Play);
so.data.dat_level_13_PerfectScore = new int(level_13_PerfectScore);
so.data.dat_level_13_BestScore = new int(level_13_BestScore);
so.data.dat_level_14_Play = new int(level_14_Play);
so.data.dat_level_14_PerfectScore = new int(level_14_PerfectScore);
so.data.dat_level_14_BestScore = new int(level_14_BestScore);
so.data.dat_level_15_Play = new int(level_15_Play);
so.data.dat_level_15_PerfectScore = new int(level_15_PerfectScore);
so.data.dat_level_15_BestScore = new int(level_15_BestScore);
so.flush();
}
public function initialise(){
money = 0;
castleLv = 0;
turretLv = 0;
trapLv = 0;
barrierLv = 0;
specialLv = 1;
arrowBasicLv = 1;
arrowFireLv = 0;
arrowIceLv = 0;
arrowThunderLv = 0;
manaStockLv = 0;
manaRegenLv = 0;
manaGainLv = 0;
moneyGainLv = 0;
slot1Lv = 1;
slot2Lv = 0;
slot3Lv = 0;
slot4Lv = 0;
slot5Lv = 0;
slot6Lv = 0;
slot7Lv = 0;
level_01_Play = 1;
level_01_PerfectScore = 2000;
level_01_BestScore = 0;
level_02_Play = 0;
level_02_PerfectScore = 4500;
level_02_BestScore = 0;
level_03_Play = 0;
level_03_PerfectScore = 8000;
level_03_BestScore = 0;
level_04_Play = 0;
level_04_PerfectScore = 12000;
level_04_BestScore = 0;
level_05_Play = 0;
level_05_PerfectScore = 25000;
level_05_BestScore = 0;
level_06_Play = 0;
level_06_PerfectScore = 35000;
level_06_BestScore = 0;
level_07_Play = 0;
level_07_PerfectScore = 45000;
level_07_BestScore = 0;
level_08_Play = 0;
level_08_PerfectScore = 70000;
level_08_BestScore = 0;
level_09_Play = 0;
level_09_PerfectScore = 120000;
level_09_BestScore = 0;
level_10_Play = 0;
level_10_PerfectScore = 140000;
level_10_BestScore = 0;
level_11_Play = 0;
level_11_PerfectScore = 160000;
level_11_BestScore = 0;
level_12_Play = 0;
level_12_PerfectScore = 180000;
level_12_BestScore = 0;
level_13_Play = 0;
level_13_PerfectScore = 200000;
level_13_BestScore = 0;
level_14_Play = 0;
level_14_PerfectScore = 250000;
level_14_BestScore = 0;
level_15_Play = 0;
level_15_PerfectScore = 300000;
level_15_BestScore = 0;
}
public function upgradeArrowThunder():Boolean{
if ((((arrowThunderLv == 0)) && ((money >= 2000)))){
money = (money - 2000);
arrowThunderLv = 1;
return (true);
};
if ((((arrowThunderLv == 1)) && ((money >= 3500)))){
money = (money - 3500);
arrowThunderLv = 2;
return (true);
};
if ((((arrowThunderLv == 2)) && ((money >= 8000)))){
money = (money - 8000);
arrowThunderLv = 3;
return (true);
};
if ((((arrowThunderLv == 3)) && ((money >= 16500)))){
money = (money - 16500);
arrowThunderLv = 4;
return (true);
};
if ((((arrowThunderLv == 4)) && ((money >= 30000)))){
money = (money - 30000);
arrowThunderLv = 5;
return (true);
};
return (false);
}
public function upgradeArrowBasic():Boolean{
if ((((arrowBasicLv == 0)) && ((money >= 1000)))){
money = (money - 1000);
arrowBasicLv = 1;
return (true);
};
if ((((arrowBasicLv == 1)) && ((money >= 2000)))){
money = (money - 2000);
arrowBasicLv = 2;
return (true);
};
if ((((arrowBasicLv == 2)) && ((money >= 6000)))){
money = (money - 6000);
arrowBasicLv = 3;
return (true);
};
if ((((arrowBasicLv == 3)) && ((money >= 14000)))){
money = (money - 14000);
arrowBasicLv = 4;
return (true);
};
if ((((arrowBasicLv == 4)) && ((money >= 25000)))){
money = (money - 25000);
arrowBasicLv = 5;
return (true);
};
return (false);
}
public function upgradeBarrier():Boolean{
if ((((barrierLv == 0)) && ((money >= 2000)))){
money = (money - 2000);
barrierLv = 1;
return (true);
};
if ((((barrierLv == 1)) && ((money >= 3000)))){
money = (money - 3000);
barrierLv = 2;
return (true);
};
if ((((barrierLv == 2)) && ((money >= 6000)))){
money = (money - 6000);
barrierLv = 3;
return (true);
};
if ((((barrierLv == 3)) && ((money >= 8000)))){
money = (money - 8000);
barrierLv = 4;
return (true);
};
if ((((barrierLv == 4)) && ((money >= 10000)))){
money = (money - 10000);
barrierLv = 5;
return (true);
};
return (false);
}
public function upgradeSpecial():Boolean{
if ((((specialLv == 0)) && ((money >= 1500)))){
money = (money - 1500);
specialLv = 1;
return (true);
};
if ((((specialLv == 1)) && ((money >= 3000)))){
money = (money - 3000);
specialLv = 2;
return (true);
};
if ((((specialLv == 2)) && ((money >= 6000)))){
money = (money - 6000);
specialLv = 3;
return (true);
};
if ((((specialLv == 3)) && ((money >= 9000)))){
money = (money - 9000);
specialLv = 4;
return (true);
};
if ((((specialLv == 4)) && ((money >= 12000)))){
money = (money - 12000);
specialLv = 5;
return (true);
};
return (false);
}
public function upgradeArrowIce():Boolean{
if ((((arrowIceLv == 0)) && ((money >= 2000)))){
money = (money - 2000);
arrowIceLv = 1;
return (true);
};
if ((((arrowIceLv == 1)) && ((money >= 3500)))){
money = (money - 3500);
arrowIceLv = 2;
return (true);
};
if ((((arrowIceLv == 2)) && ((money >= 8000)))){
money = (money - 8000);
arrowIceLv = 3;
return (true);
};
if ((((arrowIceLv == 3)) && ((money >= 16500)))){
money = (money - 16500);
arrowIceLv = 4;
return (true);
};
if ((((arrowIceLv == 4)) && ((money >= 30000)))){
money = (money - 30000);
arrowIceLv = 5;
return (true);
};
return (false);
}
}
}//package DefX.System
Section 78
//DefXDoc (DefX.DefXDoc)
package DefX {
import flash.events.*;
import FZBase.Vector.*;
import DefX.GUI.*;
import DefX.System.*;
import DefX.Army.*;
import DefX.Bullet.*;
public class DefXDoc {
private var stageRoot;// = null
private var MainMenuMgr;
private var LoaderMgr;
private var WorldMgr;
private var BattleMgr;
private var defSys;// = null
private var currentState:int;// = 0
private var UpgradeMgr;
public function DefXDoc(){
stageRoot = null;
defSys = null;
currentState = 0;
super();
}
public function startRun(){
}
private function gameHandle(event:Event):void{
if (BattleMgr){
BattleMgr.update();
};
if (currentState != defSys.gmState){
if (defSys.gmState == defSys.ST_LOADER){
LoaderMgr.initialise();
currentState = defSys.gmState;
};
if (defSys.gmState == defSys.ST_MAINMENU){
MainMenuMgr.initialise();
currentState = defSys.gmState;
defSys.playBgmCover();
};
if (defSys.gmState == defSys.ST_BATTLE){
BattleMgr.initialise();
currentState = defSys.gmState;
trace(("battle stage = " + String(defSys.game_lv)));
defSys.playBgmBattle();
};
if (defSys.gmState == defSys.ST_WORLD){
WorldMgr.initialise();
currentState = defSys.gmState;
defSys.playBgmWorld();
};
if (defSys.gmState == defSys.ST_UPGRADE){
UpgradeMgr.initialise();
currentState = defSys.gmState;
};
};
}
public function initialise(_stageRoot){
stageRoot = _stageRoot;
defSys = new DEFSystem();
if (defSys.initialise(_stageRoot)){
LoaderMgr = new LogoUI(defSys);
MainMenuMgr = new MainMenuUI(defSys);
WorldMgr = new WorldMapUI(defSys);
UpgradeMgr = new UpgradeUI(defSys);
BattleMgr = new DEFBattle(defSys);
defSys.gmState = defSys.ST_MAINMENU;
defSys.gmState = defSys.ST_LOADER;
stageRoot.addEventListener(Event.ENTER_FRAME, gameHandle, false, 0, true);
};
}
}
}//package DefX
Section 79
//ControlKey (FZBase.Control.ControlKey)
package FZBase.Control {
import flash.events.*;
public class ControlKey {
private var key_press;
private var key_press2;
private var clip;
private var key_hold;
public function ControlKey(){
super();
}
public function refreshKey(){
key_press2.refreshKey();
key_press.refreshKey();
key_hold.refreshKey();
}
public function getKeyHold():Object{
if (key_hold){
return (key_hold);
};
return (null);
}
private function keyPressed(event:KeyboardEvent):void{
if (key_press.getKeyFlag(event.keyCode) == key_hold.getKeyFlag(event.keyCode)){
key_press.setKeyFlag(event.keyCode, true);
} else {
key_press.setKeyFlag(event.keyCode, false);
};
key_press2.setKeyFlag(event.keyCode, true);
key_hold.setKeyFlag(event.keyCode, true);
clip.addEventListener(Event.ENTER_FRAME, keyPressHandle, false, 0, true);
}
private function keyPressHandle(event:Event):void{
key_press.refreshKey();
key_press2.refreshKey();
clip.removeEventListener(Event.ENTER_FRAME, keyPressHandle);
}
public function initialise(clipVar){
clip = clipVar;
key_press = new KeyFlag();
key_hold = new KeyFlag();
key_press2 = new KeyFlag();
clip.addEventListener(KeyboardEvent.KEY_DOWN, keyPressed, false, 0, true);
clip.addEventListener(KeyboardEvent.KEY_UP, keyReleased, false, 0, true);
clip.addEventListener(Event.ENTER_FRAME, keyFocus, false, 0, true);
}
public function getKeyPress2():Object{
if (key_press2){
return (key_press2);
};
return (null);
}
private function keyFocus(event:Event):void{
clip.stage.focus = clip;
}
public function getKeyPress():Object{
if (key_press){
return (key_press);
};
return (null);
}
private function keyReleased(event:KeyboardEvent){
key_hold.setKeyFlag(event.keyCode, false);
}
}
}//package FZBase.Control
Section 80
//KeyFlag (FZBase.Control.KeyFlag)
package FZBase.Control {
public class KeyFlag {
public var KEY_LEFT:Boolean;// = false
public var KEY_PGDOWN:Boolean;// = false
public var KEY_0:Boolean;// = false
public var KEY_1:Boolean;// = false
public var KEY_2:Boolean;// = false
public var KEY_3:Boolean;// = false
public var KEY_4:Boolean;// = false
public var KEY_5:Boolean;// = false
public var KEY_6:Boolean;// = false
public var KEY_7:Boolean;// = false
public var KEY_8:Boolean;// = false
public var KEY_9:Boolean;// = false
public var KEY_CONTROL:Boolean;// = false
public var KEY_A:Boolean;// = false
public var KEY_B:Boolean;// = false
public var KEY_C:Boolean;// = false
public var KEY_D:Boolean;// = false
public var KEY_E:Boolean;// = false
public var KEY_F:Boolean;// = false
public var KEY_G:Boolean;// = false
public var KEY_H:Boolean;// = false
public var KEY_I:Boolean;// = false
public var KEY_J:Boolean;// = false
public var KEY_K:Boolean;// = false
public var KEY_L:Boolean;// = false
public var KEY_M:Boolean;// = false
public var KEY_N:Boolean;// = false
public var KEY_O:Boolean;// = false
public var KEY_P:Boolean;// = false
public var KEY_Q:Boolean;// = false
public var KEY_R:Boolean;// = false
public var KEY_S:Boolean;// = false
public var KEY_T:Boolean;// = false
public var KEY_U:Boolean;// = false
public var KEY_V:Boolean;// = false
public var KEY_W:Boolean;// = false
public var KEY_X:Boolean;// = false
public var KEY_Y:Boolean;// = false
public var KEY_Z:Boolean;// = false
public var KEY_SHIFT:Boolean;// = false
public var KEY_TAB:Boolean;// = false
public var KEY_ESC:Boolean;// = false
public var KEY_NUM1:Boolean;// = false
public var KEY_NUM3:Boolean;// = false
public var KEY_NUM5:Boolean;// = false
public var KEY_NUM0:Boolean;// = false
public var KEY_NUM2:Boolean;// = false
public var KEY_NUM4:Boolean;// = false
public var KEY_NUM6:Boolean;// = false
public var KEY_NUM8:Boolean;// = false
public var KEY_UP:Boolean;// = false
public var KEY_BACKSPACE:Boolean;// = false
public var KEY_NUM7:Boolean;// = false
public var KEY_NUM9:Boolean;// = false
public var KEY_F3:Boolean;// = false
public var KEY_F5:Boolean;// = false
public var KEY_F7:Boolean;// = false
public var KEY_F2:Boolean;// = false
public var KEY_F4:Boolean;// = false
public var KEY_F6:Boolean;// = false
public var KEY_ENTER:Boolean;// = false
public var KEY_F8:Boolean;// = false
public var KEY_F1:Boolean;// = false
public var KEY_END:Boolean;// = false
public var KEY_INSERT:Boolean;// = false
public var KEY_F9:Boolean;// = false
public var KEY_DELETE:Boolean;// = false
public var KEY_DOWN:Boolean;// = false
public var KEY_PGUP:Boolean;// = false
public var KEY_HOME:Boolean;// = false
public var KEY_F10:Boolean;// = false
public var KEY_F11:Boolean;// = false
public var KEY_F12:Boolean;// = false
public var KEY_SPACE:Boolean;// = false
public var KEY_RIGHT:Boolean;// = false
public function KeyFlag(){
KEY_A = false;
KEY_B = false;
KEY_C = false;
KEY_D = false;
KEY_E = false;
KEY_F = false;
KEY_G = false;
KEY_H = false;
KEY_I = false;
KEY_J = false;
KEY_K = false;
KEY_L = false;
KEY_M = false;
KEY_N = false;
KEY_O = false;
KEY_P = false;
KEY_Q = false;
KEY_R = false;
KEY_S = false;
KEY_T = false;
KEY_U = false;
KEY_V = false;
KEY_W = false;
KEY_X = false;
KEY_Y = false;
KEY_Z = false;
KEY_0 = false;
KEY_1 = false;
KEY_2 = false;
KEY_3 = false;
KEY_4 = false;
KEY_5 = false;
KEY_6 = false;
KEY_7 = false;
KEY_8 = false;
KEY_9 = false;
KEY_NUM0 = false;
KEY_NUM1 = false;
KEY_NUM2 = false;
KEY_NUM3 = false;
KEY_NUM4 = false;
KEY_NUM5 = false;
KEY_NUM6 = false;
KEY_NUM7 = false;
KEY_NUM8 = false;
KEY_NUM9 = false;
KEY_F1 = false;
KEY_F2 = false;
KEY_F3 = false;
KEY_F4 = false;
KEY_F5 = false;
KEY_F6 = false;
KEY_F7 = false;
KEY_F8 = false;
KEY_F9 = false;
KEY_F10 = false;
KEY_F11 = false;
KEY_F12 = false;
KEY_ESC = false;
KEY_ENTER = false;
KEY_SPACE = false;
KEY_SHIFT = false;
KEY_CONTROL = false;
KEY_TAB = false;
KEY_BACKSPACE = false;
KEY_PGUP = false;
KEY_PGDOWN = false;
KEY_END = false;
KEY_HOME = false;
KEY_INSERT = false;
KEY_DELETE = false;
KEY_UP = false;
KEY_DOWN = false;
KEY_LEFT = false;
KEY_RIGHT = false;
super();
}
public function getKeyFlag(keyCode):Boolean{
switch (keyCode){
case 65:
if (KEY_A){
return (true);
};
break;
case 66:
if (KEY_B){
return (true);
};
break;
case 67:
if (KEY_C){
return (true);
};
break;
case 68:
if (KEY_D){
return (true);
};
break;
case 69:
if (KEY_E){
return (true);
};
break;
case 70:
if (KEY_F){
return (true);
};
break;
case 71:
if (KEY_G){
return (true);
};
break;
case 72:
if (KEY_H){
return (true);
};
break;
case 73:
if (KEY_I){
return (true);
};
break;
case 74:
if (KEY_J){
return (true);
};
break;
case 75:
if (KEY_K){
return (true);
};
break;
case 76:
if (KEY_L){
return (true);
};
break;
case 77:
if (KEY_M){
return (true);
};
break;
case 78:
if (KEY_N){
return (true);
};
break;
case 79:
if (KEY_O){
return (true);
};
break;
case 80:
if (KEY_P){
return (true);
};
break;
case 81:
if (KEY_Q){
return (true);
};
break;
case 82:
if (KEY_R){
return (true);
};
break;
case 83:
if (KEY_S){
return (true);
};
break;
case 84:
if (KEY_T){
return (true);
};
break;
case 85:
if (KEY_U){
return (true);
};
break;
case 86:
if (KEY_V){
return (true);
};
break;
case 87:
if (KEY_W){
return (true);
};
break;
case 88:
if (KEY_X){
return (true);
};
break;
case 89:
if (KEY_Y){
return (true);
};
break;
case 90:
if (KEY_Z){
return (true);
};
break;
case 48:
if (KEY_0){
return (true);
};
break;
case 49:
if (KEY_1){
return (true);
};
break;
case 50:
if (KEY_2){
return (true);
};
break;
case 51:
if (KEY_3){
return (true);
};
break;
case 52:
if (KEY_4){
return (true);
};
break;
case 53:
if (KEY_5){
return (true);
};
break;
case 54:
if (KEY_6){
return (true);
};
break;
case 55:
if (KEY_7){
return (true);
};
break;
case 56:
if (KEY_8){
return (true);
};
break;
case 57:
if (KEY_9){
return (true);
};
break;
case 96:
if (KEY_NUM0){
return (true);
};
break;
case 97:
if (KEY_NUM1){
return (true);
};
break;
case 98:
if (KEY_NUM2){
return (true);
};
break;
case 99:
if (KEY_NUM3){
return (true);
};
break;
case 100:
if (KEY_NUM4){
return (true);
};
break;
case 101:
if (KEY_NUM5){
return (true);
};
break;
case 102:
if (KEY_NUM6){
return (true);
};
break;
case 103:
if (KEY_NUM7){
return (true);
};
break;
case 104:
if (KEY_NUM8){
return (true);
};
break;
case 105:
if (KEY_NUM9){
return (true);
};
break;
case 112:
if (KEY_F1){
return (true);
};
break;
case 113:
if (KEY_F2){
return (true);
};
break;
case 114:
if (KEY_F3){
return (true);
};
break;
case 115:
if (KEY_F4){
return (true);
};
break;
case 116:
if (KEY_F5){
return (true);
};
break;
case 117:
if (KEY_F6){
return (true);
};
break;
case 118:
if (KEY_F7){
return (true);
};
break;
case 119:
if (KEY_F8){
return (true);
};
break;
case 120:
if (KEY_F9){
return (true);
};
break;
case 122:
if (KEY_F11){
return (true);
};
break;
case 123:
if (KEY_F12){
return (true);
};
break;
case 27:
if (KEY_ESC){
return (true);
};
break;
case 13:
if (KEY_ENTER){
return (true);
};
break;
case 32:
if (KEY_SPACE){
return (true);
};
break;
case 16:
if (KEY_SHIFT){
return (true);
};
break;
case 17:
if (KEY_CONTROL){
return (true);
};
break;
case 9:
if (KEY_TAB){
return (true);
};
break;
case 8:
if (KEY_BACKSPACE){
return (true);
};
break;
case 33:
if (KEY_PGUP){
return (true);
};
break;
case 34:
if (KEY_PGDOWN){
return (true);
};
break;
case 35:
if (KEY_END){
return (true);
};
break;
case 36:
if (KEY_HOME){
return (true);
};
break;
case 45:
if (KEY_INSERT){
return (true);
};
break;
case 46:
if (KEY_DELETE){
return (true);
};
break;
case 37:
if (KEY_LEFT){
return (true);
};
break;
case 38:
if (KEY_UP){
return (true);
};
break;
case 39:
if (KEY_RIGHT){
return (true);
};
break;
case 40:
if (KEY_DOWN){
return (true);
};
break;
default:
break;
};
return (false);
}
public function refreshKey(){
KEY_A = false;
KEY_B = false;
KEY_C = false;
KEY_D = false;
KEY_E = false;
KEY_F = false;
KEY_G = false;
KEY_H = false;
KEY_I = false;
KEY_J = false;
KEY_K = false;
KEY_L = false;
KEY_M = false;
KEY_N = false;
KEY_O = false;
KEY_P = false;
KEY_Q = false;
KEY_R = false;
KEY_S = false;
KEY_T = false;
KEY_U = false;
KEY_V = false;
KEY_W = false;
KEY_X = false;
KEY_Y = false;
KEY_Z = false;
KEY_0 = false;
KEY_1 = false;
KEY_2 = false;
KEY_3 = false;
KEY_4 = false;
KEY_5 = false;
KEY_6 = false;
KEY_7 = false;
KEY_8 = false;
KEY_9 = false;
KEY_NUM0 = false;
KEY_NUM1 = false;
KEY_NUM2 = false;
KEY_NUM3 = false;
KEY_NUM4 = false;
KEY_NUM5 = false;
KEY_NUM6 = false;
KEY_NUM7 = false;
KEY_NUM8 = false;
KEY_NUM9 = false;
KEY_F1 = false;
KEY_F2 = false;
KEY_F3 = false;
KEY_F4 = false;
KEY_F5 = false;
KEY_F6 = false;
KEY_F7 = false;
KEY_F8 = false;
KEY_F9 = false;
KEY_F10 = false;
KEY_F11 = false;
KEY_F12 = false;
KEY_ESC = false;
KEY_ENTER = false;
KEY_SPACE = false;
KEY_SHIFT = false;
KEY_CONTROL = false;
KEY_TAB = false;
KEY_BACKSPACE = false;
KEY_PGUP = false;
KEY_PGDOWN = false;
KEY_END = false;
KEY_HOME = false;
KEY_INSERT = false;
KEY_DELETE = false;
KEY_UP = false;
KEY_DOWN = false;
KEY_LEFT = false;
KEY_RIGHT = false;
}
public function setKeyFlag(keyCode, flagVar){
switch (keyCode){
case 65:
KEY_A = flagVar;
break;
case 66:
KEY_B = flagVar;
break;
case 67:
KEY_C = flagVar;
break;
case 68:
KEY_D = flagVar;
break;
case 69:
KEY_E = flagVar;
break;
case 70:
KEY_F = flagVar;
break;
case 71:
KEY_G = flagVar;
break;
case 72:
KEY_H = flagVar;
break;
case 73:
KEY_I = flagVar;
break;
case 74:
KEY_J = flagVar;
break;
case 75:
KEY_K = flagVar;
break;
case 76:
KEY_L = flagVar;
break;
case 77:
KEY_M = flagVar;
break;
case 78:
KEY_N = flagVar;
break;
case 79:
KEY_O = flagVar;
break;
case 80:
KEY_P = flagVar;
break;
case 81:
KEY_Q = flagVar;
break;
case 82:
KEY_R = flagVar;
break;
case 83:
KEY_S = flagVar;
break;
case 84:
KEY_T = flagVar;
break;
case 85:
KEY_U = flagVar;
break;
case 86:
KEY_V = flagVar;
break;
case 87:
KEY_W = flagVar;
break;
case 88:
KEY_X = flagVar;
break;
case 89:
KEY_Y = flagVar;
break;
case 90:
KEY_Z = flagVar;
break;
case 48:
KEY_0 = flagVar;
break;
case 49:
KEY_1 = flagVar;
break;
case 50:
KEY_2 = flagVar;
break;
case 51:
KEY_3 = flagVar;
break;
case 52:
KEY_4 = flagVar;
break;
case 53:
KEY_5 = flagVar;
break;
case 54:
KEY_6 = flagVar;
break;
case 55:
KEY_7 = flagVar;
break;
case 56:
KEY_8 = flagVar;
break;
case 57:
KEY_9 = flagVar;
break;
case 96:
KEY_NUM0 = flagVar;
break;
case 97:
KEY_NUM1 = flagVar;
break;
case 98:
KEY_NUM2 = flagVar;
break;
case 99:
KEY_NUM3 = flagVar;
break;
case 100:
KEY_NUM4 = flagVar;
break;
case 101:
KEY_NUM5 = flagVar;
break;
case 102:
KEY_NUM6 = flagVar;
break;
case 103:
KEY_NUM7 = flagVar;
break;
case 104:
KEY_NUM8 = flagVar;
break;
case 105:
KEY_NUM9 = flagVar;
break;
case 112:
KEY_F1 = flagVar;
break;
case 113:
KEY_F2 = flagVar;
break;
case 114:
KEY_F3 = flagVar;
break;
case 115:
KEY_F4 = flagVar;
break;
case 116:
KEY_F5 = flagVar;
break;
case 117:
KEY_F6 = flagVar;
break;
case 118:
KEY_F7 = flagVar;
break;
case 119:
KEY_F8 = flagVar;
break;
case 120:
KEY_F9 = flagVar;
break;
case 122:
KEY_F11 = flagVar;
break;
case 123:
KEY_F12 = flagVar;
break;
case 27:
KEY_ESC = flagVar;
break;
case 13:
KEY_ENTER = flagVar;
break;
case 32:
KEY_SPACE = flagVar;
break;
case 16:
KEY_SHIFT = flagVar;
break;
case 17:
KEY_CONTROL = flagVar;
break;
case 9:
KEY_TAB = flagVar;
break;
case 8:
KEY_BACKSPACE = flagVar;
break;
case 33:
KEY_PGUP = flagVar;
break;
case 34:
KEY_PGDOWN = flagVar;
break;
case 35:
KEY_END = flagVar;
break;
case 36:
KEY_HOME = flagVar;
break;
case 45:
KEY_INSERT = flagVar;
break;
case 46:
KEY_DELETE = flagVar;
break;
case 37:
KEY_LEFT = flagVar;
break;
case 38:
KEY_UP = flagVar;
break;
case 39:
KEY_RIGHT = flagVar;
break;
case 40:
KEY_DOWN = flagVar;
break;
default:
break;
};
}
}
}//package FZBase.Control
Section 81
//Particle (FZBase.Effect.Particle)
package FZBase.Effect {
import flash.events.*;
import flash.display.*;
import FZBase.Vector.*;
public class Particle extends Sprite {
const UP_BORDER = 0;
const DOWN_BORDER = 600;
const LEFT_BORDER = 0;
const RIGHT_BORDER = 1200;
private var vecPos;
private var dispCont;
private var type:int;// = 0
private var lifeSpan:int;// = 10
private var landBorder:int;// = 600
public function Particle(){
lifeSpan = 10;
landBorder = 600;
type = 0;
super();
}
public function create(_dispCont, _vecPos, _lifeSpan:int=200, _landBorder:int=600){
dispCont = _dispCont;
lifeSpan = _lifeSpan;
landBorder = _landBorder;
vecPos = _vecPos;
dispCont.addChild(this);
this.cacheAsBitmap = true;
this.x = vecPos._X;
this.y = vecPos._Y;
this.rotation = vecPos._ANGLE;
this.alpha = 100;
this.addEventListener(Event.ENTER_FRAME, particleHandle, false, 0, true);
}
private function particleHandle(event:Event):void{
if ((((((((((this.x < LEFT_BORDER)) || ((this.x > RIGHT_BORDER)))) || ((this.y < UP_BORDER)))) || ((this.y > DOWN_BORDER)))) || ((this.y > landBorder)))){
destroy();
return;
};
vecPos.setMoveParticle();
this.x = vecPos._X;
this.y = vecPos._Y;
this.rotation = vecPos._ANGLE;
lifeSpan = Math.max((lifeSpan - 1), 0);
if (lifeSpan <= 0){
destroy();
};
}
public function destroy(){
this.removeEventListener(Event.ENTER_FRAME, particleHandle);
dispCont.removeChild(this);
dispCont = null;
}
}
}//package FZBase.Effect
Section 82
//Splat (FZBase.Effect.Splat)
package FZBase.Effect {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
public class Splat extends Sprite {
private var fadeTimer:Timer;// = null
private var dispCont;
private var DefSys;
public function Splat(){
fadeTimer = null;
super();
}
public function init(_DispCont, _X:int=0, _Y:int=0){
dispCont = _DispCont;
dispCont.addChild(this);
this.cacheAsBitmap = true;
this.x = _X;
this.y = _Y;
fadeTimer = new Timer((15000 + (Math.random() * 5000)), 1);
fadeTimer.start();
fadeTimer.addEventListener(TimerEvent.TIMER_COMPLETE, timerComplete, false, 0, true);
}
private function timerComplete(event:TimerEvent):void{
destroy();
}
public function destroy(){
fadeTimer.stop();
fadeTimer.removeEventListener(TimerEvent.TIMER_COMPLETE, timerComplete);
fadeTimer = null;
dispCont.removeChild(this);
dispCont = null;
DefSys = null;
}
}
}//package FZBase.Effect
Section 83
//BGM (FZBase.Sound.BGM)
package FZBase.Sound {
import flash.events.*;
import flash.media.*;
import flash.utils.*;
public class BGM extends Sound {
private var sndTransform:SoundTransform;
private var sndFadeOut:Boolean;
private var sndFadeIn:Boolean;
private var sndPosTime:Number;
private var loop:Boolean;
private var sndObj:Sound;
private var sndChannel:SoundChannel;
private var sndTimer:Timer;
private var sndVolume:Number;
private var sndPan:Number;
public function BGM(){
super();
sndObj = this;
sndChannel = null;
sndTransform = null;
sndVolume = 1;
sndPan = 0;
sndPosTime = 0;
sndFadeIn = false;
sndFadeOut = false;
loop = false;
sndTimer = new Timer(50);
sndTimer.addEventListener(TimerEvent.TIMER, sndTimerHandler);
sndTimer.start();
}
public function setVolume(vol:Number):void{
var sndTransform:SoundTransform;
sndVolume = vol;
if (sndChannel){
sndTransform = sndChannel.soundTransform;
sndTransform.volume = sndVolume;
sndChannel.soundTransform = sndTransform;
};
}
public function stopSound():void{
if (sndChannel){
sndChannel.stop();
sndChannel.removeEventListener(Event.SOUND_COMPLETE, sound_loop);
loop = false;
trace("stopSound() ");
};
}
public function fadeOut(init:Boolean):void{
sndFadeOut = true;
sndFadeIn = false;
if (init){
setVolume(1);
};
trace("Fade Out Effect ");
}
public function pauseSound():void{
if (sndChannel){
sndPosTime = sndChannel.position;
sndChannel.stop();
sndChannel.removeEventListener(Event.SOUND_COMPLETE, sound_loop);
trace(("pauseSound(), Position :" + String(sndPosTime)));
};
}
public function playSound():void{
stopSound();
sndChannel = sndObj.play();
setVolume(sndVolume);
setPan(sndPan);
trace("playSound() ");
}
public function fadeIn(init:Boolean):void{
sndFadeIn = true;
sndFadeOut = false;
if (init){
setVolume(0);
};
trace("Fade In Effect ");
}
private function sndTimerHandler(event:TimerEvent):void{
if (((sndFadeIn) && (sndFadeOut))){
sndFadeIn = false;
sndFadeOut = false;
setVolume(1);
};
if (sndFadeIn){
sndVolume = (sndVolume + 0.01);
if (sndVolume > 1){
setVolume(1);
sndFadeIn = false;
} else {
setVolume(sndVolume);
};
};
if (sndFadeOut){
sndVolume = (sndVolume - 0.01);
if (sndVolume < 0){
setVolume(0);
sndFadeOut = false;
} else {
setVolume(sndVolume);
};
};
}
public function setPan(pan:Number):void{
var sndTransform:SoundTransform;
sndPan = pan;
if (sndChannel){
sndTransform = sndChannel.soundTransform;
sndTransform.pan = sndPan;
sndChannel.soundTransform = sndTransform;
};
}
public function resumeSound():void{
stopSound();
sndChannel = sndObj.play(sndPosTime);
if (loop){
sndChannel.addEventListener(Event.SOUND_COMPLETE, sound_loop);
};
setVolume(sndVolume);
setPan(sndPan);
trace("resumeSound() ");
}
private function sound_loop(event:Event){
sndChannel = sndObj.play();
setVolume(sndVolume);
setPan(sndPan);
sndChannel.addEventListener(Event.SOUND_COMPLETE, sound_loop);
trace("Loop Back ");
}
public function playSoundLoop():void{
stopSound();
sndChannel = sndObj.play();
sndChannel.addEventListener(Event.SOUND_COMPLETE, sound_loop);
setVolume(sndVolume);
setPan(sndPan);
loop = true;
trace("playSoundLoop() ");
}
}
}//package FZBase.Sound
Section 84
//SE (FZBase.Sound.SE)
package FZBase.Sound {
import flash.media.*;
public class SE extends Sound {
private var sndChannel:SoundChannel;
private var sndObj:Sound;
private var sndVolume:Number;
public function SE(){
super();
sndObj = this;
sndChannel = null;
sndVolume = 1;
}
public function playSound():void{
stopSound();
sndChannel = sndObj.play();
setVolume(sndVolume);
}
public function setVolume(vol:Number):void{
var sndTransform:SoundTransform;
sndVolume = vol;
if (sndChannel){
sndTransform = sndChannel.soundTransform;
sndTransform.volume = sndVolume;
sndChannel.soundTransform = sndTransform;
};
}
public function stopSound():void{
if (sndChannel){
sndChannel.stop();
};
}
}
}//package FZBase.Sound
Section 85
//Vector2d (FZBase.Vector.Vector2d)
package FZBase.Vector {
public class Vector2d {
public var _Y:Number;// = 0
public var _X:Number;// = 0
public var _ANGLE:Number;// = 0
public function Vector2d(_XVar:Number=0, _YVar:Number=0, _ANGLEVar:Number=0){
_X = 0;
_Y = 0;
_ANGLE = 0;
super();
_X = _XVar;
_Y = _YVar;
_ANGLE = _ANGLEVar;
}
public function setMoveTarget(val:Number, objVecTarget){
var vx:Number;
var vy:Number;
var angle:Number;
vx = (objVecTarget._X - _X);
vy = (objVecTarget._Y - _Y);
angle = Math.atan2(vy, vx);
_X = (val * Math.cos(angle));
_Y = (val * Math.sin(angle));
_ANGLE = ((angle * 180) / Math.PI);
}
public function getVectorTarget(objVec2d):Object{
var vx:Number;
var vy:Number;
var angle:Number;
vx = (objVec2d._X - _X);
vy = (objVec2d._Y - _Y);
angle = Math.atan2(vy, vx);
return (new Vector2d(vx, vy, angle));
}
public function getVectorTargetAngle(angleVal:Number, objVec2d):Object{
var angle:Number;
var vx:Number;
var vy:Number;
angle = angleVal;
vx = (Math.cos(angle) + objVec2d._X);
vy = (Math.sin(angle) + objVec2d._Y);
return (new Vector2d(vx, vy, angle));
}
public function setMove(val:Number){
var vx:Number;
var vy:Number;
vx = Math.cos(((_ANGLE * Math.PI) / 180));
vy = Math.sin(((_ANGLE * Math.PI) / 180));
_X = (_X + (val * vx));
_Y = (_Y + (val * vy));
}
}
}//package FZBase.Vector
Section 86
//Vector2dArmy (FZBase.Vector.Vector2dArmy)
package FZBase.Vector {
public class Vector2dArmy extends Vector2d {
private var _FLY:Boolean;// = false
private var _ANGLEBKUP:Number;// = 0
public var _FRICTION:Number;// = 0.98
public var _VR:Number;// = 0
public var _VX:Number;// = 0
public var _VY:Number;// = 0
public var _FLOOR:Number;// = 0
public var _GRAVITY:Number;// = 0.3
public function Vector2dArmy(_XVar:Number=0, _YVar:Number=0, _ANGLEVar:Number=0){
_FRICTION = 0.98;
_GRAVITY = 0.3;
_VX = 0;
_VY = 0;
_VR = 0;
_FLOOR = 0;
_ANGLEBKUP = 0;
_FLY = false;
super();
_X = _XVar;
_Y = _YVar;
_ANGLE = _ANGLEVar;
_ANGLEBKUP = _ANGLE;
}
public function setMoving(val:Number){
var vx:Number;
var vy:Number;
vx = Math.cos(((_ANGLE * Math.PI) / 180));
vy = Math.sin(((_ANGLE * Math.PI) / 180));
_X = (_X + (val * vx));
_Y = (_Y + (val * vy));
}
public function setFlying(_XT:Number=0, _YT:Number=0, _ROT:Number=0, _LANDVar:Number=500){
_VX = _XT;
_VY = _YT;
_VR = (_ROT * (_VX / Math.abs(_VX)));
_FLOOR = _LANDVar;
_FRICTION = 0.98;
_GRAVITY = 0.3;
_FLY = true;
}
public function setMoveFly(){
if (!_FLY){
return;
};
if (_Y > _FLOOR){
_Y = _FLOOR;
_VY = 0;
_GRAVITY = 0;
_VX = 0;
_VR = 0;
_FRICTION = 0;
_ANGLE = _ANGLEBKUP;
_FLY = false;
} else {
_VX = (_VX * _FRICTION);
_VY = (_VY + _GRAVITY);
_VR = (_VR * _FRICTION);
_X = (_X + _VX);
_Y = (_Y + _VY);
_ANGLE = (_ANGLE + _VR);
};
}
public function isFlying():Boolean{
return (_FLY);
}
public function comboFlying(_XT:Number=0, _YT:Number=0){
_VX = (_VX + _XT);
_VY = (_VY + _YT);
_VR = (_VR * 1.5);
_FLY = true;
}
}
}//package FZBase.Vector
Section 87
//Vector2dArrow (FZBase.Vector.Vector2dArrow)
package FZBase.Vector {
public class Vector2dArrow extends Vector2d {
public var _FRICTION:Number;// = 0.99
public var _VX:Number;// = 0
public var _VY:Number;// = 0
public var _GRAVITY:Number;// = 0.4
public function Vector2dArrow(_XVar:Number=0, _YVar:Number=0, _ANGLEVar:Number=0, _LR:int=0){
var tmpAngle:Number;
_FRICTION = 0.99;
_GRAVITY = 0.4;
_VX = 0;
_VY = 0;
super();
_X = _XVar;
_Y = _YVar;
_ANGLE = _ANGLEVar;
_VX = Math.cos(((_ANGLE * Math.PI) / 180));
_VY = Math.sin(((_ANGLE * Math.PI) / 180));
if (_LR != 0){
tmpAngle = ((_ANGLE - 90) * (Math.PI / 180));
_X = (_X + (Math.cos(tmpAngle) * _LR));
_Y = (_Y + (Math.sin(tmpAngle) * _LR));
};
}
public function setVelocity(val:Number=0){
_VX = (_VX + (val * _VX));
_VY = (_VY + (val * _VY));
}
public function setMoveArrow(){
_VX = (_VX * _FRICTION);
_VY = (_VY + _GRAVITY);
_X = (_X + _VX);
_Y = (_Y + _VY);
_ANGLE = ((Math.atan2(_VY, _VX) * 180) / Math.PI);
}
}
}//package FZBase.Vector
Section 88
//Vector2dParticle (FZBase.Vector.Vector2dParticle)
package FZBase.Vector {
public class Vector2dParticle extends Vector2d {
public var _FRICTION:Number;// = 0.98
public var _VX:Number;// = 0
public var _VY:Number;// = 0
public var _GRAVITY:Number;// = 0.3
public function Vector2dParticle(_XVar:Number=0, _YVar:Number=0, _ANGLEVar:Number=0, _VELOCITY:Number=2){
_FRICTION = 0.98;
_GRAVITY = 0.3;
_VX = 0;
_VY = 0;
super();
_X = _XVar;
_Y = _YVar;
_ANGLE = _ANGLEVar;
_VX = Math.cos(((_ANGLE * Math.PI) / 180));
_VY = Math.sin(((_ANGLE * Math.PI) / 180));
_VX = (_VX + (_VELOCITY * _VX));
_VY = (_VY + (_VELOCITY * _VY));
}
public function setMoveParticle(){
_VX = (_VX * _FRICTION);
_VY = (_VY + _GRAVITY);
_X = (_X + _VX);
_Y = (_Y + _VY);
_ANGLE = ((Math.atan2(_VY, _VX) * 180) / Math.PI);
}
}
}//package FZBase.Vector
Section 89
//angel_mc (angel_mc)
package {
import DefX.Army.*;
public dynamic class angel_mc extends CreatureRace {
public function angel_mc(){
super();
addFrameScript(23, frame24, 51, frame52, 52, frame53, 58, frame59, 74, frame75, 118, frame119, 148, frame149);
}
function frame75(){
gotoAndPlay("walk");
}
function frame24(){
gotoAndPlay("walk");
}
function frame119(){
gotoAndPlay("walk");
}
function frame52(){
gotoAndPlay("walk");
}
function frame53(){
stop();
}
function frame59(){
gotoAndPlay("walk");
}
function frame149(){
stop();
}
}
}//package
Section 90
//arrow_hit (arrow_hit)
package {
import FZBase.Sound.*;
public dynamic class arrow_hit extends SE {
public function arrow_hit(){
super();
}
}
}//package
Section 91
//background (background)
package {
import flash.display.*;
public dynamic class background extends MovieClip {
public function background(){
super();
}
}
}//package
Section 92
//bahamut_mc (bahamut_mc)
package {
import DefX.Army.*;
public dynamic class bahamut_mc extends CreatureRace {
public function bahamut_mc(){
super();
addFrameScript(19, frame20, 59, frame60, 60, frame61, 64, frame65, 76, frame77, 106, frame107, 154, frame155);
}
function frame155(){
stop();
}
function frame77(){
gotoAndPlay("walk");
}
function frame65(){
gotoAndPlay("walk");
}
function frame20(){
gotoAndPlay("walk");
}
function frame107(){
gotoAndPlay("walk");
}
function frame61(){
stop();
}
function frame60(){
gotoAndPlay("walk");
}
}
}//package
Section 93
//barrier_mc (barrier_mc)
package {
import flash.display.*;
public dynamic class barrier_mc extends MovieClip {
public function barrier_mc(){
super();
addFrameScript(12, frame13);
}
function frame13(){
gotoAndPlay("start");
}
}
}//package
Section 94
//basic_arrow (basic_arrow)
package {
import DefX.Bullet.*;
public dynamic class basic_arrow extends Arrow {
public function basic_arrow(){
super();
}
}
}//package
Section 95
//battleField (battleField)
package {
import FZBase.Sound.*;
public dynamic class battleField extends BGM {
public function battleField(){
super();
}
}
}//package
Section 96
//blood_red (blood_red)
package {
import FZBase.Effect.*;
public dynamic class blood_red extends Particle {
public function blood_red(){
super();
}
}
}//package
Section 97
//blood_red2 (blood_red2)
package {
import FZBase.Effect.*;
public dynamic class blood_red2 extends Particle {
public function blood_red2(){
super();
}
}
}//package
Section 98
//blood_splat1 (blood_splat1)
package {
import FZBase.Effect.*;
public dynamic class blood_splat1 extends Splat {
public function blood_splat1(){
super();
}
}
}//package
Section 99
//blood_splat2 (blood_splat2)
package {
import FZBase.Effect.*;
public dynamic class blood_splat2 extends Splat {
public function blood_splat2(){
super();
}
}
}//package
Section 100
//boss_mc (boss_mc)
package {
import DefX.Army.*;
public dynamic class boss_mc extends CreatureRace {
public function boss_mc(){
super();
addFrameScript(19, frame20, 83, frame84, 112, frame113);
}
function frame84(){
gotoAndPlay("walk");
}
function frame20(){
gotoAndPlay("walk");
}
function frame113(){
stop();
}
}
}//package
Section 101
//building_smash (building_smash)
package {
import FZBase.Sound.*;
public dynamic class building_smash extends SE {
public function building_smash(){
super();
}
}
}//package
Section 102
//centaur_mc (centaur_mc)
package {
import DefX.Army.*;
public dynamic class centaur_mc extends CreatureRace {
public function centaur_mc(){
super();
addFrameScript(28, frame29, 50, frame51, 51, frame52, 55, frame56, 63, frame64, 115, frame116, 158, frame159);
}
function frame159(){
stop();
}
function frame64(){
gotoAndPlay("walk");
}
function frame29(){
gotoAndPlay("walk");
}
function frame116(){
gotoAndPlay("walk");
}
function frame51(){
gotoAndPlay("walk");
}
function frame52(){
stop();
}
function frame56(){
gotoAndPlay("walk");
}
}
}//package
Section 103
//club_hit (club_hit)
package {
import FZBase.Sound.*;
public dynamic class club_hit extends SE {
public function club_hit(){
super();
}
}
}//package
Section 104
//cover_mc (cover_mc)
package {
import flash.display.*;
public dynamic class cover_mc extends MovieClip {
public var bContinue:SimpleButton;
public var bPlayMore:SimpleButton;
public var bStart:SimpleButton;
public var bNews:SimpleButton;
public var bCredit:SimpleButton;
public var logoKong:MovieClip;
public var bInstruction:SimpleButton;
public function cover_mc(){
super();
}
}
}//package
Section 105
//coverTitle (coverTitle)
package {
import FZBase.Sound.*;
public dynamic class coverTitle extends BGM {
public function coverTitle(){
super();
}
}
}//package
Section 106
//credits_mc (credits_mc)
package {
import flash.display.*;
public dynamic class credits_mc extends MovieClip {
public var bClose:SimpleButton;
public function credits_mc(){
super();
}
}
}//package
Section 107
//DebugInfo (DebugInfo)
package {
import flash.display.*;
import flash.text.*;
public dynamic class DebugInfo extends MovieClip {
public var splashEffect:TextField;
public var playerArmy:TextField;
public var totalArrow:TextField;
public var enemyArmy:TextField;
public var bloodSplat:TextField;
public var arrowAngle:TextField;
public var arrowPow:TextField;
public var bloodParticle:TextField;
public var totalObject:TextField;
public function DebugInfo(){
super();
}
}
}//package
Section 108
//devil_mc (devil_mc)
package {
import DefX.Army.*;
public dynamic class devil_mc extends CreatureRace {
public function devil_mc(){
super();
addFrameScript(49, frame50, 91, frame92, 92, frame93, 98, frame99, 106, frame107, 122, frame123, 158, frame159);
}
function frame159(){
stop();
}
function frame93(){
stop();
}
function frame107(){
gotoAndPlay("walk");
}
function frame92(){
gotoAndPlay("walk");
}
function frame99(){
gotoAndPlay("walk");
}
function frame123(){
gotoAndPlay("walk");
}
function frame50(){
gotoAndPlay("walk");
}
}
}//package
Section 109
//dragon_mc (dragon_mc)
package {
import DefX.Army.*;
public dynamic class dragon_mc extends CreatureRace {
public function dragon_mc(){
super();
addFrameScript(25, frame26, 61, frame62, 62, frame63, 68, frame69, 84, frame85, 128, frame129, 160, frame161);
}
function frame161(){
stop();
}
function frame85(){
gotoAndPlay("walk");
}
function frame26(){
gotoAndPlay("walk");
}
function frame129(){
gotoAndPlay("walk");
}
function frame62(){
gotoAndPlay("walk");
}
function frame63(){
stop();
}
function frame69(){
gotoAndPlay("walk");
}
}
}//package
Section 110
//dwarf_mc (dwarf_mc)
package {
import DefX.Army.*;
public dynamic class dwarf_mc extends CreatureRace {
public function dwarf_mc(){
super();
addFrameScript(28, frame29, 50, frame51, 51, frame52, 57, frame58, 73, frame74, 117, frame118, 153, frame154);
}
function frame154(){
stop();
}
function frame74(){
gotoAndPlay("walk");
}
function frame29(){
gotoAndPlay("walk");
}
function frame118(){
gotoAndPlay("walk");
}
function frame51(){
gotoAndPlay("walk");
}
function frame52(){
stop();
}
function frame58(){
gotoAndPlay("walk");
}
}
}//package
Section 111
//electric_explode_mc (electric_explode_mc)
package {
import DefX.Effect.*;
public dynamic class electric_explode_mc extends SplashEffect {
public function electric_explode_mc(){
super();
addFrameScript(23, frame24);
}
function frame24(){
stop();
}
}
}//package
Section 112
//elf_mc (elf_mc)
package {
import DefX.Army.*;
public dynamic class elf_mc extends CreatureRace {
public function elf_mc(){
super();
addFrameScript(39, frame40, 61, frame62, 62, frame63, 68, frame69, 84, frame85, 128, frame129, 164, frame165);
}
function frame165(){
stop();
}
function frame85(){
gotoAndPlay("walk");
}
function frame40(){
gotoAndPlay("walk");
}
function frame129(){
gotoAndPlay("walk");
}
function frame62(){
gotoAndPlay("walk");
}
function frame63(){
stop();
}
function frame69(){
gotoAndPlay("walk");
}
}
}//package
Section 113
//enemy_tower_mc (enemy_tower_mc)
package {
import flash.display.*;
public dynamic class enemy_tower_mc extends MovieClip {
public var hitBox:MovieClip;
public var health:MovieClip;
public function enemy_tower_mc(){
super();
addFrameScript(0, frame1, 19, frame20, 39, frame40, 49, frame50, 59, frame60);
}
function frame1(){
stop();
}
function frame20(){
stop();
}
function frame40(){
stop();
}
function frame50(){
stop();
}
function frame60(){
stop();
}
}
}//package
Section 114
//enemy_turret_mc (enemy_turret_mc)
package {
import flash.display.*;
public dynamic class enemy_turret_mc extends MovieClip {
public function enemy_turret_mc(){
super();
}
}
}//package
Section 115
//es_explode_mc (es_explode_mc)
package {
import DefX.Effect.*;
public dynamic class es_explode_mc extends SplashEffect {
public function es_explode_mc(){
super();
addFrameScript(26, frame27);
}
function frame27(){
stop();
}
}
}//package
Section 116
//exit_confirm_mc (exit_confirm_mc)
package {
import flash.display.*;
public dynamic class exit_confirm_mc extends MovieClip {
public var bYes:SimpleButton;
public var bNo:SimpleButton;
public function exit_confirm_mc(){
super();
}
}
}//package
Section 117
//explode_effect_mc (explode_effect_mc)
package {
import flash.display.*;
public dynamic class explode_effect_mc extends MovieClip {
public function explode_effect_mc(){
super();
addFrameScript(13, frame14);
}
function frame14(){
stop();
}
}
}//package
Section 118
//finalBattleField (finalBattleField)
package {
import FZBase.Sound.*;
public dynamic class finalBattleField extends BGM {
public function finalBattleField(){
super();
}
}
}//package
Section 119
//fire_arrow (fire_arrow)
package {
import DefX.Bullet.*;
public dynamic class fire_arrow extends Arrow {
public function fire_arrow(){
super();
}
}
}//package
Section 120
//fire_explode_mc (fire_explode_mc)
package {
import DefX.Effect.*;
public dynamic class fire_explode_mc extends SplashEffect {
public function fire_explode_mc(){
super();
addFrameScript(18, frame19);
}
function frame19(){
stop();
}
}
}//package
Section 121
//goblin_mc (goblin_mc)
package {
import DefX.Army.*;
public dynamic class goblin_mc extends CreatureRace {
public function goblin_mc(){
super();
addFrameScript(28, frame29, 50, frame51, 51, frame52, 58, frame59, 81, frame82, 123, frame124, 157, frame158);
}
function frame158(){
stop();
}
function frame82(){
gotoAndPlay("walk");
}
function frame29(){
gotoAndPlay("walk");
}
function frame124(){
gotoAndPlay("walk");
}
function frame51(){
gotoAndPlay("walk");
}
function frame52(){
stop();
}
function frame59(){
gotoAndPlay("walk");
}
}
}//package
Section 122
//golem_mc (golem_mc)
package {
import DefX.Army.*;
public dynamic class golem_mc extends CreatureRace {
public function golem_mc(){
super();
addFrameScript(48, frame49, 73, frame74, 74, frame75, 80, frame81, 96, frame97, 140, frame141, 171, frame172);
}
function frame75(){
stop();
}
function frame81(){
gotoAndPlay("walk");
}
function frame172(){
stop();
}
function frame74(){
gotoAndPlay("walk");
}
function frame97(){
gotoAndPlay("walk");
}
function frame49(){
gotoAndPlay("walk");
}
function frame141(){
gotoAndPlay("walk");
}
}
}//package
Section 123
//hard_hit (hard_hit)
package {
import FZBase.Sound.*;
public dynamic class hard_hit extends SE {
public function hard_hit(){
super();
}
}
}//package
Section 124
//hobbit_mc (hobbit_mc)
package {
import DefX.Army.*;
public dynamic class hobbit_mc extends CreatureRace {
public function hobbit_mc(){
super();
addFrameScript(28, frame29, 50, frame51, 51, frame52, 57, frame58, 73, frame74, 117, frame118, 143, frame144);
}
function frame74(){
gotoAndPlay("walk");
}
function frame144(){
stop();
}
function frame29(){
gotoAndPlay("walk");
}
function frame118(){
gotoAndPlay("walk");
}
function frame51(){
gotoAndPlay("walk");
}
function frame52(){
stop();
}
function frame58(){
gotoAndPlay("walk");
}
}
}//package
Section 125
//ice_arrow (ice_arrow)
package {
import DefX.Bullet.*;
public dynamic class ice_arrow extends Arrow {
public function ice_arrow(){
super();
}
}
}//package
Section 126
//instruct_mc (instruct_mc)
package {
import flash.display.*;
public dynamic class instruct_mc extends MovieClip {
public var bNext:SimpleButton;
public var bPrev:SimpleButton;
public var bClose:SimpleButton;
public function instruct_mc(){
super();
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4, 4, frame5, 5, frame6);
}
function frame3(){
stop();
}
function frame6(){
stop();
}
function frame1(){
stop();
}
function frame4(){
stop();
}
function frame5(){
stop();
}
function frame2(){
stop();
}
}
}//package
Section 127
//instruct2_mc (instruct2_mc)
package {
import flash.display.*;
public dynamic class instruct2_mc extends MovieClip {
public function instruct2_mc(){
super();
addFrameScript(251, frame252);
}
function frame252(){
stop();
}
}
}//package
Section 128
//interface_mc (interface_mc)
package {
import flash.display.*;
import flash.text.*;
public dynamic class interface_mc extends MovieClip {
public var tExp:TextField;
public var enemy_health:TextField;
public var mManaBar:MovieClip;
public var RB:MovieClip;
public var mPlayMore:SimpleButton;
public var mWizard:MovieClip;
public var tScore:TextField;
public var mMana:MovieClip;
public var mQuit:SimpleButton;
public var mDwarf:MovieClip;
public var mBarrier:MovieClip;
public var mPause:MovieClip;
public var player_units:TextField;
public var mFireArrow:MovieClip;
public var LB:MovieClip;
public var mThunderArrow:MovieClip;
public var player_health:TextField;
public var mSound:MovieClip;
public var mAngel:MovieClip;
public var mTrap:MovieClip;
public var mSpecial:MovieClip;
public var mInfo:MovieClip;
public var mTurret:MovieClip;
public var mHobbit:MovieClip;
public var mIceArrow:MovieClip;
public var mBasicArrow:MovieClip;
public var mDragon:MovieClip;
public var mGolem:MovieClip;
public var mElf:MovieClip;
public var enemy_units:TextField;
public function interface_mc(){
super();
}
}
}//package
Section 129
//knife_attack (knife_attack)
package {
import FZBase.Sound.*;
public dynamic class knife_attack extends SE {
public function knife_attack(){
super();
}
}
}//package
Section 130
//Kongintro30fps (Kongintro30fps)
package {
import flash.display.*;
public dynamic class Kongintro30fps extends MovieClip {
public function Kongintro30fps(){
super();
}
}
}//package
Section 131
//logo_anim_artlogicgames_mc (logo_anim_artlogicgames_mc)
package {
import flash.display.*;
public dynamic class logo_anim_artlogicgames_mc extends MovieClip {
public function logo_anim_artlogicgames_mc(){
super();
addFrameScript(234, frame235);
}
function frame235(){
stop();
}
}
}//package
Section 132
//menu (menu)
package {
import FZBase.Sound.*;
public dynamic class menu extends BGM {
public function menu(){
super();
}
}
}//package
Section 133
//ogre_mc (ogre_mc)
package {
import DefX.Army.*;
public dynamic class ogre_mc extends CreatureRace {
public function ogre_mc(){
super();
addFrameScript(28, frame29, 50, frame51, 51, frame52, 57, frame58, 77, frame78, 122, frame123, 158, frame159);
}
function frame159(){
stop();
}
function frame78(){
gotoAndPlay("walk");
}
function frame29(){
gotoAndPlay("walk");
}
function frame123(){
gotoAndPlay("walk");
}
function frame51(){
gotoAndPlay("walk");
}
function frame52(){
stop();
}
function frame58(){
gotoAndPlay("walk");
}
}
}//package
Section 134
//orc_mc (orc_mc)
package {
import DefX.Army.*;
public dynamic class orc_mc extends CreatureRace {
public function orc_mc(){
super();
addFrameScript(33, frame34, 55, frame56, 56, frame57, 62, frame63, 83, frame84, 134, frame135, 164, frame165);
}
function frame165(){
stop();
}
function frame84(){
gotoAndPlay("walk");
}
function frame34(){
gotoAndPlay("walk");
}
function frame56(){
gotoAndPlay("walk");
}
function frame57(){
stop();
}
function frame135(){
gotoAndPlay("walk");
}
function frame63(){
gotoAndPlay("walk");
}
}
}//package
Section 135
//play_on_kongregate_mc (play_on_kongregate_mc)
package {
import flash.display.*;
public dynamic class play_on_kongregate_mc extends MovieClip {
public var bYes:SimpleButton;
public var bNo:SimpleButton;
public function play_on_kongregate_mc(){
super();
}
}
}//package
Section 136
//pro_arrow_mc (pro_arrow_mc)
package {
import flash.display.*;
public dynamic class pro_arrow_mc extends MovieClip {
public function pro_arrow_mc(){
super();
}
}
}//package
Section 137
//pro_tower_mc (pro_tower_mc)
package {
import flash.display.*;
public dynamic class pro_tower_mc extends MovieClip {
public var hitBox:MovieClip;
public var health:MovieClip;
public function pro_tower_mc(){
super();
addFrameScript(0, frame1, 19, frame20, 39, frame40, 59, frame60);
}
function frame1(){
stop();
}
function frame20(){
stop();
}
function frame40(){
stop();
}
function frame60(){
stop();
}
}
}//package
Section 138
//pro_turret_mc (pro_turret_mc)
package {
import flash.display.*;
public dynamic class pro_turret_mc extends MovieClip {
public function pro_turret_mc(){
super();
}
}
}//package
Section 139
//special_arrow (special_arrow)
package {
import DefX.Bullet.*;
public dynamic class special_arrow extends Arrow {
public function special_arrow(){
super();
}
}
}//package
Section 140
//sprite_fire (sprite_fire)
package {
import FZBase.Effect.*;
public dynamic class sprite_fire extends Particle {
public function sprite_fire(){
super();
}
}
}//package
Section 141
//sprite_ice (sprite_ice)
package {
import FZBase.Effect.*;
public dynamic class sprite_ice extends Particle {
public function sprite_ice(){
super();
}
}
}//package
Section 142
//sprite_thunder (sprite_thunder)
package {
import FZBase.Effect.*;
public dynamic class sprite_thunder extends Particle {
public function sprite_thunder(){
super();
}
}
}//package
Section 143
//sword_slash (sword_slash)
package {
import FZBase.Sound.*;
public dynamic class sword_slash extends SE {
public function sword_slash(){
super();
}
}
}//package
Section 144
//thunder_arrow (thunder_arrow)
package {
import DefX.Bullet.*;
public dynamic class thunder_arrow extends Arrow {
public function thunder_arrow(){
super();
}
}
}//package
Section 145
//trap_mc (trap_mc)
package {
import flash.display.*;
public dynamic class trap_mc extends MovieClip {
public var attackBox:MovieClip;
public function trap_mc(){
super();
addFrameScript(88, frame89);
}
function frame89(){
gotoAndPlay("start");
}
}
}//package
Section 146
//trap_shoot (trap_shoot)
package {
import FZBase.Sound.*;
public dynamic class trap_shoot extends SE {
public function trap_shoot(){
super();
}
}
}//package
Section 147
//troll_mc (troll_mc)
package {
import DefX.Army.*;
public dynamic class troll_mc extends CreatureRace {
public function troll_mc(){
super();
addFrameScript(33, frame34, 55, frame56, 56, frame57, 62, frame63, 78, frame79, 122, frame123, 153, frame154);
}
function frame154(){
stop();
}
function frame79(){
gotoAndPlay("walk");
}
function frame34(){
gotoAndPlay("walk");
}
function frame123(){
gotoAndPlay("walk");
}
function frame56(){
gotoAndPlay("walk");
}
function frame57(){
stop();
}
function frame63(){
gotoAndPlay("walk");
}
}
}//package
Section 148
//turret_enemy_bullet (turret_enemy_bullet)
package {
import DefX.Bullet.*;
public dynamic class turret_enemy_bullet extends Arrow {
public function turret_enemy_bullet(){
super();
}
}
}//package
Section 149
//turret_player_bullet (turret_player_bullet)
package {
import DefX.Bullet.*;
public dynamic class turret_player_bullet extends Arrow {
public function turret_player_bullet(){
super();
}
}
}//package
Section 150
//upgrade_menu_mc (upgrade_menu_mc)
package {
import flash.display.*;
import flash.text.*;
public dynamic class upgrade_menu_mc extends MovieClip {
public var mArrowFire:MovieClip;
public var mManaGain:MovieClip;
public var mExpGain:MovieClip;
public var mManaStock:MovieClip;
public var bPlayMore:SimpleButton;
public var exp:TextField;
public var mArmyHobbit:MovieClip;
public var mManaRegen:MovieClip;
public var mArmyDragon:MovieClip;
public var mArmyDwarf:MovieClip;
public var bBack:SimpleButton;
public var mArrowIce:MovieClip;
public var mArmyAngel:MovieClip;
public var mBarrier:MovieClip;
public var mArmyElf:MovieClip;
public var mTrap:MovieClip;
public var mArrowThunder:MovieClip;
public var mArmyGolem:MovieClip;
public var mArmyWizard:MovieClip;
public var mSpecial:MovieClip;
public var mTurret:MovieClip;
public var mCastle:MovieClip;
public var bQuit:SimpleButton;
public var mArrowBasic:MovieClip;
public var bSave:SimpleButton;
public function upgrade_menu_mc(){
super();
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 151
//win_lose_mc (win_lose_mc)
package {
import flash.display.*;
import flash.text.*;
public dynamic class win_lose_mc extends MovieClip {
public var bContinue:SimpleButton;
public var exp:TextField;
public var score:TextField;
public function win_lose_mc(){
super();
addFrameScript(0, frame1, 1, frame2, 2, frame3);
}
function frame3(){
stop();
}
function frame1(){
stop();
}
function frame2(){
stop();
}
}
}//package
Section 152
//wizard_mc (wizard_mc)
package {
import DefX.Army.*;
public dynamic class wizard_mc extends CreatureRace {
public function wizard_mc(){
super();
addFrameScript(31, frame32, 70, frame71, 71, frame72, 77, frame78, 93, frame94, 137, frame138, 164, frame165);
}
function frame72(){
stop();
}
function frame165(){
stop();
}
function frame78(){
gotoAndPlay("walk");
}
function frame71(){
gotoAndPlay("walk");
}
function frame94(){
gotoAndPlay("walk");
}
function frame32(){
gotoAndPlay("walk");
}
function frame138(){
gotoAndPlay("walk");
}
}
}//package
Section 153
//world_menu_mc (world_menu_mc)
package {
import flash.display.*;
public dynamic class world_menu_mc extends MovieClip {
public var stage3:MovieClip;
public var stage5:MovieClip;
public var stage8:MovieClip;
public var stage1:MovieClip;
public var stage4:MovieClip;
public var stage6:MovieClip;
public var bSkill:SimpleButton;
public var bPlayMore:SimpleButton;
public var stage2:MovieClip;
public var stage9:MovieClip;
public var stage10:MovieClip;
public var stage12:MovieClip;
public var stage14:MovieClip;
public var stage13:MovieClip;
public var stage15:MovieClip;
public var info:MovieClip;
public var bQuit:SimpleButton;
public var stage11:MovieClip;
public var stage7:MovieClip;
public var bSave:SimpleButton;
public function world_menu_mc(){
super();
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package