Section 1
//wav (abomb_boom.wav)
package abomb_boom {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package abomb_boom
Section 2
//wav (abomb_fly.wav)
package abomb_fly {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package abomb_fly
Section 3
//wav (ASFly.wav)
package ASFly {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package ASFly
Section 4
//KeyManager (base.KeyManager)
package base {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
public class KeyManager {
protected var _keyStorage:Dictionary;
protected var _pKeyReceiver:DisplayObject;
public function KeyManager(){
super();
}
public function keyIsFirstPressed(keyCode:int):Boolean{
return ((_keyStorage[keyCode] == 1));
}
public function cleanup():void{
_keyStorage = null;
if (_pKeyReceiver != null){
if (_pKeyReceiver.hasEventListener(KeyboardEvent.KEY_DOWN)){
_pKeyReceiver.removeEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);
};
if (_pKeyReceiver.hasEventListener(KeyboardEvent.KEY_UP)){
_pKeyReceiver.removeEventListener(KeyboardEvent.KEY_UP, onKeyUp);
};
_pKeyReceiver = null;
};
}
public function keyIsReleased(keyCode:int):Boolean{
return ((_keyStorage[keyCode] == -2));
}
public function getKeyState(keyCode:int):int{
return (_keyStorage[keyCode]);
}
public function update(deltaTime_:Number):void{
var charCode:*;
for (charCode in _keyStorage) {
if (_keyStorage[charCode] >= 0){
var _local5 = _keyStorage;
var _local6 = charCode;
var _local7 = (_local5[_local6] + 1);
_local5[_local6] = _local7;
} else {
if (_keyStorage[charCode] < 0){
_local5 = _keyStorage;
_local6 = charCode;
_local7 = (_local5[_local6] - 1);
_local5[_local6] = _local7;
};
};
};
}
protected function onKeyUp(evnt:KeyboardEvent):void{
_keyStorage[evnt.keyCode] = -1;
}
public function keysContaintFirstPressed(keysCode:Array):Boolean{
var val:int;
for each (val in keysCode) {
if (keyIsFirstPressed(val)){
return (true);
};
};
return (false);
}
public function keysContaintPressed(keysCode:Array):Boolean{
var val:int;
for each (val in keysCode) {
if (keyIsPressed(val)){
return (true);
};
};
return (false);
}
protected function onKeyDown(evnt:KeyboardEvent):void{
if ((((_keyStorage[evnt.keyCode] == null)) || ((_keyStorage[evnt.keyCode] < 0)))){
_keyStorage[evnt.keyCode] = 0;
};
}
public function init():void{
_keyStorage = new Dictionary();
}
public function keysContaintReleased(keysCode:Array):Boolean{
var val:int;
for each (val in keysCode) {
if (keyIsReleased(val)){
return (true);
};
};
return (false);
}
public function enablePause(enable_:Boolean=true):void{
}
public function keyIsPressed(keyCode:int):Boolean{
return ((_keyStorage[keyCode] > 0));
}
public function initKeyManager(keyReceiver_:DisplayObject):KeyManager{
_pKeyReceiver = keyReceiver_;
_pKeyReceiver.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);
_pKeyReceiver.addEventListener(KeyboardEvent.KEY_UP, onKeyUp);
return (this);
}
public static function create():KeyManager{
var mbr:KeyManager = new (KeyManager);
mbr.init();
return (mbr);
}
}
}//package base
Section 5
//wav (BGshot.wav)
package BGshot {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package BGshot
Section 6
//wav (boom.wav)
package boom {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package boom
Section 7
//wav (box.wav)
package box {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package box
Section 8
//wav (button.wav)
package button {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package button
Section 9
//wav (disable.wav)
package disable {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package disable
Section 10
//wav (endTime.wav)
package endTime {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package endTime
Section 11
//wav (Gas_Stvorka.wav)
package Gas_Stvorka {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package Gas_Stvorka
Section 12
//wav (grShot.wav)
package grShot {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package grShot
Section 13
//wav (inGame.wav)
package inGame {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package inGame
Section 14
//gbWinScreen_127 (Interf_fla.gbWinScreen_127)
package Interf_fla {
import flash.display.*;
public dynamic class gbWinScreen_127 extends MovieClip {
public function gbWinScreen_127(){
addFrameScript(0, this.frame1);
}
function frame1(){
stop();
}
}
}//package Interf_fla
Section 15
//soundicon_4 (Interf_fla.soundicon_4)
package Interf_fla {
import flash.display.*;
public dynamic class soundicon_4 extends MovieClip {
public var hit:SimpleButton;
public function soundicon_4(){
addFrameScript(0, this.frame1, 1, this.frame2);
}
function frame1(){
stop();
}
function frame2(){
stop();
}
}
}//package Interf_fla
Section 16
//splScreen_8 (Interf_fla.splScreen_8)
package Interf_fla {
import flash.display.*;
public dynamic class splScreen_8 extends MovieClip {
public function splScreen_8(){
addFrameScript(0, this.frame1);
}
function frame1(){
stop();
}
}
}//package Interf_fla
Section 17
//windAnim_20 (Interf_fla.windAnim_20)
package Interf_fla {
import flash.display.*;
public dynamic class windAnim_20 extends MovieClip {
public var mcWind:MovieClip;
public function windAnim_20(){
addFrameScript(0, this.frame1, 7, this.frame8);
}
function frame8(){
stop();
}
function frame1(){
stop();
}
}
}//package Interf_fla
Section 18
//wav (intro.wav)
package intro {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package intro
Section 19
//wav (jetPack.wav)
package jetPack {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package jetPack
Section 20
//wav (JumpSound.wav)
package JumpSound {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package JumpSound
Section 21
//wav (kick.wav)
package kick {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package kick
Section 22
//wav (laser.wav)
package laser {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package laser
Section 23
//enemyPoint_4 (levels_fla.enemyPoint_4)
package levels_fla {
import flash.display.*;
public dynamic class enemyPoint_4 extends MovieClip {
public function enemyPoint_4(){
addFrameScript(0, this.frame1);
}
function frame1(){
visible = false;
}
}
}//package levels_fla
Section 24
//myPoint_5 (levels_fla.myPoint_5)
package levels_fla {
import flash.display.*;
public dynamic class myPoint_5 extends MovieClip {
public function myPoint_5(){
addFrameScript(0, this.frame1);
}
function frame1(){
visible = false;
}
}
}//package levels_fla
Section 25
//wav (mgShot.wav)
package mgShot {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package mgShot
Section 26
//wav (mina.wav)
package mina {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package mina
Section 27
//wav (missel.wav)
package missel {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package missel
Section 28
//wav (money.wav)
package money {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package money
Section 29
//wav (nextStep.wav)
package nextStep {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package nextStep
Section 30
//cTipTextWindow (objGame.cTipTextWindow)
package objGame {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
public class cTipTextWindow {
protected var mc:TipTextMC;
public function cTipTextWindow(_mcRoot:MovieClip){
super();
mc = new TipTextMC();
_mcRoot.addChild(mc);
mc.visible = false;
iconPart.ComentWindow = this;
mc.mouseEnabled = false;
mc.mouseChildren = false;
mc.iLife.txt.text = "";
}
public function init(obj:myObj, tarMC:Sprite):void{
mc.txtname.text = obj.name;
mc.txt.text = obj.text;
mc.iCost.text = ("$" + String(obj.cost));
if (obj.UNItype < 2000){
mc.iLife.txt.text = (obj as elementsOfBio).live.toString();
mc.iLife.gotoAndStop(1);
if ((obj as elementsOfBio).weaponTypeInf >= 0){
mc.iWeap.visible = true;
mc.iWeap.gotoAndStop(((obj as elementsOfBio).weaponTypeInf + 1));
} else {
mc.iWeap.visible = false;
};
mc.iDef.visible = false;
if ((obj as elementsOfBio).defensBonus > 0){
mc.iDef.visible = true;
mc.iDef.txt.text = (obj as elementsOfBio).defensBonus.toString();
mc.iDef.gotoAndStop(1);
};
if ((obj as elementsOfBio).demagBonus > 0){
mc.iDef.visible = true;
mc.iDef.txt.text = (obj as elementsOfBio).demagBonus.toString();
mc.iDef.gotoAndStop(2);
};
mc.iSpec.txt.visible = true;
mc.iSpec.txt.text = "";
mc.iSpec.visible = false;
if ((obj as elementsOfBio).regenSpeed > 0){
mc.iSpec.visible = true;
mc.iSpec.txt.text = (obj as elementsOfBio).regenSpeed.toString();
mc.iSpec.gotoAndStop(1);
};
if ((obj as elementsOfBio).selfDestroy){
mc.iSpec.visible = true;
mc.iSpec.txt.visible = false;
mc.iSpec.gotoAndStop(2);
};
if ((obj as elementsOfBio).laser){
mc.iSpec.visible = true;
mc.iSpec.txt.visible = false;
mc.iSpec.gotoAndStop(3);
};
if ((obj as elementsOfBio).rengen){
mc.iSpec.visible = true;
mc.iSpec.txt.visible = false;
mc.iSpec.gotoAndStop(4);
};
} else {
mc.iLife.txt.text = (obj as weapons).powerWeap.toString();
mc.iLife.gotoAndStop(2);
mc.iWeap.visible = false;
mc.iDef.visible = false;
mc.iSpec.visible = false;
};
var p:Point = mc.parent.globalToLocal(tarMC.localToGlobal(new Point(0, 0)));
if (p.x < 550){
p.x = ((p.x + (tarMC.width / 2)) + 10);
} else {
p.x = (p.x - (mc.width / 2));
p.y = ((p.y - mc.height) + 50);
};
mc.x = p.x;
mc.y = p.y;
visible = true;
}
protected function ef(e:Event):void{
}
public function get visible():Boolean{
return (mc.visible);
}
public function set visible(val:Boolean):void{
mc.visible = val;
}
public function destroy():void{
mc.parent.removeChild(mc);
mc = null;
iconPart.ComentWindow = null;
}
}
}//package objGame
Section 31
//elementsOfBio (objGame.elementsOfBio)
package objGame {
import scr.*;
public class elementsOfBio extends myObj {
public var anglMove:Number;
public var level:int;
public var speed:Number;
public var regenSpeed:int;
public var classPart:Class;
public var demagBonus:int;
public var selfDestroy:Boolean;
public var laser:Boolean;
public var rengen:Boolean;
public var live:int;
public var defensBonus:int;
public var anglHills:Number;
public var weaponTypeInf:int;
public var jumpSpeed:Number;
public var type:int;
public var jetPack:Boolean;
public static const t_LEG:int = 2;
public static const arrBioForBox:Array = [0, 1, 0, 1, 1, 2, 3, 5, 3, 1, 3, 3, 3, 4, 2, 1, 3, 5, 0, 3, 3, 3, 3, 4, 1, 3, 3, 1, 1, 5, 3, 1, 0, 4, 3, 3, 1, 1, 3, 3, 3, 4, 0, 2, 3, 6, 1, 1, 0, 4, 2, 1, 2, 2, 1, 4, 3, 3, 3, 4, 1, 5, 1, 1, 3, 6, 3, 3, 2, 2, 0, 2, 1, 5, 3, 6, 0, 2, 3, 7];
public static const t_HEAD:int = 1;
public static const t_BODY:int = 0;
public static const t_ARM:int = 3;
public static var arrBio:Array = [0, 0, 0, 1, 0, 2, 0, 3, 0, 4, 1, 0, 1, 1, 1, 2, 1, 3, 1, 4, 1, 5, 2, 0, 2, 1, 2, 2, 3, 0, 3, 1, 3, 2, 3, 3, 3, 4, 3, 5, 3, 6, 3, 7];
public function elementsOfBio(){
super("", null, "", 0, 0);
setDefoultBioPart();
}
protected function createLeg(t:int):void{
switch (t){
case 0:
name = "Caterpillar support";
text = "Caterpillar supports are the slowest but the most passable.";
live = 50;
speed = 1;
anglHills = -0.2;
cost = 50;
anglMove = 2;
icon = iconLeg3;
jumpSpeed = 9;
break;
case 1:
name = "Biped support";
text = "Biped support climbs the mountains well and jumps high.";
live = 40;
speed = 2;
anglHills = -0.1;
defensBonus = 3;
cost = 150;
anglMove = 1.5;
jumpSpeed = 17;
icon = iconLeg1;
break;
case 2:
name = "Wheel support";
text = "The wheel support is the fastest but only on the even surfaces.";
live = 30;
speed = 3;
anglHills = -0.6;
jumpSpeed = 12;
anglMove = 0.6;
cost = 200;
icon = iconLeg2;
break;
};
}
protected function createArm(t:int):void{
switch (t){
case 0:
name = "Bazooka Arm";
text = "Rockets - the main weapon! The bazooka Arm gives an infinite stock of rockets.";
live = 20;
weaponTypeInf = weapons.Missel.weaponNum;
icon = iconGun5;
break;
case 1:
name = "G-launcher Arm";
text = "The infinite amount of granades onto heads of your enemies.";
live = 25;
weaponTypeInf = weapons.Grenada.weaponNum;
icon = iconGun6;
break;
case 2:
name = "Sword Arm";
text = "Adds damages to each shot or blow.";
live = 35;
weaponTypeInf = weapons.Udar.weaponNum;
demagBonus = 3;
icon = iconGun3;
break;
case 3:
name = "BigGun arm";
text = "Infinite amount of 30mm shells. Only one shot is compensated by the great damages.";
live = 45;
demagBonus = 2;
weaponTypeInf = weapons.BigGun.weaponNum;
icon = iconGun2;
cost = 100;
break;
case 4:
name = "Circular saw Arm";
text = "To saw the opponent in two, what can be better? Infinite stock Circular saw";
demagBonus = 4;
live = 55;
weaponTypeInf = weapons.Disko.weaponNum;
icon = iconGun4;
cost = 140;
break;
case 5:
name = "MachineGun Arm";
text = "Small damage is compensated by quantity. 15 bullets in a row will turn the opponent into minced meat.";
live = 35;
weaponTypeInf = weapons.MashinGun.weaponNum;
demagBonus = 3;
icon = iconGun1;
cost = 150;
break;
case 6:
name = "PlasmaGun Arm";
text = "Plasma burns through everything! The power of the weapon justifies the price!";
demagBonus = 4;
live = 45;
weaponTypeInf = weapons.PlasmaGun.weaponNum;
cost = 600;
icon = iconGun8;
break;
case 7:
name = "Laser Arm";
text = "The laser easily passes through stone and the opponent's body!";
demagBonus = 5;
live = 35;
weaponTypeInf = weapons.Laser.weaponNum;
cost = 700;
icon = iconGun7;
break;
};
}
public function createElementFromUIN(n:int):void{
var t:int = (int((n / 100)) - 10);
var l:int = (n % 10);
createElement(t, l);
}
public function createElement(t:int, L:int):void{
setDefoultBioPart();
type = Math.min(Math.max(t, 0), 4);
level = Math.max(L, 0);
switch (t){
case 0:
createBody(L);
break;
case 1:
createHead(L);
break;
case 2:
createLeg(L);
break;
case 3:
case 4:
createArm(L);
break;
};
cost = (cost + ((((((live * 2) + (regenSpeed * 20)) + (demagBonus * 15)) + (level * 10)) + (weaponTypeInf * 5)) + (defensBonus * 15)));
UNItype = ((1000 + (type * 100)) + level);
}
public function setDefoultBioPart():void{
type = 0;
level = 0;
live = 10;
weaponTypeInf = -1;
name = "body";
text = "body o";
icon = iconBody1;
demagBonus = 0;
defensBonus = 0;
laser = false;
rengen = false;
regenSpeed = 0;
selfDestroy = false;
speed = 0;
anglHills = 0;
jumpSpeed = 0;
cost = 0;
UNItype = ((1000 + (type * 100)) + level);
}
public function toString():String{
return (((String(type) + "_") + String(level)));
}
override public function copy():Object{
var b:elementsOfBio = new elementsOfBio();
b.createElement(type, level);
b.count = count;
return (b);
}
protected function createHead(t:int):void{
switch (t){
case 0:
name = "Usual Head";
text = "Standard head. Nothing special.";
live = 20;
icon = iconHead1;
break;
case 1:
name = "Strong Head";
text = "The strengthened version of a usual head.";
live = 50;
defensBonus = 3;
icon = iconHead3;
cost = 30;
break;
case 2:
name = "Kamikaze Head";
text = "Explodes after death and damages everyone around.";
live = 30;
selfDestroy = true;
icon = iconHead4;
cost = 50;
break;
case 3:
name = "Sniper Head";
text = "Head with a ballistic calculator. Automatically displays the trajectory.";
live = 25;
cost = 250;
laser = true;
demagBonus = 4;
icon = iconHead5;
break;
case 4:
name = "X-Ray Head";
text = "X-Ray allows to see the content of the boxes. Just place the cursor on them.";
live = 55;
rengen = true;
cost = 110;
icon = iconHead2;
break;
case 5:
name = "Teleport Head";
text = "The built-in teleporter allows to be transferred to any point of the map.";
live = 40;
cost = 180;
icon = iconHead6;
weaponTypeInf = weapons.Teleport.weaponNum;
break;
};
}
protected function createBody(t:int):void{
icon = iconBody1;
switch (t){
case 0:
name = "Usual body";
text = "Standard body. Nothing special.";
live = 30;
icon = iconBody1;
break;
case 1:
name = "Armour body";
text = "The usual body strengthened by armour.";
defensBonus = 4;
cost = 150;
live = 30;
icon = iconBody2;
break;
case 2:
name = "Strong Body";
text = "Protected body with increased amount of lives - the easiest way to win.";
live = 65;
cost = 200;
icon = iconBody3;
defensBonus = 5;
break;
case 3:
name = "Medic Body";
text = "Regeneration - your bionoid regenerates several lost hit points every round.";
live = 30;
regenSpeed = 5;
icon = iconBody4;
cost = 100;
break;
case 4:
name = "JetPack Body";
text = "JetPack behind the back allows to steal up to the enemies standing at inaccessible heights";
live = 40;
weaponTypeInf = weapons.JetPack.weaponNum;
cost = 150;
icon = iconBody5;
break;
};
}
public static function createInString(s:String):elementsOfBio{
var a:Array = s.split("_");
var b:elementsOfBio = new (elementsOfBio);
b.createElement(a[0], a[1]);
return (b);
}
public static function getRandomElemets():elementsOfBio{
var b:elementsOfBio = new (elementsOfBio);
var k:int = int(Math.max(0, Math.min((arrBioForBox.length / 2), (int(((Math.random() * 10) + (Math.random() * 10))) + scrMap.bioLev))));
b.createElement(arrBioForBox[(k * 2)], arrBioForBox[((k * 2) + 1)]);
return (b);
}
}
}//package objGame
Section 32
//iconPart (objGame.iconPart)
package objGame {
import flash.events.*;
import flash.display.*;
import war.*;
import scr.*;
import flash.text.*;
public class iconPart {
protected var hitBt:SimpleButton;
protected var infin:MovieClip;
protected var rezFunc:Function;
protected var iconMC:Sprite;
protected var m_enable:Boolean;
protected var mc:MovieClip;
protected var countTxt:TextField;
protected var selMC:MovieClip;
public var obj:myObj;
protected var Magaz:Boolean;
public static var ComentWindow:cTipTextWindow;
public static var ComentString:TextField;
public function iconPart(){
super();
}
protected function clic(e:Event):void{
var s:Boolean;
if (rezFunc != null){
s = selected;
if (selected){
rezFunc(null);
} else {
rezFunc(obj);
};
selected = !(s);
};
}
public function set enable(val:Boolean):void{
m_enable = val;
hitBt.visible = val;
if (!val){
stageScr.setColorMC(mc, [1, 0, 0, 0, -100, 0, 1, 0, 0, -100, 0, 0, 1, 0, -100, 0, 0, 0, 1, 0]);
} else {
mc.filters = [];
};
}
public function init(mcr:MovieClip, x:int, y:int, _obj:myObj, iconClic:Function, _Magaz:Boolean=false):void{
Magaz = _Magaz;
obj = _obj;
mc = new iconAll();
mcr.addChild(mc);
mc.x = x;
mc.y = y;
rezFunc = iconClic;
var pl:MovieClip = mc["podlMC"];
if (_obj.UNItype < 2000){
pl.gotoAndStop(1);
} else {
pl.gotoAndStop(2);
};
hitBt = (mc["hit"] as SimpleButton);
countTxt = (mc["txt"] as TextField);
infin = (mc["infiMc"] as MovieClip);
infin.cacheAsBitmap = true;
iconMC = (mc["iconMc"] as Sprite);
iconMC.cacheAsBitmap = true;
selMC = (mc["mcSel"] as MovieClip);
selMC.cacheAsBitmap = true;
selected = false;
var mci:Sprite = (new _obj.icon() as Sprite);
iconMC.addChild(mci);
WarField.mc2pic((mci as MovieClip));
iconMC.cacheAsBitmap = true;
count = obj.count;
hitBt.addEventListener(MouseEvent.CLICK, clic);
hitBt.addEventListener(MouseEvent.MOUSE_OVER, overMouse);
hitBt.addEventListener(MouseEvent.MOUSE_OUT, outMouse);
}
public function get enable():Boolean{
return (m_enable);
}
public function get selected():Boolean{
return (selMC.visible);
}
public function set count(val:int):void{
if (Magaz){
countTxt.text = ("$" + String(obj.cost));
infin.visible = false;
obj.count = 1;
} else {
obj.count = val;
countTxt.text = String(val);
enable = (val > 0);
if (val > 100){
countTxt.visible = false;
infin.visible = true;
} else {
countTxt.visible = true;
infin.visible = false;
};
};
}
public function get count():int{
return (obj.count);
}
public function updateCount():void{
if (Magaz){
obj.count = 1;
};
count = obj.count;
}
protected function overMouse(e:Event):void{
if (ComentWindow != null){
ComentWindow.init(obj, mc);
};
if (ComentString != null){
ComentString.text = obj.name;
};
}
public function set selected(val:Boolean):void{
selMC.visible = val;
}
public function destroy():void{
hitBt.removeEventListener(MouseEvent.CLICK, clic);
hitBt.removeEventListener(MouseEvent.MOUSE_OVER, overMouse);
hitBt.removeEventListener(MouseEvent.MOUSE_OUT, outMouse);
hitBt = null;
mc.parent.removeChild(mc);
mc = null;
iconMC = null;
infin = null;
countTxt = null;
rezFunc = null;
}
protected function outMouse(e:Event):void{
if (ComentWindow != null){
ComentWindow.visible = false;
};
if (ComentString != null){
ComentString.text = "";
};
}
}
}//package objGame
Section 33
//myObj (objGame.myObj)
package objGame {
public class myObj {
public var UNItype:int;
public var name:String;
public var cost:int;
public var count:int;
public var icon:Class;
public var text:String;
public function myObj(_name:String, ic:Class, t:String, UNT:int, _cost:int){
super();
icon = ic;
count = 1;
name = _name;
text = t;
UNItype = UNT;
cost = _cost;
}
public function copy():Object{
var o:myObj = new myObj(name, icon, text, UNItype, cost);
o.count = count;
return (o);
}
}
}//package objGame
Section 34
//panelIcon (objGame.panelIcon)
package objGame {
import flash.events.*;
import flash.display.*;
import scr.*;
public class panelIcon {
protected var functPanel:Function;
protected var textType:Boolean;
protected var sbDw:SimpleButton;
protected var holo:MovieClip;
protected var maskaMC:MovieClip;
protected var sbUp:SimpleButton;
protected var maxW:int;
protected var slider:MovieClip;
protected var maxH:int;
protected var shiftNum:int;
protected var Magaz:Boolean;
protected var arrIcon:Array;
protected var curPos:int;
public static const heightIcon:int = 44;
public static const widthIcon:int = 68;
public function panelIcon(){
super();
arrIcon = [];
}
public function addIcon(obj:myObj):void{
var ic:iconPart;
var i:int;
if (arrIcon.length > 0){
i = 0;
while (i < arrIcon.length) {
ic = arrIcon[i];
if (ic.obj.UNItype == obj.UNItype){
trace(ic.count, obj.count);
ic.count = (ic.count + obj.count);
return;
};
i++;
};
};
if (obj.count <= 0){
return;
};
ic = new iconPart();
var xx:int = ((arrIcon.length % maxW) * widthIcon);
var yy:int = (int((arrIcon.length / maxW)) * heightIcon);
arrIcon.push(ic);
var f:Function = clicSel;
if (functPanel == null){
f = null;
};
ic.init(slider, xx, yy, (obj.copy() as myObj), f, Magaz);
ic.count = obj.count;
showEnButton();
}
public function unselectAll():void{
var ic:iconPart;
var i:int;
while (i < arrIcon.length) {
ic = arrIcon[i];
ic.selected = false;
i++;
};
}
public function updateCount():void{
var i:int;
while (i < arrIcon.length) {
arrIcon[i].updateCount();
i++;
};
}
public function clicString(n:int):void{
if (functPanel != null){
unselectAll();
functPanel(n);
};
}
public function clear():void{
var d:iconPart;
while (arrIcon.length > 0) {
d = arrIcon.shift();
d.destroy();
};
}
public function addString(text:String, e:Boolean, n:int, star:Boolean=false):void{
textType = true;
var ic:stringOfList = new stringOfList();
var xx:int;
var yy:int = (int((arrIcon.length / maxW)) * 23);
arrIcon.push(ic);
ic.initString(slider, xx, yy, text, clicString, n);
ic.enable = e;
ic.showStar(star);
showEnButton();
}
public function addAllPart():void{
addFromArray(Main.Profil.partArr);
}
protected function clicSel(ob:myObj):void{
if (functPanel != null){
unselectAll();
functPanel(ob);
};
}
public function addObjFromUIN(n:int):void{
var f:elementsOfBio;
var w:weapons;
if (n < 2000){
f = new elementsOfBio();
f.createElementFromUIN(n);
addIcon(f);
} else {
w = weapons.getWeap((n - 2001));
addIcon(w);
};
}
public function destroy():void{
var ic:iconPart;
var i:int;
if (iconPart.ComentString != null){
iconPart.ComentString = null;
};
if (arrIcon.length > 0){
i = 0;
while (i < arrIcon.length) {
ic = arrIcon[i];
ic.destroy();
i++;
};
};
holo = null;
arrIcon = null;
maskaMC.parent.removeChild(maskaMC);
slider.parent.removeChild(slider);
slider = null;
maskaMC = null;
if (sbUp != null){
sbUp.removeEventListener(MouseEvent.CLICK, clicUp);
};
if (sbDw != null){
sbDw.removeEventListener(MouseEvent.CLICK, clicDw);
};
sbUp = null;
sbDw = null;
functPanel = null;
}
public function delIcon(obj:myObj):void{
var ic:iconPart;
var i:int;
trace("del pan ", obj.name);
if (arrIcon.length > 0){
i = 0;
while (i < arrIcon.length) {
ic = arrIcon[i];
if (ic.obj.UNItype == obj.UNItype){
ic.count--;
return;
};
i++;
};
};
}
public function select(n:int):void{
unselectAll();
n = Math.min((arrIcon.length - 1), Math.max(n, 0));
arrIcon[n].selected = true;
if (n > ((curPos + maxH) - 2)){
curPos = (n - 2);
};
slider.y = (-(curPos) * shiftNum);
showEnButton();
}
protected function showEnButton():void{
if (sbUp != null){
stageScr.enabeButon(sbUp, (curPos > 0));
};
if (sbDw != null){
stageScr.enabeButon(sbDw, (curPos < ((int((arrIcon.length / maxW)) - maxH) + 1)));
};
}
public function showMagaz(mon:int):void{
var m:iconPart;
var i:int;
while (i < arrIcon.length) {
m = arrIcon[i];
if (m.obj.cost > mon){
m.enable = false;
} else {
m.enable = true;
};
i++;
};
}
public function addFromArray(a:Array):void{
var bp:myObj;
var i:int;
while (i < a.length) {
bp = a[i];
addIcon(bp);
i++;
};
}
public function addAllWeap():void{
addFromArray(Main.Profil.shellArr);
}
protected function clicDw(e:Event):void{
if (curPos < ((int((arrIcon.length / maxW)) - maxH) + 1)){
curPos++;
};
slider.y = (-(curPos) * shiftNum);
showEnButton();
}
public function reLoad(a:Array):void{
var ic:iconPart;
var i:int;
if (((!((holo == null))) && ((holo.currentFrame == 1)))){
holo.play();
};
if (arrIcon.length > 0){
i = 0;
while (i < arrIcon.length) {
ic = arrIcon[i];
ic.count = 0;
i++;
};
};
i = 0;
while (i < a.length) {
addIcon(a[i]);
i++;
};
}
public function create(mc:MovieClip, upBt:SimpleButton, dwBt:SimpleButton, wc:int, hc:int, fu:Function, texType:Boolean, magaz:Boolean=false):void{
maxH = hc;
maxW = wc;
textType = texType;
Magaz = magaz;
functPanel = fu;
maskaMC = new MovieClip();
slider = new MovieClip();
mc.addChild(slider);
mc.addChild(maskaMC);
holo = mc.parent["holoMC"];
if (holo != null){
holo.stop();
};
trace("holo", holo);
sbUp = upBt;
if (sbUp != null){
sbUp.addEventListener(MouseEvent.CLICK, clicUp);
};
sbDw = dwBt;
if (sbDw != null){
sbDw.addEventListener(MouseEvent.CLICK, clicDw);
};
curPos = 0;
maskaMC.graphics.beginFill(10, 1);
if (texType){
shiftNum = 23;
maskaMC.graphics.drawRect(0, -5, 160, ((hc - 1) * shiftNum));
} else {
shiftNum = heightIcon;
maskaMC.graphics.drawRect((-(widthIcon) / 2), -5, (wc * widthIcon), ((hc * shiftNum) + 10));
};
if (mc.parent["mcComentString"] != null){
iconPart.ComentString = mc.parent["mcComentString"];
};
maskaMC.graphics.endFill();
slider.mask = maskaMC;
}
protected function clicUp(e:Event):void{
if (curPos > 0){
curPos--;
};
slider.y = (-(curPos) * shiftNum);
showEnButton();
}
}
}//package objGame
Section 35
//stringOfList (objGame.stringOfList)
package objGame {
import flash.events.*;
import flash.display.*;
import scr.*;
import flash.text.*;
public class stringOfList extends iconPart {
protected var num:int;
protected var mcS:MovieClip;
public function stringOfList(){
super();
}
public function initString(mcr:MovieClip, x:int, y:int, t:String, iconClic:Function, _num:int):void{
mc = new strMc();
mcr.addChild(mc);
mc.x = x;
mc.y = y;
rezFunc = iconClic;
num = _num;
hitBt = (mc["hit"] as SimpleButton);
mcS = (mc["mcStar"] as MovieClip);
mcS.visible = false;
countTxt = (mc["txt"] as TextField);
countTxt.text = t;
countTxt.cacheAsBitmap = true;
selMC = (mc["mcSel"] as MovieClip);
hitBt.addEventListener(MouseEvent.CLICK, clic);
selected = false;
enable = true;
}
override protected function clic(e:Event):void{
rezFunc(num);
selected = true;
}
override public function set enable(value:Boolean):void{
m_enable = value;
hitBt.visible = value;
if (!value){
stageScr.setColorMC(mc, [1, 0, 0, 0, -100, 0, 1, 0, 0, -100, 0, 0, 1, 0, -100, 0, 0, 0, 1, 0]);
} else {
mc.filters = [];
};
}
override public function destroy():void{
hitBt.removeEventListener(MouseEvent.CLICK, clic);
hitBt = null;
mc.parent.removeChild(mc);
mc = null;
iconMC = null;
infin = null;
countTxt = null;
rezFunc = null;
}
override public function get enable():Boolean{
return (super.enable);
}
public function showStar(b:Boolean):void{
mcS.visible = b;
}
}
}//package objGame
Section 36
//weapons (objGame.weapons)
package objGame {
import war.*;
public class weapons extends myObj {
public var powerWeap:int;
public var timerWeap:int;
public var radiusWeap:int;
public var armNum:int;
public var classWeap:Class;
public var weaponNum:int;
public static const Missel:weapons = new weapons("Rocket", "Rockets - the main weapon! Mind the wind!", cMissel, iconMissel, 5, 2001, 40, 45, 1);
;
public static const Dinamit:weapons = new weapons("Time bomb", "Plant and run! The hitting range is huge!", cDinamit, iconDinamit, 40, 2006, 60, 70, 10);
;
public static const ABomb:weapons = new weapons("A-Bomb", "Destroys everything! Simply point a drop place! Mind the wind!", cAbomb, iconAbomb, 800, 2011, 100, 150, 9);
;
public static const AirStrike:weapons = new weapons("Air Strike", "5 rockets from the sky will make a mass grave out of the enemy group! Mind the wind!", cASMissel, iconAirStrike, 500, 2007, 40, 50, 9);
;
public static const Disko:weapons = new weapons("Circular saw", "To saw the opponent in two, what can be better?", cDisko, iconDisco, 15, 2013, 50, 80, 5);
;
public static const Teleport:weapons = new weapons("Teleport", "Freedom to move! Simply point where you want to find yourself", cTeleport, iconTeleport, 60, 2014, 50, 80, 9, 10);
;
public static const Udar:weapons = new weapons("Kick", "Throws the opponent back", cUdar, iconUdar, 0, 2005, 50, 50, 3);
;
public static const cGrenada:weapons = new weapons("Claster Bomb", "Explodes in 1-5 seconds and scatters into 5 small bombs.", cClasterBomb, iconCBomb, 15, 2003, 30, 45, 2);
;
public static const Grenada:weapons = new weapons("Grenade", "The grenade will explode in 1-5 sec. Rebounds from obstacles.", cGrenade, iconGrenada, 5, 2002, 35, 50, 2);
;
public static const BigGun:weapons = new weapons("30mm Gun", "Only one shot is compensated by the great damages", bullet, iconBigGun, 50, 2008, 15, 100, 4);
;
public static const JetPack:weapons = new weapons("JetPack", "Allows to steal up to the enemies standing at inaccessible heights", cJetPack, iconJetPack, 50, 2009, 5, 50, 10);
;
public static const PlasmaBomb:weapons = new weapons("Plasma Grenate", "Star fire in metal packing. Explodes in 1-5 seconds.", cPlasmaGrenad, iconPBomb, 90, 2012, 50, 80, 2);
;
public static const MashinGun:weapons = new weapons("Machine gun", "15 bullets in a row will turn the opponent into minced meat", cMashingun, iconMashinGun, 20, 2004, 12, 7, 6, 60);
;
public static const Laser:weapons = new weapons("Laser", "The laser easily passes through stone and the opponent's body!", cLaser, iconLaserGun, 364, 2015, 12, 80, 8);
;
public static const PlasmaGun:weapons = new weapons("Plasma Gun", "Burn the opponent with star fire", cPlasmaGan, iconPlasmaGun, 110, 2010, 20, 12, 7, 60);
;
public static var allWeapArr:Array = [Missel, Grenada, cGrenada, MashinGun, Udar, Dinamit, AirStrike, BigGun, JetPack, PlasmaGun, ABomb, PlasmaBomb, Disko, Teleport, Laser];
public static var addMissionWeapArr:Array = [cGrenada, BigGun, cGrenada, Dinamit, MashinGun, Dinamit, AirStrike, AirStrike, BigGun, PlasmaBomb, BigGun, BigGun, JetPack, cGrenada, Dinamit, JetPack, PlasmaGun, PlasmaGun, ABomb, MashinGun, PlasmaBomb, PlasmaBomb, Teleport, PlasmaBomb, Disko, Laser, Disko, Dinamit, AirStrike, Disko, Disko, Teleport];
public function weapons(n:String, t:String, classW:Class, ic:Class, _cost:int, u:int, radiusw:int=30, powerw:int=30, arm:int=1, timW:int=0){
super(n, ic, t, u, _cost);
weaponNum = (u - 2001);
armNum = arm;
classWeap = classW;
radiusWeap = radiusw;
powerWeap = powerw;
timerWeap = timW;
}
override public function copy():Object{
var w:weapons = new weapons(name, text, classWeap, icon, cost, UNItype, radiusWeap, powerWeap, armNum, timerWeap);
w.count = count;
return (w);
}
public static function getWeap(n:int):weapons{
return (allWeapArr[n].copy());
}
}
}//package objGame
Section 37
//wav (plasmaboom.wav)
package plasmaboom {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package plasmaboom
Section 38
//wav (plasmaGun.wav)
package plasmaGun {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package plasmaGun
Section 39
//B_10 (PRELOADER_fla.B_10)
package PRELOADER_fla {
import flash.display.*;
public dynamic class B_10 extends MovieClip {
public function B_10(){
addFrameScript(13, this.frame14);
}
function frame14(){
stop();
}
}
}//package PRELOADER_fla
Section 40
//D_18 (PRELOADER_fla.D_18)
package PRELOADER_fla {
import flash.display.*;
public dynamic class D_18 extends MovieClip {
public function D_18(){
addFrameScript(13, this.frame14);
}
function frame14(){
stop();
}
}
}//package PRELOADER_fla
Section 41
//I_12 (PRELOADER_fla.I_12)
package PRELOADER_fla {
import flash.display.*;
public dynamic class I_12 extends MovieClip {
public function I_12(){
addFrameScript(13, this.frame14);
}
function frame14(){
stop();
}
}
}//package PRELOADER_fla
Section 42
//N_16 (PRELOADER_fla.N_16)
package PRELOADER_fla {
import flash.display.*;
public dynamic class N_16 extends MovieClip {
public function N_16(){
addFrameScript(13, this.frame14);
}
function frame14(){
stop();
}
}
}//package PRELOADER_fla
Section 43
//O_14 (PRELOADER_fla.O_14)
package PRELOADER_fla {
import flash.display.*;
public dynamic class O_14 extends MovieClip {
public function O_14(){
addFrameScript(13, this.frame14);
}
function frame14(){
stop();
}
}
}//package PRELOADER_fla
Section 44
//S_20 (PRELOADER_fla.S_20)
package PRELOADER_fla {
import flash.display.*;
public dynamic class S_20 extends MovieClip {
public function S_20(){
addFrameScript(13, this.frame14);
}
function frame14(){
stop();
}
}
}//package PRELOADER_fla
Section 45
//wav (s_steps.wav)
package s_steps {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package s_steps
Section 46
//wav (s_weell.wav)
package s_weell {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package s_weell
Section 47
//wav (saw.wav)
package saw {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package saw
Section 48
//allScrLab (scr.allScrLab)
package scr {
import objGame.*;
import flash.text.*;
public class allScrLab extends stageScr {
protected var money:TextField;
protected var TText:cTipTextWindow;
public var curElement:elementsOfBio;
protected var bioVan1:bioVanna;
protected var bioVan2:bioVanna;
protected var bioVan4:bioVanna;
protected var bioVan5:bioVanna;
public var stol:panelIcon;
protected var bioVan3:bioVanna;
public function allScrLab(){
super();
}
public function reselectAllbiovann():void{
bioVan1.setSelection();
bioVan2.setSelection();
bioVan3.setSelection();
bioVan4.setSelection();
bioVan5.setSelection();
}
public function returnToList(b:elementsOfBio):void{
stol.addIcon(b);
stol.delIcon(curElement);
stol.unselectAll();
}
override public function destroy():void{
TText.destroy();
stol.destroy();
bioVan1.destroy();
bioVan2.destroy();
bioVan3.destroy();
bioVan4.destroy();
bioVan5.destroy();
money = null;
curElement = null;
super.destroy();
}
}
}//package scr
Section 49
//bioVanna (scr.bioVanna)
package scr {
import flash.events.*;
import flash.display.*;
import objGame.*;
import war.*;
import flash.text.*;
public class bioVanna {
protected var mcLArm:MovieClip;
public var mainBio:bioVanna;
protected var IcmcBody:MovieClip;
protected var mcHead:MovieClip;
protected var parentScr:allScrLab;
protected var IcmcLeg:MovieClip;
protected var mcLeg:MovieClip;
protected var numUnit:int;
protected var mcAll:MovieClip;
protected var IcmcAll:MovieClip;
protected var mcRArm:MovieClip;
public var curBionoid:paramUnit;
public var hitBt:SimpleButton;
protected var IcmcLArm:MovieClip;
protected var holo:MovieClip;
protected var IcmcHead:MovieClip;
protected var mcBody:MovieClip;
protected var curMC:MovieClip;
public var textName:TextField;
protected var mcShirmaAll:MovieClip;
protected var IcmcRArm:MovieClip;
protected var buttonEn:Boolean;
public function bioVanna(_mc:MovieClip, ss:allScrLab, num:int=0){
super();
numUnit = num;
parentScr = ss;
buttonEn = false;
curMC = _mc;
mcLeg = _mc["Leg"];
mcHead = _mc["Head"];
mcBody = _mc["Body"];
mcLArm = _mc["LArm"];
mcRArm = _mc["RArm"];
mcShirmaAll = _mc["mcShirma"];
textName = _mc["nameUnit"];
setName(num);
mcAll = new Bionoid4vann();
mcAll.scaleX = 0.9;
mcAll.scaleY = 0.9;
_mc["All"].addChild(mcAll);
mcAll.x = 60;
mcAll.y = 180;
holo = _mc["All"]["holoMC"];
hitBt = (_mc["hit"] as SimpleButton);
mcAll["leg"].gotoAndStop(1);
mcAll["head"].gotoAndStop(1);
mcAll["body"].gotoAndStop(1);
mcAll["arm"].gotoAndStop(1);
setSelection();
}
public function destroy():void{
var s:SimpleButton;
if (buttonEn){
s = (curMC["hitHead"] as SimpleButton);
s.removeEventListener(MouseEvent.CLICK, clicHead);
s.removeEventListener(MouseEvent.ROLL_OVER, owerMouse);
s.removeEventListener(MouseEvent.ROLL_OUT, outMouse);
s = (curMC["hitBody"] as SimpleButton);
s.removeEventListener(MouseEvent.CLICK, clicBody);
s.removeEventListener(MouseEvent.ROLL_OVER, owerMouse);
s.removeEventListener(MouseEvent.ROLL_OUT, outMouse);
s = (curMC["hitLeg"] as SimpleButton);
s.removeEventListener(MouseEvent.CLICK, clicLeg);
s.removeEventListener(MouseEvent.ROLL_OVER, owerMouse);
s.removeEventListener(MouseEvent.ROLL_OUT, outMouse);
s = (curMC["hitLArm"] as SimpleButton);
s.removeEventListener(MouseEvent.CLICK, clicLArm);
s.removeEventListener(MouseEvent.ROLL_OVER, owerMouse);
s.removeEventListener(MouseEvent.ROLL_OUT, outMouse);
s = (curMC["hitRArm"] as SimpleButton);
s.removeEventListener(MouseEvent.CLICK, clicRArm);
s.removeEventListener(MouseEvent.ROLL_OVER, owerMouse);
s.removeEventListener(MouseEvent.ROLL_OUT, outMouse);
s = null;
};
curMC = null;
mcLeg = null;
mcHead = null;
mcBody = null;
mcLArm = null;
mcRArm = null;
mcAll = null;
mcShirmaAll = null;
}
public function get enable():Boolean{
return (!(mcShirmaAll.visible));
}
protected function clicBody(e:Event):void{
setNewPart(0);
}
public function setName(n:int):void{
if (textName != null){
textName.text = ("UNIT " + String(n));
};
}
protected function owerMouse(e:Event):void{
var tar:MovieClip;
if (((!((holo == null))) && ((holo.currentFrame == 1)))){
holo.play();
};
var o:elementsOfBio = new elementsOfBio();
if (e.target.name == "hitHead"){
o.createElement(elementsOfBio.t_HEAD, curBionoid.head);
tar = IcmcHead;
};
if (e.target.name == "hitBody"){
tar = IcmcBody;
o.createElement(elementsOfBio.t_BODY, curBionoid.body);
};
if (e.target.name == "hitLeg"){
tar = IcmcLeg;
o.createElement(elementsOfBio.t_LEG, curBionoid.leg);
};
if (e.target.name == "hitLArm"){
tar = IcmcLArm;
o.createElement(elementsOfBio.t_ARM, curBionoid.armL);
};
if (e.target.name == "hitRArm"){
o.createElement(elementsOfBio.t_ARM, curBionoid.armR);
tar = IcmcRArm;
};
if (iconPart.ComentWindow != null){
iconPart.ComentWindow.init(o, tar);
};
}
public function set enable(val:Boolean):void{
mcShirmaAll.visible = !(val);
}
public function init(b:paramUnit):void{
var mt:elementsOfBio;
curBionoid = b;
showBionoid(curBionoid);
if (IcmcHead != null){
IcmcHead.parent.removeChild(IcmcHead);
};
if (IcmcBody != null){
IcmcBody.parent.removeChild(IcmcBody);
};
if (IcmcLeg != null){
IcmcLeg.parent.removeChild(IcmcLeg);
};
if (IcmcLArm != null){
IcmcLArm.parent.removeChild(IcmcLArm);
};
if (IcmcRArm != null){
IcmcRArm.parent.removeChild(IcmcRArm);
};
mt = new elementsOfBio();
mt.createElement(elementsOfBio.t_HEAD, b.head);
IcmcHead = new mt.icon();
mcHead.addChild(IcmcHead);
mt = new elementsOfBio();
mt.createElement(elementsOfBio.t_BODY, b.body);
IcmcBody = new mt.icon();
mcBody.addChild(IcmcBody);
mt = new elementsOfBio();
mt.createElement(elementsOfBio.t_LEG, b.leg);
IcmcLeg = new mt.icon();
mcLeg.addChild(IcmcLeg);
mt = new elementsOfBio();
mt.createElement(elementsOfBio.t_ARM, b.armL);
IcmcLArm = new mt.icon();
mcLArm.addChild(IcmcLArm);
mt = new elementsOfBio();
mt.createElement(elementsOfBio.t_ARM, b.armR);
IcmcRArm = new mt.icon();
mcRArm.addChild(IcmcRArm);
setSelection();
}
public function createHitBt(maxB:bioVanna):void{
mainBio = maxB;
hitBt.addEventListener(MouseEvent.CLICK, selectBio);
}
protected function clicLArm(e:Event):void{
setNewPart(3);
}
protected function clicHead(e:Event):void{
setNewPart(1);
}
protected function clicLeg(e:Event):void{
setNewPart(2);
}
public function setSelection():void{
if (mcHead == null){
return;
};
mcHead.sel.visible = false;
mcBody.sel.visible = false;
mcLeg.sel.visible = false;
mcLArm.sel.visible = false;
mcRArm.sel.visible = false;
if (parentScr.curElement == null){
return;
};
if (parentScr.curElement.UNItype > 2000){
return;
};
switch (parentScr.curElement.type){
case 0:
mcBody.sel.visible = true;
break;
case 1:
mcHead.sel.visible = true;
break;
case 2:
mcLeg.sel.visible = true;
break;
case 3:
mcLArm.sel.visible = true;
mcRArm.sel.visible = true;
break;
};
}
protected function returnElementsToList(t:int, l:int):void{
var bp:elementsOfBio = new elementsOfBio();
bp.createElement(t, l);
parentScr.returnToList(bp);
}
public function createButtons():void{
var s:SimpleButton;
s = (curMC["hitHead"] as SimpleButton);
s.addEventListener(MouseEvent.CLICK, clicHead);
s.addEventListener(MouseEvent.ROLL_OVER, owerMouse);
s.addEventListener(MouseEvent.ROLL_OUT, outMouse);
s = (curMC["hitBody"] as SimpleButton);
s.addEventListener(MouseEvent.CLICK, clicBody);
s.addEventListener(MouseEvent.ROLL_OVER, owerMouse);
s.addEventListener(MouseEvent.ROLL_OUT, outMouse);
s = (curMC["hitLeg"] as SimpleButton);
s.addEventListener(MouseEvent.CLICK, clicLeg);
s.addEventListener(MouseEvent.ROLL_OVER, owerMouse);
s.addEventListener(MouseEvent.ROLL_OUT, outMouse);
s = (curMC["hitLArm"] as SimpleButton);
s.addEventListener(MouseEvent.CLICK, clicLArm);
s.addEventListener(MouseEvent.ROLL_OVER, owerMouse);
s.addEventListener(MouseEvent.ROLL_OUT, outMouse);
s = (curMC["hitRArm"] as SimpleButton);
s.addEventListener(MouseEvent.CLICK, clicRArm);
s.addEventListener(MouseEvent.ROLL_OVER, owerMouse);
s.addEventListener(MouseEvent.ROLL_OUT, outMouse);
buttonEn = true;
}
public function showBionoid(u:paramUnit):void{
enable = true;
curBionoid = u;
mcAll["leg"].gotoAndStop((u.leg + 1));
mcAll["leg"].cacheAsBitmap = true;
mcAll["head"].gotoAndStop((u.head + 1));
mcAll["head"].cacheAsBitmap = true;
mcAll["body"].gotoAndStop((u.body + 1));
mcAll["body"].cacheAsBitmap = true;
mcAll["arm"].gotoAndStop((u.armL + 1));
mcAll["arm"].cacheAsBitmap = true;
}
public function selectBio(e:Event):void{
mainBio.init(curBionoid);
mainBio.setName(numUnit);
}
protected function clicRArm(e:Event):void{
setNewPart(4);
}
public function setNewPart(n:int):void{
if (parentScr.curElement == null){
return;
};
if (parentScr.curElement.count <= 0){
return;
};
switch (n){
case 0:
if (parentScr.curElement.type != elementsOfBio.t_BODY){
return;
};
returnElementsToList(elementsOfBio.t_BODY, curBionoid.body);
curBionoid.body = parentScr.curElement.level;
break;
case 1:
if (parentScr.curElement.type != elementsOfBio.t_HEAD){
return;
};
returnElementsToList(elementsOfBio.t_HEAD, curBionoid.head);
curBionoid.head = parentScr.curElement.level;
break;
case 2:
if (parentScr.curElement.type != elementsOfBio.t_LEG){
return;
};
returnElementsToList(elementsOfBio.t_LEG, curBionoid.leg);
curBionoid.leg = parentScr.curElement.level;
break;
case 3:
if (parentScr.curElement.type != elementsOfBio.t_ARM){
return;
};
returnElementsToList(elementsOfBio.t_ARM, curBionoid.armL);
curBionoid.armL = parentScr.curElement.level;
break;
case 4:
if (parentScr.curElement.type != elementsOfBio.t_ARM){
return;
};
returnElementsToList(elementsOfBio.t_ARM, curBionoid.armR);
curBionoid.armR = parentScr.curElement.level;
break;
};
init(curBionoid);
curBionoid.recalc();
SoundConst._playSound(SoundConst.S_setPart);
parentScr.curElement = null;
parentScr.reselectAllbiovann();
}
protected function outMouse(e:Event):void{
if (holo != null){
holo.gotoAndStop(1);
};
if (iconPart.ComentWindow != null){
iconPart.ComentWindow.visible = false;
};
}
}
}//package scr
Section 50
//cStaticTipText (scr.cStaticTipText)
package scr {
import flash.events.*;
import flash.display.*;
public class cStaticTipText {
public static var mcObj:mcTipText;
public static var arrTipText:Array = [];
public function cStaticTipText(){
super();
}
public static function outMouseTT(e:Event):void{
if (mcObj != null){
mcObj.parent.removeChild(mcObj);
mcObj = null;
};
}
public static function overMouseTT(e:Event):void{
var n:int = arrTipText.indexOf(e.target);
if (mcObj != null){
mcObj.parent.removeChild(mcObj);
mcObj = null;
};
if (n < 0){
return;
};
mcObj = new mcTipText();
mcObj.mouseEnabled = false;
mcObj.mouseChildren = false;
e.target.parent.addChild(mcObj);
mcObj.x = e.target.x;
mcObj.y = e.target.y;
mcObj.txt.text = arrTipText[(n + 1)];
}
public static function clear():void{
var s:SimpleButton;
var t:String;
var i:int;
while (i < int((arrTipText.length / 2))) {
s = arrTipText[(i * 2)];
t = arrTipText[((i * 2) + 1)];
if (s != null){
s.removeEventListener(MouseEvent.MOUSE_OVER, overMouseTT);
s.removeEventListener(MouseEvent.MOUSE_OUT, outMouseTT);
};
i++;
};
if (mcObj != null){
mcObj.parent.removeChild(mcObj);
mcObj = null;
};
arrTipText = [];
}
public static function addText(sb:SimpleButton, t:String):void{
sb.addEventListener(MouseEvent.MOUSE_OVER, overMouseTT);
sb.addEventListener(MouseEvent.MOUSE_OUT, outMouseTT);
arrTipText.push(sb);
arrTipText.push(t);
}
}
}//package scr
Section 51
//scrHTP (scr.scrHTP)
package scr {
public class scrHTP extends stageScr {
public function scrHTP(){
super();
addButon("btBack", btBackClic);
addButon("bt39", Main.btClic);
cStaticTipText.addText(this["btBack"], "Return to start screen");
cStaticTipText.addText(this["btLife"], "HIT POINT components OF BIONOID");
cStaticTipText.addText(this["btInf"], "Infinite charges for the weapon");
cStaticTipText.addText(this["btAttack"], "POWER WEAPONS");
cStaticTipText.addText(this["btArm"], "Bonus Defens");
cStaticTipText.addText(this["btDam"], "Bonus Attack");
cStaticTipText.addText(this["btReg"], "Special skill: Regeneration");
cStaticTipText.addText(this["btKam"], "Special skill: Kamicadze");
cStaticTipText.addText(this["btSnip"], "Special skill: Sniper");
cStaticTipText.addText(this["btXray"], "Special skill: X-Ray vision");
cStaticTipText.addText(this["btText"], "Name and the text of the description");
}
}
}//package scr
Section 52
//scrIntro (scr.scrIntro)
package scr {
import flash.events.*;
public class scrIntro extends stageScr {
public function scrIntro(){
super();
addButon("btNext", btNextClic);
addButon("bt39", Main.btClic);
cStaticTipText.addText(this["btNext"], "Next screen");
stop();
}
public function btNextClic(e:Event):void{
switch (currentFrame){
case 1:
case 2:
case 3:
case 4:
nextFrame();
break;
case 5:
Main.setState(Main.ST_MAP);
break;
};
}
}
}//package scr
Section 53
//scrLab (scr.scrLab)
package scr {
import flash.events.*;
import flash.display.*;
import objGame.*;
import war.*;
import flash.text.*;
public class scrLab extends allScrLab {
public function scrLab(){
super();
}
override public function init():void{
TText = new cTipTextWindow(this);
if (Main.Profil.HelpLabShow){
closeHelp(null);
};
Main.Profil.HelpLabShow = true;
addButon("btBack", btBackClic);
addButon("btMap", btMapClic);
addButon("btShop", btShopClic);
stageScr.enabeButon(this["btLab"], false);
addButon("btWar", btWarClic);
cStaticTipText.addText(this["btShop"], "Go to Shop");
cStaticTipText.addText(this["btMap"], "Select Map for fight");
cStaticTipText.addText(this["btBack"], "Return to start screen");
cStaticTipText.addText(this["btWar"], "To begin fight");
addButon("btHelp", btShowHelp);
cStaticTipText.addText(this["btHelp"], "Show help screen");
stol = new panelIcon();
var st:MovieClip = (this["btStol"] as MovieClip);
stol.create(st["cont"], st["btLeft"], st[""], 8, 2, fun, false, false);
stol.addAllPart();
bioVan1 = new bioVanna(this["bioVanna1"], this, 1);
bioVan2 = new bioVanna(this["bioVanna2"], this, 2);
bioVan3 = new bioVanna(this["bioVanna3"], this, 3);
bioVan4 = new bioVanna(this["bioVanna4"], this, 4);
bioVan5 = new bioVanna(this["bioVanna5"], this, 5);
var a:Array = [bioVan1, bioVan2, bioVan3, bioVan4, bioVan5];
var i:int;
while (i < Main.Profil.bionoidsArr.length) {
a[i].createButtons();
a[i].init(Main.Profil.bionoidsArr[i]);
i++;
};
addButon("allHit", funcDesel);
addButon("btByeBioV1", byeBioVann);
addButon("btByeBioV2", byeBioVann);
addButon("btByeBioV3", byeBioVann);
cStaticTipText.addText(this["btByeBioV1"], "Purchase an additional bionoid");
cStaticTipText.addText(this["btByeBioV2"], "Purchase an additional bionoid");
cStaticTipText.addText(this["btByeBioV3"], "Purchase an additional bionoid");
money = (this["mcMoney"] as TextField);
money.text = ("$ " + String(Main.Profil.money));
selectBiovannBut();
}
override public function destroy():void{
Main.Profil.save();
super.destroy();
}
public function byeBioVann(e:Event):void{
var w:cWindYesNo = new cWindYesNo(this, "Add Bionoid", "You wish to buy new bionoids \n 1000$", yesBye);
}
public function yesBye():void{
var bio:paramUnit;
var a:Array;
if (Main.Profil.chekMoney(1000, true)){
SoundConst._playSound(SoundConst.S_money);
bio = paramUnit.initDefault();
Main.Profil.bionoidsArr.push(bio);
Main.Profil.save();
a = [bioVan1, bioVan2, bioVan3, bioVan4, bioVan5];
a[(Main.Profil.bionoidsArr.length - 1)].createButtons();
a[(Main.Profil.bionoidsArr.length - 1)].init(Main.Profil.bionoidsArr[(Main.Profil.bionoidsArr.length - 1)]);
money.text = ("$ " + String(Main.Profil.money));
selectBiovannBut();
};
}
override public function returnToList(b:elementsOfBio):void{
Main.Profil.addPart(b);
Main.Profil.delPart(curElement);
super.returnToList(b);
}
protected function selectBiovannBut():void{
this["btByeBioV1"].visible = true;
this["btByeBioV2"].visible = false;
this["btByeBioV3"].visible = false;
if (Main.Profil.bionoidsArr.length == 3){
this["btByeBioV1"].visible = false;
this["btByeBioV2"].visible = true;
this["btByeBioV3"].visible = false;
};
if (Main.Profil.bionoidsArr.length == 4){
this["btByeBioV1"].visible = false;
this["btByeBioV2"].visible = false;
this["btByeBioV3"].visible = true;
};
if (Main.Profil.bionoidsArr.length == 5){
this["btByeBioV1"].visible = false;
this["btByeBioV2"].visible = false;
this["btByeBioV3"].visible = false;
};
}
protected function funcDesel(e:Event):void{
stol.unselectAll();
curElement = null;
reselectAllbiovann();
}
protected function fun(ob:elementsOfBio):void{
SoundConst._buttonClick();
curElement = ob;
reselectAllbiovann();
}
}
}//package scr
Section 54
//scrMag (scr.scrMag)
package scr {
import flash.display.*;
import objGame.*;
import flash.text.*;
public class scrMag extends stageScr {
protected var money:TextField;
protected var TText:cTipTextWindow;
protected var magStol:panelIcon;
protected var curObj:myObj;
protected var stol:panelIcon;
public function scrMag(){
super();
}
override public function init():void{
var i:int;
var b:elementsOfBio;
TText = new cTipTextWindow(this);
addButon("btLab", btLabClic);
addButon("btMap", btMapClic);
addButon("btBack", btBackClic);
stageScr.enabeButon(this["btShop"], false);
addButon("btWar", btWarClic);
cStaticTipText.addText(this["btMap"], "Select Map for fight");
cStaticTipText.addText(this["btBack"], "Return to start screen");
cStaticTipText.addText(this["btLab"], "Go to Laboratory");
cStaticTipText.addText(this["btWar"], "To begin fight");
addButon("btHelp", btShowHelp);
cStaticTipText.addText(this["btHelp"], "Show help screen");
if (Main.Profil.HelpShopShow){
closeHelp(null);
};
Main.Profil.HelpShopShow = true;
stol = new panelIcon();
var st:MovieClip = (this["btStol"] as MovieClip);
stol.create(st["cont"], st["btLeft"], st["btRight"], 8, 2, null, false);
stol.addAllPart();
stol.addAllWeap();
magStol = new panelIcon();
st = (this["shopStol"] as MovieClip);
magStol.create(st["cont"], st["btMagLeft"], st["btMagRight"], 4, 3, sellEl, false, true);
i = 0;
while (i < weapons.allWeapArr.length) {
if (i != weapons.Udar.weaponNum){
magStol.addIcon(weapons.getWeap(i));
};
i++;
};
i = 0;
while (i < (elementsOfBio.arrBio.length / 2)) {
b = new elementsOfBio();
b.createElement(elementsOfBio.arrBio[(i * 2)], elementsOfBio.arrBio[((i * 2) + 1)]);
b.count = 1;
magStol.addIcon(b);
i++;
};
money = (this["mcMoney"] as TextField);
money.text = ("$ " + String(Main.Profil.money));
magStol.showMagaz(Main.Profil.money);
}
public function byeFunc():void{
if (Main.Profil.chekMoney(curObj.cost, true)){
SoundConst._playSound(SoundConst.S_money);
stol.addObjFromUIN(curObj.UNItype);
Main.Profil.addPart(curObj);
money.text = ("$ " + String(Main.Profil.money));
magStol.showMagaz(Main.Profil.money);
};
}
protected function sellEl(e:myObj):void{
curObj = e;
SoundConst._buttonClick();
var t:String = ((("You wish to buy a \n" + e.name) + "\n $") + String(e.cost));
var w:cWindYesNo = new cWindYesNo(this, "Shop", t, byeFunc);
}
override public function destroy():void{
Main.Profil.save();
TText.destroy();
TText = null;
money = null;
stol.destroy();
magStol.destroy();
super.destroy();
}
}
}//package scr
Section 55
//scrMap (scr.scrMap)
package scr {
import flash.events.*;
import flash.display.*;
import objGame.*;
import war.*;
import flash.text.*;
public class scrMap extends stageScr {
protected var money:TextField;
protected var mcMapWind:MovieClip;
protected var ListShell:panelIcon;
protected var TText:cTipTextWindow;
protected var mcMapBG:MovieClip;
protected var ShellArr:Array;
protected var ListMission:panelIcon;
protected var Bionoid_1:Array;
protected var Bionoid_2:Array;
protected var Bionoid_3:Array;
protected var Bionoid_4:Array;
protected var Bionoid_5:Array;
public static var arrname:Array = ["Desert Trial", "7", "The Big Dump", "6", "Plateau", "18", "Junkyard", "4", "The Pyramid", "3", "Smooth Hills", "13", "Broken bridge", "1", "The Excavations", "16", "Dump Grotto", "5", "Hanging Hill", "8", "Soaring Iceberg", "9", "The Tomb", "17", "Treetop Hill", "2", "Frosty Bridge", "12", "Death Valleys", "14", "Ice Caverns", "11", "Celestial tree", "15", "Dump Cave", "19", "Ice Hummock", "10", "Metal Mess", "20"];
public static var bioLev:int;
public function scrMap(){
Bionoid_1 = ["0_0_0_2_2", "0_1_0_0_2", "0_1_0_0_2", "0_1_1_1_2", "1_0_1_5_2", "0_1_1_6_2", "1_2_1_3_2", "1_2_1_1_4", "0_2_1_3_2", "2_2_1_0_3", "1_1_4_7_4", "2_2_1_4_5", "2_2_1_7_6"];
Bionoid_2 = ["_________", "0_0_0_1_2", "1_0_1_1_2", "1_1_1_2_2", "0_1_1_0_2", "1_1_0_1_3", "1_1_1_4_5", "1_3_1_0_4", "1_1_1_3_2", "1_1_1_1_3", "1_1_4_6_2", "2_3_2_4_6", "2_2_1_7_6"];
Bionoid_3 = ["_________", "_________", "_________", "_________", "0_2_2_4_1", "1_0_1_1_2", "1_2_2_4_5", "2_2_2_4_2", "0_2_3_3_2", "2_2_1_2_4", "2_2_1_2_4", "2_2_1_5_2", "2_2_1_6_7"];
Bionoid_4 = ["_________", "_________", "_________", "_________", "_________", "_________", "1_1_0_3_1", "1_1_3_5_4", "1_3_1_3_2", "0_1_3_3_2", "_________", "2_3_1_2_3", "2_2_1_7_6"];
Bionoid_5 = ["_________", "_________", "_________", "_________", "_________", "_________", "_________", "_________", "2_2_3_3_2", "2_2_4_4_1", "_________", "2_2_1_0_3", "2_2_1_7_6"];
ShellArr = ["0_20", "0_20_3_1", "3_3_0_20", "0_20_3_5_6_2", "6_4_9_1_5_1", "6_5_5_1_9_2", "9_3_5_2_11_2", "9_4_5_2_6_6_4_5", "9_5_5_2_14_1", "9_3_3_5_5_2_14_2", "10_1_5_2_11_2", "10_1_5_3_14_1_9_4", "10_1_5_3_14_2_9_4"];
super();
}
override public function destroy():void{
Main.Profil.save();
TText.destroy();
TText = null;
ListMission.destroy();
ListMission = null;
mcMapBG = null;
mcMapWind = null;
ListShell.destroy();
ListShell = null;
super.destroy();
}
override public function init():void{
var i:int;
var m:MovieClip;
var bi:bioVanna;
TText = new cTipTextWindow(this);
addButon("btLab", btLabClic);
addButon("btShop", btShopClic);
addButon("btBack", btBackClic);
addButon("bt39", Main.btClic);
stageScr.enabeButon(this["btMap"], false);
addButon("btWar", btWarClic);
var mmm:MovieClip = (this["mcList"]["mcMapPic"]["cont"] as MovieClip);
mcMapBG = new bg();
mmm.addChild(mcMapBG);
mcMapWind = new pic1();
mmm.addChild(mcMapWind);
money = (this["mcMoney"] as TextField);
money.text = ("$ " + String(Main.Profil.money));
cStaticTipText.addText(this["btShop"], "Go to Shop");
cStaticTipText.addText(this["btBack"], "Return to start screen");
cStaticTipText.addText(this["btLab"], "Go to Laboratory");
cStaticTipText.addText(this["btWar"], "To begin fight");
ListMission = new panelIcon();
ListMission.create(this["mcList"]["cont"], this["mcList"]["btUp"], this["mcList"]["btDw"], 1, 8, selMap, true, false);
i = 0;
while (i < 5) {
m = this[("bio" + String((i + 1)))];
bi = new bioVanna(m, null);
if (i < Main.Profil.bionoidsArr.length){
bi.showBionoid(Main.Profil.bionoidsArr[i]);
};
i++;
};
var sm:int;
i = 0;
while (i < (arrname.length / 2)) {
ListMission.addString(arrname[(i * 2)], (i <= Main.Profil.openLevels), i, (i < Main.Profil.openLevels));
if (i <= Main.Profil.openLevels){
sm = i;
};
i++;
};
Main.curLevel = Math.min(sm, Main.curLevel);
selMap(Main.curLevel);
ListMission.select(Main.curLevel);
ListShell = new panelIcon();
ListShell.create(this["mcWeap"]["cont"], null, null, 6, 4, null, false, false);
ListShell.addAllWeap();
}
protected function btStartClic(e:Event):void{
Engine.PVMmode = true;
Main.setState(Main.ST_START);
}
protected function selMap(map:int):void{
var bp:paramUnit;
var w:weapons;
Main.curLevel = map;
var mapNum:int = int(arrname[((map * 2) + 1)]);
WarField.numLev = mapNum;
bioLev = int(Math.max(0, Math.min((Bionoid_1.length - 1), (((((Main.Profil.openLevels / 4) + (map / 3)) + 0.6) + Main.Profil.bionoidsArr.length) - 2))));
CPU.LevelAI = Math.max(1, (8 - bioLev));
mcMapWind.gotoAndStop(mapNum);
mcMapBG.gotoAndStop(mapNum);
trace("num-", Main.curLevel, " max", Main.Profil.openLevels, " nmap-", mapNum, " levBio-", bioLev, CPU.LevelAI);
Main.Profil2 = new profil();
Main.Profil2.createDefault();
Main.Profil2.bionoidsArr = [];
Main.Profil2.bionoidsArr.push(paramUnit.createBioInString(Bionoid_1[bioLev]));
if (Bionoid_2[bioLev] != "_________"){
bp = paramUnit.createBioInString(Bionoid_2[bioLev]);
Main.Profil2.bionoidsArr.push(bp);
};
if (Bionoid_3[bioLev] != "_________"){
bp = paramUnit.createBioInString(Bionoid_3[bioLev]);
Main.Profil2.bionoidsArr.push(bp);
};
if (Bionoid_4[bioLev] != "_________"){
bp = paramUnit.createBioInString(Bionoid_4[bioLev]);
Main.Profil2.bionoidsArr.push(bp);
};
if (Bionoid_5[bioLev] != "_________"){
bp = paramUnit.createBioInString(Bionoid_5[bioLev]);
Main.Profil2.bionoidsArr.push(bp);
};
var s:String = ShellArr[bioLev];
var a:Array = s.split("_");
var i:int;
while (i < (a.length / 2)) {
w = weapons.getWeap(a[(i * 2)]);
w.count = a[((i * 2) + 1)];
Main.Profil2.addPart(w);
i++;
};
}
}
}//package scr
Section 56
//scrMP (scr.scrMP)
package scr {
import flash.events.*;
import flash.display.*;
import objGame.*;
import war.*;
public class scrMP extends stageScr {
protected var ListMoney:panelIcon;
protected var mcMapBG:MovieClip;
protected var ListMission:panelIcon;
protected var mcMapWind:MovieClip;
protected var arrBio_1:Array;
protected var arrBio_2:Array;
public static const moneyArr:Array = [100, 500, 1000, 2000, 5000];
public static var mapNum:int = 1;
protected static var moneySelected:int = 0;
public function scrMP(){
super();
}
protected function selMoney(s:int):void{
initNewMPGame();
Main.Profil.money = moneyArr[s];
Main.Profil2.money = moneyArr[s];
showAll();
}
protected function selMap(map:int):void{
Main.curLevel = map;
var mapNum:int = int(scrMap.arrname[((map * 2) + 1)]);
WarField.numLev = mapNum;
mcMapWind.gotoAndStop(mapNum);
mcMapBG.gotoAndStop(mapNum);
}
protected function btShop1Clic(e:Event):void{
scrMPShop.curProfill = Main.Profil;
Main.setState(Main.ST_MPShop);
}
protected function btShop2Clic(e:Event):void{
scrMPShop.curProfill = Main.Profil2;
Main.setState(Main.ST_MPShop);
}
override public function init():void{
var i:int;
var m:MovieClip;
var bi:bioVanna;
addButon("bt39", Main.btClic);
addButon("btBack", btBackClic);
addButon("btShop1", btShop1Clic);
addButon("btShop2", btShop2Clic);
stageScr.enabeButon(this["btMap"], false);
addButon("btWar", btWarMPClic);
var mmm:MovieClip = (this["mapList"]["mcMapPic"]["cont"] as MovieClip);
mcMapBG = new bg();
mmm.addChild(mcMapBG);
mcMapWind = new pic1();
mmm.addChild(mcMapWind);
ListMission = new panelIcon();
ListMission.create(this["mapList"]["cont"], this["mapList"]["btUp"], this["mapList"]["btDw"], 1, 8, selMap, true, false);
i = 0;
while (i < (scrMap.arrname.length / 2)) {
ListMission.addString(scrMap.arrname[(i * 2)], true, i, false);
i++;
};
selMap(Main.curLevel);
ListMission.select(Main.curLevel);
ListMoney = new panelIcon();
ListMoney.create(this["moneyList"]["cont"], null, null, 1, 6, selMoney, true, false);
i = 0;
while (i < moneyArr.length) {
ListMoney.addString(("$ " + String(moneyArr[i])), true, i);
i++;
};
arrBio_1 = [];
arrBio_2 = [];
i = 0;
while (i < 5) {
m = this[("mcChar" + String((i + 1)))];
bi = new bioVanna(m, null);
arrBio_1.push(bi);
m = this[("mc2Char" + String((i + 1)))];
bi = new bioVanna(m, null);
arrBio_2.push(bi);
i++;
};
showAll();
}
public function showAll():void{
this["mcMoney1"].text = ("$" + String(Main.Profil.money));
this["mcMoney2"].text = ("$" + String(Main.Profil2.money));
var i:int;
while (i < 5) {
if (i < Main.Profil.bionoidsArr.length){
arrBio_1[i].showBionoid(Main.Profil.bionoidsArr[i]);
} else {
arrBio_1[i].enable = false;
};
if (i < Main.Profil2.bionoidsArr.length){
arrBio_2[i].showBionoid(Main.Profil2.bionoidsArr[i]);
} else {
arrBio_2[i].enable = false;
};
i++;
};
}
protected function btWarMPClic(e:Event):void{
Engine.PVMmode = false;
Main.setState(Main.ST_WAR);
}
public static function initNewMPGame():void{
Main.Profil = new profil();
Main.Profil2 = new profil();
Main.Profil.HelpWarShow = true;
Main.Profil.createDefault();
Main.Profil2.createDefault();
Main.Profil.money = 1000;
Main.Profil2.money = 1000;
}
}
}//package scr
Section 57
//scrMPShop (scr.scrMPShop)
package scr {
import flash.events.*;
import flash.display.*;
import objGame.*;
import war.*;
import flash.text.*;
public class scrMPShop extends allScrLab {
protected var byeBt:SimpleButton;
protected var BioVannU:bioVanna;
protected var magStol:panelIcon;
protected var curObj:myObj;
public static var curProfill:profil;
public function scrMPShop(){
super();
}
override public function reselectAllbiovann():void{
BioVannU.setSelection();
}
public function byeBioVann(e:Event):void{
var w:cWindYesNo = new cWindYesNo(this, "Add Bionoid", "you bye new bionoids \n 1000$", yesBye);
}
protected function btShop1Clic(e:Event):void{
SoundConst._buttonClick();
scrMPShop.curProfill = Main.Profil;
showProfill();
}
protected function btMapMP(e:Event):void{
SoundConst._buttonClick();
Main.setState(Main.ST_MP);
}
override public function init():void{
var i:int;
var b:elementsOfBio;
addButon("btMap", btMapMP);
addButon("btBack", btBackClic);
addButon("btShop1", btShop1Clic);
addButon("btShop2", btShop2Clic);
addButon("bt39", Main.btClic);
TText = new cTipTextWindow(this);
addButon("btWar", btWarMPClic);
stol = new panelIcon();
var st:MovieClip = (this["stolMC"] as MovieClip);
stol.create(st["cont"], st["btLeft"], st["btRight"], 8, 2, fun, false, false);
magStol = new panelIcon();
st = (this["shopStil"] as MovieClip);
magStol.create(st["cont"], st["btMagLeft"], st["btMagRight"], 4, 3, sellEl, false, true);
i = 0;
while (i < weapons.allWeapArr.length) {
if (i != weapons.Udar.weaponNum){
magStol.addIcon(weapons.getWeap(i));
};
i++;
};
i = 0;
while (i < (elementsOfBio.arrBio.length / 2)) {
b = new elementsOfBio();
b.createElement(elementsOfBio.arrBio[(i * 2)], elementsOfBio.arrBio[((i * 2) + 1)]);
b.count = 1;
magStol.addIcon(b);
i++;
};
money = (this["mcMoney"] as TextField);
bioVan1 = new bioVanna(this["mcChar1"], this, 1);
bioVan2 = new bioVanna(this["mcChar2"], this, 2);
bioVan3 = new bioVanna(this["mcChar3"], this, 3);
bioVan4 = new bioVanna(this["mcChar4"], this, 4);
bioVan5 = new bioVanna(this["mcChar5"], this, 5);
BioVannU = new bioVanna(this["bioV1"], this, 1);
BioVannU.createButtons();
bioVan1.createHitBt(BioVannU);
bioVan2.createHitBt(BioVannU);
bioVan3.createHitBt(BioVannU);
bioVan4.createHitBt(BioVannU);
bioVan5.createHitBt(BioVannU);
byeBt = (this["btByeBioV"] as SimpleButton);
addButon("btByeBioV", byeBioVann);
cStaticTipText.addText(this["btByeBioV"], "Purchase an additional bionoid");
showProfill();
}
public function byeFunc():void{
if (curProfill.chekMoney(curObj.cost, true)){
SoundConst._playSound(SoundConst.S_money);
stol.addObjFromUIN(curObj.UNItype);
Main.Profil.addPart(curObj);
money.text = ("$ " + String(curProfill.money));
magStol.showMagaz(curProfill.money);
};
}
protected function btShop2Clic(e:Event):void{
SoundConst._buttonClick();
scrMPShop.curProfill = Main.Profil2;
showProfill();
}
public function yesBye():void{
var bio:paramUnit;
var a:Array;
if (curProfill.chekMoney(1000, true)){
SoundConst._playSound(SoundConst.S_money);
bio = paramUnit.initDefault();
curProfill.bionoidsArr.push(bio);
if (curProfill.bionoidsArr.length >= 5){
byeBt.visible = false;
};
a = [bioVan1, bioVan2, bioVan3, bioVan4, bioVan5];
a[(curProfill.bionoidsArr.length - 1)].showBionoid(curProfill.bionoidsArr[(Main.Profil.bionoidsArr.length - 1)]);
};
money.text = ("$ " + String(curProfill.money));
}
override public function returnToList(b:elementsOfBio):void{
curProfill.addPart(b);
curProfill.delPart(curElement);
super.returnToList(b);
}
protected function sellEl(e:myObj):void{
curObj = e;
SoundConst._buttonClick();
var t:String = ((("You wish to buy the \n" + e.name) + "\n money $") + String(e.cost));
var w:cWindYesNo = new cWindYesNo(this, "Shop", t, byeFunc);
}
public function showProfill():void{
var i:int;
money.text = ("$ " + String(curProfill.money));
magStol.showMagaz(curProfill.money);
stol.clear();
stol.addFromArray(curProfill.partArr);
stol.addFromArray(curProfill.shellArr);
var a:Array = [bioVan1, bioVan2, bioVan3, bioVan4, bioVan5];
i = 0;
while (i < a.length) {
if (i < curProfill.bionoidsArr.length){
a[i].showBionoid(curProfill.bionoidsArr[i]);
} else {
a[i].enable = false;
};
i++;
};
BioVannU.init(bioVan1.curBionoid);
if (curProfill.bionoidsArr.length >= 5){
byeBt.visible = false;
};
stageScr.enabeButon(this["btShop1"], true);
stageScr.enabeButon(this["btShop2"], true);
if (curProfill == Main.Profil){
stageScr.enabeButon(this["btShop1"], false);
} else {
stageScr.enabeButon(this["btShop2"], false);
};
}
protected function btWarMPClic(e:Event):void{
SoundConst._buttonClick();
Engine.PVMmode = false;
Main.setState(Main.ST_WAR);
}
override public function destroy():void{
magStol.destroy();
super.destroy();
}
protected function fun(ob:myObj):void{
if (ob.UNItype < 2000){
SoundConst._buttonClick();
curElement = (ob as elementsOfBio);
} else {
curElement = null;
stol.unselectAll();
};
reselectAllbiovann();
}
}
}//package scr
Section 58
//scrRez (scr.scrRez)
package scr {
import flash.events.*;
import flash.display.*;
import objGame.*;
import war.*;
import flash.text.*;
public class scrRez extends stageScr {
protected var rezTXTWind:MovieClip;
protected var TText:cTipTextWindow;
public var textRez:Array;
protected var stol:panelIcon;
public static var rezWar:Boolean;
public static var elements:Array = [];
public static var oldMoney:int;
public function scrRez(){
textRez = ["Good job, \n applicant,you have passed the test. You can play this game later and improve your score. You have yet another contender to battle; he is waiting for you on the planet Ironcania. You should purchase some weapons from the store, you will need it.", "Great! \nVictory is yours! Now you have a fight on the Duphusavi plateau ahead of you. Win it and you’ll become a cadet! Remember: this time you will face stronger bionoids, so we recommend attending the lab where you can upgrade your unit as well.", "Congrats on the achievement, Cadet! Welcome to our organization! By the way, do you remember your rival from the planet Ironcania? He, as well, reached the rank of cadet. Looks like, you will have to meet him one more time. He, definitely acquired new weapons and upgraded his unit, so, we recommend you do the same!", "Congratulations!\n You have been showing consistently good results, so, you are being promoted to Private! Your new battle will take place at the Duphusavi pyramids. But don’t let your guard down; this unit is stronger than the previous one.", "Good, job, Private! \nCongrats on the new rank! It will be more difficult to earn the next rank. New contender is waiting for you on the planet Greenhill, we are not going to reveal the level of his skills, but he is definitely no weaker than the ones you have already met.", "Not bad!\n Now you will have to go to the planet Winterland, where your next rival is waiting for you. He is trying to become lieutenant as well, but only one of you will be able to participate in the test.", "Great! \nNow you will have to pass the test for the rank of lieutenant on the planet Duphusavi. By the way, the local archeologists dug up some interesting things at the old firing range, those things became the weapons for their local contender’s unit.", "Your rival from\n the Ironcania planet is stepping on your toes. He upgraded his unit with the newest weapons. Make sure you work hard in the lab as well, before you face this contender while trying to earn the commander’s rank", "Your rival\n wasn’t lucky! And you passed the first out of 4 steps needed for the commander’s rank. Now, go to the Greenhill, the contender known to you already, is ready for the fight! ", "Great, \nyou passed the 2nd step of the test. Battle your rival on the Winterland planet and come back to Duphusavi for the final test for the rank of the commander.", "Lieutenant, \nyou have 1 step left, before you become a commander! New unit of bionoids is waiting for you in the burial chamber on Duphusavi. We recommend you to prepare well for this fight!", "Good job, commander! \nCongratulations on the promotion! But if you want to become a master, you will have to work even harder! Greenhill is calling!", "Awesome! \nYour unit has become very strong! But…hardly the strongest. The commander from the Winterland is in charge of a very powerful unit as well. Show him who the best is!", "Your rival from\n the planet Greenhill is rapidly upgrading his bionoids. Let’s see who is going to win the battle.", "Your opponent \nfrom the Winterland isn’t giving up! He is sure; he can win over your unit of bionoids. Rumor says he has got new weapons or equipment…let’s see if it's true.", "The commander \nfrom the Greenhill got the last chance to show that his unit is stronger. Looks like he has prepared something special….", "The contender \nfrom the Greenhill planet officially leaves the contest. But your old opponent from the Ironcania planet is waiting for a battle with you. He managed to catch up with you and became a commander as well. His unit is strong, so we suggest your upgrade of your weapons and try your hardest!", "The next fight \nis crucially important. The contestant from the Winterland is bidding his rank! If you win, he will give up his rank and leave the contest for good!", "ALL right, \nwe have only two contestants left- you and the representative from the Ironcania. This is the final fight! Be ready for everything! Spend some money, purchase the best weapons! The winner will be pronounced the Master of the game!", "Congratulations, \nyou are the Master of war! Your victorious bionoids will become a part of our army!"];
super();
}
override public function init():void{
var i:int;
TText = new cTipTextWindow(this);
addButon("btBack", btBackClic);
addButon("bt39", Main.btClic);
addButon("btPMG", Main.btClic);
cStaticTipText.addText(this["btBack"], "Return to start screen");
cStaticTipText.addText(this["btMap"], "Return to Map select");
var money:TextField = (this["mcMoney"] as TextField);
money.text = ("$ " + String(Main.Profil.money));
var sZag:String = "";
var sText:String = "";
rezTXTWind = (this["rezTxt"] as MovieClip);
var st:MovieClip = (this["btStol"] as MovieClip);
stol = new panelIcon();
stol.create(st["cont"], st["btLeft"], st["btRight"], 8, 2, null, false);
st.visible = false;
rezTXTWind.visible = false;
if (Engine.PVMmode){
addButon("btMap", btMapClic);
if (rezWar){
sZag = "You WIN!!!";
Main.Profil.money = (Main.Profil.money + (50 + (10 * Main.curLevel)));
sText = (("Proffit $" + String((Main.Profil.money - oldMoney))) + "\n");
sText = (sText + (("Killed enemies " + String(Main.Profil2.bionoidsArr.length)) + "\n"));
stol.addFromArray(elements);
i = 0;
while (i < elements.length) {
Main.Profil.addPart(elements[i]);
i++;
};
if (elements.length > 0){
st.visible = true;
};
trace("rezzzzza ", Main.curLevel, Main.Profil.openLevels);
if (Main.curLevel == Main.Profil.openLevels){
Main.Profil.openLevels++;
Main.curLevel++;
rezTXTWind.visible = true;
rezTXTWind.txt.text = textRez[(Main.curLevel - 1)];
if (Main.Profil.openLevels < 20){
sText = (sText + "Open new level");
} else {
sText = (sText + "================================= \nAll levels are completed");
};
};
Main.Profil.save();
} else {
sZag = "You lose!";
sText = (("Proffit $" + String((Main.Profil.money - oldMoney))) + "\n");
};
} else {
addButon("btMap", btBackClic);
money.visible = false;
st.visible = false;
if (rezWar){
sZag = "SQUAD 1 WIN!!!";
} else {
sZag = "SQUAD 2 WIN!!!";
};
};
this["zag"]["txt"].text = sZag;
this["pole"]["txt"].text = sText;
}
override public function destroy():void{
stol.destroy();
stol = null;
TText.destroy();
TText = null;
super.destroy();
}
public function ttt(e:Event):void{
Main.curLevel++;
Main.curLevel = (Main.curLevel % 20);
rezTXTWind.visible = true;
rezTXTWind.txt.text = textRez[Main.curLevel];
}
}
}//package scr
Section 59
//scrStart (scr.scrStart)
package scr {
import flash.events.*;
import flash.display.*;
import flash.net.*;
public class scrStart extends stageScr {
protected var mcAnim:MovieClip;
public function scrStart(){
super();
}
override public function init():void{
stage.frameRate = 30;
addButon("bt39", Main.btClic);
addButon("HitBt", Main.btClic);
addButon("PMGbt", Main.btClic);
(this["HitBt"] as SimpleButton).visible = false;
mcAnim = this["mcWindAnim"];
var mcW:MovieClip = mcAnim["mcWind"];
addButon("btNewGame", btStartClic);
cStaticTipText.addText(this["btNewGame"], "Start new game");
var d:SharedObject = SharedObject.getLocal(Main.gameName);
if (d.data["openLevels"] != null){
addButon("btCont", btContClic);
cStaticTipText.addText(this["btCont"], "Continue old game");
} else {
stageScr.enabeButon(this["btCont"], false);
};
addButon("btHTP", btHTPClic);
cStaticTipText.addText(this["btHTP"], "go to How to Play Screen");
addButon("btMP", btMPClic);
cStaticTipText.addText(this["btMP"], "MultyPlay game for 2 players");
addButon("y", btYesClic, mcW["btYes"]);
addButon("n", btNoClic, mcW["btNo"]);
}
protected function btStartClic(e:Event):void{
mcAnim.gotoAndPlay(2);
}
protected function btHTPClic(e:Event):void{
Main.setState(Main.ST_HTP);
}
protected function btContClic(e:Event):void{
Main.Profil.createDefault();
Main.Profil.load();
if (Main.curLevel > Main.Profil.openLevels){
Main.curLevel = Main.Profil.openLevels;
};
Main.setState(Main.ST_MAP);
}
protected function btYesClic(e:Event):void{
mcAnim.play();
Main.Profil.createDefault();
Main.Profil.save();
Main.curLevel = 0;
Main.setState(Main.ST_Intro);
}
protected function btNoClic(e:Event):void{
mcAnim.play();
}
protected function btMPClic(e:Event):void{
scrMP.initNewMPGame();
Main.setState(Main.ST_MP);
}
}
}//package scr
Section 60
//scrWar (scr.scrWar)
package scr {
import flash.display.*;
import war.*;
public class scrWar extends MovieClip {
protected var eng:Engine;
public function scrWar(){
super();
Main.curState = this;
init();
}
public function init():void{
eng = new Engine();
trace("War 1 ", Main.curLevel);
eng.init(this);
}
public function destroy():void{
eng.destroy();
Main.curState = null;
}
}
}//package scr
Section 61
//stageScr (scr.stageScr)
package scr {
import flash.events.*;
import flash.display.*;
import war.*;
import flash.filters.*;
public class stageScr extends MovieClip {
protected var btnArr:Array;
protected var helpScreen:MovieClip;
protected var funcArr:Array;
public function stageScr(){
super();
btnArr = [];
funcArr = [];
Main.curState = this;
helpScreen = this["mcHelp"];
if (helpScreen != null){
addButon("", closeHelp, helpScreen["btExitHelp"]);
addButon("", closeHelp, helpScreen["hitAll"]);
};
cStaticTipText.addText(Main.instMC["btSound"]["hit"], "On/Off Sound");
init();
SoundConst._playBGMusic();
}
protected function btWarClic(e:Event):void{
SoundConst._buttonClick();
Engine.PVMmode = true;
Main.setState(Main.ST_WAR);
}
public function destroy():void{
var s:SimpleButton;
cStaticTipText.clear();
var i:int;
while (i < btnArr.length) {
s = (btnArr[i] as SimpleButton);
s.removeEventListener(MouseEvent.CLICK, funcArr[i]);
btnArr[i] = null;
funcArr[i] = null;
i++;
};
btnArr = null;
funcArr = null;
helpScreen = null;
Main.curState = null;
}
protected function btShopClic(e:Event):void{
SoundConst._buttonClick();
Main.setState(Main.ST_SHOP);
}
public function init():void{
}
protected function btMapClic(e:Event):void{
SoundConst._buttonClick();
Main.setState(Main.ST_MAP);
}
protected function btShowHelp(e:Event):void{
if (helpScreen != null){
SoundConst._buttonClick();
helpScreen.visible = true;
};
}
protected function closeHelp(e:Event):void{
if (helpScreen != null){
SoundConst._buttonClick();
helpScreen.visible = false;
};
}
protected function btBackClic(e:Event):void{
SoundConst._buttonClick();
Main.setState(Main.ST_START);
}
protected function btLabClic(e:Event):void{
SoundConst._buttonClick();
Main.setState(Main.ST_LAB);
}
protected function addButon(name:String, func:Function, ss:SimpleButton=null):void{
var s:SimpleButton = (this.getChildByName(name) as SimpleButton);
if (ss != null){
s = ss;
};
if (s == null){
trace("btn not found", name);
return;
};
s.addEventListener(MouseEvent.CLICK, func);
funcArr.push(func);
btnArr.push(s);
}
public static function enabeButon(s:SimpleButton, b:Boolean):void{
var e:Array = [1, 0, 0, 0, -100, 0, 1, 0, 0, -100, 0, 0, 1, 0, -100, 0, 0, 0, 1, 0];
if (b){
s.filters = [];
s.enabled = true;
} else {
setColorMC((s as DisplayObject), e);
s.enabled = false;
};
}
public static function setColorMC(mc:Object, matrix:Array):void{
var filter:ColorMatrixFilter = new ColorMatrixFilter(matrix);
var filters:Array = new Array();
filters.push(filter);
(mc as DisplayObject).filters = filters;
}
}
}//package scr
Section 62
//wav (setPart.wav)
package setPart {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package setPart
Section 63
//wav (shot.wav)
package shot {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package shot
Section 64
//SoundManager (sound.SoundManager)
package sound {
import flash.events.*;
import flash.media.*;
import flash.utils.*;
import flash.system.*;
public class SoundManager {
protected var m_sBackSoundID:String;
protected var m_soundOn:Boolean;
protected var m_schBackSound:SoundChannel;
protected var m_dictSounds:Dictionary;
protected var m_dictChannels:Dictionary;
public function SoundManager(){
super();
this.m_dictSounds = new Dictionary();
this.m_dictChannels = new Dictionary();
this.soundOn = true;
this.m_sBackSoundID = null;
}
protected function onSoundComplete(event:Event):void{
delete this.m_dictChannels[(event.target as SoundChannel)];
}
public function stopBackSound():void{
if (this.m_schBackSound != null){
this.m_schBackSound.stop();
this.m_schBackSound = null;
};
}
public function setTransform(sID:String, soundTransform:SoundTransform):void{
(this.m_dictSounds[sID] as SoundObject).m_transform = soundTransform;
}
public function stopSound(sID:SoundChannel):void{
this.m_dictChannels[sID].stop();
}
public function get soundOn():Boolean{
return (this.m_soundOn);
}
public function removeSound(sID:String):void{
delete this.m_dictSounds[sID];
}
public function setVolume(sID:String, nVolume:Number):void{
(this.m_dictSounds[sID] as SoundObject).m_transform.volume = nVolume;
}
public function addSound(sClassName:String, sID:String=null):void{
if (sID == null){
sID = sClassName;
};
var classSound:Class = (ApplicationDomain.currentDomain.getDefinition(sClassName) as Class);
var sndObj:SoundObject = new SoundObject(new (classSound));
if (sndObj.m_sound == null){
trace("==========Not Sound======================", sClassName);
};
this.m_dictSounds[sID] = sndObj;
}
public function playBackSound(sID:String):SoundChannel{
if (((!((this.m_schBackSound == null))) && (!((this.m_sBackSoundID == sID))))){
this.m_schBackSound.stop();
this.m_schBackSound = null;
};
if (this.m_schBackSound == null){
this.m_schBackSound = this.playSound(sID, 0, (int.MAX_VALUE - 100));
};
this.m_sBackSoundID = sID;
return (this.m_schBackSound);
}
public function playSound(sID:String, nStartTime:Number=0, iLoops:int=0):SoundChannel{
var sou:SoundObject;
var sndChannel:SoundChannel;
var sID = sID;
var nStartTime = nStartTime;
var iLoops = iLoops;
if (this.soundOn){
sou = (this.m_dictSounds[sID] as SoundObject);
sndChannel = sou.play(nStartTime, iLoops);
this.m_dictChannels[sndChannel] = sndChannel;
sndChannel.addEventListener(Event.SOUND_COMPLETE, this.onSoundComplete, false, 0, true);
return (sndChannel);
//unresolved jump
var _slot1 = e;
trace("SoundManager::playSound exception", _slot1.getStackTrace());
return (null);
};
return (null);
}
public function set soundOn(bValue:Boolean):void{
var channel:SoundChannel;
this.m_soundOn = bValue;
if (!this.m_soundOn){
for each (channel in this.m_dictChannels) {
channel.stop();
};
} else {
this.m_dictChannels = new Dictionary();
if (this.m_sBackSoundID != null){
this.playBackSound(this.m_sBackSoundID);
};
};
}
}
}//package sound
Section 65
//SoundObject (sound.SoundObject)
package sound {
import flash.media.*;
class SoundObject {
public var m_transform:SoundTransform;
public var m_sound:Sound;
function SoundObject(sound:Sound){
super();
this.m_sound = sound;
this.m_transform = new SoundTransform();
}
public function play(nStartTime:Number=0, iLoops:int=0):SoundChannel{
return (this.m_sound.play(nStartTime, iLoops, this.m_transform));
}
}
}//package sound
Section 66
//wav (startGame.wav)
package startGame {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package startGame
Section 67
//wav (timeBomb.wav)
package timeBomb {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package timeBomb
Section 68
//wav (track.wav)
package track {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package track
Section 69
//balistic (war.balistic)
package war {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
public class balistic {
public var type:int;
public var koofRicoshet:Number;
public var power:int;
public var soundName:String;
public var inRotable:Boolean;
public var boomClass:Class;
public var powerBoom:int;
protected var resultFunct:Function;
protected var endP:Point;
public var mc:MovieClip;
public var radiusBoom:int;
protected var scaleBoomXY:Number;
public var inGravi:Boolean;
protected var startP:Point;
protected var speedX:Number;
protected var speedY:Number;
public var inWinded:Boolean;
public var inCurs:Boolean;
public function balistic(){
super();
}
public function boom():void{
var b:MovieClip;
if (mc != null){
Engine.inst.addDamag(mc.x, mc.y, radiusBoom, powerBoom);
Engine.inst.Level.addCircl_mask(mc.x, mc.y, radiusBoom);
b = new boomClass();
Engine.inst.Level.sky.addChild(b);
b.x = mc.x;
b.y = mc.y;
b.scaleX = scaleBoomXY;
b.scaleY = scaleBoomXY;
if (soundName != ""){
SoundConst._playSound(soundName);
};
b = null;
};
destroy();
}
public function destroy():void{
Engine.inst.removeEventListener("up", update);
if (mc != null){
Engine.inst.Level.sky.removeChild(mc);
};
mc = null;
resultFunct = null;
Engine.inst.listMoovedObject[Engine.inst.listMoovedObject.indexOf(this)] = null;
}
public function init(c:Class, pb:int, rb:int, result:Function=null):void{
scaleBoomXY = 1;
soundName = SoundConst.S_boom;
boomClass = boomMicro;
koofRicoshet = 0.5;
mc = (new (c) as MovieClip);
mc.cacheAsBitmap = true;
inGravi = true;
inWinded = true;
inRotable = true;
inCurs = false;
Engine.inst.Level.sky.addChild(mc);
radiusBoom = rb;
powerBoom = pb;
resultFunct = boom;
Engine.inst.listMoovedObject.push(this);
if (result != null){
resultFunct = result;
} else {
resultFunct = boom;
};
}
public function update(e:Event):void{
speedX = (inWinded) ? (speedX + Engine.windSpeed) : speedX;
speedY = (inGravi) ? (speedY + Engine.gravi) : speedY;
if (inCurs){
mc.rotation = ((180 * (Math.atan2(speedY, speedX) + (Math.PI / 2))) / Math.PI);
} else {
mc.rotation = (inRotable) ? (mc.rotation + 8) : mc.rotation;
};
endP = new Point((mc.x + speedX), (mc.y + speedY));
startP = Engine.findLineTrack(startP, endP, 2, true);
mc.x = startP.x;
mc.y = startP.y;
if ((((((mc.y > 600)) || ((mc.x < -200)))) || ((mc.x > 1000)))){
Engine.inst.endWeaponTime(1);
destroy();
return;
};
if (startP != endP){
resultFunct();
};
}
public function ricoshet():void{
var ricVect:Point = Engine.inst.Level.getRicoshetVector(startP);
var v:Number = (Math.sqrt(((speedX * speedX) + (speedY * speedY))) * koofRicoshet);
speedX = (ricVect.x * v);
speedY = (ricVect.y * v);
}
public function startFromUnit(u:unit):void{
initStart(u.FirePoint.x, u.FirePoint.y, Math.cos(u.aimFromWorld()), Math.sin(u.aimFromWorld()), u.Power);
}
public function initStart(x:Number, y:Number, dx:Number, dy:Number, p:int):void{
power = p;
mc.x = x;
mc.y = y;
startP = new Point(mc.x, mc.y);
speedX = dx;
speedY = dy;
Engine.inst.addEventListener("up", update);
scaleBoomXY = 1;
}
}
}//package war
Section 70
//bullet (war.bullet)
package war {
import objGame.*;
public class bullet extends balistic {
public function bullet(){
super();
}
override public function startFromUnit(u:unit):void{
Engine.inst.listMoovedObject.push(this);
init(mcBullet, weapons.BigGun.powerWeap, weapons.BigGun.radiusWeap);
SoundConst._playSound(SoundConst.S_BGshot);
inGravi = false;
inWinded = false;
inCurs = true;
inRotable = false;
super.initStart(u.FirePoint.x, u.FirePoint.y, (Math.cos(u.aimFromWorld()) * 70), (Math.sin(u.aimFromWorld()) * 70), 100);
boomClass = boomMicro;
}
override public function initStart(x:Number, y:Number, dx:Number, dy:Number, p:int):void{
init(mcBullet, weapons.MashinGun.powerWeap, weapons.MashinGun.radiusWeap);
boomClass = boomBullet;
soundName = "";
inGravi = false;
inCurs = true;
inWinded = false;
inRotable = false;
super.initStart(x, y, (dx * 50), (dy * 50), p);
}
public function initPlasma(x:Number, y:Number, dx:Number, dy:Number, p:int):void{
init(mcPlasmaBulet, weapons.PlasmaGun.powerWeap, weapons.PlasmaGun.radiusWeap);
boomClass = boomPlasma;
soundName = "";
inGravi = false;
inWinded = false;
inCurs = true;
inRotable = false;
super.initStart(x, y, (dx * 30), (dy * 30), p);
}
override public function boom():void{
Engine.inst.endWeaponTime(7);
super.boom();
}
}
}//package war
Section 71
//cAbomb (war.cAbomb)
package war {
import objGame.*;
public class cAbomb extends balistic {
public static const xspeed:int = 5;
public function cAbomb(){
super();
}
override public function startFromUnit(u:unit):void{
init(mcAbomb, weapons.ABomb.powerWeap, weapons.ABomb.radiusWeap);
soundName = SoundConst.S_abomb_boom;
boomClass = boomAtom;
inGravi = true;
inCurs = true;
inWinded = true;
inRotable = false;
initStart(u.xPoint, -50, xspeed, 0, 0);
SoundConst._playSound(SoundConst.S_abomb_fly);
}
override public function boom():void{
Engine.inst.endWeaponTime(10);
super.boom();
}
}
}//package war
Section 72
//cASMissel (war.cASMissel)
package war {
public class cASMissel extends balistic {
public static const ASspeedX:Number = 4;
public function cASMissel(){
super();
}
override public function startFromUnit(u:unit):void{
var w:cMissel;
SoundConst._playSound(SoundConst.s_ASFly);
var i:int = (u.xPoint - 100);
while (i <= (u.xPoint + 100)) {
w = new cMissel();
w.initASStart(i, -50, ASspeedX, 0, 1);
i = (i + 50);
};
}
}
}//package war
Section 73
//cBalisticInd (war.cBalisticInd)
package war {
import flash.events.*;
import flash.display.*;
public class cBalisticInd {
protected const contInd:int = 45;
protected var arrAllPoint:Array;
protected var curUnit:unit;
public function cBalisticInd(){
super();
}
public function destroy():void{
Engine.inst.removeEventListener("up", update);
curUnit = null;
var i:int;
while (i < contInd) {
Engine.inst.Level.sky.removeChild(arrAllPoint[i]);
i++;
};
}
public function hide():void{
curUnit = null;
var i:int;
while (i < contInd) {
arrAllPoint[i].visible = false;
i++;
};
}
public function update(e:Event):void{
var x:Number;
var y:Number;
var speedX:Number;
var speedY:Number;
var wn:int;
var g:Number;
var w:Number;
var i:int;
if (Engine.inst.state != Engine.st_HOD){
return;
};
if (curUnit != null){
x = curUnit.FirePoint.x;
y = curUnit.FirePoint.y;
speedX = ((Math.cos(curUnit.aimFromWorld()) * curUnit.Power) / 3);
speedY = ((Math.sin(curUnit.aimFromWorld()) * curUnit.Power) / 3);
wn = curUnit.group.curWeap.weaponNum;
g = Engine.gravi;
w = Engine.windSpeed;
if ((((((((((wn == 4)) || ((wn == 5)))) || ((wn == 8)))) || ((wn == 12)))) || ((wn == 13)))){
x = 0;
y = 0;
w = 0;
speedX = 0;
speedY = 0;
g = 0;
};
if ((((((((((((((wn == 1)) || ((wn == 2)))) || ((wn == 3)))) || ((wn == 7)))) || ((wn == 9)))) || ((wn == 11)))) || ((wn == 14)))){
w = 0;
};
if ((((((((wn == 3)) || ((wn == 7)))) || ((wn == 9)))) || ((wn == 14)))){
g = 0;
};
if ((((wn == 6)) || ((wn == 10)))){
y = -50;
x = curUnit.xPoint;
speedY = 0;
if (wn == 6){
speedX = cASMissel.ASspeedX;
} else {
speedX = cAbomb.xspeed;
};
};
i = 0;
while (i < contInd) {
speedX = (speedX + w);
speedY = (speedY + g);
x = (x + speedX);
y = (y + speedY);
arrAllPoint[i].x = x;
arrAllPoint[i].y = y;
i++;
};
};
}
public function showBio(b:unit):void{
curUnit = b;
var i:int;
while (i < contInd) {
arrAllPoint[i].visible = true;
i++;
};
update(null);
}
public function init():void{
var mc:MovieClip;
arrAllPoint = [];
var i:int;
while (i < contInd) {
mc = new balisticPoint();
arrAllPoint.push(mc);
Engine.inst.Level.sky.addChild(mc);
i++;
};
Engine.inst.addEventListener("up", update);
}
}
}//package war
Section 74
//cBox (war.cBox)
package war {
import flash.events.*;
import flash.display.*;
import objGame.*;
import flash.geom.*;
public class cBox {
protected var timer:int;
protected var money:Boolean;
protected var curPoint:Point;
protected var med:Boolean;
protected var mc:MovieClip;
protected var curWeap:myObj;
public function cBox(){
var rr:int;
var p:Point;
var m:MovieClip;
super();
med = (Math.random() > 0.5);
Engine.inst.listMoovedObject.push(this);
Engine.inst.addEventListener("up", update);
money = false;
if (med){
mc = new medpac();
} else {
mc = new boxSecret();
if ((((Math.random() > 0.7)) && (Engine.PVMmode))){
trace("add box money");
money = true;
} else {
if ((((Math.random() > 0.7)) && (Engine.PVMmode))){
curWeap = elementsOfBio.getRandomElemets();
} else {
rr = int((Math.random() * weapons.addMissionWeapArr.length));
if (Engine.PVMmode){
rr = int((Math.min(weapons.addMissionWeapArr.length, Main.curLevel) + (15 * Math.random())));
};
curWeap = weapons.addMissionWeapArr[rr].copy();
};
};
};
mc.addEventListener(MouseEvent.MOUSE_OVER, owerMouse);
Engine.inst.Level.sky.addChild(mc);
var xt:int = int((((Math.random() * 350) + (Math.random() * 350)) + 50));
if (Engine.inst.Level.findFreePoint(new Point(xt, 0)).y < 10){
p = Engine.inst.Level.findFreePoint(new Point(xt, 300));
mc.x = p.x;
mc.y = (p.y - 20);
m = new teleportMC();
Engine.inst.Level.sky.addChild(m);
m.x = p.x;
m.y = p.y;
} else {
mc.x = xt;
mc.y = -50;
};
timer = 0;
curPoint = new Point(mc.x, mc.y);
}
public function destroy():void{
curWeap = null;
curPoint = null;
Engine.inst.removeEventListener("up", update);
mc.removeEventListener(MouseEvent.MOUSE_OVER, owerMouse);
if (mc != null){
Engine.inst.Level.sky.removeChild(mc);
};
mc = null;
Engine.inst.listMoovedObject[Engine.inst.listMoovedObject.indexOf(this)] = null;
}
public function get dPoint2():Boolean{
return (Engine.inst.Level.chekHitXY(mc.x, (mc.y + 5)));
}
public function update(e:Event):void{
var m:TextBubl;
if (timer > 0){
timer--;
if (timer <= 1){
destroy();
};
return;
};
if (dPoint1){
curPoint = Engine.inst.Level.findFreePoint(curPoint);
mc.x = curPoint.x;
mc.y = curPoint.y;
} else {
if (!dPoint2){
mc.y = (mc.y + 4);
curPoint.y = mc.y;
};
};
if (Engine.inst.curGroup.curUnit != null){
if (Point.distance(curPoint, Engine.inst.curGroup.curUnit.startPos) < 20){
SoundConst._playSound(SoundConst.S_box);
if (med){
Engine.inst.curGroup.curUnit.life = (Engine.inst.curGroup.curUnit.life + 20);
} else {
m = new TextBubl();
Engine.inst.Level.sky.addChild(m);
m.x = mc.x;
m.y = mc.y;
if (money){
Engine.inst.addMoney(Engine.inst.curGroup, 50, false);
SoundConst._playSound(SoundConst.S_money);
m.mcBubl.txt.text = "+50 $";
} else {
Engine.inst.curGroup.addPart(curWeap);
m.mcBubl.txt.text = curWeap.name;
};
};
timer = (mc.totalFrames + 1);
mc.gotoAndPlay(2);
};
};
}
public function get dPoint1():Boolean{
return (Engine.inst.Level.chekHitXY(mc.x, mc.y));
}
public function owerMouse(e:Event):void{
var m:TextBubl;
var s:String;
if (((!((Engine.inst.curGroup.curUnit == null))) && (Engine.inst.curGroup.curUnit.param.rengen))){
m = new TextBubl();
Engine.inst.Level.sky.addChild(m);
m.x = mc.x;
m.y = mc.y;
s = "MedPac +20";
if (money){
s = "+50 $";
};
if (((!(med)) && (!(money)))){
s = curWeap.name;
};
m.mcBubl.txt.text = s;
};
}
}
}//package war
Section 75
//cClasterBomb (war.cClasterBomb)
package war {
import flash.events.*;
import objGame.*;
public class cClasterBomb extends balistic {
public var timerValue:int;
public function cClasterBomb(){
super();
}
override public function startFromUnit(u:unit):void{
super.startFromUnit(u);
timerValue = (u.timeGrenad * 30);
}
override public function initStart(x:Number, y:Number, dx:Number, dy:Number, p:int):void{
SoundConst._playSound(SoundConst.S_grShot);
timerValue = 20;
init(ClasterBomb, 60, 35, ricoshet);
super.initStart(x, y, ((dx * p) / 3), ((dy * p) / 3), p);
inWinded = false;
soundName = SoundConst.S_mina;
boomClass = boomMacro;
}
override public function update(e:Event):void{
var f:balistic;
var i:int;
super.update(e);
timerValue--;
if (timerValue <= 0){
Engine.inst.endWeaponTime(15);
i = -2;
while (i <= 2) {
f = new balistic();
f.init(Claster, (weapons.cGrenada.radiusWeap / 2), (weapons.cGrenada.powerWeap / 2));
f.boomClass = boomMacro;
f.initStart(mc.x, mc.y, (((i + speedX) + (Math.random() * 4)) - 2), ((-4 + speedY) + (Math.random() * -5)), 0);
f.soundName = SoundConst.S_BGshot;
i++;
};
boom();
};
}
public function firstHit():void{
ricoshet();
}
}
}//package war
Section 76
//cDinamit (war.cDinamit)
package war {
import flash.events.*;
import objGame.*;
public class cDinamit extends balistic {
public var timerValue:int;
public function cDinamit(){
super();
}
override public function update(e:Event):void{
timerValue--;
if (timerValue <= 0){
Engine.inst.endWeaponTime(10);
boom();
return;
};
if (timerValue < 60){
speedY = 0;
} else {
super.update(e);
};
}
override public function initStart(x:Number, y:Number, dx:Number, dy:Number, p:int):void{
timerValue = 100;
init(dinamitMC, weapons.Dinamit.powerWeap, weapons.Dinamit.radiusWeap, ricoshet);
super.initStart(x, y, 0, 0, p);
inRotable = false;
inWinded = false;
boomClass = boom3MEGA;
koofRicoshet = 0.1;
SoundConst._playSound(SoundConst.S_timeBomb);
soundName = SoundConst.S_mina;
}
}
}//package war
Section 77
//cDisko (war.cDisko)
package war {
import flash.events.*;
import flash.geom.*;
public class cDisko extends balistic {
protected var pointUdar:Point;
protected var timer:int;
protected var un:unit;
public function cDisko(){
super();
}
override public function destroy():void{
un = null;
pointUdar = null;
Engine.inst.removeEventListener("up", update);
Engine.inst.listMoovedObject[Engine.inst.listMoovedObject.indexOf(this)] = null;
}
override public function update(e:Event):void{
var enGr:groupUnit;
var u:unit;
var i:int;
timer--;
if (timer <= 12){
enGr = Engine.inst.getEnemeGroup(un.group);
un.Aim = (un.Aim + 2);
pointUdar.x = un.FirePoint.x;
pointUdar.y = un.FirePoint.y;
i = 0;
while (i < enGr.arrUnit.length) {
u = enGr.arrUnit[i];
if (u != null){
if (Point.distance(pointUdar, u.centerPoint) < 20){
u.life = (u.life - (5 + un.param.demagBonus));
if (timer == 0){
Engine.inst.endWeaponTime(10);
u.addSpeed(((u.startPos.x - un.startPos.x) / 4), -8);
};
};
};
i++;
};
if (timer <= 0){
destroy();
};
};
}
override public function startFromUnit(u:unit):void{
un = u;
Engine.inst.listMoovedObject.push(this);
timer = 15;
pointUdar = new Point(un.FirePoint.x, un.FirePoint.y);
Engine.inst.addEventListener("up", update);
SoundConst._playSound(SoundConst.S_saw);
}
}
}//package war
Section 78
//cGrenade (war.cGrenade)
package war {
import flash.events.*;
import objGame.*;
public class cGrenade extends balistic {
public var timerValue:int;
public function cGrenade(){
super();
}
override public function update(e:Event):void{
timerValue--;
if (timerValue <= 0){
Engine.inst.endWeaponTime(7);
boom();
return;
};
super.update(e);
}
override public function initStart(x:Number, y:Number, dx:Number, dy:Number, p:int):void{
timerValue = 50;
SoundConst._playSound(SoundConst.S_grShot);
init(Grenade, weapons.Grenada.powerWeap, weapons.Grenada.radiusWeap, ricoshet);
super.initStart(x, y, ((dx * p) / 3), ((dy * p) / 3), p);
koofRicoshet = 0.4;
inWinded = false;
boomClass = boomMacro;
}
override public function startFromUnit(u:unit):void{
super.startFromUnit(u);
timerValue = (u.timeGrenad * 30);
}
}
}//package war
Section 79
//cJetPack (war.cJetPack)
package war {
import flash.events.*;
public class cJetPack extends balistic {
protected var timer:int;
protected var un:unit;
public function cJetPack(){
super();
}
override public function startFromUnit(u:unit):void{
un = u;
SoundConst._playSound(SoundConst.S_jetPack);
Engine.inst.listMoovedObject.push(this);
timer = 60;
speedX = Math.cos(u.aimFromWorld());
speedY = Math.sin(u.aimFromWorld());
un.addSpeed(0, -12);
Engine.inst.addEventListener("up", update);
}
override public function destroy():void{
un = null;
Engine.inst.removeEventListener("up", update);
Engine.inst.listMoovedObject[Engine.inst.listMoovedObject.indexOf(this)] = null;
}
override public function update(e:Event):void{
timer--;
if (timer < 0){
un.jetMove(false);
Engine.inst.endWeaponTime(1);
destroy();
return;
};
un.jetMove(true);
}
}
}//package war
Section 80
//cLaser (war.cLaser)
package war {
import flash.events.*;
import objGame.*;
import flash.geom.*;
public class cLaser extends balistic {
protected var un:unit;
protected var fp:Point;
protected var tp:Point;
protected var count:int;
public static const countBullet:int = 8;
public function cLaser(){
super();
}
override public function startFromUnit(u:unit):void{
un = u;
Engine.inst.listMoovedObject.push(this);
count = countBullet;
speedX = Math.cos(u.aimFromWorld());
speedY = Math.sin(u.aimFromWorld());
mc = new laserBeem();
mc.x = u.FirePoint.x;
mc.y = u.FirePoint.y;
mc.rotation = (u.aimFromWorld() * 57);
Engine.inst.Level.sky.addChild(mc);
fp = u.FirePoint.clone();
tp = new Point((fp.x + (speedX * 2000)), (fp.y + (speedY * 2000)));
SoundConst._playSound(SoundConst.S_laser);
trace("create laser", fp, tp);
Engine.inst.addEventListener("up", update);
}
override public function update(e:Event):void{
var p:Point;
var i:int;
if (count > 0){
count--;
Engine.inst.Level.sky.graphics.clear();
i = 0;
while (i < 8) {
p = Engine.findLineTrack(fp, tp, 1, true);
p.offset((speedX * 3), (speedY * 3));
if ((((((((p.x > 800)) || ((p.x < 0)))) || ((p.y < 0)))) || ((p.y > 600)))){
trace("desrt", tp, p);
count = 0;
mc.mc.scaleX = (Point.distance(p, un.FirePoint) / 800);
break;
};
if (((!(Engine.inst.Level.chekHit(p))) && (Engine.inst.Level.chekHitUnit(p)))){
Engine.inst.addDamag(p.x, p.y, weapons.Laser.radiusWeap, weapons.Laser.powerWeap);
fp = p.clone();
fp.offset((speedX * 10), (speedY * 10));
trace("!!!!!!!!!!!!!!!!!!!HIT");
};
Engine.inst.Level.addCircl_mask(p.x, p.y, weapons.Laser.radiusWeap);
mc.mc.scaleX = (Point.distance(p, un.FirePoint) / 800);
i++;
};
} else {
destroy();
};
}
override public function destroy():void{
Engine.inst.endWeaponTime(2);
Engine.inst.Level.sky.graphics.clear();
fp = null;
tp = null;
Engine.inst.removeEventListener("up", update);
Engine.inst.listMoovedObject[Engine.inst.listMoovedObject.indexOf(this)] = null;
if (mc != null){
Engine.inst.Level.sky.removeChild(mc);
};
mc = null;
}
}
}//package war
Section 81
//cMashingun (war.cMashingun)
package war {
import flash.events.*;
public class cMashingun extends balistic {
protected var timer:int;
protected var un:unit;
protected var count:int;
public static const countBullet:int = 15;
public function cMashingun(){
super();
}
override public function startFromUnit(u:unit):void{
un = u;
Engine.inst.listMoovedObject.push(this);
timer = 0;
count = countBullet;
speedX = Math.cos(u.aimFromWorld());
speedY = Math.sin(u.aimFromWorld());
Engine.inst.addEventListener("up", update);
}
override public function destroy():void{
un = null;
Engine.inst.removeEventListener("up", update);
Engine.inst.listMoovedObject[Engine.inst.listMoovedObject.indexOf(this)] = null;
}
override public function update(e:Event):void{
var b:bullet;
timer--;
if (timer > 0){
return;
};
if (un.state == unit.S_DEAD){
count = 0;
};
if (count > 0){
if (un != null){
un.UpdateBDLevel();
speedX = Math.cos(un.aimFromWorld());
speedY = Math.sin(un.aimFromWorld());
b = new bullet();
b.initStart(un.FirePoint.x, un.FirePoint.y, speedX, speedY, 1);
b.mc.rotation = ((180 * (Math.atan2(speedY, speedX) + (Math.PI / 2))) / Math.PI);
SoundConst._playSound(SoundConst.s_mgShot);
};
timer = 3;
count--;
} else {
un.endFire();
destroy();
};
}
}
}//package war
Section 82
//cMissel (war.cMissel)
package war {
import flash.events.*;
import flash.display.*;
import objGame.*;
public class cMissel extends balistic {
public var classSmoke:Class;
public function cMissel(){
super();
}
public function initASStart(x:Number, y:Number, dx:Number, dy:Number, p:int):void{
init(AirStrakeMissel, weapons.AirStrike.powerWeap, weapons.AirStrike.radiusWeap);
boomClass = boom3MEGA;
super.initStart(x, y, dx, dy, p);
inGravi = true;
inCurs = true;
inWinded = true;
inRotable = false;
power = 500;
classSmoke = SmokeAirStrike;
}
override public function initStart(x:Number, y:Number, dx:Number, dy:Number, p:int):void{
init(MisselMC, weapons.Missel.powerWeap, weapons.Missel.radiusWeap);
boomClass = boomMicro;
super.initStart(x, y, ((dx * p) / 3), ((dy * p) / 3), p);
inGravi = true;
inCurs = true;
inWinded = true;
inRotable = false;
SoundConst._playSound(SoundConst.s_missel);
classSmoke = Smoke;
}
override public function update(e:Event):void{
var b:MovieClip;
if (power > 0){
b = new classSmoke();
Engine.inst.Level.sky.addChild(b);
b.x = mc.x;
b.y = mc.y;
b.rotation = (Math.random() * 350);
power--;
};
super.update(e);
}
override public function destroy():void{
trace("w", inWinded, "g", inGravi);
Engine.inst.endWeaponTime(7);
super.destroy();
}
}
}//package war
Section 83
//cPlasmaGan (war.cPlasmaGan)
package war {
import flash.events.*;
import flash.geom.*;
public class cPlasmaGan extends balistic {
protected var fp:Point;
protected var timer:int;
protected var un:unit;
protected var count:int;
public static const countBullet:int = 12;
public function cPlasmaGan(){
super();
}
override public function startFromUnit(u:unit):void{
un = u;
Engine.inst.listMoovedObject.push(this);
timer = 0;
count = countBullet;
speedX = Math.cos(u.aimFromWorld());
speedY = Math.sin(u.aimFromWorld());
fp = u.FirePoint.clone();
SoundConst._playSound(SoundConst.S_plasmaGun);
Engine.inst.addEventListener("up", update);
}
override public function update(e:Event):void{
var b:bullet;
timer--;
if (timer > 0){
return;
};
if (un.state == unit.S_DEAD){
count = 0;
};
if (count > 0){
if (un != null){
un.UpdateBDLevel();
fp = un.FirePoint.clone();
speedX = Math.cos(un.aimFromWorld());
speedY = Math.sin(un.aimFromWorld());
};
speedY = (speedY * (0.99 + (Math.random() / 5)));
b = new bullet();
b.initPlasma((fp.x + (speedX * 5)), (fp.y + (speedY * 5)), speedX, speedY, 1);
timer = 2;
count--;
} else {
un.endFire();
un = null;
destroy();
};
}
}
}//package war
Section 84
//cPlasmaGrenad (war.cPlasmaGrenad)
package war {
import flash.events.*;
import objGame.*;
public class cPlasmaGrenad extends balistic {
public var timerValue:int;
public function cPlasmaGrenad(){
super();
}
override public function startFromUnit(u:unit):void{
initStart(u.FirePoint.x, u.FirePoint.y, Math.cos(u.aimFromWorld()), Math.sin(u.aimFromWorld()), u.Power);
timerValue = (u.timeGrenad * 30);
}
override public function initStart(x:Number, y:Number, dx:Number, dy:Number, p:int):void{
SoundConst._playSound(SoundConst.S_grShot);
timerValue = 50;
init(mcPlasmaBomb, weapons.PlasmaBomb.powerWeap, weapons.PlasmaBomb.radiusWeap, firstHit);
super.initStart(x, y, ((dx * p) / 3), ((dy * p) / 3), p);
inWinded = false;
boomClass = boomPlasma;
soundName = SoundConst.S_plasmaboom;
scaleBoomXY = 3;
koofRicoshet = 0.3;
}
override public function update(e:Event):void{
timerValue--;
if (timerValue <= 0){
boom();
Engine.inst.endWeaponTime(7);
return;
};
super.update(e);
}
public function firstHit():void{
ricoshet();
}
}
}//package war
Section 85
//CPU (war.CPU)
package war {
import objGame.*;
import flash.geom.*;
public class CPU {
protected const nulPoint:Point;
protected var listVariant:Array;
protected var listEnemy:Array;
protected var numUtyk:int;
public var tarFinded:Boolean;
public var curPower:int;
public var curTime:int;
public var curStartPoint:Point;
protected var numRetarget:int;
public var curAngl:int;
protected var curVariant:CPUvar;
protected var myGroup:groupUnit;
protected var notTarVariant:CPUvar;
public var curEndPoint:Point;
protected var enemyGroup:groupUnit;
protected var timerDump:int;
public var curWeap:weapons;
public var tarSelected:Boolean;
public var curUnit:unit;
protected var curNumU:int;
public static var LevelAI:int = 1;
public function CPU(g2:groupUnit, g1:groupUnit){
nulPoint = new Point(0, 0);
super();
myGroup = g2;
enemyGroup = g1;
tarSelected = false;
curEndPoint = null;
trace("CreateCPU");
}
public function chekGroup(tar:unit, r:int):int{
var c:int;
var i:int;
while (i < listEnemy.length) {
if (Point.distance(tar.startPos, listEnemy[i].startPos) < r){
c++;
};
i++;
};
return (c);
}
public function retarget():void{
numRetarget++;
numUtyk = 0;
trace("==============================retarget=================================");
curNumU = 0;
listEnemy = [];
var i:int;
while (i < enemyGroup.arrUnit.length) {
if (enemyGroup.arrUnit[i] != null){
listEnemy.push(enemyGroup.arrUnit[i]);
};
i++;
};
curUnit.UpdateBDLevel();
tarFinded = false;
tarSelected = false;
listVariant = [];
addVarMove();
}
public function findJump(LeftJump:Boolean, ps:Point):Point{
var p2:Point;
var ricVect:Point;
var v:Number;
var p:Point = ps.clone();
var dx:Number = curUnit.param.speed;
var dy:Number = -(curUnit.param.jumpSpeed);
if (LeftJump){
dx = -(dx);
};
var b:Boolean;
while (true) {
p2 = p.clone();
dy = (dy + Engine.gravi);
p2.offset(dx, dy);
p = Engine.findLineTrack(p, p2, 2, false);
if (p.y > 600){
return (ps.clone());
};
if ((((p.x < 5)) || ((p.x > 795)))){
return (ps.clone());
};
if (p != p2){
ricVect = Engine.inst.Level.getRicoshetVector(p);
if (ricVect.y < curUnit.param.anglHills){
p = Engine.inst.Level.findFreePoint(p);
return (p);
};
v = (Math.sqrt(((dx * dx) + (dy * dy))) * 0.5);
dx = (ricVect.x * v);
dy = (ricVect.y * v);
};
};
return (p);
}
public function findTar(tar:unit):void{
var i:int;
var pRetr:Point;
var cl:int;
var sX:Number;
var sY:Number;
var cCGr:int;
var t:int;
var xAS:int;
var pAS:Point;
var cAS:int;
var mx:int;
var tAbomb:int;
var xAB:int;
if (curUnit.state == unit.S_STAND){
curUnit.state = unit.S_AIM;
};
var dist:int = int(Math.abs(Point.distance(tar.startPos, curUnit.startPos)));
var zMov:int = int((50 + (Math.random() * 100)));
if (tar.startPos.x > curUnit.startPos.x){
zMov = -(zMov);
};
zMov = Math.max(5, Math.min(795, (curUnit.startPos.x + zMov)));
var nextPoint:Point = nulPoint.clone();
var ps:Point = new Point(zMov, curUnit.startPos.y);
ps = Engine.inst.Level.findFreePoint(ps);
if (chekMoveTar(curUnit.startPos, ps)){
nextPoint = curEndPoint.clone();
};
curEndPoint = nulPoint.clone();
trace("chek tar unit x=", tar.startPos.x);
var tarPos:Point = tar.centerPoint.clone();
curUnit.state = unit.S_AIM;
curUnit.setAimtoMouse(tarPos.x, tarPos.y);
ps = tar.startPos.clone();
ps.offset(((ps.x)<curUnit.startPos.x) ? 10 : -10, 0);
ps = Engine.inst.Level.findFreePoint(ps);
if (((chekMoveTar(curUnit.startPos, ps)) && ((Point.distance(curUnit.startPos, ps) < 30)))){
if (Point.distance(curEndPoint, ps) < 15){
if (Point.distance(ps, curUnit.startPos) < 20){
ps = nulPoint.clone();
};
if (curUnit.arrWeapon[weapons.Dinamit.weaponNum].count > 0){
pRetr = nulPoint;
if (chekMove(true, 140, ps)){
pRetr = curEndPoint.clone();
};
if (chekMove(false, 140, ps)){
pRetr = curEndPoint.clone();
};
curEndPoint = nulPoint.clone();
trace("othod point", pRetr, ps);
if (pRetr.x > 0){
pRetr = Engine.inst.Level.findFreePoint(pRetr);
curUnit.setAimtoMouse(tarPos.x, (tarPos.y - 10));
addVar(weapons.Dinamit, curUnit.Aim, ps, pRetr, calcCost(tarPos.x, tarPos.y, weapons.Dinamit.radiusWeap, weapons.Dinamit.powerWeap));
if (tar.life < 70){
listVariant.push(listVariant[(listVariant.length - 1)]);
};
};
};
if (curUnit.arrWeapon[weapons.Udar.weaponNum].count > 0){
curPower = 0;
curUnit.setAimtoMouse(tarPos.x, tarPos.y);
addVar(weapons.Udar, curUnit.Aim, ps, nextPoint, calcCost(tarPos.x, tarPos.y, 30, weapons.Udar.powerWeap, true));
if (tar.life < weapons.Udar.powerWeap){
listVariant.push(listVariant[(listVariant.length - 1)]);
};
};
if (curUnit.arrWeapon[weapons.Disko.weaponNum].count > 0){
curPower = 0;
curUnit.setAimtoMouse(tarPos.x, tarPos.y);
addVar(weapons.Disko, curUnit.Aim, ps, nextPoint, calcCost(tarPos.x, tarPos.y, 50, 50, true));
if (tar.life < 30){
listVariant.push(listVariant[(listVariant.length - 1)]);
};
};
};
};
curUnit.setAimtoMouse(tarPos.x, tarPos.y);
var pMG:Point = Engine.findLineTrack(curUnit.FirePoint, tarPos, 1, true);
if ((((curUnit.arrWeapon[weapons.MashinGun.weaponNum].count > 0)) && ((dist > 35)))){
if (Point.distance(pMG, tarPos) < 50){
addVar(weapons.MashinGun, curUnit.Aim, nulPoint, nextPoint, ((calcCost(pMG.x, pMG.y, weapons.MashinGun.radiusWeap, weapons.MashinGun.powerWeap) * cMashingun.countBullet) * 1.2));
trace("MG");
if (tar.life < 50){
listVariant.push(listVariant[(listVariant.length - 1)]);
};
} else {
if (curUnit.arrWeapon[weapons.MashinGun.weaponNum].count > 100){
addVar(weapons.MashinGun, curUnit.Aim, nulPoint, nulPoint, 0);
};
};
};
if ((((((curUnit.arrWeapon[weapons.BigGun.weaponNum].count > 0)) && ((dist > 70)))) && ((Point.distance(pMG, tarPos) < 10)))){
addVar(weapons.BigGun, curUnit.Aim, nulPoint, nextPoint, (calcCost(pMG.x, pMG.y, weapons.BigGun.radiusWeap, weapons.BigGun.powerWeap) * 1.1));
trace("BG");
if (tar.life < 70){
listVariant.push(listVariant[(listVariant.length - 1)]);
};
};
if ((((curUnit.arrWeapon[weapons.PlasmaGun.weaponNum].count > 0)) && ((dist > 80)))){
if (Point.distance(pMG, tarPos) < 150){
addVar(weapons.PlasmaGun, curUnit.Aim, nulPoint, nextPoint, ((calcCost(pMG.x, pMG.y, weapons.PlasmaGun.radiusWeap, weapons.PlasmaGun.powerWeap) * cPlasmaGan.countBullet) * 1.3));
trace("PG");
if (tar.life < 150){
listVariant.push(listVariant[(listVariant.length - 1)]);
};
} else {
if (curUnit.arrWeapon[weapons.PlasmaGun.weaponNum].count > 100){
addVar(weapons.PlasmaGun, curUnit.Aim, nulPoint, nulPoint, 0);
};
};
};
curUnit.setAimtoMouse(tarPos.x, tarPos.y);
if ((((curUnit.arrWeapon[weapons.Laser.weaponNum].count > 0)) && ((dist > 20)))){
cl = 0;
pMG = curUnit.FirePoint.clone();
sX = Math.cos(curUnit.aimFromWorld());
sY = Math.sin(curUnit.aimFromWorld());
pMG.offset((sX * 15), (sY * 15));
i = 0;
while (i < 130) {
pMG.offset((sX * 10), (sY * 10));
cl = (cl + (calcCost(pMG.x, pMG.y, weapons.Laser.radiusWeap, weapons.Laser.powerWeap) * 1.5));
i++;
};
addVar(weapons.Laser, curUnit.Aim, nulPoint, nextPoint, cl);
if (tar.life < 90){
listVariant.push(listVariant[(listVariant.length - 1)]);
};
};
if (chekBalisticTargert(tarPos)){
if ((((curUnit.arrWeapon[weapons.Grenada.weaponNum].count > 0)) && ((dist > 80)))){
addVar(weapons.Grenada, curAngl, nulPoint, nextPoint, (calcCost((tar.startPos.x + 5), tar.startPos.y, weapons.Grenada.radiusWeap, weapons.Grenada.powerWeap) * 0.6));
trace("add Gr");
if (tar.life < 40){
listVariant.push(listVariant[(listVariant.length - 1)]);
};
};
if ((((curUnit.arrWeapon[weapons.cGrenada.weaponNum].count > 0)) && ((dist > 100)))){
trace("addCG");
cCGr = calcCost((tar.startPos.x + 5), tar.startPos.y, weapons.cGrenada.radiusWeap, weapons.cGrenada.powerWeap);
cCGr = (cCGr + calcCost((tar.startPos.x + 15), tar.startPos.y, (weapons.cGrenada.radiusWeap / 2), (weapons.cGrenada.powerWeap / 2)));
cCGr = (cCGr + calcCost((tar.startPos.x - 15), tar.startPos.y, (weapons.cGrenada.radiusWeap / 2), (weapons.cGrenada.powerWeap / 2)));
cCGr = (cCGr + calcCost((tar.startPos.x + 40), tar.startPos.y, (weapons.cGrenada.radiusWeap / 2), (weapons.cGrenada.powerWeap / 2)));
cCGr = (cCGr + calcCost((tar.startPos.x - 40), tar.startPos.y, (weapons.cGrenada.radiusWeap / 2), (weapons.cGrenada.powerWeap / 2)));
addVar(weapons.cGrenada, curAngl, nulPoint, nextPoint, (cCGr * 0.6));
if (tar.life < 70){
listVariant.push(listVariant[(listVariant.length - 1)]);
};
if (chekGroup(tar, (weapons.cGrenada.radiusWeap * 4)) > 1){
listVariant.push(listVariant[(listVariant.length - 1)]);
};
};
if ((((curUnit.arrWeapon[weapons.PlasmaBomb.weaponNum].count > 0)) && ((dist > 100)))){
addVar(weapons.PlasmaBomb, curAngl, null, nextPoint, (calcCost((tar.startPos.x + 5), tar.startPos.y, weapons.PlasmaBomb.radiusWeap, weapons.PlasmaBomb.powerWeap) * 0.7));
trace("add pGr");
if (tar.life < 80){
listVariant.push(listVariant[(listVariant.length - 1)]);
};
};
};
if ((((curUnit.arrWeapon[weapons.Missel.weaponNum].count > 0)) && ((dist > 50)))){
if (chekBalisticTargert(tarPos, true, 10)){
addVar(weapons.Missel, curAngl, nulPoint, nextPoint, (calcCost(tar.centerPoint.y, (tar.centerPoint.y - 10), weapons.Missel.radiusWeap, weapons.Missel.powerWeap) * 1.1));
trace("addMissel");
if (tar.life < 50){
listVariant.push(listVariant[(listVariant.length - 1)]);
};
};
};
if ((((curUnit.arrWeapon[weapons.AirStrike.weaponNum].count > 0)) && ((dist > 200)))){
t = Math.sqrt(((2 * (tarPos.y + 50)) / Engine.gravi));
xAS = ((tar.startPos.x - (cASMissel.ASspeedX * t)) - (((Engine.windSpeed * t) * t) / 2));
if (chekFreeTraektory(new Point(xAS, -50), cASMissel.ASspeedX, 0, t, true)){
trace("addAirstrike", t, xAS);
cAS = 0;
mx = 0;
while (mx < 5) {
pAS = new Point(((tar.startPos.x + (mx * 50)) - 100), tar.startPos.y);
pAS = Engine.inst.Level.findFreePoint(pAS);
cAS = (cAS + calcCost(pAS.x, pAS.y, weapons.AirStrike.radiusWeap, weapons.AirStrike.powerWeap));
mx++;
};
curAngl = 90;
addVar(weapons.AirStrike, curAngl, nextPoint, new Point(xAS, -50), (cAS * 0.8));
if (tar.life < cAS){
listVariant.push(listVariant[(listVariant.length - 1)]);
};
};
};
if ((((curUnit.arrWeapon[weapons.ABomb.weaponNum].count > 0)) && ((dist > 280)))){
tAbomb = Math.sqrt(((2 * (tarPos.y + 50)) / Engine.gravi));
xAB = ((tar.startPos.x - (((Engine.windSpeed * tAbomb) * tAbomb) / 2)) - (cAbomb.xspeed * tAbomb));
if (chekFreeTraektory(new Point(xAB, -50), cAbomb.xspeed, 0, tAbomb, false)){
addVar(weapons.ABomb, curAngl, nextPoint, new Point(xAB, -50), (calcCost((tar.startPos.x + 5), (tar.startPos.y - 10), weapons.ABomb.radiusWeap, weapons.ABomb.powerWeap) * 0.8));
trace("addABomb");
if (tar.life < 50){
listVariant.push(listVariant[(listVariant.length - 1)]);
};
};
};
curUnit.state = unit.S_STAND;
}
protected function chekSelfDestroyDemag(u:unit):int{
var d:int;
var i:int;
while (i < listEnemy.length) {
if (listEnemy[i] != u){
d = (d + listEnemy[i].getNumDamag(u.startPos.x, u.startPos.y, unit.radiusSelfDestroy, unit.powerSelfDestroy));
};
i++;
};
return (d);
}
protected function addVarMove():void{
var t:unit;
var xt:int;
var count:int = listVariant.length;
var nextPoint:Point = Engine.inst.Level.findFreePoint(new Point(Math.max(5, Math.min(795, (curUnit.startPos.x + int((90 + (Math.random() * 100)))))), curUnit.startPos.y));
if (chekMoveTar(curUnit.startPos, nextPoint)){
addVar(null, 90, nextPoint, nulPoint, 0);
};
nextPoint = Engine.inst.Level.findFreePoint(new Point(Math.max(5, Math.min(795, (curUnit.startPos.x - int((90 + (Math.random() * 100)))))), curUnit.startPos.y));
if (chekMoveTar(curUnit.startPos, nextPoint)){
addVar(null, 90, nextPoint, nulPoint, 0);
};
var minX = 10000;
var i:int;
while (i < listEnemy.length) {
xt = listEnemy[i].startPos.x;
if (Math.abs((curUnit.startPos.x - minX)) > Math.abs((curUnit.startPos.x - xt))){
minX = xt;
t = listEnemy[i];
};
i++;
};
nextPoint = Engine.inst.Level.findFreePoint(new Point(Math.max(5, Math.min(795, (curUnit.startPos.x + int((50 - (Math.random() * 100)))))), curUnit.startPos.y));
if (!chekMoveTar(curUnit.startPos, nextPoint)){
nextPoint = nulPoint.clone();
};
var d:int = int(Point.distance(curUnit.startPos, t.startPos));
curUnit.setAimtoMouse(t.centerPoint.x, t.centerPoint.y);
if ((((curUnit.arrWeapon[weapons.BigGun.weaponNum].count > 0)) && ((d > 50)))){
addVar(weapons.BigGun, curUnit.Aim, nulPoint, nextPoint, -10);
};
if ((((curUnit.arrWeapon[weapons.MashinGun.weaponNum].count > 0)) && ((d > 10)))){
addVar(weapons.MashinGun, curUnit.Aim, nulPoint, nextPoint, -1);
};
if ((((curUnit.arrWeapon[weapons.PlasmaGun.weaponNum].count > 0)) && ((d > 70)))){
addVar(weapons.PlasmaGun, curUnit.Aim, nulPoint, nextPoint, -6);
};
notTarVariant = null;
chekBalisticTargert(t.centerPoint, false, 30);
if (notTarVariant != null){
curPower = notTarVariant.curPower;
curTime = (notTarVariant.curTime - 1);
if ((((curUnit.arrWeapon[weapons.cGrenada.weaponNum].count > 0)) && ((d > 90)))){
addVar(weapons.cGrenada, notTarVariant.curAngl, nulPoint, nextPoint, -2);
};
};
notTarVariant = null;
chekBalisticTargert(t.centerPoint, true, 30);
if (notTarVariant != null){
curPower = notTarVariant.curPower;
curTime = notTarVariant.curTime;
if ((((curUnit.arrWeapon[weapons.Missel.weaponNum].count > 0)) && ((d > 30)))){
addVar(weapons.Missel, notTarVariant.curAngl, nulPoint, nextPoint, 0);
};
};
notTarVariant = null;
if ((listVariant.length - count) < 2){
if (Point.distance(curUnit.startPos, findJump((minX < curUnit.startPos.x), curUnit.startPos)) > 20){
curUnit.Aim = ((xt)>curUnit.startPos.x) ? 90 : 270;
curUnit.moveJump();
timerDump = 30;
tarFinded = false;
} else {
Engine.inst.state = Engine.st_ENDHOD;
};
};
}
protected function moveTo(pTar:Point):void{
if (Math.abs((pTar.x - curUnit.startPos.x)) < 10){
if (Math.abs((pTar.y - curUnit.startPos.y)) > 30){
retarget();
};
pTar.x = 0;
pTar.y = 0;
curUnit.endMove();
curUnit.UpdateBDLevel();
return;
};
if (curUnit.state != unit.S_STAND){
return;
};
if (!curUnit.normHodUnit){
if ((((((curWeap == weapons.AirStrike)) || ((curWeap == weapons.ABomb)))) && ((numUtyk > 2)))){
curStartPoint = nulPoint.clone();
curUnit.endMove();
curUnit.UpdateBDLevel();
return;
};
curUnit.stepBack();
curUnit.stepBack();
curUnit.moveJump();
numUtyk++;
return;
};
if (pTar.x < curUnit.startPos.x){
curUnit.moveLeft();
} else {
curUnit.moveRight();
};
timerDump = 5;
}
public function chekMove(leftMove:Boolean, dist:int, ps:Point):Boolean{
var nextPoint:Point;
var startPos:Point = ps.clone();
var s:Number = curUnit.param.speed;
if (leftMove){
s = -(s);
};
var i:int;
while (i < (int((dist / curUnit.param.speed)) + 1)) {
nextPoint = startPos.clone();
nextPoint.offset(s, 0);
nextPoint = Engine.inst.Level.findFreePoint(nextPoint);
if ((((nextPoint.x < 5)) || ((nextPoint.x > 795)))){
return (false);
};
if (Math.abs((startPos.y - nextPoint.y)) > Math.abs((s * curUnit.param.anglMove))){
return (false);
};
startPos = nextPoint;
i++;
};
curEndPoint = startPos;
return (true);
}
public function chekBalisticTargert(tarPos:Point, wind:Boolean=false, timMin:int=30):Boolean{
var rez:Boolean;
var dyy:Number = (tarPos.y - curUnit.FirePoint.y);
var dxx:Number = (tarPos.x - curUnit.FirePoint.x);
var dx:Number = 0;
var dy:Number = 0;
if (int((dxx / 33.3)) > 120){
return (false);
};
var i = 150;
while (i > Math.max(timMin, int((dxx / 33)))) {
if (wind){
dx = ((dxx - (((Engine.windSpeed * i) * i) / 2)) / i);
} else {
dx = (dxx / i);
};
dy = ((dyy - (((Engine.gravi * i) * i) / 2)) / i);
curUnit.setAimtoMouse((curUnit.centerPoint.x + dx), (curUnit.centerPoint.y + dy));
dyy = (tarPos.y - curUnit.FirePoint.y);
dxx = (tarPos.x - curUnit.FirePoint.x);
if (Math.sqrt(((dx * dx) + (dy * dy))) <= 33.3){
if (chekFreeTraektory(curUnit.FirePoint.clone(), dx, dy, i, wind)){
curTime = Math.max(1, (int((i / 30)) + 1));
curAngl = curUnit.Aim;
curPower = (int((Math.sqrt(((dx * dx) + (dy * dy))) + 1)) * 3);
if ((((Math.abs(((curTime * 30) - i)) < 3)) && (!(wind)))){
return (true);
};
if ((((curTime > 1)) && ((Math.abs((((curTime - 1) * 30) - i)) < 3)))){
curTime--;
};
if ((((((Math.abs(((curTime * 30) - i)) > 3)) && ((LevelAI < 3)))) && (!(wind)))){
dx = ((dxx / curTime) / 30);
dy = (((dyy - ((((Engine.gravi * curTime) * curTime) * 30) * 15)) / curTime) / 30);
if (Math.sqrt(((dx * dx) + (dy * dy))) <= 33){
curUnit.setAimtoMouse((curUnit.centerPoint.x + dx), (curUnit.centerPoint.y + dy));
if (chekFreeTraektory(curUnit.FirePoint.clone(), dx, dy, (curTime * 30), wind)){
trace("SET SUPER GRENADE");
curAngl = curUnit.Aim;
curPower = (int((Math.sqrt(((dx * dx) + (dy * dy))) + 1)) * 3);
};
};
};
rez = true;
if (Math.random() > 0.8){
return (true);
};
};
};
i--;
};
return (rez);
}
protected function addVar(w:weapons, a:int, sp:Point, ep:Point, cost:int):void{
var cVar:CPUvar = new CPUvar();
cVar.curPower = curPower;
if (w != null){
cVar.curWeap = curUnit.arrWeapon[w.weaponNum];
} else {
cVar.curWeap = null;
};
if (Math.random() > ((1 / LevelAI) + 0.6)){
a = (a + ((Math.random() * 4) - 2));
};
cVar.curAngl = a;
if (ep == null){
ep = nulPoint;
};
cVar.tarPoint = ep.clone();
if (sp == null){
sp = nulPoint;
};
cVar.startPoint = sp.clone();
cVar.cost = cost;
cVar.curTime = curTime;
listVariant.push(cVar);
}
public function update():void{
if (timerDump > 0){
timerDump--;
return;
};
if (curUnit.state == unit.S_AIM){
curUnit.state = unit.S_STAND;
};
if (numRetarget > 8){
Engine.inst.state = Engine.st_ENDHOD;
};
if (!tarFinded){
FindAllTar();
return;
};
if (numUtyk > 5){
trace("5 Utyk");
retarget();
if (Engine.inst.state != Engine.st_HOD){
Engine.inst.state = Engine.st_ENDHOD;
};
return;
};
if (curStartPoint.x > 0){
moveTo(curStartPoint);
return;
};
if (curWeap == null){
retarget();
return;
};
if (tarSelected){
if (myGroup.curWeap.UNItype != curVariant.curWeap.UNItype){
Engine.inst.setWeap(curVariant.curWeap);
};
if ((((curVariant.curWeap.UNItype == weapons.Udar.weaponNum)) || ((curVariant.curWeap.UNItype == weapons.Disko.weaponNum)))){
if (calcCost(curUnit.FirePoint.x, (curUnit.FirePoint.y + 30), 30, 30) < 10){
retarget();
return;
};
};
if (Math.abs((curUnit.Aim - curVariant.curAngl)) >= 4){
if (curUnit.Aim < curVariant.curAngl){
curUnit.AimUp();
} else {
curUnit.AimDown();
};
timerDump = 2;
return;
};
curUnit.Aim = curVariant.curAngl;
curUnit.Power = curVariant.curPower;
curUnit.timeGrenad = curVariant.curTime;
if ((((curVariant.curWeap.UNItype == weapons.AirStrike.UNItype)) || ((curVariant.curWeap.UNItype == weapons.ABomb.UNItype)))){
curUnit.xPoint = curVariant.tarPoint.x;
timerDump = 1000;
} else {
if (curVariant.tarPoint.x > 0){
curEndPoint = curVariant.tarPoint;
};
};
trace("fire_CPU");
Engine.inst.fireCurUnit();
tarSelected = false;
};
if (curUnit.state == unit.S_inSHOTING){
return;
};
if (Engine.inst.state != Engine.st_HOD2){
return;
};
if (curEndPoint.x > 0){
moveTo(curEndPoint);
return;
};
Engine.inst.state = Engine.st_ENDHOD;
}
public function chekMoveTar(sp:Point, ep:Point):Boolean{
var nextPoint:Point;
if ((((ep.x <= 5)) || ((ep.x > 795)))){
return (false);
};
var s:Number = curUnit.param.speed;
if (ep.x < sp.x){
s = -(s);
};
var dist:int = Math.abs(int((ep.x - sp.x)));
var startPos:Point = sp.clone();
var i:int;
while (i < (int((dist / curUnit.param.speed)) + 1)) {
nextPoint = startPos.clone();
nextPoint.offset(s, 0);
nextPoint = Engine.inst.Level.findFreePoint(nextPoint);
if ((((nextPoint.x < 5)) || ((nextPoint.x > 795)))){
return (false);
};
if (Math.abs((startPos.y - nextPoint.y)) > Math.abs((s * curUnit.param.anglMove))){
return (false);
};
startPos = nextPoint;
curEndPoint = startPos;
i++;
};
return (true);
}
protected function selectVariant():void{
trace("select variant===============================", listVariant.length);
if (listVariant.length < 2){
retarget();
return;
};
timerDump = (3 * LevelAI);
var s:Number = 0;
listVariant.sortOn("cost", Array.NUMERIC);
var i:int;
while (i < listVariant.length) {
trace(listVariant[i].cost, ((listVariant[i].curWeap)==null) ? null : listVariant[i].curWeap.name);
i++;
};
s = Math.max(1, int((listVariant.length / 4)));
curVariant = listVariant[Math.max(0, Math.min((listVariant.length - 1), int(((listVariant.length - s) + Math.max(0, (((s * 1.3) - (LevelAI / 3)) * Math.random()))))))];
trace("var_________ ", curVariant.cost, ((curVariant.curWeap)==null) ? null : curVariant.curWeap.name, curVariant.startPoint, curVariant.tarPoint);
if (curVariant.curAngl > 180){
curUnit.Aim = 270;
} else {
curUnit.Aim = 90;
};
curEndPoint = curVariant.tarPoint;
curStartPoint = curVariant.startPoint;
curWeap = curVariant.curWeap;
tarSelected = true;
tarFinded = true;
curUnit.state = unit.S_STAND;
myGroup.showLifeBar();
enemyGroup.showLifeBar();
}
public function startFindTar(u:unit):void{
curUnit = u;
tarSelected = false;
timerDump = ((12 * LevelAI) + 12);
curNumU = 0;
listEnemy = [];
curEndPoint = null;
curStartPoint = null;
numRetarget = 0;
numUtyk = 0;
var d:int;
retarget();
trace("StartFindCPU enemi=", listEnemy.length, " myX ", u.startPos.x);
}
public function chekFreeTraektory(p:Point, dx:Number, dy:Number, t:int, w:Boolean=true):Boolean{
var ap:int = (int((Math.sqrt(((dx * dx) + (dy * dy))) + 1)) * 3);
var ep:Point = p.clone();
var sp:Point = p.clone();
var i:int;
while (i < (t - 1)) {
if (w){
dx = (dx + Engine.windSpeed);
};
dy = (dy + Engine.gravi);
ep.offset(dx, dy);
if (Engine.chekLineTrack(p, ep, 2)){
p = ep.clone();
} else {
if (Point.distance(sp, ep) > 50){
notTarVariant = new CPUvar();
notTarVariant.curAngl = curUnit.Aim;
notTarVariant.curPower = ap;
notTarVariant.curTime = Math.max(1, (int((i / 30)) + 1));
};
return (false);
};
if ((((((p.y > 600)) || ((p.x < -200)))) || ((p.x > 1000)))){
return (false);
};
i++;
};
return (true);
}
public function destroy():void{
curUnit = null;
curWeap = null;
myGroup = null;
enemyGroup = null;
listEnemy = null;
listVariant = null;
curVariant = null;
}
public function calcCost(x:int, y:int, r:int, p:int, udar:Boolean=false):int{
var i:int;
var d:int;
var c:int;
i = 0;
while (i < listEnemy.length) {
d = listEnemy[i].getNumDamag(x, y, r, p);
c = (c + d);
if (listEnemy[i].life < d){
if (listEnemy[i].param.selfDestroy){
c = (c + chekSelfDestroyDemag(listEnemy[i]));
};
c = (c + 100);
};
i++;
};
var cf:int;
i = 0;
while (i < myGroup.arrUnit.length) {
if (myGroup.arrUnit[i] != null){
d = myGroup.arrUnit[i].getNumDamag(x, y, r, p);
if (!udar){
cf = (cf + d);
if (myGroup.arrUnit[i].life <= d){
if (myGroup.arrUnit[i].param.selfDestroy){
c = (c + chekSelfDestroyDemag(myGroup.arrUnit[i]));
};
cf = (cf + 50);
};
};
};
i++;
};
var k:Number = 1.5;
if (myGroup.life > (enemyGroup.life * (1 + (LevelAI / 10)))){
k = 0.5;
};
if (cf > myGroup.life){
k = 8;
};
if (c >= enemyGroup.life){
k = 0;
c = (c * 10);
};
return (int((c - (cf * k))));
}
protected function FindAllTar():void{
if (listEnemy[curNumU] == null){
retarget();
};
if (curUnit.state != unit.S_STAND){
return;
};
curUnit.UpdateBDLevel();
findTar(listEnemy[curNumU]);
timerDump = (3 * LevelAI);
curNumU++;
if (curNumU >= listEnemy.length){
trace("End Search ", listVariant.length);
selectVariant();
};
}
}
}//package war
Section 86
//CPUvar (war.CPUvar)
package war {
import objGame.*;
import flash.geom.*;
public class CPUvar {
public var curPower:int;
public var tarPoint:Point;
public var curTime:int;
public var startPoint:Point;
public var curAngl:int;
public var cost:int;
public var curWeap:weapons;
public function CPUvar(){
super();
curTime = 3;
curAngl = 5;
curPower = 100;
curWeap = (weapons.Missel.copy() as weapons);
cost = 0;
tarPoint = new Point();
startPoint = new Point();
}
public function copy():CPUvar{
var n:CPUvar = new CPUvar();
n.curAngl = curAngl;
n.curPower = curPower;
n.curTime = curTime;
n.curWeap = curWeap;
n.cost = cost;
n.tarPoint = tarPoint;
n.startPoint = startPoint;
return (n);
}
}
}//package war
Section 87
//cTeleport (war.cTeleport)
package war {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
public class cTeleport extends balistic {
protected var timer:int;
protected var un:unit;
protected var tarPoint:Point;
public function cTeleport(){
super();
}
override public function startFromUnit(u:unit):void{
un = u;
tarPoint = new Point(u.xPoint, u.yPoint);
if (Engine.inst.Level.chekHit(tarPoint)){
tarPoint = Engine.inst.Level.findFreePoint(tarPoint);
};
Engine.inst.listMoovedObject.push(this);
timer = 0;
Engine.inst.addEventListener("up", update);
var m:MovieClip = new teleportMC();
Engine.inst.Level.sky.addChild(m);
m.x = u.startPos.x;
m.y = u.startPos.y;
m = new teleportMC();
Engine.inst.Level.sky.addChild(m);
m.x = tarPoint.x;
m.y = tarPoint.y;
}
override public function update(e:Event):void{
timer++;
if (timer >= 10){
un.setPosition(tarPoint);
Engine.inst.endWeaponTime(5);
un.endFire();
un = null;
tarPoint = null;
destroy();
};
}
}
}//package war
Section 88
//cUdar (war.cUdar)
package war {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
public class cUdar extends balistic {
protected var pointUdar:Point;
protected var timer:int;
protected var un:unit;
public var powerUdar:int;
public function cUdar(){
super();
}
override public function update(e:Event):void{
var enGr:groupUnit;
var u:unit;
var i:int;
timer--;
if (timer <= 0){
if (un != null){
enGr = Engine.inst.getEnemeGroup(un.group);
i = 0;
while (i < enGr.arrUnit.length) {
u = enGr.arrUnit[i];
if (u != null){
if (Point.distance(pointUdar, u.startPos) < 25){
u.life = (u.life - (powerUdar + un.param.demagBonus));
u.addSpeed(((u.startPos.x - un.startPos.x) / 2), -15);
};
};
i++;
};
un.endFire();
};
destroy();
};
}
override public function destroy():void{
Engine.inst.endWeaponTime(7);
un = null;
pointUdar = null;
Engine.inst.removeEventListener("up", update);
Engine.inst.listMoovedObject[Engine.inst.listMoovedObject.indexOf(this)] = null;
}
override public function startFromUnit(u:unit):void{
un = u;
Engine.inst.listMoovedObject.push(this);
timer = 3;
var mcEff:MovieClip = new handpunch();
Engine.inst.Level.sky.addChild(mcEff);
mcEff.x = un.startPos.x;
mcEff.y = un.startPos.y;
if (!u.faceToLeft()){
mcEff.scaleX = -1;
};
pointUdar = new Point(un.FirePoint.x, (un.FirePoint.y + 30));
SoundConst._playSound(SoundConst.S_kick);
Engine.inst.addEventListener("up", update);
powerUdar = 30;
}
}
}//package war
Section 89
//Engine (war.Engine)
package war {
import flash.events.*;
import flash.display.*;
import objGame.*;
import flash.geom.*;
import scr.*;
import base.*;
import flash.text.*;
public class Engine extends EventDispatcher {
public var listMoovedObject:Array;
protected var timTF:TextField;
protected var pausaInd:Boolean;
public var state_timer:int;
protected var timerMC:MovieClip;
public var panelWeap:panelIcon;
public var curGroup:groupUnit;
public var indASAB:MovieClip;
protected var indBal:cBalisticInd;
protected var m_state:int;
protected var contCurWeap:MovieClip;
public var groupPL1:groupUnit;
public var groupPL2:groupUnit;
protected var boxVer:Number;
protected var mcBG:MovieClip;
public var myCPU:CPU;
public var rootMC_:MovieClip;
protected var helpscreen:MovieClip;
protected var tempUP:Function;
protected var contPanel:MovieClip;
public var Level:WarField;
public var keyMan:KeyManager;
public static const st_WEAPONTIME:int = 4;
public static const gravi:Number = 1;
public static const st_HOD2:int = 5;
public static const st_ENDHOD:int = 2;
public static const st_START:int = 0;
public static const st_FINISH:int = 1;
public static const st_HOD:int = 3;
public static var inst:Engine;
public static var addDamagBonus:int = 0;
public static var windSpeed:Number = 0;
public static var PVMmode:Boolean = true;
public function Engine(){
super();
inst = this;
}
public function jumpBT(e:Event):void{
if (state < st_HOD){
return;
};
if (curGroup.curUnit.CPUdrive){
return;
};
curGroup.curUnit.moveJump();
}
public function setAim(e:Event):void{
if (curGroup.curUnit == null){
return;
};
if (state != st_HOD){
return;
};
if (curGroup.curUnit.CPUdrive){
return;
};
if ((((curGroup.curWeap.UNItype == weapons.AirStrike.UNItype)) || ((curGroup.curWeap.UNItype == weapons.ABomb.UNItype)))){
indASAB.visible = true;
indASAB.x = rootMC_.mouseX;
} else {
indASAB.visible = false;
};
curGroup.curUnit.setAimtoMouse(rootMC_.mouseX, rootMC_.mouseY);
}
public function YesExit():void{
Main.Profil.money = scrRez.oldMoney;
scrRez.rezWar = false;
Main.setState(Main.ST_REZ);
}
public function init(mc:MovieClip):void{
var s:SimpleButton;
boxVer = 0.5;
scrRez.elements = [];
scrRez.rezWar = false;
scrRez.oldMoney = Main.Profil.money;
trace("init_Engine");
rootMC_ = new MovieClip();
mc.addChild(rootMC_);
keyMan = KeyManager.create();
keyMan.initKeyManager(mc.stage);
Level = new WarField();
Level.init(rootMC_);
listMoovedObject = [];
contPanel = new PanelBatl();
mc.addChild(contPanel);
timerMC = contPanel["timMC"];
timTF = timerMC["txt"];
groupPL1 = new groupUnit(contPanel["mcBarLeft"], [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0]);
groupPL1.addWeaponFromArray(Main.Profil.shellArr);
groupPL2 = new groupUnit(contPanel["mcBarRight"], [0.3, 1.5, -0.8, 0, 0, 0.1, 0.5, 0.36, 0, 0, 1, 0.1, -0.16, 0, 0, 0, 0, 0, 1, 0]);
groupPL2.addWeaponFromArray(Main.Profil2.shellArr);
contCurWeap = (contPanel["contCurWeap"] as MovieClip);
panelWeap = new panelIcon();
panelWeap.create((contPanel["mcWeapCont"] as MovieClip)["cont"], null, null, 4, 4, setWeap, false);
panelWeap.addAllWeap();
s = (contPanel.getChildByName("btLeft") as SimpleButton);
s.addEventListener(MouseEvent.MOUSE_DOWN, leftBT);
s.addEventListener(MouseEvent.MOUSE_UP, endMove);
cStaticTipText.addText(s, "Move bionoid to left");
s = (contPanel.getChildByName("btRight") as SimpleButton);
s.addEventListener(MouseEvent.MOUSE_DOWN, rightBT);
s.addEventListener(MouseEvent.MOUSE_UP, endMove);
cStaticTipText.addText(s, "Move bionoid to right");
s = (contPanel.getChildByName("btJump") as SimpleButton);
s.addEventListener(MouseEvent.CLICK, jumpBT);
cStaticTipText.addText(s, "Jump bionoid");
s = (contPanel.getChildByName("weapBT") as SimpleButton);
s.addEventListener(MouseEvent.CLICK, changWeapBT);
cStaticTipText.addText(s, "Select weapon");
s = (contPanel.getChildByName("btExit") as SimpleButton);
s.addEventListener(MouseEvent.CLICK, exitBT);
s = (contPanel.getChildByName("btHelp") as SimpleButton);
s.addEventListener(MouseEvent.CLICK, showhelp);
cStaticTipText.addText(s, "Exit from fight");
s = (contPanel.getChildByName("hit2") as SimpleButton);
s.addEventListener(MouseEvent.CLICK, closeWindWeapon);
addUnits(groupPL1, Main.Profil.bionoidsArr, false);
addUnits(groupPL2, Main.Profil2.bionoidsArr, PVMmode);
if (PVMmode){
myCPU = new CPU(groupPL2, groupPL1);
};
tempUP = updateEF;
rootMC_.addEventListener(Event.ENTER_FRAME, EF);
rootMC_.addEventListener(MouseEvent.MOUSE_MOVE, setAim);
rootMC_.addEventListener(MouseEvent.CLICK, fireBTStart);
curGroup = groupPL2;
m_state = -1;
state = st_START;
indBal = new cBalisticInd();
indBal.init();
indASAB = new indAS();
Level.sky.addChild(indASAB);
indASAB.visible = false;
indASAB.y = 5;
if (!Main.Profil.HelpWarShow){
Main.Profil.HelpWarShow = true;
showhelp(null);
};
}
public function addDamag(x:int, y:int, r:int, p:int):void{
groupPL1.addDamag(x, y, r, p);
groupPL2.addDamag(x, y, r, p);
if (groupPL1.life <= 0){
EndGame(groupPL1);
};
if (groupPL2.life <= 0){
EndGame(groupPL2);
};
}
public function get state():int{
return (m_state);
}
public function leftBT(e:Event):void{
if (state < st_HOD){
return;
};
if (curGroup.curUnit.CPUdrive){
return;
};
curGroup.curUnit.moveLeft();
}
public function NoExit():void{
setPausa(false);
}
public function set state(val:int):void{
trace("setState", val);
if ((((val == m_state)) || ((m_state == st_FINISH)))){
return;
};
var timeArr:Array = [5, 60, 30, 1000, 310, 90];
state_timer = timeArr[val];
var tVis:Array = [false, false, false, true, false, true];
timerMC.visible = tVis[val];
if (val == st_START){
SoundConst._playSound(SoundConst.s_startGame);
};
m_state = val;
}
public function EF(e:Event):void{
tempUP();
}
public function updateEF(e:Event=null):void{
var arrNext:Array;
pausaInd = false;
if (state_timer > 0){
state_timer--;
timTF.text = String((int((state_timer / 30)) + 1));
if ((((state == st_HOD)) && ((state_timer < 150)))){
if (state_timer == 148){
SoundConst._playSound(SoundConst.s_EndTime);
};
if ((state_timer % 10) == 3){
timTF.visible = false;
};
if ((state_timer % 10) == 0){
timTF.visible = true;
};
};
if (state_timer <= 0){
if (state == st_FINISH){
Main.Profil.shellArr = groupPL1.arrWeapon;
Main.setState(Main.ST_REZ);
return;
};
arrNext = [st_HOD, st_FINISH, st_HOD, st_ENDHOD, st_HOD2, st_ENDHOD];
if ((((m_state == st_ENDHOD)) && (!(chekAllUnitState())))){
curGroup.curUnit.endMove();
inst.dispatchEvent(new Event("upUnit"));
inst.dispatchEvent(new Event("up"));
state_timer = 6;
return;
};
if ((((m_state == st_START)) || ((m_state == st_ENDHOD)))){
nextStep();
};
state = arrNext[state];
return;
};
};
if (state == st_START){
return;
};
if (state == st_FINISH){
inst.dispatchEvent(new Event("upUnit"));
inst.dispatchEvent(new Event("up"));
return;
};
if (curGroup.curUnit == null){
return;
};
keyMan.update(0);
if (state >= st_HOD){
if (!curGroup.curUnit.CPUdrive){
if (keyMan.keysContaintPressed([37, 65])){
curGroup.curUnit.moveLeft();
};
if (keyMan.keysContaintPressed([39, 68])){
curGroup.curUnit.moveRight();
};
if (keyMan.keysContaintPressed([38, 32, 87])){
curGroup.curUnit.moveJump();
};
if (keyMan.keyIsPressed(49)){
curGroup.curUnit.timeGrenad = 1;
};
if (keyMan.keyIsPressed(50)){
curGroup.curUnit.timeGrenad = 2;
};
if (keyMan.keyIsPressed(51)){
curGroup.curUnit.timeGrenad = 3;
};
if (keyMan.keyIsPressed(52)){
curGroup.curUnit.timeGrenad = 4;
};
if (keyMan.keyIsPressed(53)){
curGroup.curUnit.timeGrenad = 5;
};
if (keyMan.keysContaintReleased([37, 39, 65, 68])){
curGroup.curUnit.endMove();
};
};
};
if (curGroup.curUnit.CPUdrive){
myCPU.update();
};
inst.dispatchEvent(new Event("upUnit"));
inst.dispatchEvent(new Event("up"));
}
public function setPausa(b:Boolean):void{
trace("rezzzzza s su ", state, curGroup.curUnit.state);
if (b){
tempUP = new Function();
pausaInd = true;
rootMC_.removeEventListener(MouseEvent.MOUSE_MOVE, setAim);
rootMC_.removeEventListener(MouseEvent.CLICK, fireBTStart);
} else {
tempUP = updateEF;
rootMC_.addEventListener(MouseEvent.MOUSE_MOVE, setAim);
rootMC_.addEventListener(MouseEvent.CLICK, fireBTStart);
};
}
public function chekAllUnitState():Boolean{
return (((groupPL1.chekAllUnitState()) && (groupPL2.chekAllUnitState())));
}
public function fireBTStart(e:Event):void{
if (pausaInd){
return;
};
if (state != st_HOD){
return;
};
if (curGroup.curUnit.CPUdrive){
return;
};
fireCurUnit();
}
protected function scrHelpClose(e:Event):void{
helpscreen.hit.removeEventListener(MouseEvent.MOUSE_UP, scrHelpClose);
rootMC_.removeChild(helpscreen);
helpscreen = null;
setPausa(false);
}
protected function showhelp(e:Event):void{
if (pausaInd){
scrHelpClose(null);
return;
};
setPausa(true);
if (helpscreen != null){
scrHelpClose(null);
};
helpscreen = new helpscreenMC();
helpscreen.hit.addEventListener(MouseEvent.MOUSE_UP, scrHelpClose);
rootMC_.addChild(helpscreen);
if (groupPL2.arrUnit[0] != null){
helpscreen.hEB.x = groupPL2.arrUnit[0].startPos.x;
helpscreen.hEB.y = groupPL2.arrUnit[0].startPos.y;
};
if (groupPL1.arrUnit[0] != null){
helpscreen.hYB.x = groupPL1.arrUnit[0].startPos.x;
helpscreen.hYB.y = groupPL1.arrUnit[0].startPos.y;
};
}
public function addMoney(g:groupUnit, m:int, enemy:Boolean=true):void{
if ((((g == groupPL1)) && (enemy))){
Main.Profil2.money = (Main.Profil2.money + m);
} else {
Main.Profil.money = (Main.Profil.money + m);
};
}
public function endWeaponTime(n:int=1):void{
if (m_state == st_WEAPONTIME){
state_timer = n;
};
}
public function endMove(e:Event):void{
if (state < st_HOD){
return;
};
if (curGroup.curUnit.CPUdrive){
return;
};
curGroup.curUnit.endMove();
}
public function changWeapBT(e:Event):void{
if (state != st_HOD){
return;
};
if (curGroup.curUnit.CPUdrive){
return;
};
contPanel.gotoAndPlay(2);
}
public function EndGame(defeatGroup:groupUnit):void{
trace("endGame");
if (state == st_FINISH){
return;
};
state = st_FINISH;
scrRez.rezWar = ((defeatGroup == groupPL2) as Boolean);
}
protected function addUnits(g:groupUnit, a:Array, p:Boolean):void{
var ap:Array;
var u:unit;
var ddx:int;
if (g == groupPL1){
ap = Level.arrMyPosition;
} else {
ap = Level.arrEnPosition;
};
var i:int;
while (i < a.length) {
u = g.createUnit(a[i]);
ddx = int((Math.random() * ap.length));
u.setPosition(ap[ddx]);
ap.splice(ddx, 1);
u.CPUdrive = p;
i++;
};
}
public function fireStartAim(e:Event):void{
if (state < st_HOD){
return;
};
if (curGroup.curUnit.CPUdrive){
return;
};
if (curGroup.curUnit.state == unit.S_STAND){
curGroup.curUnit.state = unit.S_AIM;
curGroup.curUnit.setAimtoMouse(rootMC_.mouseX, rootMC_.mouseY);
};
}
public function fireCurUnit():void{
if (curGroup.curUnit.fire()){
indASAB.visible = false;
indBal.hide();
state = st_WEAPONTIME;
};
}
public function nextStep():void{
var box:cBox;
trace("nextStep");
indBal.hide();
inst.dispatchEvent(new Event("recalc"));
inst.dispatchEvent(new Event("upStep"));
SoundConst._playSound(SoundConst.S_nextStep);
if (groupPL1.life <= 0){
EndGame(groupPL1);
return;
};
if (groupPL2.life <= 0){
EndGame(groupPL2);
return;
};
curGroup.curUnit.endMove();
if (curGroup == groupPL1){
curGroup = groupPL2;
} else {
curGroup = groupPL1;
};
curGroup.getNextCurUnit();
reLoadWeapon();
curGroup.curUnit.selected();
setWeap(curGroup.curWeap);
addDamagBonus = curGroup.curUnit.param.demagBonus;
windSpeed = int((((Math.random() * 5) + (Math.random() * 5)) - 5));
contPanel["windMC"].gotoAndStop((Math.abs(windSpeed) + 1));
windSpeed = (windSpeed / 10);
if (windSpeed < 0){
contPanel["windMC"].scaleX = -1;
} else {
contPanel["windMC"].scaleX = 1;
};
boxVer = (boxVer - 0.1);
if (Math.random() > boxVer){
box = new cBox();
boxVer = 0.8;
};
setWeap(curGroup.curWeap);
stageScr.setColorMC(timerMC, curGroup.color);
unit.timerConst = 300;
if (curGroup.curUnit.CPUdrive){
myCPU.startFindTar(curGroup.curUnit);
unit.timerConst = 10;
};
if (curGroup.curUnit.param.laser){
indBal.showBio(curGroup.curUnit);
};
}
public function getEnemeGroup(g:groupUnit):groupUnit{
var gr:groupUnit = groupPL1;
if (g == gr){
gr = groupPL2;
};
return (gr);
}
public function reLoadWeapon():void{
curGroup.curUnit.recalcWeapons();
panelWeap.clear();
var i:int;
while (i < curGroup.curUnit.arrWeapon.length) {
if (curGroup.curUnit.arrWeapon[i].count > 0){
panelWeap.addIcon(curGroup.curUnit.arrWeapon[i]);
};
i++;
};
}
public function rightBT(e:Event):void{
if (state < st_HOD){
return;
};
if (curGroup.curUnit.CPUdrive){
return;
};
curGroup.curUnit.moveRight();
}
public function exitBT(e:Event):void{
setPausa(true);
var w:cWindYesNo = new cWindYesNo(rootMC_, "To leave fight? ", "You will leave fight but all collected by you will be lost", YesExit, NoExit);
}
public function closeWindWeapon(e:Event):void{
contPanel.gotoAndStop(1);
}
public function destroy():void{
var s:SimpleButton;
indBal.destroy();
if (PVMmode){
myCPU.destroy();
myCPU = null;
};
rootMC_.removeEventListener(Event.ENTER_FRAME, EF);
if (rootMC_.hasEventListener(MouseEvent.MOUSE_MOVE)){
rootMC_.removeEventListener(MouseEvent.MOUSE_MOVE, setAim);
};
if (rootMC_.hasEventListener(MouseEvent.CLICK)){
rootMC_.removeEventListener(MouseEvent.CLICK, fireBTStart);
};
keyMan.cleanup();
keyMan = null;
groupPL1.destroy();
groupPL2.destroy();
s = (contPanel.getChildByName("btLeft") as SimpleButton);
s.removeEventListener(MouseEvent.MOUSE_DOWN, leftBT);
s.removeEventListener(MouseEvent.MOUSE_UP, endMove);
s = (contPanel.getChildByName("btRight") as SimpleButton);
s.removeEventListener(MouseEvent.MOUSE_DOWN, rightBT);
s.removeEventListener(MouseEvent.MOUSE_UP, endMove);
s = (contPanel.getChildByName("btJump") as SimpleButton);
s.removeEventListener(MouseEvent.CLICK, jumpBT);
s = (contPanel.getChildByName("weapBT") as SimpleButton);
s.removeEventListener(MouseEvent.CLICK, changWeapBT);
s = (contPanel.getChildByName("btExit") as SimpleButton);
s.removeEventListener(MouseEvent.CLICK, exitBT);
s = (contPanel.getChildByName("btHelp") as SimpleButton);
s.removeEventListener(MouseEvent.CLICK, showhelp);
s = (contPanel.getChildByName("hit2") as SimpleButton);
s.removeEventListener(MouseEvent.CLICK, closeWindWeapon);
listMoovedObject = null;
Level.destroy();
Level = null;
rootMC_.parent.removeChild(rootMC_);
rootMC_ = null;
}
public function setWeap(w:weapons):void{
contPanel.gotoAndStop(1);
if (w.count <= 0){
curGroup.findFreeWeap();
w = curGroup.curWeap;
};
while (contCurWeap.numChildren > 0) {
contCurWeap.removeChildAt(0);
};
curGroup.setCurWeap(w);
var mm:MovieClip = new w.icon();
contCurWeap.addChild(mm);
mm.mouseEnabled = false;
mm.mouseChildren = false;
}
public static function findLineTrack(startPoint:Point, endPoint:Point, pixDrop:int=1, Unit:Boolean=false):Point{
var d:int = int(Math.max(Math.abs((endPoint.x - startPoint.x)), Math.abs((endPoint.y - startPoint.y))));
d = int((d / pixDrop));
var dx:Number = ((endPoint.x - startPoint.x) / d);
var dy:Number = ((endPoint.y - startPoint.y) / d);
var i:int;
while (i < d) {
if (((inst.Level.chekHit(startPoint)) || (((Unit) && (inst.Level.chekHitUnit(startPoint)))))){
startPoint.offset(-(dx), -(dy));
return (startPoint);
};
startPoint.offset(dx, dy);
i++;
};
return (endPoint);
}
public static function getDist(x:int, y:int, x1:int, y1:int):Number{
return (Math.sqrt((((x - x1) * (x - x1)) + ((y - y1) * (y - y1)))));
}
public static function chekLineTrack(startPoint:Point, endPoint:Point, pixDrop:int=1):Boolean{
return ((findLineTrack(startPoint, endPoint, pixDrop) == endPoint));
}
}
}//package war
Section 90
//groupUnit (war.groupUnit)
package war {
import flash.display.*;
import objGame.*;
import scr.*;
public class groupUnit {
public var arrUnit:Array;
protected var m_life:int;
protected var m_curUnit:int;
public var curWeap:weapons;
protected var maxlife:int;
public var color:Array;
public var arrWeapon:Array;
protected var barLife:cBar;
public function groupUnit(mcBar:MovieClip, _color:Array){
super();
barLife = new cBar();
barLife.init(mcBar);
arrUnit = [];
maxlife = 0;
arrWeapon = [];
var i:int;
while (i < weapons.allWeapArr.length) {
arrWeapon.push(weapons.getWeap(i));
arrWeapon[i].count = 0;
i++;
};
life = 0;
color = _color;
stageScr.setColorMC(mcBar, color);
}
public function set curUnit(value:unit):void{
var t:int = arrUnit.indexOf(value);
if (t >= 0){
m_curUnit = t;
};
}
public function showLifeBar():void{
var i:int;
while (i < arrUnit.length) {
if (arrUnit[i] != null){
arrUnit[i].barLive.visible = true;
};
i++;
};
}
public function addUnit(u:unit):void{
arrUnit.push(u);
maxlife = (maxlife + u.life);
barLife.max = maxlife;
life = (life + u.life);
u.group = this;
u.setColorMC(color);
m_curUnit = (arrUnit.length - 1);
}
public function addDamag(x:int, y:int, r:int, p:int):void{
var i:int;
while (i < arrUnit.length) {
if (arrUnit[i] != null){
arrUnit[i].addDamag(x, y, r, p);
};
i++;
};
if (m_life <= 0){
Engine.inst.EndGame(this);
};
}
public function setCurWeap(w:weapons):void{
curWeap = curUnit.arrWeapon[w.weaponNum];
curUnit.setWeapon(curWeap.armNum);
}
public function findFreeWeap():void{
if (curWeap != null){
if (curWeap.count > 0){
return;
};
};
var i:int;
while (i < curUnit.arrWeapon.length) {
if (curUnit.arrWeapon[i].count > 0){
curWeap = curUnit.arrWeapon[i];
return;
};
i++;
};
}
public function dellUnit(u:unit):void{
var t:int = arrUnit.indexOf(u);
arrUnit[t] = null;
}
public function createUnit(pu:paramUnit):unit{
var u:unit;
u = new unit();
u.group = this;
u.init(Engine.inst.Level.unitsMc, pu);
addUnit(u);
return (u);
}
public function get curUnit():unit{
if (arrUnit[m_curUnit] == null){
getNextCurUnit();
};
return (arrUnit[m_curUnit]);
}
public function hideLifeBar():void{
var i:int;
while (i < arrUnit.length) {
if (arrUnit[i] != null){
arrUnit[i].barLive.visible = false;
};
i++;
};
}
public function addWeaponFromArray(a:Array):void{
var w:weapons;
var i:int;
while (i < a.length) {
w = a[i];
arrWeapon[w.weaponNum].count = (arrWeapon[w.weaponNum].count + w.count);
i++;
};
if (arrWeapon[weapons.Missel.weaponNum].count < 10){
arrWeapon[weapons.Missel.weaponNum].count = 10;
};
if (arrWeapon[weapons.Grenada.weaponNum].count < 10){
arrWeapon[weapons.Grenada.weaponNum].count = 10;
};
if (arrWeapon[weapons.cGrenada.weaponNum].count < 5){
arrWeapon[weapons.cGrenada.weaponNum].count = 5;
};
}
public function addPart(o:myObj):void{
if (o.UNItype > 2000){
arrWeapon[(o as weapons).weaponNum].count++;
Engine.inst.reLoadWeapon();
} else {
if (this == Engine.inst.groupPL1){
scrRez.elements.push(o);
};
};
}
public function chekAllUnitState():Boolean{
var i:int;
while (i < arrUnit.length) {
if (((!((arrUnit[i] == null))) && (!((arrUnit[i].state == unit.S_STAND))))){
return (false);
};
i++;
};
return (true);
}
public function set life(val:int):void{
barLife.value = val;
m_life = val;
}
public function getNextCurUnit():unit{
var b:Boolean;
var i:int;
m_curUnit++;
if (m_curUnit >= arrUnit.length){
m_curUnit = 0;
};
if ((((arrUnit[m_curUnit] == null)) || ((arrUnit[m_curUnit].state == unit.S_DEAD)))){
b = true;
i = 0;
while (i < arrUnit.length) {
if (((!((arrUnit[i] == null))) && (!((arrUnit[i].state == unit.S_DEAD))))){
b = false;
};
i++;
};
if (b){
return (null);
};
getNextCurUnit();
};
return (curUnit);
}
public function get life():int{
return (m_life);
}
public function destroy():void{
var u:unit;
barLife.cleanup();
while (arrUnit.length > 0) {
if (arrUnit[0] != null){
arrUnit[0].destroy();
};
u = arrUnit.shift();
};
arrWeapon = null;
curWeap = null;
arrUnit = null;
color = null;
}
}
}//package war
Section 91
//paramUnit (war.paramUnit)
package war {
import objGame.*;
public class paramUnit extends elementsOfBio {
public var head:int;
public var body:int;
public var weaponArr:Array;
public var leg:int;
public var armL:int;
public var armR:int;
public var soundStep:String;
public function paramUnit(){
super();
weaponArr = [];
var i:int;
while (i < weapons.allWeapArr.length) {
weaponArr.push(weapons.allWeapArr[i].copy());
i++;
};
weaponArr[weapons.Udar.weaponNum].count = 999;
}
public function recalc():void{
var i:int;
var el:elementsOfBio;
weaponArr = [];
i = 0;
while (i < weapons.allWeapArr.length) {
weaponArr.push(weapons.allWeapArr[i].copy());
weaponArr[i].count = 0;
i++;
};
weaponArr[weapons.Udar.weaponNum].count = 999;
var n:String = name;
setDefoultBioPart();
name = n;
live = 0;
var a:Array = [body, head, leg, armL, armR];
i = 0;
while (i < a.length) {
el = new elementsOfBio();
el.createElement(i, a[i]);
addElement(el);
i++;
};
}
public function getClassHead():Class{
var a:Array = [Bp_head1, Bp_head3, Bp_head4, Bp_head5, Bp_head2, Bp_head6];
return (a[head]);
}
public function getClassBody():Class{
var a:Array = [Bp_body1, Bp_body2, Bp_body3, Bp_body4, Bp_body5];
return (a[body]);
}
public function getClassLeg():Class{
var a:Array = [Leg3, Leg1, Leg2];
var b:Array = [SoundConst.S_track, SoundConst.s_s_steps, SoundConst.s_s_weell];
soundStep = b[leg];
return (a[leg]);
}
protected function addElement(el:elementsOfBio):void{
live = (live + el.live);
if (el.weaponTypeInf >= 0){
weaponArr[el.weaponTypeInf].count = 999;
};
demagBonus = (demagBonus + el.demagBonus);
laser = ((laser) || (el.laser));
rengen = ((rengen) || (el.rengen));
selfDestroy = ((selfDestroy) || (el.selfDestroy));
regenSpeed = (regenSpeed + el.regenSpeed);
jetPack = ((jetPack) || (el.jetPack));
cost = (cost + el.cost);
if (el.speed > 0){
speed = el.speed;
};
if (el.jumpSpeed > 0){
jumpSpeed = el.jumpSpeed;
};
if (el.anglHills != 0){
anglHills = el.anglHills;
};
}
override public function toString():String{
return (((((((((String(leg) + "_") + String(body)) + "_") + String(head)) + "_") + String(armL)) + "_") + String(armR)));
}
public static function initDefault():paramUnit{
var d:paramUnit = new (paramUnit);
d.name = "Troll 1";
d.armL = 0;
d.armR = 2;
d.body = 0;
d.leg = 0;
d.head = 0;
d.live = 0;
d.cost = 0;
d.recalc();
return (d);
}
public static function createBioInString(s:String):paramUnit{
var a:Array = s.split("_");
var p:paramUnit = paramUnit.initDefault();
p.leg = int(a[0]);
p.body = int(a[1]);
p.head = int(a[2]);
p.armL = int(a[3]);
p.armR = int(a[4]);
p.recalc();
return (p);
}
}
}//package war
Section 92
//unit (war.unit)
package war {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import scr.*;
public class unit {
public var CPUdrive:Boolean;
protected var mcLHand:MovieClip;
protected var mcRHand:MovieClip;
public var normHodUnit:Boolean;
protected var firePointMC:Sprite;
protected var mcDead:MovieClip;
protected var mcRAim:MovieClip;
protected var m_timeGrenad:int;
protected var m_state:int;
protected var m_aimUngl:Number;
protected var mcAimTar:MovieClip;
protected var mcBody:MovieClip;
protected var selectedMC:MovieClip;
protected var s_timer:int;
public var group:groupUnit;
public var param:paramUnit;
protected var m_life:int;
public var startPos:Point;
protected var mc:MovieClip;
public var yPoint:int;
protected var numDX:Number;
protected var mcHead:MovieClip;
public var barLive:cBar;
protected var m_startAnimFrame:int;
protected var m_power:Number;
protected var mcJetFlame:MovieClip;
public var temp:int;
public var arrWeapon:Array;
protected var root:MovieClip;
protected var mcLAim:MovieClip;
protected var speedX:Number;
protected var speedY:Number;
protected var m_EndAnimFrame:int;
public var xPoint:int;
public static const radiusSelfDestroy:int = 50;
protected static const SCALE_KOOF:Number = 0.3;
public static const powerSelfDestroy:int = 40;
public static const S_STAND:int = 0;
public static const S_DEAD:int = 4;
public static const S_INFLY:int = 3;
public static const shiftCentrY:int = -20;
public static const S_inSHOTING:int = 6;
public static const S_AIM:int = 5;
public static const S_JUMP:int = 2;
public static const S_MOVE:int = 1;
public static var timerConst:int = 10;
public function unit(){
super();
}
public function destroy():void{
Engine.inst.removeEventListener("upUnit", update);
Engine.inst.removeEventListener("recalc", recalc);
barLive.cleanup();
group.dellUnit(this);
group = null;
mcBody = null;
mcHead = null;
mcRHand = null;
mcLHand = null;
mcRAim = null;
mcLAim = null;
mcAimTar = null;
firePointMC = null;
root.removeChild(mc);
root = null;
mc = null;
mcDead = null;
}
public function upStep(e:Event):void{
if (state == S_DEAD){
return;
};
barLive.visible = true;
if ((((m_life < param.live)) && ((param.regenSpeed > 0)))){
life = (life + param.regenSpeed);
};
selectedMC.visible = false;
}
public function recalc(e:Event):void{
if (state == S_DEAD){
return;
};
barLive.visible = true;
move();
}
private function inFly():void{
var ricVect:Point;
var v:Number;
normHodUnit = true;
speedY = (speedY + Engine.gravi);
s_timer++;
startPos = new Point(mc.x, mc.y);
var endP:Point = startPos.clone();
endP.offset(speedX, speedY);
startPos = Engine.findLineTrack(startPos, endP, 2);
if (startPos != endP){
ricVect = Engine.inst.Level.getRicoshetVector(startPos);
if ((((ricVect.y < param.anglHills)) && ((speedY > 0)))){
state = S_STAND;
s_timer = 0;
speedX = 0;
speedY = 0;
numDX = 0;
startPos = Engine.inst.Level.findFreePoint(startPos);
} else {
v = (Math.sqrt(((speedX * speedX) + (speedY * speedY))) * 0.5);
speedX = (ricVect.x * v);
speedY = (ricVect.y * v);
};
};
if ((((((startPos.x >= 800)) || ((startPos.x < 0)))) || ((startPos.y > 595)))){
dead();
s_timer = 1;
return;
};
mc.x = startPos.x;
mc.y = startPos.y;
}
public function init(r:MovieClip, _param:paramUnit):void{
CPUdrive = false;
normHodUnit = true;
_param.recalc();
root = r;
param = _param;
param.recalc();
var c:Class = param.getClassLeg();
mc = (new (c) as MovieClip);
mc.scaleX = SCALE_KOOF;
mc.scaleY = SCALE_KOOF;
r.addChild(mc);
barLive = new cBar();
barLive.init(mc.liveMC);
barLive.max = _param.live;
numDX = 0;
startPos = new Point();
mcBody = mc.pBody;
selectedMC = mc.selMC;
mcHead = mc.pHead;
mcRAim = mcBody.pRHand;
mcLAim = mcBody.pLHand;
mcRHand = mcRAim.part;
mcLHand = mcLAim.part;
firePointMC = (mcLHand.firePoint as Sprite);
mcAimTar = mcLAim.aim;
mcJetFlame = mcBody.mcJet;
mcJetFlame.visible = false;
mc.gotoAndStop(1);
selectedMC.visible = false;
var clbp:Class = param.getClassBody();
var mb:MovieClip = new (clbp);
WarField.clearMC(mcBody["cont"]);
(mcBody["cont"] as MovieClip).addChild(mb);
WarField.mc2pic(mcBody["cont"]);
clbp = param.getClassHead();
mb = new (clbp);
WarField.clearMC(mcHead);
mcHead.addChild(mb);
mcHead.cacheAsBitmap = true;
mcLHand.gotoAndStop((param.armL + 1));
mcRHand.cacheAsBitmap = true;
mcLHand.cacheAsBitmap = true;
Power = 10;
mcAimTar.visible = false;
Aim = 110;
Engine.inst.addEventListener("upUnit", update);
Engine.inst.addEventListener("recalc", recalc);
Engine.inst.addEventListener("upStep", upStep);
m_life = param.live;
barLive.visible = false;
barLive.value = m_life;
mcLAim.stop();
mcRAim.stop();
state = S_STAND;
}
public function jetMove(b:Boolean):void{
mcJetFlame.visible = b;
if (!b){
endFire();
numDX = 0;
};
var dx:Number = (mc.parent.mouseX - mc.x);
var dy:Number = (mc.parent.mouseY - mc.y);
m_power = (int((Math.sqrt((((dx * dx) + (dy * dy)) + 100)) / 2)) - 1);
Aim = ((Math.atan2(dy, dx) * 57) + 90);
addSpeed(((Math.cos(aimFromWorld()) * m_power) / 45), ((Math.sin(aimFromWorld()) * m_power) / 45));
}
public function setWeapon(n:int):void{
mcLHand.gotoAndStop(n);
}
public function setAimtoMouse(x:Number, y:Number):void{
var xP:Point = centerPoint;
xPoint = int(x);
yPoint = int(y);
var dx:Number = (x - xP.x);
var dy:Number = (y - xP.y);
Power = (int((Math.sqrt((((dx * dx) * 8) + ((dy * dy) * 8))) / 2)) - 1);
Aim = ((Math.atan2(dy, dx) * 57.296) + 90);
if (state == S_STAND){
state = S_AIM;
};
}
public function set state(value:int):void{
if (m_state == S_DEAD){
return;
};
m_state = value;
mcAimTar.visible = false;
switch (m_state){
case S_AIM:
mcAimTar.visible = true;
case S_inSHOTING:
m_startAnimFrame = 1;
m_EndAnimFrame = 2;
break;
case S_STAND:
m_startAnimFrame = 1;
m_EndAnimFrame = (mc.currentLabels[1].frame - 1);
break;
case S_MOVE:
m_startAnimFrame = mc.currentLabels[1].frame;
m_EndAnimFrame = (mc.currentLabels[2].frame - 1);
break;
case S_INFLY:
m_startAnimFrame = mc.currentLabels[3].frame;
m_EndAnimFrame = (m_startAnimFrame + 1);
break;
case S_JUMP:
m_startAnimFrame = mc.currentLabels[2].frame;
m_EndAnimFrame = (mc.currentLabels[3].frame - 1);
break;
case S_DEAD:
break;
};
if ((((mc.currentFrame < m_startAnimFrame)) || ((mc.currentFrame > m_EndAnimFrame)))){
mc.gotoAndStop(m_startAnimFrame);
};
}
public function get Aim():int{
return (m_aimUngl);
}
public function addSpeed(dx:Number, dy:Number):void{
numDX = (numDX + dx);
speedX = int(numDX);
speedY = (speedY + dy);
if (state == S_DEAD){
return;
};
if (state != S_INFLY){
state = S_INFLY;
};
}
public function get timeGrenad():int{
return (m_timeGrenad);
}
public function fire():Boolean{
var c:Class;
var b:balistic;
if ((((state == S_STAND)) || ((state == S_AIM)))){
trace("fire ", group.curWeap.name);
UpdateBDLevel();
mcAimTar.visible = false;
c = group.curWeap.classWeap;
b = new (c);
s_timer = (group.curWeap.timerWeap * 2);
b.startFromUnit(this);
state = S_inSHOTING;
mcLHand.gotoAndStop((param.armL + 1));
if (arrWeapon[group.curWeap.weaponNum].count < 900){
group.arrWeapon[group.curWeap.weaponNum].count--;
};
group.findFreeWeap();
return (true);
};
return (false);
}
public function get centerPoint():Point{
return (mc.parent.globalToLocal(mc.localToGlobal(new Point(0, -90))));
}
public function aimFromWorld():Number{
var u:Number = (Aim - 90);
return ((u / 57.3));
}
public function getNumDamag(x:int, y:int, r:int, p:int):int{
var dam:Number = (p + Engine.addDamagBonus);
if (mc == null){
return (0);
};
var d:int = int(Engine.getDist(x, y, centerPoint.x, centerPoint.y));
if (d > (r * 2)){
return (0);
};
if (d > r){
dam = (dam * (1 - ((d - r) / r)));
};
if (d < 12){
dam = (p + Engine.addDamagBonus);
};
dam = Math.max(0, (dam - param.defensBonus));
return (Math.min(m_life, dam));
}
public function set timeGrenad(val:int):void{
var m:TextBubl;
if ((((((group.curWeap.UNItype == 2002)) || ((group.curWeap.UNItype == 2003)))) || ((group.curWeap.UNItype == 2012)))){
m = new TextBubl();
Engine.inst.Level.sky.addChild(m);
m.x = mc.x;
m.y = mc.y;
m.mcBubl.txt.text = (("Grenade time set to " + String(val)) + " sec.");
};
m_timeGrenad = val;
}
public function set Aim(n:int):void{
if (n > 360){
n = (n - 360);
};
if (n < 0){
n = (n + 360);
};
m_aimUngl = n;
if (n < 180){
mc.scaleX = -(SCALE_KOOF);
} else {
mc.scaleX = SCALE_KOOF;
};
mcLAim.gotoAndStop((90 - int((Math.abs((180 - n)) / 2))));
}
public function endMove():void{
if (state == S_AIM){
state = S_STAND;
};
if (state == S_MOVE){
s_timer = 1;
};
trace("END MOVE", state);
}
protected function deadUpdate():void{
var b:MovieClip;
var endP:Point;
mc.visible = false;
mcDead.x = mc.x;
mcDead.y = mc.y;
s_timer--;
if (s_timer <= 0){
Engine.inst.addMoney(group, int((param.cost / 15)));
mc.visible = false;
destroy();
return;
};
if (s_timer == 10){
if (param.selfDestroy){
b = new boomPlasma();
Engine.inst.Level.sky.addChild(b);
SoundConst._playSound(SoundConst.S_plasmaboom);
b.x = mc.x;
b.y = mc.y;
b = null;
Engine.inst.Level.addCircl_mask(mc.x, mc.y, radiusSelfDestroy);
Engine.inst.addDamag(mc.x, mc.y, radiusSelfDestroy, powerSelfDestroy);
};
};
if (mc.y < 600){
speedY = (speedY + Engine.gravi);
startPos = new Point(mc.x, mc.y);
endP = new Point((mc.x + speedX), (mc.y + speedY));
startPos = Engine.findLineTrack(startPos, endP, 2);
mc.x = startPos.x;
mc.y = startPos.y;
};
}
public function UpdateBDLevel():void{
mc.visible = false;
Engine.inst.groupPL1.hideLifeBar();
Engine.inst.groupPL2.hideLifeBar();
Engine.inst.Level.createBDUnitsPosition();
mc.visible = true;
}
public function chekHitMC(mcp:MovieClip):Boolean{
return (mc.hitTestObject(mcp));
}
public function dead():void{
if (Engine.inst.curGroup.curUnit == this){
Engine.inst.state = Engine.st_ENDHOD;
};
if (m_life > 0){
group.life = (group.life - m_life);
};
m_life = 0;
s_timer = 25;
state = S_DEAD;
mcDead = new biocaput();
stageScr.setColorMC(mcDead, group.color);
mc.parent.addChild(mcDead);
mcDead.x = mc.x;
mcDead.y = mc.y;
}
public function AimDown():void{
Aim = (Aim - 4);
}
public function setColorMC(matrix:Array):void{
stageScr.setColorMC(mc, matrix);
}
public function moveLeft():void{
if (state == S_AIM){
state = S_STAND;
};
if (state != S_STAND){
return;
};
s_timer = timerConst;
speedX = -(param.speed);
speedY = 0;
SoundConst._playSound(param.soundStep);
state = S_MOVE;
}
protected function updateAnim():void{
mc.nextFrame();
if (mc.currentFrame > m_EndAnimFrame){
mc.gotoAndPlay(m_startAnimFrame);
};
}
public function get state():int{
return (m_state);
}
public function addDamag(x:int, y:int, r:int, p:int):void{
if (m_state == S_DEAD){
return;
};
var dam:Number = getNumDamag(x, y, r, p);
if (dam < 1){
return;
};
trace("getdemage", dam);
var a:Number = Math.atan2((centerPoint.y - y), (centerPoint.x - x));
speedX = (speedX + Math.max(-4.5, Math.min(4.5, ((dam * Math.cos(a)) / 2))));
speedY = (speedY + Math.max(-4.5, Math.min(4.5, ((dam * Math.sin(a)) / 2))));
state = S_INFLY;
var eff:MovieClip = new bloodMC();
stageScr.setColorMC(eff, group.color);
Engine.inst.Level.sky.addChild(eff);
if (Math.random() > 0.5){
eff.scaleX = -1;
};
eff.x = mc.x;
eff.y = mc.y;
life = (life - dam);
}
public function selected():void{
recalcWeapons();
m_timeGrenad = 3;
var s:MovieClip = new selectedUnit();
Engine.inst.Level.sky.addChild(s);
s.x = mc.x;
s.y = mc.y;
selectedMC.visible = true;
group.findFreeWeap();
mc.parent.setChildIndex(mc, (mc.parent.numChildren - 1));
}
public function moveJump():void{
if (state == S_AIM){
state = S_STAND;
};
if (state != S_STAND){
return;
};
speedX = ((-(Math.abs(mc.scaleX)) / mc.scaleX) * param.speed);
speedY = -(param.jumpSpeed);
state = S_JUMP;
SoundConst._playSound(SoundConst.S_JumpSound);
s_timer = 10;
}
public function AimUp():void{
Aim = (Aim + 4);
}
public function setPosition(p:Point):void{
startPos = Engine.inst.Level.findFreePoint(p);
mc.x = startPos.x;
mc.y = startPos.y;
if (startPos.y > 600){
destroy();
};
}
public function recalcWeapons():void{
arrWeapon = [];
var i:int;
while (i < param.weaponArr.length) {
arrWeapon.push(param.weaponArr[i].copy());
arrWeapon[i].count = (arrWeapon[i].count + group.arrWeapon[i].count);
i++;
};
group.findFreeWeap();
}
public function endFire():void{
if (state == S_inSHOTING){
s_timer = 1;
};
}
public function update(e:Event):void{
normHodUnit = true;
updateAnim();
switch (state){
case S_STAND:
return;
case S_MOVE:
move();
break;
case S_INFLY:
inFly();
break;
case S_JUMP:
s_timer--;
if (s_timer <= 0){
state = S_INFLY;
};
break;
case S_DEAD:
deadUpdate();
break;
case S_inSHOTING:
s_timer--;
if (s_timer <= 0){
state = S_STAND;
};
break;
};
}
public function set Power(n:int):void{
m_power = Math.max(0, Math.min(n, 100));
mcAimTar.gotoAndStop(m_power);
mcAimTar.visible = true;
}
public function moveRight():void{
if (state == S_AIM){
state = S_STAND;
};
if (state != S_STAND){
return;
};
s_timer = timerConst;
speedX = param.speed;
SoundConst._playSound(param.soundStep);
speedY = 0;
state = S_MOVE;
}
private function move():void{
var xx:Number;
s_timer--;
if (Math.abs(speedX) > 0.01){
xx = ((-(speedX) / Math.abs(speedX)) * SCALE_KOOF);
if (mc.scaleX != xx){
mc.scaleX = xx;
};
};
startPos = new Point(mc.x, mc.y);
var nextPoint:Point = startPos.clone();
nextPoint.offset(int(speedX), int(speedY));
nextPoint = Engine.inst.Level.findFreePoint(nextPoint);
if (Point.distance(startPos, nextPoint) < 1){
s_timer = 0;
};
if ((((Math.abs((startPos.y - nextPoint.y)) > Math.abs((speedX * param.anglMove)))) || (Engine.inst.Level.chekHit(centerPoint)))){
if ((nextPoint.y - startPos.y) > 10){
trace("obryv");
s_timer = 1;
state = S_INFLY;
nextPoint = startPos.clone();
nextPoint.offset(speedX, speedY);
speedY = 0;
} else {
normHodUnit = false;
nextPoint = Engine.inst.Level.findFreePoint(startPos.clone());
};
};
mc.x = nextPoint.x;
mc.y = nextPoint.y;
if (s_timer <= 0){
speedX = 0;
speedY = 0;
state = S_STAND;
};
startPos = nextPoint;
if ((((((startPos.x >= 800)) || ((startPos.x < 0)))) || ((startPos.y > 595)))){
dead();
s_timer = 1;
return;
};
}
public function stepBack():void{
if (state == S_AIM){
state = S_STAND;
};
var x:int = startPos.x;
if (mc.scaleX > 0){
x = (x + param.speed);
} else {
x = (x - param.speed);
};
if (Engine.inst.Level.chekHit(new Point(x, startPos.y))){
startPos = new Point(x, startPos.y);
};
}
public function get FirePoint():Point{
if (firePointMC == null){
return (new Point(0, 0));
};
var p:Point = new Point(firePointMC.x, firePointMC.y);
p = firePointMC.parent.localToGlobal(p);
p = Engine.inst.Level.sky.globalToLocal(p);
return (p);
}
public function faceToLeft():Boolean{
return ((mc.scaleX > 0));
}
public function get Power():int{
return (m_power);
}
public function set life(val:int):void{
val = Math.max(0, Math.min(val, param.live));
if (mc == null){
return;
};
var m:TextBubl = new TextBubl();
Engine.inst.Level.sky.addChild(m);
m.x = mc.x;
m.y = mc.y;
m.mcBubl.txt.text = String((val - m_life));
if (val > m_life){
m.mcBubl.txt.textColor = 0x7D00;
};
group.life = (group.life + (val - m_life));
m_life = val;
barLive.value = m_life;
if (m_life == 0){
dead();
};
}
public function get life():int{
return (m_life);
}
}
}//package war
Section 93
//WarField (war.WarField)
package war {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
public class WarField {
protected var hitPoint:Array;
protected var picZona:MovieClip;
protected var View2Zona:MovieClip;
protected var hitZona:MovieClip;
public var sky:MovieClip;
protected var root:MovieClip;
public var unitsMc:MovieClip;
protected var bdPic:BitmapData;
public var viewZona:MovieClip;
protected var bdUnitPosition:BitmapData;
protected var pic2Zona:MovieClip;
protected var bdHit:BitmapData;
protected var mcBG:MovieClip;
public var arrMyPosition:Array;
public var arrEnPosition:Array;
protected static const countHitPoint:int = 32;
public static var numLev:int = 1;
public function WarField(){
super();
}
public function getRicoshetVector(startP:Point):Point{
var ricVect:Point = new Point(0, 0);
var tv:Point = new Point(0, 0);
var i:int;
while (i < countHitPoint) {
tv = hitPoint[i].clone();
tv.offset(startP.x, startP.y);
if (chekHitUnit(tv)){
ricVect.offset(-(hitPoint[i].x), -(hitPoint[i].y));
};
i++;
};
ricVect.normalize(1);
return (ricVect);
}
public function fillPic(classBitmap:Class):void{
var b:BitmapData = new BitmapData(10, 10, true);
b = new classBitmap(100, 100);
var mat:Matrix = new Matrix();
picZona.graphics.beginBitmapFill(b, mat, true, true);
picZona.graphics.drawRect(0, 0, 800, 600);
picZona.graphics.endFill();
}
public function chekHit(p:Point):Boolean{
if ((((p.y < 0)) || ((p.x < 0)))){
return (false);
};
return (!((bdPic.getPixel32(int(p.x), int(p.y)) == 0)));
}
public function chekHitXY(x:int, y:int):Boolean{
if ((((y < 0)) || ((x < 0)))){
return (false);
};
return (!((bdPic.getPixel32(x, y) == 0)));
}
public function init(mc:MovieClip):void{
root = mc;
arrMyPosition = [];
arrEnPosition = [];
var du:Number = ((Math.PI * 2) / 16);
hitPoint = new Array(countHitPoint);
var i:int;
while (i < countHitPoint) {
hitPoint[i] = new Point((-(Math.sin((du * i))) * 10), (Math.cos((du * i)) * 10));
i++;
};
mcBG = new bg();
root.addChild(mcBG);
mcBG.gotoAndStop(numLev);
viewZona = new MovieClip();
root.addChild(viewZona);
View2Zona = new MovieClip();
sky = new MovieClip();
unitsMc = new MovieClip();
unitsMc.graphics.beginFill(1, 0.1);
unitsMc.graphics.drawCircle(0, 0, 1);
unitsMc.graphics.endFill();
pic2Zona = new MovieClip();
picZona = new MovieClip();
viewZona.addChild(pic2Zona);
viewZona.addChild(View2Zona);
View2Zona.addChild(picZona);
View2Zona.addChild(unitsMc);
viewZona.addChild(sky);
createLevel();
}
public function createBitmapData(mc:MovieClip):BitmapData{
var clipContentsBound:Rectangle = mc.getBounds(viewZona);
var bitmapData:BitmapData = new BitmapData(clipContentsBound.width, clipContentsBound.height, true, 0);
var mat:Matrix = new Matrix();
bitmapData.draw(mc, mat);
return (bitmapData);
}
public function findFreePoint(p:Point):Point{
if (chekHit(p)){
while (chekHit(p)) {
p.y = (p.y - 2);
};
} else {
while (!(chekHit(p))) {
p.y = (p.y + 2);
if (p.y >= bdPic.height){
p.y = (p.y + 12);
break;
};
};
p.y = (p.y - 2);
};
return (p);
}
public function destroy():void{
clearMC(pic2Zona);
clearMC(picZona);
viewZona.removeChild(sky);
viewZona.removeChild(pic2Zona);
viewZona.removeChild(View2Zona);
View2Zona.removeChild(picZona);
View2Zona.removeChild(unitsMc);
pic2Zona = null;
View2Zona = null;
picZona = null;
unitsMc = null;
sky = null;
}
public function cropPic(mc:MovieClip):void{
bdHit = createBitmapData(mc);
bdPic = createBitmapData(picZona);
bdPic.copyChannel(bdHit, new Rectangle(0, 0, picZona.width, picZona.height), new Point(0, 0), BitmapDataChannel.RED, BitmapDataChannel.ALPHA);
clearMC(picZona);
var bitmap:Bitmap = new Bitmap(bdPic);
picZona.addChild(bitmap);
}
public function createLevel():void{
var m:MovieClip;
var p:Point;
var mmm:MovieClip = new pic1();
mmm.gotoAndStop(numLev);
picZona.addChild(mmm);
var i:int;
while (i < 10) {
m = mmm[("e" + String(i))];
p = new Point(m.x, m.y);
arrEnPosition.push(p);
mmm.removeChild(m);
m = mmm[("m" + String(i))];
p = new Point(m.x, m.y);
arrMyPosition.push(p);
mmm.removeChild(m);
i++;
};
mc2pic(picZona);
redrawPic2();
bdPic = createBitmapData(picZona);
bdUnitPosition = bdPic.clone();
}
public function chekHitUnit(p:Point):Boolean{
return (!((bdUnitPosition.getPixel32(int(p.x), int(p.y)) == 0)));
}
public function createBDUnitsPosition():void{
Engine.inst.groupPL1.hideLifeBar();
Engine.inst.groupPL2.hideLifeBar();
bdUnitPosition = createBitmapData(View2Zona);
}
public function addCircl_mask(x:Number, y:Number, r:Number):void{
bdPic = createBitmapData(picZona);
hitZona = new MovieClip();
hitZona.graphics.lineStyle(0, 0, 0);
hitZona.graphics.beginFill(0xFFFFFF, 1);
hitZona.graphics.drawRect(0, 0, ((r * 2) + 2), ((r * 2) + 2));
hitZona.graphics.endFill();
bdHit = createBitmapData(hitZona);
bdHit.copyChannel(bdPic, new Rectangle(((x - r) - 1), ((y - r) - 1), ((r * 2) + 2), ((r * 2) + 2)), new Point(0, 0), BitmapDataChannel.ALPHA, BitmapDataChannel.RED);
hitZona.graphics.clear();
var bitmap:Bitmap = new Bitmap(bdHit);
hitZona.addChild(bitmap);
var hi1:MovieClip = new MovieClip();
hi1.graphics.lineStyle(0, 0, 0);
hi1.graphics.beginFill(0, 1);
hi1.graphics.drawCircle((r + 1), (r + 1), r);
hi1.graphics.endFill();
hitZona.addChild(hi1);
bdHit = createBitmapData(hitZona);
bdPic.copyChannel(bdHit, new Rectangle(0, 0, bdHit.width, bdHit.height), new Point(((x - r) - 1), ((y - r) - 1)), BitmapDataChannel.RED, BitmapDataChannel.ALPHA);
clearMC(picZona);
bitmap = new Bitmap(bdPic);
picZona.addChild(bitmap);
createBDUnitsPosition();
redrawPic2();
Engine.inst.dispatchEvent(new Event("recalc"));
}
public function redrawPic2():void{
}
public static function clearMC(mc:MovieClip):void{
mc.graphics.clear();
while (mc.numChildren > 0) {
mc.removeChildAt(0);
};
}
public static function mc2pic(spr:MovieClip):void{
var clipContentsBound:Rectangle = spr.getBounds(spr);
var bitmapData:BitmapData = new BitmapData(clipContentsBound.width, clipContentsBound.height, true, 0);
var mat:Matrix = new Matrix();
mat.translate(-(clipContentsBound.x), -(clipContentsBound.y));
bitmapData.draw(spr, mat);
while (spr.numChildren > 0) {
spr.removeChildAt(0);
};
spr.graphics.clear();
var bitmap:Bitmap = new Bitmap(bitmapData, PixelSnapping.ALWAYS, false);
bitmap.x = clipContentsBound.x;
bitmap.y = clipContentsBound.y;
spr.addChild(bitmap);
}
}
}//package war
Section 94
//AirStrakeMissel (AirStrakeMissel)
package {
import flash.display.*;
public dynamic class AirStrakeMissel extends MovieClip {
}
}//package
Section 95
//allSound (allSound)
package {
import flash.display.*;
public dynamic class allSound extends MovieClip {
public function allSound(){
addFrameScript(0, this.frame1);
}
function frame1(){
stop();
stop();
}
}
}//package
Section 96
//balisticPoint (balisticPoint)
package {
import flash.display.*;
public dynamic class balisticPoint extends MovieClip {
}
}//package
Section 97
//bg (bg)
package {
import flash.display.*;
public dynamic class bg extends MovieClip {
}
}//package
Section 98
//biocaput (biocaput)
package {
public dynamic class biocaput extends singlEffect {
}
}//package
Section 99
//Bionoid4vann (Bionoid4vann)
package {
import flash.display.*;
public dynamic class Bionoid4vann extends MovieClip {
public var head:MovieClip;
public var body:MovieClip;
public var arm:MovieClip;
public var leg:MovieClip;
}
}//package
Section 100
//bloodMC (bloodMC)
package {
public dynamic class bloodMC extends singlEffect {
}
}//package
Section 101
//boom3MEGA (boom3MEGA)
package {
public dynamic class boom3MEGA extends singlEffect {
}
}//package
Section 102
//boomAtom (boomAtom)
package {
public dynamic class boomAtom extends singlEffect {
}
}//package
Section 103
//boomBullet (boomBullet)
package {
public dynamic class boomBullet extends singlEffect {
}
}//package
Section 104
//boomMacro (boomMacro)
package {
public dynamic class boomMacro extends singlEffect {
}
}//package
Section 105
//boomMicro (boomMicro)
package {
public dynamic class boomMicro extends singlEffect {
}
}//package
Section 106
//boomPlasma (boomPlasma)
package {
public dynamic class boomPlasma extends singlEffect {
}
}//package
Section 107
//boxSecret (boxSecret)
package {
import flash.display.*;
public dynamic class boxSecret extends MovieClip {
public function boxSecret(){
addFrameScript(0, this.frame1);
}
function frame1(){
stop();
}
}
}//package
Section 108
//Bp_body1 (Bp_body1)
package {
import flash.display.*;
public dynamic class Bp_body1 extends MovieClip {
}
}//package
Section 109
//Bp_body2 (Bp_body2)
package {
import flash.display.*;
public dynamic class Bp_body2 extends MovieClip {
}
}//package
Section 110
//Bp_body3 (Bp_body3)
package {
import flash.display.*;
public dynamic class Bp_body3 extends MovieClip {
}
}//package
Section 111
//Bp_body4 (Bp_body4)
package {
import flash.display.*;
public dynamic class Bp_body4 extends MovieClip {
}
}//package
Section 112
//Bp_body5 (Bp_body5)
package {
import flash.display.*;
public dynamic class Bp_body5 extends MovieClip {
}
}//package
Section 113
//Bp_head1 (Bp_head1)
package {
import flash.display.*;
public dynamic class Bp_head1 extends MovieClip {
}
}//package
Section 114
//Bp_head2 (Bp_head2)
package {
import flash.display.*;
public dynamic class Bp_head2 extends MovieClip {
}
}//package
Section 115
//Bp_head3 (Bp_head3)
package {
import flash.display.*;
public dynamic class Bp_head3 extends MovieClip {
}
}//package
Section 116
//Bp_head4 (Bp_head4)
package {
import flash.display.*;
public dynamic class Bp_head4 extends MovieClip {
}
}//package
Section 117
//Bp_head5 (Bp_head5)
package {
import flash.display.*;
public dynamic class Bp_head5 extends MovieClip {
}
}//package
Section 118
//Bp_head6 (Bp_head6)
package {
import flash.display.*;
public dynamic class Bp_head6 extends MovieClip {
}
}//package
Section 119
//cardiogram (cardiogram)
package {
public dynamic class cardiogram extends randomFrameMC {
}
}//package
Section 120
//cBar (cBar)
package {
import flash.display.*;
public class cBar {
protected var _val:Number;
public var max:int;
public var mc:MovieClip;
public var autoUpdate:Boolean;
public function cBar(){
super();
}
public function set value(val:Number):void{
_val = Math.min(max, Math.max(0, val));
if (autoUpdate){
mc.gotoAndStop((int(((100 / max) * _val)) + 1));
};
}
public function cleanup():void{
mc = null;
}
public function get value():Number{
return (_val);
}
public function get visible():Boolean{
return (mc.visible);
}
public function init(_mc:MovieClip):void{
mc = _mc;
max = 100;
value = 0;
autoUpdate = true;
}
public function update():void{
var r:int = (mc.currentFrame + int(((int(((100 / max) * _val)) - mc.currentFrame) / 2)));
mc.gotoAndStop((r + 1));
}
public function set visible(val:Boolean):void{
mc.visible = val;
}
}
}//package
Section 121
//Claster (Claster)
package {
import flash.display.*;
public dynamic class Claster extends MovieClip {
}
}//package
Section 122
//ClasterBomb (ClasterBomb)
package {
import flash.display.*;
public dynamic class ClasterBomb extends MovieClip {
}
}//package
Section 123
//cWindYesNo (cWindYesNo)
package {
import flash.events.*;
import flash.display.*;
import flash.text.*;
public class cWindYesNo {
protected var sYes:SimpleButton;
protected var func:Function;
protected var funcNo:Function;
protected var sNo:SimpleButton;
protected var mc:YesNoWindAnim;
protected var textF:TextField;
protected var textH:TextField;
public function cWindYesNo(root:MovieClip, headline:String, text:String, yesFunction:Function, nofunct:Function=null){
super();
mc = new YesNoWindAnim();
root.addChild(mc);
trace(mc);
var b:MovieClip = mc["mcWind"];
sYes = b["btYes"];
sNo = b["btNo"];
textF = b["txt"];
textH = b["head"];
textF.text = text;
textH.text = headline;
func = yesFunction;
funcNo = nofunct;
sYes.addEventListener(MouseEvent.CLICK, clicYes);
sNo.addEventListener(MouseEvent.CLICK, clicNo);
mc.gotoAndPlay(2);
}
protected function clicYes(e:Event):void{
func();
destroy();
}
public function destroy():void{
sYes.removeEventListener(MouseEvent.CLICK, clicYes);
sNo.removeEventListener(MouseEvent.CLICK, clicNo);
func = null;
sYes = null;
sNo = null;
textF = null;
textH = null;
mc.parent.removeChild(mc);
mc = null;
}
protected function clicNo(e:Event):void{
if (funcNo != null){
funcNo();
};
destroy();
}
}
}//package
Section 124
//dinamitMC (dinamitMC)
package {
import flash.display.*;
public dynamic class dinamitMC extends MovieClip {
}
}//package
Section 125
//Grenade (Grenade)
package {
import flash.display.*;
public dynamic class Grenade extends MovieClip {
}
}//package
Section 126
//handpunch (handpunch)
package {
public dynamic class handpunch extends singlEffect {
}
}//package
Section 127
//helpscreenMC (helpscreenMC)
package {
import flash.display.*;
public dynamic class helpscreenMC extends MovieClip {
public var hYB:MovieClip;
public var hit:hitBT;
public var hEB:MovieClip;
}
}//package
Section 128
//hitBT (hitBT)
package {
import flash.display.*;
public dynamic class hitBT extends SimpleButton {
}
}//package
Section 129
//iconAbomb (iconAbomb)
package {
import flash.display.*;
public dynamic class iconAbomb extends MovieClip {
}
}//package
Section 130
//iconAirStrike (iconAirStrike)
package {
import flash.display.*;
public dynamic class iconAirStrike extends MovieClip {
}
}//package
Section 131
//iconAll (iconAll)
package {
import flash.display.*;
import flash.text.*;
public dynamic class iconAll extends MovieClip {
public var mcSel:MovieClip;
public var iconMc:MovieClip;
public var txt:TextField;
public var hit:hitBT;
public var podlMC:MovieClip;
public var infiMc:MovieClip;
}
}//package
Section 132
//iconBigGun (iconBigGun)
package {
import flash.display.*;
public dynamic class iconBigGun extends MovieClip {
}
}//package
Section 133
//iconBody1 (iconBody1)
package {
import flash.display.*;
public dynamic class iconBody1 extends MovieClip {
}
}//package
Section 134
//iconBody2 (iconBody2)
package {
import flash.display.*;
public dynamic class iconBody2 extends MovieClip {
}
}//package
Section 135
//iconBody3 (iconBody3)
package {
import flash.display.*;
public dynamic class iconBody3 extends MovieClip {
}
}//package
Section 136
//iconBody4 (iconBody4)
package {
import flash.display.*;
public dynamic class iconBody4 extends MovieClip {
}
}//package
Section 137
//iconBody5 (iconBody5)
package {
import flash.display.*;
public dynamic class iconBody5 extends MovieClip {
}
}//package
Section 138
//iconCBomb (iconCBomb)
package {
import flash.display.*;
public dynamic class iconCBomb extends MovieClip {
}
}//package
Section 139
//iconDinamit (iconDinamit)
package {
import flash.display.*;
public dynamic class iconDinamit extends MovieClip {
}
}//package
Section 140
//iconDisco (iconDisco)
package {
import flash.display.*;
public dynamic class iconDisco extends MovieClip {
}
}//package
Section 141
//iconGrenada (iconGrenada)
package {
import flash.display.*;
public dynamic class iconGrenada extends MovieClip {
}
}//package
Section 142
//iconGun1 (iconGun1)
package {
import flash.display.*;
public dynamic class iconGun1 extends MovieClip {
}
}//package
Section 143
//iconGun2 (iconGun2)
package {
import flash.display.*;
public dynamic class iconGun2 extends MovieClip {
}
}//package
Section 144
//iconGun3 (iconGun3)
package {
import flash.display.*;
public dynamic class iconGun3 extends MovieClip {
}
}//package
Section 145
//iconGun4 (iconGun4)
package {
import flash.display.*;
public dynamic class iconGun4 extends MovieClip {
}
}//package
Section 146
//iconGun5 (iconGun5)
package {
import flash.display.*;
public dynamic class iconGun5 extends MovieClip {
}
}//package
Section 147
//iconGun6 (iconGun6)
package {
import flash.display.*;
public dynamic class iconGun6 extends MovieClip {
}
}//package
Section 148
//iconGun7 (iconGun7)
package {
import flash.display.*;
public dynamic class iconGun7 extends MovieClip {
}
}//package
Section 149
//iconGun8 (iconGun8)
package {
import flash.display.*;
public dynamic class iconGun8 extends MovieClip {
}
}//package
Section 150
//iconHead1 (iconHead1)
package {
import flash.display.*;
public dynamic class iconHead1 extends MovieClip {
}
}//package
Section 151
//iconHead2 (iconHead2)
package {
import flash.display.*;
public dynamic class iconHead2 extends MovieClip {
}
}//package
Section 152
//iconHead3 (iconHead3)
package {
import flash.display.*;
public dynamic class iconHead3 extends MovieClip {
}
}//package
Section 153
//iconHead4 (iconHead4)
package {
import flash.display.*;
public dynamic class iconHead4 extends MovieClip {
}
}//package
Section 154
//iconHead5 (iconHead5)
package {
import flash.display.*;
public dynamic class iconHead5 extends MovieClip {
}
}//package
Section 155
//iconHead6 (iconHead6)
package {
import flash.display.*;
public dynamic class iconHead6 extends MovieClip {
}
}//package
Section 156
//iconJetPack (iconJetPack)
package {
import flash.display.*;
public dynamic class iconJetPack extends MovieClip {
}
}//package
Section 157
//iconLaserGun (iconLaserGun)
package {
import flash.display.*;
public dynamic class iconLaserGun extends MovieClip {
}
}//package
Section 158
//iconLeg1 (iconLeg1)
package {
import flash.display.*;
public dynamic class iconLeg1 extends MovieClip {
}
}//package
Section 159
//iconLeg2 (iconLeg2)
package {
import flash.display.*;
public dynamic class iconLeg2 extends MovieClip {
}
}//package
Section 160
//iconLeg3 (iconLeg3)
package {
import flash.display.*;
public dynamic class iconLeg3 extends MovieClip {
}
}//package
Section 161
//iconMashinGun (iconMashinGun)
package {
import flash.display.*;
public dynamic class iconMashinGun extends MovieClip {
}
}//package
Section 162
//iconMissel (iconMissel)
package {
import flash.display.*;
public dynamic class iconMissel extends MovieClip {
}
}//package
Section 163
//iconPBomb (iconPBomb)
package {
import flash.display.*;
public dynamic class iconPBomb extends MovieClip {
}
}//package
Section 164
//iconPlasmaGun (iconPlasmaGun)
package {
import flash.display.*;
public dynamic class iconPlasmaGun extends MovieClip {
}
}//package
Section 165
//iconTeleport (iconTeleport)
package {
import flash.display.*;
public dynamic class iconTeleport extends MovieClip {
}
}//package
Section 166
//iconUdar (iconUdar)
package {
import flash.display.*;
public dynamic class iconUdar extends MovieClip {
}
}//package
Section 167
//indAS (indAS)
package {
import flash.display.*;
public dynamic class indAS extends MovieClip {
}
}//package
Section 168
//intro39Games (intro39Games)
package {
import flash.display.*;
public dynamic class intro39Games extends MovieClip {
public function intro39Games(){
addFrameScript(249, this.frame250);
}
function frame250(){
stop();
}
}
}//package
Section 169
//introScr (introScr)
package {
import scr.*;
public dynamic class introScr extends scrIntro {
}
}//package
Section 170
//laserBeem (laserBeem)
package {
import flash.display.*;
public dynamic class laserBeem extends MovieClip {
public var mc:MovieClip;
}
}//package
Section 171
//Leg1 (Leg1)
package {
import flash.display.*;
public dynamic class Leg1 extends MovieClip {
public var pHead:MovieClip;
public var pBody:MovieClip;
public var liveMC:MovieClip;
public var selMC:MovieClip;
}
}//package
Section 172
//Leg2 (Leg2)
package {
import flash.display.*;
public dynamic class Leg2 extends MovieClip {
public var pHead:MovieClip;
public var pBody:MovieClip;
public var liveMC:MovieClip;
public var selMC:MovieClip;
}
}//package
Section 173
//Leg3 (Leg3)
package {
import flash.display.*;
public dynamic class Leg3 extends MovieClip {
public var pHead:MovieClip;
public var pBody:MovieClip;
public var liveMC:MovieClip;
public var selMC:MovieClip;
}
}//package
Section 174
//Main (Main)
package {
import flash.events.*;
import flash.display.*;
import flash.net.*;
public class Main extends Sprite {
public static const ST_MP:int = 7;
public static const ST_SHOP:int = 2;
public static const gameName:String = "Bionoids_1.1";
public static const ST_MAP:int = 5;
public static const ST_LAB:int = 1;
public static const ST_WAR:int = 3;
public static const ST_START:int = 0;
public static const ST_HTP:int = 6;
public static const ST_MPShop:int = 8;
public static const ST_REZ:int = 4;
public static const ST_Intro:int = 9;
protected static var _curState:int;
public static var Profil2:profil;
public static var instMC:MovieClip;
public static var Profil:profil;
public static var curLevel:int = 1;
protected static var timerEF:int;
public static var curState:Object;
public function Main():void{
super();
if (stage){
init();
} else {
addEventListener(Event.ADDED_TO_STAGE, init);
};
}
private function init(e:Event=null):void{
MochiBot.track(this, "735c39f8");
removeEventListener(Event.ADDED_TO_STAGE, init);
Profil = new profil();
Profil.createDefault();
instMC = new rootMC();
this.addChild(instMC);
var inrom:MovieClip = (instMC["introMC"] as MovieClip);
inrom.addChild(new intro39Games());
var bts:SimpleButton = instMC["btSound"]["hit"];
SoundConst.init();
bts.addEventListener(MouseEvent.CLICK, hitSoundBt);
var s:SimpleButton = (instMC["hitIntro"] as SimpleButton);
s.addEventListener(MouseEvent.CLICK, btClic);
}
protected function hitSoundBt(e:Event):void{
if (instMC["btSound"].currentFrame == 1){
SoundConst._soundOff();
} else {
SoundConst._soundOn();
};
instMC["btSound"].play();
trace(SoundConst._isSoundOn());
}
protected static function efGotoState(e:Event):void{
var a:Array;
timerEF++;
if (timerEF > 10){
SoundConst._playSound(SoundConst.s_Gas_Stvorka);
curState.destroy();
instMC.removeEventListener(Event.ENTER_FRAME, efGotoState);
a = ["lbStart", "lbLab", "lbMag", "lbWar", "lbRez", "lbMap", "lbHTP", "lbMP", "lbMPshop", "lbIntro"];
instMC.gotoAndStop(a[_curState]);
if (_curState == ST_WAR){
SoundConst._playInGameMusic();
} else {
SoundConst._playIntroMusic();
};
};
}
public static function setState(n:int):void{
if (n == _curState){
return;
};
_curState = n;
instMC["splScreen"].gotoAndPlay(2);
timerEF = 0;
SoundConst._playSound(SoundConst.s_Gas_Stvorka);
instMC.addEventListener(Event.ENTER_FRAME, efGotoState);
}
public static function btClic(e:Event):void{
SoundConst._buttonClick();
var req:URLRequest = new URLRequest("http://www.39games.com/");
navigateToURL(req, "_blank");
}
}
}//package
Section 175
//mcAbomb (mcAbomb)
package {
import flash.display.*;
public dynamic class mcAbomb extends MovieClip {
}
}//package
Section 176
//mcBullet (mcBullet)
package {
import flash.display.*;
public dynamic class mcBullet extends MovieClip {
}
}//package
Section 177
//mcPlasmaBomb (mcPlasmaBomb)
package {
import flash.display.*;
public dynamic class mcPlasmaBomb extends MovieClip {
}
}//package
Section 178
//mcPlasmaBulet (mcPlasmaBulet)
package {
import flash.display.*;
public dynamic class mcPlasmaBulet extends MovieClip {
}
}//package
Section 179
//mcTipText (mcTipText)
package {
import flash.display.*;
import flash.text.*;
public dynamic class mcTipText extends MovieClip {
public var txt:TextField;
public function mcTipText(){
addFrameScript(0, this.frame1);
}
function frame1(){
trace("showText");
stop();
}
}
}//package
Section 180
//medpac (medpac)
package {
import flash.display.*;
public dynamic class medpac extends MovieClip {
public function medpac(){
addFrameScript(0, this.frame1);
}
function frame1(){
stop();
}
}
}//package
Section 181
//MisselMC (MisselMC)
package {
import flash.display.*;
public dynamic class MisselMC extends MovieClip {
}
}//package
Section 182
//MochiBot (MochiBot)
package {
import flash.display.*;
import flash.net.*;
import flash.system.*;
public dynamic class MochiBot extends Sprite {
public function MochiBot(){
super();
}
public static function track(parent:Sprite, tag:String):MochiBot{
if (Security.sandboxType == "localWithFile"){
return (null);
};
var self:MochiBot = new (MochiBot);
parent.addChild(self);
Security.allowDomain("*");
Security.allowInsecureDomain("*");
var server:String = "http://core.mochibot.com/my/core.swf";
var lv:URLVariables = new URLVariables();
lv["sb"] = Security.sandboxType;
lv["v"] = Capabilities.version;
lv["swfid"] = tag;
lv["mv"] = "8";
lv["fv"] = "9";
var url:String = self.root.loaderInfo.loaderURL;
if (url.indexOf("http") == 0){
lv["url"] = url;
} else {
lv["url"] = "local";
};
var req:URLRequest = new URLRequest(server);
req.contentType = "application/x-www-form-urlencoded";
req.method = URLRequestMethod.POST;
req.data = lv;
var loader:Loader = new Loader();
self.addChild(loader);
loader.load(req);
return (self);
}
}
}//package
Section 183
//PanelBatl (PanelBatl)
package {
import flash.display.*;
public dynamic class PanelBatl extends MovieClip {
public var mcBarLeft:MovieClip;
public var mcWeapCont:MovieClip;
public var hit2:hitBT;
public var contCurWeap:MovieClip;
public var weapBT:SimpleButton;
public var btExit:SimpleButton;
public var windMC:MovieClip;
public var btJump:SimpleButton;
public var btRight:SimpleButton;
public var timMC:MovieClip;
public var btHelp:SimpleButton;
public var bt39:SimpleButton;
public var btLeft:SimpleButton;
public var mcBarRight:MovieClip;
public function PanelBatl(){
addFrameScript(0, this.frame1, 9, this.frame10);
}
function frame10(){
stop();
}
function frame1(){
stop();
}
}
}//package
Section 184
//pic1 (pic1)
package {
import flash.display.*;
public dynamic class pic1 extends MovieClip {
public var m0:MovieClip;
public var m2:MovieClip;
public var m4:MovieClip;
public var m6:MovieClip;
public var m7:MovieClip;
public var e0:MovieClip;
public var m9:MovieClip;
public var e2:MovieClip;
public var e3:MovieClip;
public var e4:MovieClip;
public var e5:MovieClip;
public var e6:MovieClip;
public var m8:MovieClip;
public var e1:MovieClip;
public var e9:MovieClip;
public var m3:MovieClip;
public var m5:MovieClip;
public var e7:MovieClip;
public var e8:MovieClip;
public var m1:MovieClip;
}
}//package
Section 185
//Preloader (Preloader)
package {
import flash.events.*;
import flash.display.*;
import flash.text.*;
import flash.net.*;
import flash.utils.*;
public class Preloader extends MovieClip {
protected var p:MovieClip;
protected var prT:TextField;
protected var tim:int;
public function Preloader(){
super();
addEventListener(Event.ENTER_FRAME, checkFrame);
loaderInfo.addEventListener(ProgressEvent.PROGRESS, progress);
p = new scrPreload();
this.addChild(p);
p.x = 400;
p.y = 300;
prT = (p["per"] as TextField);
var s:SimpleButton = (p["bt39"] as SimpleButton);
s.addEventListener(MouseEvent.CLICK, btClic);
prT.text = "0%";
tim = 0;
}
protected function checkFrame(e:Event):void{
tim++;
var t:int = int(((loaderInfo.bytesLoaded / loaderInfo.bytesTotal) * 200));
t = Math.min(t, tim);
prT.text = (String(int((t / 2))) + " %");
if (p.currentFrame != t){
p.gotoAndStop(t);
};
if (t > 199){
removeEventListener(Event.ENTER_FRAME, checkFrame);
startup();
};
}
protected function startup():void{
stop();
loaderInfo.removeEventListener(ProgressEvent.PROGRESS, progress);
var mainClass:Class = (getDefinitionByName("Main") as Class);
addChild((new (mainClass) as DisplayObject));
var s:SimpleButton = (p["bt39"] as SimpleButton);
s.removeEventListener(MouseEvent.CLICK, btClic);
removeChild(p);
p = null;
}
protected function btClic(e:Event):void{
var req:URLRequest = new URLRequest("http://www.39games.com/");
navigateToURL(req, "_blank");
}
protected function progress(e:ProgressEvent):void{
}
}
}//package
Section 186
//profil (profil)
package {
import objGame.*;
import war.*;
import flash.net.*;
public class profil {
public var money:int;
public var HelpLabShow:Boolean;
public var name:String;
public var shellArr:Array;
public var HelpShopShow:Boolean;
public var openLevels:int;
public var bionoidsArr:Array;
public var score:int;
public var partArr:Array;
public var HelpWarShow:Boolean;
public function profil(){
super();
bionoidsArr = [];
partArr = [];
shellArr = [];
name = "anonim";
money = 0;
openLevels = 0;
score = 0;
}
public function delPart(e:myObj):void{
var i:int;
trace("del prof", e.name);
if (e.UNItype < 2000){
i = 0;
while (i < partArr.length) {
if (partArr[i].UNItype == e.UNItype){
partArr[i].count = (partArr[i].count - Math.max(e.count, 1));
trace("del prof", e.name, partArr[i].count);
break;
};
i++;
};
} else {
i = 0;
while (i < shellArr.length) {
if (shellArr[i].UNItype == e.UNItype){
shellArr[i].count = (shellArr[i].count - Math.max(e.count, 1));
break;
};
i++;
};
};
}
public function createDefault():void{
bionoidsArr = [];
partArr = [];
shellArr = [];
name = "anonim";
money = 100;
openLevels = 0;
score = 0;
HelpLabShow = false;
HelpShopShow = false;
HelpWarShow = false;
var bp:paramUnit = paramUnit.initDefault();
bionoidsArr.push(bp);
bp = paramUnit.initDefault();
bionoidsArr.push(bp);
var bpart:elementsOfBio = new elementsOfBio();
bpart.createElement(0, 1);
partArr.push(bpart);
var a:weapons = (weapons.cGrenada.copy() as weapons);
a.count = 5;
shellArr.push(a);
a = (weapons.Missel.copy() as weapons);
a.count = 10;
shellArr.push(a);
a = (weapons.Grenada.copy() as weapons);
a.count = 10;
shellArr.push(a);
a = (weapons.Dinamit.copy() as weapons);
a.count = 2;
shellArr.push(a);
}
public function load():void{
var bio:elementsOfBio;
var we:weapons;
var bionoid:paramUnit;
bionoidsArr = [];
partArr = [];
shellArr = [];
name = "anonim";
money = 0;
openLevels = 0;
score = 0;
Main.curLevel = 0;
var d:SharedObject = SharedObject.getLocal(Main.gameName);
if (d.data["name"] != null){
name = d.data["name"];
} else {
name = "anonimus";
};
openLevels = d.data["openLevels"];
money = d.data["money"];
score = d.data["score"];
HelpLabShow = d.data["HelpLabShow"];
HelpShopShow = d.data["HelpShopShow"];
HelpWarShow = d.data["HelpWarShow"];
var len:int = d.data["partCount"];
var i:int;
while (i < len) {
bio = elementsOfBio.createInString(d.data[("part_" + String(i))]);
bio.count = d.data[("PartCount_" + String(i))];
trace("loadBio", bio.name, bio.count);
addPart(bio);
i++;
};
len = d.data["shellCount"];
i = 0;
while (i < len) {
we = weapons.getWeap(int(d.data[("shell_" + String(i))]));
we.count = int(d.data[("shellCount_" + String(i))]);
addPart(we);
trace("load ", we.name, we.count, d.data[("shellCount_" + String(i))]);
i++;
};
len = d.data["bionoidCount"];
trace(this, "load bio-", len);
i = 0;
while (i < len) {
bionoid = paramUnit.createBioInString(d.data[("bionoids_" + String(i))]);
bionoidsArr.push(bionoid);
i++;
};
if (d.data["curLevel"] != null){
Main.curLevel = d.data["curLevel"];
};
}
public function addPart(e:myObj):void{
var i:int;
if (e.UNItype < 2000){
i = 0;
while (i < partArr.length) {
if (partArr[i].UNItype == e.UNItype){
partArr[i].count = (partArr[i].count + e.count);
return;
};
i++;
};
partArr.push(e);
} else {
i = 0;
while (i < shellArr.length) {
if (shellArr[i].UNItype == e.UNItype){
shellArr[i].count = (shellArr[i].count + e.count);
return;
};
i++;
};
shellArr.push(e);
};
}
public function chekMoney(cost:int, bye:Boolean=false):Boolean{
if (cost > money){
SoundConst._playSound(SoundConst.S_disable);
return (false);
};
if (bye){
money = (money - cost);
};
return (true);
}
public function save():void{
var d:SharedObject = SharedObject.getLocal(Main.gameName);
d.data["name"] = name;
d.data["openLevels"] = openLevels;
d.data["money"] = money;
d.data["score"] = score;
d.data["HelpLabShow"] = HelpLabShow;
d.data["HelpShopShow"] = HelpShopShow;
d.data["HelpWarShow"] = HelpWarShow;
d.data["partCount"] = partArr.length;
var i:int;
while (i < partArr.length) {
d.data[("part_" + String(i))] = partArr[i].toString();
d.data[("PartCount_" + String(i))] = partArr[i].count;
i++;
};
d.data["shellCount"] = shellArr.length;
i = 0;
while (i < shellArr.length) {
d.data[("shell_" + String(i))] = shellArr[i].weaponNum;
d.data[("shellCount_" + String(i))] = shellArr[i].count;
i++;
};
d.data["bionoidCount"] = bionoidsArr.length;
trace("save bio-", bionoidsArr.length);
i = 0;
while (i < bionoidsArr.length) {
d.data[("bionoids_" + String(i))] = bionoidsArr[i].toString();
i++;
};
d.data["curLevel"] = Main.curLevel;
d.flush();
trace("rezzzzza 1 o c ", openLevels, Main.curLevel);
}
}
}//package
Section 187
//randomFrameMC (randomFrameMC)
package {
import flash.events.*;
import flash.display.*;
public class randomFrameMC extends MovieClip {
public function randomFrameMC(){
super();
this.addEventListener(Event.ENTER_FRAME, init);
}
protected function init(e:Event):void{
gotoAndPlay(int((1 + (Math.random() * this.totalFrames))));
removeEventListener(Event.ENTER_FRAME, init);
}
}
}//package
Section 188
//rootMC (rootMC)
package {
import flash.display.*;
public dynamic class rootMC extends MovieClip {
public var introMC:MovieClip;
public var hitIntro:hitBT;
public var splScreen:MovieClip;
public var btSound:MovieClip;
public function rootMC(){
addFrameScript(251, this.frame252);
}
function frame252(){
stop();
}
}
}//package
Section 189
//scr2MultPlayMC (scr2MultPlayMC)
package {
import scr.*;
public dynamic class scr2MultPlayMC extends scrMPShop {
}
}//package
Section 190
//scrHTPmc (scrHTPmc)
package {
import scr.*;
public dynamic class scrHTPmc extends scrHTP {
}
}//package
Section 191
//scrLabMc (scrLabMc)
package {
import scr.*;
public dynamic class scrLabMc extends scrLab {
}
}//package
Section 192
//scrMagMc (scrMagMc)
package {
import scr.*;
public dynamic class scrMagMc extends scrMag {
}
}//package
Section 193
//scrMapMc (scrMapMc)
package {
import scr.*;
public dynamic class scrMapMc extends scrMap {
}
}//package
Section 194
//scrMultPlayMC (scrMultPlayMC)
package {
import scr.*;
public dynamic class scrMultPlayMC extends scrMP {
}
}//package
Section 195
//scrPreload (scrPreload)
package {
import flash.display.*;
import flash.text.*;
public dynamic class scrPreload extends MovieClip {
public var bt39:SimpleButton;
public var per:TextField;
}
}//package
Section 196
//scrRezMc (scrRezMc)
package {
import scr.*;
public dynamic class scrRezMc extends scrRez {
public function scrRezMc(){
addFrameScript(47, this.frame48);
}
function frame48(){
stop();
}
}
}//package
Section 197
//scrStartMc (scrStartMc)
package {
import scr.*;
public dynamic class scrStartMc extends scrStart {
}
}//package
Section 198
//scrWarMc (scrWarMc)
package {
import scr.*;
public dynamic class scrWarMc extends scrWar {
}
}//package
Section 199
//selectedUnit (selectedUnit)
package {
public dynamic class selectedUnit extends singlEffect {
}
}//package
Section 200
//singlEffect (singlEffect)
package {
import flash.events.*;
import flash.display.*;
public class singlEffect extends MovieClip {
public function singlEffect(){
super();
addEventListener(Event.ENTER_FRAME, up);
}
protected function up(e:Event):void{
if (currentFrame == totalFrames){
removeEventListener(Event.ENTER_FRAME, up);
parent.removeChild(this);
};
}
}
}//package
Section 201
//Smoke (Smoke)
package {
public dynamic class Smoke extends singlEffect {
}
}//package
Section 202
//SmokeAirStrike (SmokeAirStrike)
package {
public dynamic class SmokeAirStrike extends singlEffect {
}
}//package
Section 203
//SoundConst (SoundConst)
package {
import flash.display.*;
import flash.media.*;
import sound.*;
public class SoundConst {
public var m_engineLoop:SoundChannel;
public static const S_intro:String = "intro.wav";
public static const S_laser:String = "laser.wav";
public static const s_s_weell:String = "s_weell.wav";
public static const S_setPart:String = "setPart.wav";
public static const S_box:String = "box.wav";
public static const s_mgShot:String = "mgShot.wav";
public static const S_abomb_boom:String = "abomb_boom.wav";
public static const s_ASFly:String = "ASFly.wav";
public static const S_plasmaboom:String = "plasmaboom.wav";
public static const S_button:String = "button.wav";
public static const S_inGame:String = "inGame.wav";
public static const s_s_steps:String = "s_steps.wav";
public static const S_BGshot:String = "BGshot.wav";
public static const S_kick:String = "kick.wav";
public static const s_startGame:String = "startGame.wav";
public static const S_plasmaGun:String = "plasmaGun.wav";
public static const S_mina:String = "mina.wav";
public static const s_Gas_Stvorka:String = "Gas_Stvorka.wav";
public static const S_abomb_fly:String = "abomb_fly.wav";
public static const S_nextStep:String = "nextStep.wav";
public static const S_boom:String = "boom.wav";
public static const S_money:String = "money.wav";
public static const s_EndTime:String = "endTime.wav";
public static const S_track:String = "track.wav";
public static const S_shot:String = "shot.wav";
public static const S_jetPack:String = "jetPack.wav";
public static const s_missel:String = "missel.wav";
public static const S_grShot:String = "grShot.wav";
public static const S_JumpSound:String = "JumpSound.wav";
public static const MUSIC_1:String = "intro.wav";
public static const MUSIC_2:String = "inGame.wav";
public static const S_timeBomb:String = "timeBomb.wav";
public static const S_disable:String = "disable.wav";
public static const S_saw:String = "saw.wav";
protected static var curBGSound:String = "intro.wav";
public static var MUSIC_VOLUME:Number = 1;
public static var soundManager:SoundManager;
public static var SOUND_VOLUME:Number = 2;
public static var _instance:SoundConst;
public function SoundConst(){
super();
_instance = this;
init();
}
public function get volume():Number{
return (SOUND_VOLUME);
}
public function set volume(value:Number):void{
SOUND_VOLUME = value;
MUSIC_VOLUME = (value * 0.6);
setVolume();
}
public static function _playSound(s:String):void{
if (soundManager == null){
init();
};
soundManager.playSound(s);
}
public static function init():void{
SOUND_VOLUME = 0.5;
MUSIC_VOLUME = 0.1;
var m:MovieClip = new allSound();
soundManager = new SoundManager();
soundManager.addSound(MUSIC_1);
soundManager.addSound(MUSIC_2);
soundManager.addSound(S_timeBomb);
soundManager.addSound(S_grShot);
soundManager.addSound(S_setPart);
soundManager.addSound(S_button);
soundManager.addSound(S_jetPack);
soundManager.addSound(S_BGshot);
soundManager.addSound(S_plasmaGun);
soundManager.addSound(S_plasmaboom);
soundManager.addSound(S_boom);
soundManager.addSound(S_abomb_boom);
soundManager.addSound(S_abomb_fly);
soundManager.addSound(S_nextStep);
soundManager.addSound(S_disable);
soundManager.addSound(S_track);
soundManager.addSound(S_money);
soundManager.addSound(S_shot);
soundManager.addSound(S_saw);
soundManager.addSound(S_kick);
soundManager.addSound(S_inGame);
soundManager.addSound(S_intro);
soundManager.addSound(S_mina);
soundManager.addSound(S_laser);
soundManager.addSound(S_JumpSound);
soundManager.addSound(S_box);
soundManager.addSound(s_mgShot);
soundManager.addSound(s_missel);
soundManager.addSound(s_s_weell);
soundManager.addSound(s_s_steps);
soundManager.addSound(s_ASFly);
soundManager.addSound(s_startGame);
soundManager.addSound(s_Gas_Stvorka);
soundManager.addSound(s_EndTime);
setVolume();
}
public static function _playBGMusic():void{
soundManager.playBackSound(curBGSound);
}
public static function setVolume():void{
soundManager.setVolume(MUSIC_1, MUSIC_VOLUME);
soundManager.setVolume(MUSIC_2, MUSIC_VOLUME);
soundManager.setVolume(S_timeBomb, SOUND_VOLUME);
soundManager.setVolume(S_grShot, SOUND_VOLUME);
soundManager.setVolume(S_setPart, SOUND_VOLUME);
soundManager.setVolume(S_button, SOUND_VOLUME);
soundManager.setVolume(S_jetPack, SOUND_VOLUME);
soundManager.setVolume(S_BGshot, SOUND_VOLUME);
soundManager.setVolume(S_plasmaGun, SOUND_VOLUME);
soundManager.setVolume(S_plasmaboom, SOUND_VOLUME);
soundManager.setVolume(S_boom, SOUND_VOLUME);
soundManager.setVolume(S_abomb_boom, SOUND_VOLUME);
soundManager.setVolume(S_abomb_fly, SOUND_VOLUME);
soundManager.setVolume(S_nextStep, SOUND_VOLUME);
soundManager.setVolume(S_disable, SOUND_VOLUME);
soundManager.setVolume(S_track, SOUND_VOLUME);
soundManager.setVolume(S_money, SOUND_VOLUME);
soundManager.setVolume(S_shot, SOUND_VOLUME);
soundManager.setVolume(S_saw, SOUND_VOLUME);
soundManager.setVolume(S_kick, SOUND_VOLUME);
soundManager.setVolume(S_inGame, SOUND_VOLUME);
soundManager.setVolume(S_intro, SOUND_VOLUME);
soundManager.setVolume(S_mina, SOUND_VOLUME);
soundManager.setVolume(S_laser, SOUND_VOLUME);
soundManager.setVolume(S_JumpSound, SOUND_VOLUME);
soundManager.setVolume(S_box, SOUND_VOLUME);
soundManager.setVolume(s_mgShot, SOUND_VOLUME);
soundManager.setVolume(s_missel, SOUND_VOLUME);
soundManager.setVolume(s_s_weell, SOUND_VOLUME);
soundManager.setVolume(s_s_steps, SOUND_VOLUME);
soundManager.setVolume(s_ASFly, SOUND_VOLUME);
soundManager.setVolume(s_startGame, SOUND_VOLUME);
soundManager.setVolume(s_Gas_Stvorka, SOUND_VOLUME);
soundManager.setVolume(s_EndTime, SOUND_VOLUME);
}
public static function _playIntroMusic():void{
if (soundManager == null){
init();
};
soundManager.playBackSound(MUSIC_1);
curBGSound = MUSIC_1;
}
public static function _soundOn():void{
soundManager.soundOn = true;
_playBGMusic();
}
public static function _playInGameMusic():void{
soundManager.playBackSound(MUSIC_2);
curBGSound = MUSIC_2;
}
public static function _soundOff():void{
soundManager.soundOn = false;
_stopBGSound();
}
public static function _stopBGSound():void{
soundManager.stopBackSound();
}
public static function _buttonClick():void{
soundManager.playSound(S_button);
}
public static function _isSoundOn():Boolean{
return (soundManager.soundOn);
}
}
}//package
Section 204
//strMc (strMc)
package {
import flash.display.*;
import flash.text.*;
public dynamic class strMc extends MovieClip {
public var txt:TextField;
public var hit:hitBT;
public var mcSel:MovieClip;
public var mcStar:MovieClip;
}
}//package
Section 205
//teleportMC (teleportMC)
package {
public dynamic class teleportMC extends singlEffect {
}
}//package
Section 206
//TextBubl (TextBubl)
package {
public dynamic class TextBubl extends singlEffect {
}
}//package
Section 207
//TipTextMC (TipTextMC)
package {
import flash.display.*;
import flash.text.*;
public dynamic class TipTextMC extends MovieClip {
public var iSpec:MovieClip;
public var iLife:MovieClip;
public var iWeap:MovieClip;
public var txt:TextField;
public var txtname:TextField;
public var iDef:MovieClip;
public var iCost:TextField;
}
}//package
Section 208
//YesNoWindAnim (YesNoWindAnim)
package {
import flash.display.*;
public dynamic class YesNoWindAnim extends MovieClip {
public var mcWind:MovieClip;
public function YesNoWindAnim(){
addFrameScript(0, this.frame1, 4, this.frame5);
}
function frame5(){
stop();
}
function frame1(){
stop();
}
}
}//package