Section 1
//NewgroundsAPIAsset_API_Conencted_4 (APIConnector_fla.NewgroundsAPIAsset_API_Conencted_4)
package APIConnector_fla {
import flash.display.*;
import com.newgrounds.components.*;
public dynamic class NewgroundsAPIAsset_API_Conencted_4 extends MovieClip {
public function NewgroundsAPIAsset_API_Conencted_4(){
addFrameScript(36, this.frame37);
}
function frame37(){
APIConnector(parent).clear();
}
}
}//package APIConnector_fla
Section 2
//NewgroundsAPIAsset_ConnectingAPI_2 (APIConnector_fla.NewgroundsAPIAsset_ConnectingAPI_2)
package APIConnector_fla {
import flash.display.*;
public dynamic class NewgroundsAPIAsset_ConnectingAPI_2 extends MovieClip {
public function NewgroundsAPIAsset_ConnectingAPI_2(){
addFrameScript(9, this.frame10);
}
function frame10(){
stop();
}
}
}//package APIConnector_fla
Section 3
//NewgroundsAPIAsset_Connection_Error_7 (APIConnector_fla.NewgroundsAPIAsset_Connection_Error_7)
package APIConnector_fla {
import flash.display.*;
import com.newgrounds.components.*;
public dynamic class NewgroundsAPIAsset_Connection_Error_7 extends MovieClip {
public function NewgroundsAPIAsset_Connection_Error_7(){
addFrameScript(9, this.frame10, 20, this.frame21);
}
function frame10(){
stop();
}
function frame21(){
APIConnector(parent).clear();
}
}
}//package APIConnector_fla
Section 4
//NewgroundsAPIAsset_FlashAd_Container_41 (APIConnector_fla.NewgroundsAPIAsset_FlashAd_Container_41)
package APIConnector_fla {
import flash.events.*;
import flash.display.*;
import com.newgrounds.*;
public dynamic class NewgroundsAPIAsset_FlashAd_Container_41 extends MovieClip {
public var adMask:MovieClip;
public var ngLinkButton:SimpleButton;
public function NewgroundsAPIAsset_FlashAd_Container_41(){
addFrameScript(0, this.frame1, 10, this.frame11);
}
public function onNGLinkClicked(_arg1:MouseEvent):void{
API.loadNewgrounds();
}
function frame1(){
this.ngLinkButton.addEventListener(MouseEvent.CLICK, this.onNGLinkClicked);
}
function frame11(){
gotoAndPlay(1);
}
}
}//package APIConnector_fla
Section 5
//NewgroundsAPIAsset_Load_Indicator_3 (APIConnector_fla.NewgroundsAPIAsset_Load_Indicator_3)
package APIConnector_fla {
import flash.events.*;
import flash.display.*;
public dynamic class NewgroundsAPIAsset_Load_Indicator_3 extends MovieClip {
public function NewgroundsAPIAsset_Load_Indicator_3(){
addFrameScript(0, this.frame1);
}
public function onEnterFrame(_arg1:Event):void{
if (((visible) && (stage))){
rotation = (rotation + 30);
} else {
removeEventListener(Event.ENTER_FRAME, this.onEnterFrame);
};
}
function frame1(){
addEventListener(Event.ENTER_FRAME, this.onEnterFrame);
}
}
}//package APIConnector_fla
Section 6
//NewgroundsAPIAsset_Login_Warning_5 (APIConnector_fla.NewgroundsAPIAsset_Login_Warning_5)
package APIConnector_fla {
import flash.display.*;
import com.newgrounds.components.*;
public dynamic class NewgroundsAPIAsset_Login_Warning_5 extends MovieClip {
public function NewgroundsAPIAsset_Login_Warning_5(){
addFrameScript(9, this.frame10, 20, this.frame21);
}
function frame10(){
stop();
}
function frame21(){
APIConnector(parent).clear();
}
}
}//package APIConnector_fla
Section 7
//MD5 (com.adobe.crypto.MD5)
package com.adobe.crypto {
import flash.utils.*;
import com.adobe.utils.*;
public class MD5 {
public static var digest:ByteArray;
public static function hash(_arg1:String):String{
var _local2:ByteArray = new ByteArray();
_local2.writeUTFBytes(_arg1);
return (hashBinary(_local2));
}
public static function hashBytes(_arg1:ByteArray):String{
return (hashBinary(_arg1));
}
public static function hashBinary(_arg1:ByteArray):String{
var _local6:int;
var _local7:int;
var _local8:int;
var _local9:int;
var _local2 = 1732584193;
var _local3 = -271733879;
var _local4 = -1732584194;
var _local5 = 271733878;
var _local10:Array = createBlocks(_arg1);
var _local11:int = _local10.length;
var _local12:int;
while (_local12 < _local11) {
_local6 = _local2;
_local7 = _local3;
_local8 = _local4;
_local9 = _local5;
_local2 = ff(_local2, _local3, _local4, _local5, _local10[int((_local12 + 0))], 7, -680876936);
_local5 = ff(_local5, _local2, _local3, _local4, _local10[int((_local12 + 1))], 12, -389564586);
_local4 = ff(_local4, _local5, _local2, _local3, _local10[int((_local12 + 2))], 17, 606105819);
_local3 = ff(_local3, _local4, _local5, _local2, _local10[int((_local12 + 3))], 22, -1044525330);
_local2 = ff(_local2, _local3, _local4, _local5, _local10[int((_local12 + 4))], 7, -176418897);
_local5 = ff(_local5, _local2, _local3, _local4, _local10[int((_local12 + 5))], 12, 1200080426);
_local4 = ff(_local4, _local5, _local2, _local3, _local10[int((_local12 + 6))], 17, -1473231341);
_local3 = ff(_local3, _local4, _local5, _local2, _local10[int((_local12 + 7))], 22, -45705983);
_local2 = ff(_local2, _local3, _local4, _local5, _local10[int((_local12 + 8))], 7, 1770035416);
_local5 = ff(_local5, _local2, _local3, _local4, _local10[int((_local12 + 9))], 12, -1958414417);
_local4 = ff(_local4, _local5, _local2, _local3, _local10[int((_local12 + 10))], 17, -42063);
_local3 = ff(_local3, _local4, _local5, _local2, _local10[int((_local12 + 11))], 22, -1990404162);
_local2 = ff(_local2, _local3, _local4, _local5, _local10[int((_local12 + 12))], 7, 1804603682);
_local5 = ff(_local5, _local2, _local3, _local4, _local10[int((_local12 + 13))], 12, -40341101);
_local4 = ff(_local4, _local5, _local2, _local3, _local10[int((_local12 + 14))], 17, -1502002290);
_local3 = ff(_local3, _local4, _local5, _local2, _local10[int((_local12 + 15))], 22, 1236535329);
_local2 = gg(_local2, _local3, _local4, _local5, _local10[int((_local12 + 1))], 5, -165796510);
_local5 = gg(_local5, _local2, _local3, _local4, _local10[int((_local12 + 6))], 9, -1069501632);
_local4 = gg(_local4, _local5, _local2, _local3, _local10[int((_local12 + 11))], 14, 643717713);
_local3 = gg(_local3, _local4, _local5, _local2, _local10[int((_local12 + 0))], 20, -373897302);
_local2 = gg(_local2, _local3, _local4, _local5, _local10[int((_local12 + 5))], 5, -701558691);
_local5 = gg(_local5, _local2, _local3, _local4, _local10[int((_local12 + 10))], 9, 38016083);
_local4 = gg(_local4, _local5, _local2, _local3, _local10[int((_local12 + 15))], 14, -660478335);
_local3 = gg(_local3, _local4, _local5, _local2, _local10[int((_local12 + 4))], 20, -405537848);
_local2 = gg(_local2, _local3, _local4, _local5, _local10[int((_local12 + 9))], 5, 568446438);
_local5 = gg(_local5, _local2, _local3, _local4, _local10[int((_local12 + 14))], 9, -1019803690);
_local4 = gg(_local4, _local5, _local2, _local3, _local10[int((_local12 + 3))], 14, -187363961);
_local3 = gg(_local3, _local4, _local5, _local2, _local10[int((_local12 + 8))], 20, 1163531501);
_local2 = gg(_local2, _local3, _local4, _local5, _local10[int((_local12 + 13))], 5, -1444681467);
_local5 = gg(_local5, _local2, _local3, _local4, _local10[int((_local12 + 2))], 9, -51403784);
_local4 = gg(_local4, _local5, _local2, _local3, _local10[int((_local12 + 7))], 14, 1735328473);
_local3 = gg(_local3, _local4, _local5, _local2, _local10[int((_local12 + 12))], 20, -1926607734);
_local2 = hh(_local2, _local3, _local4, _local5, _local10[int((_local12 + 5))], 4, -378558);
_local5 = hh(_local5, _local2, _local3, _local4, _local10[int((_local12 + 8))], 11, -2022574463);
_local4 = hh(_local4, _local5, _local2, _local3, _local10[int((_local12 + 11))], 16, 1839030562);
_local3 = hh(_local3, _local4, _local5, _local2, _local10[int((_local12 + 14))], 23, -35309556);
_local2 = hh(_local2, _local3, _local4, _local5, _local10[int((_local12 + 1))], 4, -1530992060);
_local5 = hh(_local5, _local2, _local3, _local4, _local10[int((_local12 + 4))], 11, 1272893353);
_local4 = hh(_local4, _local5, _local2, _local3, _local10[int((_local12 + 7))], 16, -155497632);
_local3 = hh(_local3, _local4, _local5, _local2, _local10[int((_local12 + 10))], 23, -1094730640);
_local2 = hh(_local2, _local3, _local4, _local5, _local10[int((_local12 + 13))], 4, 681279174);
_local5 = hh(_local5, _local2, _local3, _local4, _local10[int((_local12 + 0))], 11, -358537222);
_local4 = hh(_local4, _local5, _local2, _local3, _local10[int((_local12 + 3))], 16, -722521979);
_local3 = hh(_local3, _local4, _local5, _local2, _local10[int((_local12 + 6))], 23, 76029189);
_local2 = hh(_local2, _local3, _local4, _local5, _local10[int((_local12 + 9))], 4, -640364487);
_local5 = hh(_local5, _local2, _local3, _local4, _local10[int((_local12 + 12))], 11, -421815835);
_local4 = hh(_local4, _local5, _local2, _local3, _local10[int((_local12 + 15))], 16, 530742520);
_local3 = hh(_local3, _local4, _local5, _local2, _local10[int((_local12 + 2))], 23, -995338651);
_local2 = ii(_local2, _local3, _local4, _local5, _local10[int((_local12 + 0))], 6, -198630844);
_local5 = ii(_local5, _local2, _local3, _local4, _local10[int((_local12 + 7))], 10, 1126891415);
_local4 = ii(_local4, _local5, _local2, _local3, _local10[int((_local12 + 14))], 15, -1416354905);
_local3 = ii(_local3, _local4, _local5, _local2, _local10[int((_local12 + 5))], 21, -57434055);
_local2 = ii(_local2, _local3, _local4, _local5, _local10[int((_local12 + 12))], 6, 1700485571);
_local5 = ii(_local5, _local2, _local3, _local4, _local10[int((_local12 + 3))], 10, -1894986606);
_local4 = ii(_local4, _local5, _local2, _local3, _local10[int((_local12 + 10))], 15, -1051523);
_local3 = ii(_local3, _local4, _local5, _local2, _local10[int((_local12 + 1))], 21, -2054922799);
_local2 = ii(_local2, _local3, _local4, _local5, _local10[int((_local12 + 8))], 6, 1873313359);
_local5 = ii(_local5, _local2, _local3, _local4, _local10[int((_local12 + 15))], 10, -30611744);
_local4 = ii(_local4, _local5, _local2, _local3, _local10[int((_local12 + 6))], 15, -1560198380);
_local3 = ii(_local3, _local4, _local5, _local2, _local10[int((_local12 + 13))], 21, 1309151649);
_local2 = ii(_local2, _local3, _local4, _local5, _local10[int((_local12 + 4))], 6, -145523070);
_local5 = ii(_local5, _local2, _local3, _local4, _local10[int((_local12 + 11))], 10, -1120210379);
_local4 = ii(_local4, _local5, _local2, _local3, _local10[int((_local12 + 2))], 15, 718787259);
_local3 = ii(_local3, _local4, _local5, _local2, _local10[int((_local12 + 9))], 21, -343485551);
_local2 = (_local2 + _local6);
_local3 = (_local3 + _local7);
_local4 = (_local4 + _local8);
_local5 = (_local5 + _local9);
_local12 = (_local12 + 16);
};
digest = new ByteArray();
digest.writeInt(_local2);
digest.writeInt(_local3);
digest.writeInt(_local4);
digest.writeInt(_local5);
digest.position = 0;
return ((((IntUtil.toHex(_local2) + IntUtil.toHex(_local3)) + IntUtil.toHex(_local4)) + IntUtil.toHex(_local5)));
}
private static function f(_arg1:int, _arg2:int, _arg3:int):int{
return (((_arg1 & _arg2) | (~(_arg1) & _arg3)));
}
private static function g(_arg1:int, _arg2:int, _arg3:int):int{
return (((_arg1 & _arg3) | (_arg2 & ~(_arg3))));
}
private static function h(_arg1:int, _arg2:int, _arg3:int):int{
return (((_arg1 ^ _arg2) ^ _arg3));
}
private static function i(_arg1:int, _arg2:int, _arg3:int):int{
return ((_arg2 ^ (_arg1 | ~(_arg3))));
}
private static function transform(_arg1:Function, _arg2:int, _arg3:int, _arg4:int, _arg5:int, _arg6:int, _arg7:int, _arg8:int):int{
var _local9:int = (((_arg2 + int(_arg1(_arg3, _arg4, _arg5))) + _arg6) + _arg8);
return ((IntUtil.rol(_local9, _arg7) + _arg3));
}
private static function ff(_arg1:int, _arg2:int, _arg3:int, _arg4:int, _arg5:int, _arg6:int, _arg7:int):int{
return (transform(f, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7));
}
private static function gg(_arg1:int, _arg2:int, _arg3:int, _arg4:int, _arg5:int, _arg6:int, _arg7:int):int{
return (transform(g, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7));
}
private static function hh(_arg1:int, _arg2:int, _arg3:int, _arg4:int, _arg5:int, _arg6:int, _arg7:int):int{
return (transform(h, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7));
}
private static function ii(_arg1:int, _arg2:int, _arg3:int, _arg4:int, _arg5:int, _arg6:int, _arg7:int):int{
return (transform(i, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7));
}
private static function createBlocks(_arg1:ByteArray):Array{
var _local2:Array = new Array();
var _local3:int = (_arg1.length * 8);
var _local4 = 0xFF;
var _local5:int;
while (_local5 < _local3) {
_local2[int((_local5 >> 5))] = (_local2[int((_local5 >> 5))] | ((_arg1[(_local5 / 8)] & _local4) << (_local5 % 32)));
_local5 = (_local5 + 8);
};
_local2[int((_local3 >> 5))] = (_local2[int((_local3 >> 5))] | (128 << (_local3 % 32)));
_local2[int(((((_local3 + 64) >>> 9) << 4) + 14))] = _local3;
return (_local2);
}
}
}//package com.adobe.crypto
Section 8
//PNGEncoder (com.adobe.images.PNGEncoder)
package com.adobe.images {
import flash.display.*;
import flash.utils.*;
import flash.geom.*;
public class PNGEncoder {
private static var crcTable:Array;
private static var crcTableComputed:Boolean = false;
public static function encode(_arg1:BitmapData):ByteArray{
var _local6:uint;
var _local7:int;
var _local2:ByteArray = new ByteArray();
_local2.writeUnsignedInt(2303741511);
_local2.writeUnsignedInt(218765834);
var _local3:ByteArray = new ByteArray();
_local3.writeInt(_arg1.width);
_local3.writeInt(_arg1.height);
_local3.writeUnsignedInt(134610944);
_local3.writeByte(0);
writeChunk(_local2, 1229472850, _local3);
var _local4:ByteArray = new ByteArray();
var _local5:int;
while (_local5 < _arg1.height) {
_local4.writeByte(0);
if (!_arg1.transparent){
_local7 = 0;
while (_local7 < _arg1.width) {
_local6 = _arg1.getPixel(_local7, _local5);
_local4.writeUnsignedInt(uint((((_local6 & 0xFFFFFF) << 8) | 0xFF)));
_local7++;
};
} else {
_local7 = 0;
while (_local7 < _arg1.width) {
_local6 = _arg1.getPixel32(_local7, _local5);
_local4.writeUnsignedInt(uint((((_local6 & 0xFFFFFF) << 8) | (_local6 >>> 24))));
_local7++;
};
};
_local5++;
};
_local4.compress();
writeChunk(_local2, 1229209940, _local4);
writeChunk(_local2, 1229278788, null);
return (_local2);
}
private static function writeChunk(_arg1:ByteArray, _arg2:uint, _arg3:ByteArray):void{
var _local8:uint;
var _local9:uint;
var _local10:uint;
if (!crcTableComputed){
crcTableComputed = true;
crcTable = [];
_local9 = 0;
while (_local9 < 0x0100) {
_local8 = _local9;
_local10 = 0;
while (_local10 < 8) {
if ((_local8 & 1)){
_local8 = uint((uint(3988292384) ^ uint((_local8 >>> 1))));
} else {
_local8 = uint((_local8 >>> 1));
};
_local10++;
};
crcTable[_local9] = _local8;
_local9++;
};
};
var _local4:uint;
if (_arg3 != null){
_local4 = _arg3.length;
};
_arg1.writeUnsignedInt(_local4);
var _local5:uint = _arg1.position;
_arg1.writeUnsignedInt(_arg2);
if (_arg3 != null){
_arg1.writeBytes(_arg3);
};
var _local6:uint = _arg1.position;
_arg1.position = _local5;
_local8 = 4294967295;
var _local7:int;
while (_local7 < (_local6 - _local5)) {
_local8 = uint((crcTable[((_local8 ^ _arg1.readUnsignedByte()) & uint(0xFF))] ^ uint((_local8 >>> 8))));
_local7++;
};
_local8 = uint((_local8 ^ uint(4294967295)));
_arg1.position = _local6;
_arg1.writeUnsignedInt(_local8);
}
}
}//package com.adobe.images
Section 9
//JSON (com.adobe.serialization.json.JSON)
package com.adobe.serialization.json {
public class JSON {
public static function encode(_arg1:Object):String{
var _local2:JSONEncoder = new JSONEncoder(_arg1);
return (_local2.getString());
}
public static function decode(_arg1:String){
var _local2:JSONDecoder = new JSONDecoder(_arg1);
return (_local2.getValue());
}
}
}//package com.adobe.serialization.json
Section 10
//JSONDecoder (com.adobe.serialization.json.JSONDecoder)
package com.adobe.serialization.json {
public class JSONDecoder {
private var value;
private var tokenizer:JSONTokenizer;
private var token:JSONToken;
public function JSONDecoder(_arg1:String){
this.tokenizer = new JSONTokenizer(_arg1);
this.nextToken();
this.value = this.parseValue();
}
public function getValue(){
return (this.value);
}
private function nextToken():JSONToken{
return ((this.token = this.tokenizer.getNextToken()));
}
private function parseArray():Array{
var _local1:Array = new Array();
this.nextToken();
if (this.token.type == JSONTokenType.RIGHT_BRACKET){
return (_local1);
};
while (true) {
_local1.push(this.parseValue());
this.nextToken();
if (this.token.type == JSONTokenType.RIGHT_BRACKET){
return (_local1);
};
if (this.token.type == JSONTokenType.COMMA){
this.nextToken();
} else {
this.tokenizer.parseError(("Expecting ] or , but found " + this.token.value));
};
};
return (null);
}
private function parseObject():Object{
var _local2:String;
var _local1:Object = new Object();
this.nextToken();
if (this.token.type == JSONTokenType.RIGHT_BRACE){
return (_local1);
};
while (true) {
if (this.token.type == JSONTokenType.STRING){
_local2 = String(this.token.value);
this.nextToken();
if (this.token.type == JSONTokenType.COLON){
this.nextToken();
_local1[_local2] = this.parseValue();
this.nextToken();
if (this.token.type == JSONTokenType.RIGHT_BRACE){
return (_local1);
};
if (this.token.type == JSONTokenType.COMMA){
this.nextToken();
} else {
this.tokenizer.parseError(("Expecting } or , but found " + this.token.value));
};
} else {
this.tokenizer.parseError(("Expecting : but found " + this.token.value));
};
} else {
this.tokenizer.parseError(("Expecting string but found " + this.token.value));
};
};
return (null);
}
private function parseValue():Object{
if (this.token == null){
this.tokenizer.parseError("Unexpected end of input");
};
switch (this.token.type){
case JSONTokenType.LEFT_BRACE:
return (this.parseObject());
case JSONTokenType.LEFT_BRACKET:
return (this.parseArray());
case JSONTokenType.STRING:
case JSONTokenType.NUMBER:
case JSONTokenType.TRUE:
case JSONTokenType.FALSE:
case JSONTokenType.NULL:
return (this.token.value);
default:
this.tokenizer.parseError(("Unexpected " + this.token.value));
};
return (null);
}
}
}//package com.adobe.serialization.json
Section 11
//JSONEncoder (com.adobe.serialization.json.JSONEncoder)
package com.adobe.serialization.json {
import flash.utils.*;
public class JSONEncoder {
private var jsonString:String;
public function JSONEncoder(_arg1){
this.jsonString = this.convertToString(_arg1);
}
public function getString():String{
return (this.jsonString);
}
private function convertToString(_arg1):String{
if ((_arg1 is String)){
return (this.escapeString((_arg1 as String)));
};
if ((_arg1 is Number)){
return ((isFinite((_arg1 as Number))) ? _arg1.toString() : "null");
} else {
if ((_arg1 is Boolean)){
return ((_arg1) ? "true" : "false");
} else {
if ((_arg1 is Array)){
return (this.arrayToString((_arg1 as Array)));
};
if ((((_arg1 is Object)) && (!((_arg1 == null))))){
return (this.objectToString(_arg1));
};
};
};
return ("null");
}
private function escapeString(_arg1:String):String{
var _local3:String;
var _local6:String;
var _local7:String;
var _local2 = "";
var _local4:Number = _arg1.length;
var _local5:int;
while (_local5 < _local4) {
_local3 = _arg1.charAt(_local5);
switch (_local3){
case "\"":
_local2 = (_local2 + "\\\"");
break;
case "\\":
_local2 = (_local2 + "\\\\");
break;
case "\b":
_local2 = (_local2 + "\\b");
break;
case "\f":
_local2 = (_local2 + "\\f");
break;
case "\n":
_local2 = (_local2 + "\\n");
break;
case "\r":
_local2 = (_local2 + "\\r");
break;
case "\t":
_local2 = (_local2 + "\\t");
break;
default:
if (_local3 < " "){
_local6 = _local3.charCodeAt(0).toString(16);
_local7 = ((_local6.length == 2)) ? "00" : "000";
_local2 = (_local2 + (("\\u" + _local7) + _local6));
} else {
_local2 = (_local2 + _local3);
};
};
_local5++;
};
return ((("\"" + _local2) + "\""));
}
private function arrayToString(_arg1:Array):String{
var _local2 = "";
var _local3:int;
while (_local3 < _arg1.length) {
if (_local2.length > 0){
_local2 = (_local2 + ",");
};
_local2 = (_local2 + this.convertToString(_arg1[_local3]));
_local3++;
};
return ((("[" + _local2) + "]"));
}
private function objectToString(_arg1:Object):String{
var value:Object;
var key:String;
var v:XML;
var o = _arg1;
var s = "";
var classInfo:XML = describeType(o);
if (classInfo.@name.toString() == "Object"){
for (key in o) {
value = o[key];
if ((value is Function)){
} else {
if (s.length > 0){
s = (s + ",");
};
s = (s + ((this.escapeString(key) + ":") + this.convertToString(value)));
};
};
} else {
for each (v in classInfo..*.(((name() == "variable")) || ((name() == "accessor")))) {
if (s.length > 0){
s = (s + ",");
};
s = (s + ((this.escapeString(v.@name.toString()) + ":") + this.convertToString(o[v.@name])));
};
};
return ((("{" + s) + "}"));
}
}
}//package com.adobe.serialization.json
Section 12
//JSONParseError (com.adobe.serialization.json.JSONParseError)
package com.adobe.serialization.json {
public class JSONParseError extends Error {
private var _location:int;
private var _text:String;
public function JSONParseError(_arg1:String="", _arg2:int=0, _arg3:String=""){
super(_arg1);
name = "JSONParseError";
this._location = _arg2;
this._text = _arg3;
}
public function get location():int{
return (this._location);
}
public function get text():String{
return (this._text);
}
}
}//package com.adobe.serialization.json
Section 13
//JSONToken (com.adobe.serialization.json.JSONToken)
package com.adobe.serialization.json {
public class JSONToken {
private var _type:int;
private var _value:Object;
public function JSONToken(_arg1:int=-1, _arg2:Object=null){
this._type = _arg1;
this._value = _arg2;
}
public function get type():int{
return (this._type);
}
public function set type(_arg1:int):void{
this._type = _arg1;
}
public function get value():Object{
return (this._value);
}
public function set value(_arg1:Object):void{
this._value = _arg1;
}
}
}//package com.adobe.serialization.json
Section 14
//JSONTokenizer (com.adobe.serialization.json.JSONTokenizer)
package com.adobe.serialization.json {
public class JSONTokenizer {
private var obj:Object;
private var jsonString:String;
private var loc:int;
private var ch:String;
public function JSONTokenizer(_arg1:String){
this.jsonString = _arg1;
this.loc = 0;
this.nextChar();
}
public function getNextToken():JSONToken{
var _local2:String;
var _local3:String;
var _local4:String;
var _local1:JSONToken = new JSONToken();
this.skipIgnored();
switch (this.ch){
case "{":
_local1.type = JSONTokenType.LEFT_BRACE;
_local1.value = "{";
this.nextChar();
break;
case "}":
_local1.type = JSONTokenType.RIGHT_BRACE;
_local1.value = "}";
this.nextChar();
break;
case "[":
_local1.type = JSONTokenType.LEFT_BRACKET;
_local1.value = "[";
this.nextChar();
break;
case "]":
_local1.type = JSONTokenType.RIGHT_BRACKET;
_local1.value = "]";
this.nextChar();
break;
case ",":
_local1.type = JSONTokenType.COMMA;
_local1.value = ",";
this.nextChar();
break;
case ":":
_local1.type = JSONTokenType.COLON;
_local1.value = ":";
this.nextChar();
break;
case "t":
_local2 = ((("t" + this.nextChar()) + this.nextChar()) + this.nextChar());
if (_local2 == "true"){
_local1.type = JSONTokenType.TRUE;
_local1.value = true;
this.nextChar();
} else {
this.parseError(("Expecting 'true' but found " + _local2));
};
break;
case "f":
_local3 = (((("f" + this.nextChar()) + this.nextChar()) + this.nextChar()) + this.nextChar());
if (_local3 == "false"){
_local1.type = JSONTokenType.FALSE;
_local1.value = false;
this.nextChar();
} else {
this.parseError(("Expecting 'false' but found " + _local3));
};
break;
case "n":
_local4 = ((("n" + this.nextChar()) + this.nextChar()) + this.nextChar());
if (_local4 == "null"){
_local1.type = JSONTokenType.NULL;
_local1.value = null;
this.nextChar();
} else {
this.parseError(("Expecting 'null' but found " + _local4));
};
break;
case "\"":
_local1 = this.readString();
break;
default:
if (((this.isDigit(this.ch)) || ((this.ch == "-")))){
_local1 = this.readNumber();
} else {
if (this.ch == ""){
return (null);
};
this.parseError((("Unexpected " + this.ch) + " encountered"));
};
};
return (_local1);
}
private function readString():JSONToken{
var _local3:String;
var _local4:int;
var _local1:JSONToken = new JSONToken();
_local1.type = JSONTokenType.STRING;
var _local2 = "";
this.nextChar();
while (((!((this.ch == "\""))) && (!((this.ch == ""))))) {
if (this.ch == "\\"){
this.nextChar();
switch (this.ch){
case "\"":
_local2 = (_local2 + "\"");
break;
case "/":
_local2 = (_local2 + "/");
break;
case "\\":
_local2 = (_local2 + "\\");
break;
case "b":
_local2 = (_local2 + "\b");
break;
case "f":
_local2 = (_local2 + "\f");
break;
case "n":
_local2 = (_local2 + "\n");
break;
case "r":
_local2 = (_local2 + "\r");
break;
case "t":
_local2 = (_local2 + "\t");
break;
case "u":
_local3 = "";
_local4 = 0;
while (_local4 < 4) {
if (!this.isHexDigit(this.nextChar())){
this.parseError((" Excepted a hex digit, but found: " + this.ch));
};
_local3 = (_local3 + this.ch);
_local4++;
};
_local2 = (_local2 + String.fromCharCode(parseInt(_local3, 16)));
break;
default:
_local2 = (_local2 + ("\\" + this.ch));
};
} else {
_local2 = (_local2 + this.ch);
};
this.nextChar();
};
if (this.ch == ""){
this.parseError("Unterminated string literal");
};
this.nextChar();
_local1.value = _local2;
return (_local1);
}
private function readNumber():JSONToken{
var _local1:JSONToken = new JSONToken();
_local1.type = JSONTokenType.NUMBER;
var _local2 = "";
if (this.ch == "-"){
_local2 = (_local2 + "-");
this.nextChar();
};
if (!this.isDigit(this.ch)){
this.parseError("Expecting a digit");
};
if (this.ch == "0"){
_local2 = (_local2 + this.ch);
this.nextChar();
if (this.isDigit(this.ch)){
this.parseError("A digit cannot immediately follow 0");
};
} else {
while (this.isDigit(this.ch)) {
_local2 = (_local2 + this.ch);
this.nextChar();
};
};
if (this.ch == "."){
_local2 = (_local2 + ".");
this.nextChar();
if (!this.isDigit(this.ch)){
this.parseError("Expecting a digit");
};
while (this.isDigit(this.ch)) {
_local2 = (_local2 + this.ch);
this.nextChar();
};
};
if ((((this.ch == "e")) || ((this.ch == "E")))){
_local2 = (_local2 + "e");
this.nextChar();
if ((((this.ch == "+")) || ((this.ch == "-")))){
_local2 = (_local2 + this.ch);
this.nextChar();
};
if (!this.isDigit(this.ch)){
this.parseError("Scientific notation number needs exponent value");
};
while (this.isDigit(this.ch)) {
_local2 = (_local2 + this.ch);
this.nextChar();
};
};
var _local3:Number = Number(_local2);
if (((isFinite(_local3)) && (!(isNaN(_local3))))){
_local1.value = _local3;
return (_local1);
};
this.parseError((("Number " + _local3) + " is not valid!"));
return (null);
}
private function nextChar():String{
return ((this.ch = this.jsonString.charAt(this.loc++)));
}
private function skipIgnored():void{
var _local1:int;
do {
_local1 = this.loc;
this.skipWhite();
this.skipComments();
} while (_local1 != this.loc);
}
private function skipComments():void{
if (this.ch == "/"){
this.nextChar();
switch (this.ch){
case "/":
do {
this.nextChar();
} while (((!((this.ch == "\n"))) && (!((this.ch == "")))));
this.nextChar();
break;
case "*":
this.nextChar();
while (true) {
if (this.ch == "*"){
this.nextChar();
if (this.ch == "/"){
this.nextChar();
break;
};
} else {
this.nextChar();
};
if (this.ch == ""){
this.parseError("Multi-line comment not closed");
};
};
break;
default:
this.parseError((("Unexpected " + this.ch) + " encountered (expecting '/' or '*' )"));
};
};
}
private function skipWhite():void{
while (this.isWhiteSpace(this.ch)) {
this.nextChar();
};
}
private function isWhiteSpace(_arg1:String):Boolean{
return ((((((((_arg1 == " ")) || ((_arg1 == "\t")))) || ((_arg1 == "\n")))) || ((_arg1 == "\r"))));
}
private function isDigit(_arg1:String):Boolean{
return ((((_arg1 >= "0")) && ((_arg1 <= "9"))));
}
private function isHexDigit(_arg1:String):Boolean{
var _local2:String = _arg1.toUpperCase();
return (((this.isDigit(_arg1)) || ((((_local2 >= "A")) && ((_local2 <= "F"))))));
}
public function parseError(_arg1:String):void{
throw (new JSONParseError(_arg1, this.loc, this.jsonString));
}
}
}//package com.adobe.serialization.json
Section 15
//JSONTokenType (com.adobe.serialization.json.JSONTokenType)
package com.adobe.serialization.json {
public class JSONTokenType {
public static const UNKNOWN:int = -1;
public static const COMMA:int = 0;
public static const LEFT_BRACE:int = 1;
public static const RIGHT_BRACE:int = 2;
public static const LEFT_BRACKET:int = 3;
public static const RIGHT_BRACKET:int = 4;
public static const COLON:int = 6;
public static const TRUE:int = 7;
public static const FALSE:int = 8;
public static const NULL:int = 9;
public static const STRING:int = 10;
public static const NUMBER:int = 11;
}
}//package com.adobe.serialization.json
Section 16
//IntUtil (com.adobe.utils.IntUtil)
package com.adobe.utils {
public class IntUtil {
private static var hexChars:String = "0123456789abcdef";
public static function rol(_arg1:int, _arg2:int):int{
return (((_arg1 << _arg2) | (_arg1 >>> (32 - _arg2))));
}
public static function ror(_arg1:int, _arg2:int):uint{
var _local3:int = (32 - _arg2);
return (((_arg1 << _local3) | (_arg1 >>> (32 - _local3))));
}
public static function toHex(_arg1:int, _arg2:Boolean=false):String{
var _local4:int;
var _local5:int;
var _local3 = "";
if (_arg2){
_local4 = 0;
while (_local4 < 4) {
_local3 = (_local3 + (hexChars.charAt(((_arg1 >> (((3 - _local4) * 8) + 4)) & 15)) + hexChars.charAt(((_arg1 >> ((3 - _local4) * 8)) & 15))));
_local4++;
};
} else {
_local5 = 0;
while (_local5 < 4) {
_local3 = (_local3 + (hexChars.charAt(((_arg1 >> ((_local5 * 8) + 4)) & 15)) + hexChars.charAt(((_arg1 >> (_local5 * 8)) & 15))));
_local5++;
};
};
return (_local3);
}
}
}//package com.adobe.utils
Section 17
//APIConnector (com.newgrounds.components.APIConnector)
package com.newgrounds.components {
import flash.events.*;
import flash.display.*;
import com.newgrounds.*;
import flash.utils.*;
public class APIConnector extends MovieClip {
public var errorDialog:MovieClip;
public var background:MovieClip;
public var viewLatestButton:SimpleButton;
public var closeButton:SimpleButton;
public var viewAuthorizedButton:SimpleButton;
private var _initialized:Boolean;
private var _movieId:String;
private var _encryptionKey:String;
private var _movieVersion:String;
private var _showConnectingPopup:Boolean;// = true
private var _useErrorPopup:Boolean;// = true
private var _medalPopup:MedalPopup;
private var _popDelay:Timer;
public function APIConnector(){
this._popDelay = new Timer(3000, 1);
super();
addFrameScript(0, this.frame1, 6, this.frame7, 7, this.frame8);
if (((!((parent == null))) && ((getQualifiedClassName(parent) == "fl.livepreview::LivePreviewParent")))){
return;
};
this.useErrorPopup = true;
this.useMedalPopup = true;
this._popDelay.addEventListener(TimerEvent.TIMER, this.errorTimerHandler);
addEventListener(Event.ENTER_FRAME, this.enterFrameHandler);
if (stage){
addEventListener(Event.RENDER, this.renderHandler);
stage.invalidate();
} else {
this.clear();
};
}
public function get movieId():String{
return (this._movieId);
}
public function set movieId(_arg1:String):void{
this._movieId = _arg1;
}
public function get encryptionKey():String{
return (this._encryptionKey);
}
public function set encryptionKey(_arg1:String):void{
this._encryptionKey = _arg1;
}
public function get movieVersion():String{
return (this._movieVersion);
}
public function set movieVersion(_arg1:String):void{
this._movieVersion = _arg1;
}
public function get debugMode():Boolean{
return (API.debugMode);
}
public function set debugMode(_arg1:Boolean):void{
API.debugMode = true;
}
public function get useMedalPopup():Boolean{
return (!((this._medalPopup == null)));
}
public function set useMedalPopup(_arg1:Boolean):void{
if (((_arg1) && (!(this._medalPopup)))){
this._medalPopup = new MedalPopup();
addChild(this._medalPopup);
} else {
if (((!(_arg1)) && (this._medalPopup))){
removeChild(this._medalPopup);
this._medalPopup = null;
};
};
}
public function get useErrorPopup():Boolean{
return (this._useErrorPopup);
}
public function set useErrorPopup(_arg1:Boolean):void{
this._useErrorPopup = _arg1;
API.addEventListener(APIEvent.API_CONNECTED, this.movieConnectedHandler);
if (this._useErrorPopup){
API.addEventListener(APIEvent.NEW_VERSION_AVAILABLE, this.newVersionAvailableHandler);
API.addEventListener(APIEvent.HOST_BLOCKED, this.hostBlockedHandler);
} else {
API.removeEventListener(APIEvent.NEW_VERSION_AVAILABLE, this.newVersionAvailableHandler);
API.removeEventListener(APIEvent.HOST_BLOCKED, this.hostBlockedHandler);
};
}
public function get showConnectingPopup():Boolean{
return (this._showConnectingPopup);
}
public function set showConnectingPopup(_arg1:Boolean):void{
this._showConnectingPopup = _arg1;
if (((!(_arg1)) && ((((currentLabel == "connecting")) || ((currentLabel == "connected")))))){
this.clear();
};
}
public function clear():void{
gotoAndStop("idle");
}
public function connect():void{
API.setVersion(this._movieVersion);
API.connect(root.loaderInfo, this._movieId, this._encryptionKey);
visible = true;
if (this.showConnectingPopup){
gotoAndStop("connecting");
};
}
private function renderHandler(_arg1:Event):void{
removeEventListener(Event.RENDER, this.renderHandler);
this.clear();
this.connect();
}
private function movieConnectedHandler(_arg1:APIEvent):void{
if (_arg1.success){
if (((((((API.isPublishedHost()) && (API.IsCompatible()))) && (!(API.hasUserSession())))) && (!(API.debugMode)))){
gotoAndStop("no_login");
this._popDelay.start();
visible = true;
} else {
if (this.showConnectingPopup){
gotoAndStop("connected");
};
};
} else {
gotoAndStop("no_connect");
this._popDelay.start();
visible = true;
};
}
private function newVersionAvailableHandler(_arg1:APIEvent):void{
gotoAndStop("new_version");
visible = true;
this.centerOnStage();
}
private function hostBlockedHandler(_arg1:APIEvent):void{
gotoAndStop("bad_host");
visible = true;
this.centerOnStage();
}
private function closeButtonClickHandler(_arg1:Event):void{
this.clear();
}
private function officialVersionClickHandler(_arg1:Event):void{
API.loadOfficialVersion();
}
private function enterFrameHandler(_arg1:Event):void{
this.forceAlwaysOnTop();
}
private function initButtons():void{
if (this.viewLatestButton){
this.viewLatestButton.addEventListener(MouseEvent.CLICK, this.officialVersionClickHandler);
};
if (this.viewAuthorizedButton){
this.viewAuthorizedButton.addEventListener(MouseEvent.CLICK, this.officialVersionClickHandler);
};
if (this.closeButton){
this.closeButton.addEventListener(MouseEvent.CLICK, this.closeButtonClickHandler);
};
}
private function forceAlwaysOnTop():void{
var myIndex:uint;
var topIndex:uint;
if (((parent) && (visible))){
try {
myIndex = parent.getChildIndex(this);
topIndex = (parent.numChildren - 1);
if (myIndex != topIndex){
parent.setChildIndex(this, topIndex);
};
} catch(e:Error) {
};
};
}
private function centerOnStage():void{
if (stage){
x = (stage.stageWidth / 2);
y = (stage.stageHeight / 2);
};
}
private function errorTimerHandler(_arg1:TimerEvent):void{
if (this.errorDialog){
this.errorDialog.gotoAndPlay("closeme");
} else {
this.clear();
};
}
function frame1(){
stop();
}
function frame7(){
this.initButtons();
}
function frame8(){
this.initButtons();
}
}
}//package com.newgrounds.components
Section 18
//FlashAd (com.newgrounds.components.FlashAd)
package com.newgrounds.components {
import flash.events.*;
import flash.display.*;
import com.newgrounds.*;
import flash.utils.*;
import flash.net.*;
import flash.system.*;
public class FlashAd extends Sprite {
public var background:MovieClip;
private var _showBackground:Boolean;
private var _adURLLoader:URLLoader;
private var _adRect:Sprite;
private var _mask:Shape;
private var _ad:Loader;
private static const DEBUG_AD_URL:String = "http://www.ngads.com/adtest.php";
private static const REMOVED_FROM_STAGE:String = "removedFromStage";
private static var _adResetTime:uint = 0;
private static var _adURL:URLRequest;
public function FlashAd(_arg1:Boolean=true){
if (((!((parent == null))) && ((getQualifiedClassName(parent) == "fl.livepreview::LivePreviewParent")))){
return;
};
this._adRect = new Sprite();
this._adRect.graphics.beginFill(0);
this._adRect.graphics.moveTo(0, 0);
this._adRect.graphics.lineTo(300, 0);
this._adRect.graphics.lineTo(300, 250);
this._adRect.graphics.lineTo(0, 250);
this._adRect.graphics.lineTo(0, 0);
this._adRect.graphics.endFill();
this._mask = new Shape();
this._mask.graphics.beginFill(0);
this._mask.graphics.moveTo(0, 0);
this._mask.graphics.lineTo(300, 0);
this._mask.graphics.lineTo(300, 250);
this._mask.graphics.lineTo(0, 250);
this._mask.graphics.lineTo(0, 0);
this._mask.graphics.endFill();
addChild(this._adRect);
this._adRect.addChild(this._mask);
this._adRect.visible = false;
x = Math.round(x);
y = Math.round(y);
scaleX = 1;
scaleY = 1;
if (this.background){
if (this.background.ngLinkButton){
this.background.ngLinkButton.addEventListener(MouseEvent.CLICK, this.linkClickHandler);
};
if (this.background.loadingClip){
this.background.loadingClip.visible = false;
};
};
if (API.isFlashVersion(9, 0, 28)){
addEventListener(REMOVED_FROM_STAGE, this.onRemovedFromStage);
};
if (API.adsApproved){
this.loadAdFeed(API.adFeedURL);
} else {
API.addEventListener(APIEvent.ADS_APPROVED, this.onAdsApproved, false, 0, true);
};
this.showBackground = _arg1;
}
public function get showBackground():Boolean{
return (this._showBackground);
}
public function set showBackground(_arg1:Boolean):void{
this._showBackground = _arg1;
if (this.background){
this.background.visible = _arg1;
this._adRect.mask = (_arg1) ? this.background.adMask : null;
};
}
public function removeAd():void{
removeEventListener(REMOVED_FROM_STAGE, this.onRemovedFromStage);
if (((this.background) && (this.background.loadingClip))){
this.background.loadingClip.visible = false;
};
if (this._adURLLoader){
try {
this._adURLLoader.close();
} catch(e:Error) {
};
};
if (this._adRect){
this._adRect.visible = false;
};
if (this._ad){
trace("[NewgroundsAPI] :: Ad removed");
try {
this._ad.close();
} catch(e:Error) {
};
try {
Object(this._ad).unloadAndStop(true);
} catch(e:Error) {
_ad.unload();
};
if (this._ad.parent){
this._ad.parent.removeChild(this._ad);
};
};
this._ad = null;
}
private function onAdsApproved(_arg1:APIEvent):void{
API.removeEventListener(APIEvent.ADS_APPROVED, this.onAdsApproved, false);
if (_arg1.success){
this.loadAdFeed(API.adFeedURL);
} else {
trace("[NewgroundsAPI] :: No ad feed URL supplied to Newgrounds API ad!");
};
}
private function loadAdFeed(_arg1:String):void{
var adFeedURL = _arg1;
this._adURLLoader = new URLLoader();
this._adURLLoader.addEventListener(Event.COMPLETE, this.onAdFeedLoaded);
this._adURLLoader.addEventListener(IOErrorEvent.IO_ERROR, this.onAdError);
this._adURLLoader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, this.onAdError);
if (!adFeedURL){
trace("[Newgrounds API] :: Invalid feed URL!");
return;
};
if (this.hasAdElapsed){
if (adFeedURL.indexOf("?") > -1){
_adURL = new URLRequest(((adFeedURL + "&random=") + Math.random()));
} else {
_adURL = new URLRequest(((adFeedURL + "?random=") + Math.random()));
};
};
try {
this._adURLLoader.load(_adURL);
} catch(e:Error) {
onAdError(null);
};
if (((this.background) && (this.background.loadingClip))){
this.background.loadingClip.visible = true;
};
}
private function loadAd(_arg1:String):void{
if (this._ad){
this.removeAd();
};
this._ad = new Loader();
this._ad.contentLoaderInfo.addEventListener(Event.COMPLETE, this.onAdLoaded);
this._ad.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, this.onAdError);
this._ad.load(new URLRequest(_arg1), new LoaderContext(false, new ApplicationDomain(null)));
if (((this.background) && (this.background.loadingClip))){
this.background.loadingClip.visible = true;
};
}
private function onAdFeedLoaded(_arg1:Event):void{
var _local2:URLLoader = URLLoader(_arg1.target);
if (((_local2.data) && (!((_local2.data == ""))))){
this.loadAd((_local2.data as String));
} else {
dispatchEvent(new APIEvent(APIEvent.AD_ATTACHED, false, new APIError("FLASH_ADS_NOT_APPROVED", "Unable to render ad")));
if (((this.background) && (this.background.loadingClip))){
this.background.loadingClip.visible = false;
};
};
}
private function onAdFeedError(_arg1:Event):void{
trace("[NewgroundsAPI] :: Unable to load ad feed!");
if (((this.background) && (this.background.loadingClip))){
this.background.loadingClip.visible = false;
};
}
private function onAdError(_arg1:Event):void{
dispatchEvent(new APIEvent(APIEvent.AD_ATTACHED, false, new APIError("FLASH_ADS_NOT_APPROVED", "Unable to render ad")));
this.removeAd();
}
private function onAdLoaded(_arg1:Event):void{
this._adRect.addChild(this._ad);
this._ad.mask = this._mask;
this._adRect.visible = true;
if (this.background){
if (this._showBackground){
this._adRect.mask = this.background.adMask;
};
if (this.background.loadingClip){
this.background.loadingClip.visible = false;
};
};
trace("[NewgroundsAPI] :: Ad loaded!");
dispatchEvent(new APIEvent(APIEvent.AD_ATTACHED, true));
}
private function onRemovedFromStage(_arg1:Event):void{
this.removeAd();
}
private function get hasAdElapsed():Boolean{
if (getTimer() >= _adResetTime){
_adResetTime = (getTimer() + ((1000 * 60) * 5));
return (true);
};
return (false);
}
private function linkClickHandler(_arg1:MouseEvent):void{
API.loadNewgrounds();
}
}
}//package com.newgrounds.components
Section 19
//MedalPopup (com.newgrounds.components.MedalPopup)
package com.newgrounds.components {
import flash.events.*;
import flash.display.*;
import com.newgrounds.*;
import flash.utils.*;
import flash.text.*;
public class MedalPopup extends MovieClip {
public var medalNameText:TextField;
public var medalValueText:TextField;
public var medalContainer:Sprite;
private var _initialized:Boolean;
private var _medal:Medal;
private var _medalIcon:Bitmap;
private var _medalQueue:Array;
private var _popDelay:Timer;
public function MedalPopup(){
this._medalQueue = [];
this._popDelay = new Timer(3000, 1);
super();
addFrameScript(0, this.frame1, 9, this.frame10, 18, this.frame19);
if (((!((parent == null))) && ((getQualifiedClassName(parent) == "fl.livepreview::LivePreviewParent")))){
return;
};
visible = false;
addEventListener(Event.ENTER_FRAME, this.enterFrameHandler);
stop();
API.addEventListener(APIEvent.MEDAL_UNLOCKED, this.onMedalUnlocked, false, 0, true);
this._popDelay.addEventListener(TimerEvent.TIMER, this.timerHandler);
}
public function get popupTime():Number{
return ((this._popDelay.delay / 1000));
}
public function set popupTime(_arg1:Number):void{
if (isNaN(_arg1)){
_arg1 = 3;
};
this._popDelay.delay = (_arg1 * 1000);
}
private function enterFrameHandler(_arg1:Event):void{
var myIndex:uint;
var topIndex:uint;
var event = _arg1;
if (((this._medalQueue.length) && (!(visible)))){
this._medal = this._medalQueue.pop();
this._popDelay.start();
gotoAndPlay("medal_show");
visible = true;
};
if (((visible) && (parent))){
try {
myIndex = parent.getChildIndex(this);
topIndex = (parent.numChildren - 1);
if (myIndex != topIndex){
parent.setChildIndex(this, topIndex);
};
} catch(error:Error) {
};
};
}
private function onMedalUnlocked(_arg1:APIEvent):void{
if (((((_arg1.success) && (_arg1.data))) && ((_arg1.data is Medal)))){
this._medalQueue.push(Medal(_arg1.data));
};
}
private function showMedalInfo():void{
if (!this._medal){
return;
};
if (this.medalContainer){
this._medalIcon = this._medal.createIconBitmap();
this.medalContainer.addChild(this._medalIcon);
};
if (this.medalNameText){
this.medalNameText.text = this._medal.name;
};
if (this.medalValueText){
this.medalValueText.text = (this._medal.value.toString() + "pts");
};
this._popDelay.start();
stop();
}
private function timerHandler(_arg1:TimerEvent):void{
if (((this._medalIcon) && (this._medalIcon.parent))){
this._medalIcon.parent.removeChild(this._medalIcon);
this._medalIcon = null;
};
gotoAndPlay("medal_hide");
this._popDelay.stop();
}
function frame1(){
stop();
}
function frame10(){
this.showMedalInfo();
stop();
}
function frame19(){
stop();
visible = false;
}
}
}//package com.newgrounds.components
Section 20
//API (com.newgrounds.API)
package com.newgrounds {
import flash.events.*;
import flash.display.*;
import com.newgrounds.components.*;
import flash.utils.*;
import com.adobe.serialization.json.*;
import flash.net.*;
import com.adobe.crypto.*;
import com.adobe.images.*;
import flash.system.*;
public class API {
public static const VERSION:String = "2.9";
private static const GATEWAY_URL:String = "http://www.ngads.com/gateway_v2.php";
private static const AD_TERMS_URL:String = "http://www.newgrounds.com/wiki/flashads/terms/";
private static const COMMANDS_WIKI_URL:String = "http://www.newgrounds.com/wiki/flashapi/commands/";
private static var do_echo:Boolean = false;
private static var _debug:Boolean = true;
private static var _connected:Boolean = false;
private static var _isMetadataLoaded:Boolean = false;
private static var _preloadComplete:Boolean = false;
private static var _adsApproved:Boolean = false;
private static var _saveGroupId:uint;
private static var _saveFileId:uint;
private static var _trackerId:uint;
private static var _movieId:String;
private static var _encryptionKey:String;
private static var _url:String;
private static var _host:String;
private static var connected:Boolean;
private static var version:String;
private static var ad_url:String;
private static var publisher_id:uint;
private static var session_id:String;
private static var user_email:String;
private static var user_name:String;
private static var user_id:uint;
private static var userpage_format:String;
private static var _medals:Array;
private static var timeoutTimer:Timer = new Timer(8000, 1);
private static var _userpageFormat:String;
private static var _scoreboards:Array = new Array();
private static var _bridge:Bridge;
private static var _saveFile:SaveFile;
private static var _imageFilePath:String;
private static var _saveFilePath:String;
private static var _saveGroups:Array = [];
private static var root:DisplayObject;
private static var _eventDispatcher:EventDispatcher = new EventDispatcher();
private static var score_page_counts:Object = new Object();
private static var compression_radix:String = "/g8236klvBQ#&|;Zb*7CEA59%s`Oue1wziFp$rDVY@TKxUPWytSaGHJ>dmoMR^<0~4qNLhc(I+fjn)X";
private static var compressor:BaseN = new BaseN(compression_radix);
public static var errors:Dictionary = APIError.init_codes();
private static var sharedObjects:Dictionary = new Dictionary();
private static var _preloadAssets:Array = [];
public static var periods:Object = getPeriodAliases();
private static var period_aliases:Object = {t:{name:"Today", alias:"TODAY"}, p:{name:"Yesterday", alias:"YESTERDAY"}, w:{name:"This Week", alias:"THIS_WEEK"}, m:{name:"This Month", alias:"THIS_MONTH"}, y:{name:"This Year", alias:"THIS_YEAR"}, a:{name:"All-Time", alias:"ALL_TIME"}};
private static var secureCommand:String;
public static function get adFeedURL():String{
return (ad_url);
}
public static function get preloadComplete():Boolean{
return (_preloadComplete);
}
private static function assertConnected():Boolean{
if (!_connected){
return (false);
};
return (true);
}
public static function setVersion(_arg1:String):void{
if (((_arg1) && (!((_arg1 == ""))))){
version = _arg1;
};
}
public static function setUserEmail(_arg1:String):void{
user_email = _arg1;
}
public static function get debugMode():Boolean{
return (_debug);
}
public static function set debugMode(_arg1:Boolean):void{
_debug = _arg1;
}
public static function getTrackerID():uint{
return (_trackerId);
}
public static function getUserID():uint{
return (user_id);
}
public static function getUserName():String{
return (user_name);
}
public static function isConnected():Boolean{
return (_connected);
}
public static function getOfficialURL():String{
var _local1:String = ((((((GATEWAY_URL + "?tracker_id=") + _movieId) + "&command_id=") + getCommandID("loadOfficalVersion")) + "&seed=") + Math.random());
if (debugMode){
_local1 = (_local1 + "&debug=1");
};
return (_local1);
}
public static function get adsApproved():Boolean{
return (_adsApproved);
}
public static function hasUserSession():Boolean{
return (((((!((session_id == null))) && (!((session_id == ""))))) && (!((publisher_id == 0)))));
}
public static function isNewgrounds():Boolean{
return ((((publisher_id == 1)) || ((getHost().toLowerCase().indexOf("ungrounded.net") > -1))));
}
public static function IsCompatible():Boolean{
return (!((publisher_id == 0)));
}
public static function hasUserEmail():Boolean{
return (((!((user_email == null))) && (!((user_email == "")))));
}
public static function connectionTimeOut(_arg1:Event=null):void{
dispatchEvent(new APIEvent(APIEvent.API_CONNECTED, false, new APIError("CONNECTION_FAILED", "Connection to NewgroundsAPI gateway timed out.")));
}
public static function connect(_arg1:LoaderInfo, _arg2:String, _arg3:String=null):void{
var loaderInfo = _arg1;
var m_id = _arg2;
var encrypt_key = _arg3;
if (!loaderInfo){
fatalError("Null loaderInfo paremeter passed in to connectMovie!", "");
return;
};
try {
if (loaderInfo.loader){
loaderInfo = loaderInfo.loader.loaderInfo;
};
} catch(error:Error) {
};
_url = loaderInfo.url;
_host = _url;
if ((((_host.indexOf("http://") > -1)) || ((_host.indexOf("https://") > -1)))){
_host = _host.split("/")[2].toLowerCase();
} else {
_host = "localhost";
};
var flashVars:Object = loaderInfo.parameters;
if (isPublishedHost()){
debugMode = false;
};
if (((!(debugMode)) && (flashVars))){
if (flashVars.NewgroundsAPI_UserName){
user_name = flashVars.NewgroundsAPI_UserName;
};
if (flashVars.NewgroundsAPI_UserID){
user_id = flashVars.NewgroundsAPI_UserID;
};
if (flashVars.NewgroundsAPI_PublisherID){
publisher_id = flashVars.NewgroundsAPI_PublisherID;
} else {
publisher_id = 1;
};
if (flashVars.NewgroundsAPI_UserpageFormat){
_userpageFormat = flashVars.NewgroundsAPI_UserpageFormat;
};
if (flashVars.NewgroundsAPI_SessionID){
session_id = flashVars.NewgroundsAPI_SessionID;
};
if (flashVars.NewgroundsAPI_SaveGroupID){
_saveGroupId = flashVars.NewgroundsAPI_SaveGroupID;
};
if (flashVars.NewgroundsAPI_SaveFileID){
_saveFileId = flashVars.NewgroundsAPI_SaveFileID;
};
if (flashVars.NewgroundsAPI_SandboxID){
_bridge = new Bridge(flashVars.NewgroundsAPI_SandboxID);
};
} else {
publisher_id = 1;
session_id = "D3bu64p1U53R";
user_id = 10;
user_name = "API-Debugger";
};
if (connected){
fatalError("NewgroundsAPI.connect() - connection already in progress", "connect");
return;
};
timeoutTimer.start();
if (!m_id){
fatalError("NewgroundsAPI.connectMovie() - missing required movieId parameter", "connectMovie");
};
_movieId = String(m_id);
_trackerId = uint(_movieId.substring(0, _movieId.indexOf(":")));
_encryptionKey = encrypt_key;
connected = true;
sendCommand("connectMovie", {host:getHost(), movie_version:version});
}
private static function getHost():String{
return (_host);
}
public static function isPublishedHost():Boolean{
return (((!((getHost() == "localhost"))) && ((getHost().indexOf("file://") == -1))));
}
public static function loadUserPage(_arg1:uint=0, _arg2:String=null):Boolean{
var _local3:String;
if ((((_arg1 == 0)) && ((_arg2 == null)))){
if (hasUserSession()){
_arg1 = user_id;
_arg2 = user_name;
} else {
return (false);
};
};
if (publisher_id == 1){
_local3 = (("http://" + _arg2.toLowerCase()) + ".newgrounds.com");
navigateToURL(new URLRequest(_local3), "_blank");
return (true);
};
if (userpage_format){
_local3 = userpage_format;
_local3 = _local3.split(":user_id:").join(_arg1.toString());
_local3 = _local3.split(":user_name:").join(escape(_arg2));
navigateToURL(new URLRequest(_local3), "_blank");
return (true);
};
return (false);
}
public static function loadNewgrounds():void{
sendCommand("loadNewgrounds", {host:getHost()}, true);
}
public static function loadOfficialVersion():void{
navigateToURL(new URLRequest(getOfficialURL()));
}
public static function loadMySite():void{
sendCommand("loadMySite", {host:getHost()}, true);
}
public static function loadCustomLink(_arg1:String):void{
sendCommand("loadCustomLink", {host:getHost(), link:_arg1}, true);
}
public static function logCustomEvent(_arg1:String):void{
sendCommand("logCustomEvent", {host:getHost(), event:_arg1});
}
public static function getScoreBoardByName(_arg1:String):ScoreBoard{
var _local2:ScoreBoard;
for each (_local2 in _scoreboards) {
if (_local2.name == _arg1){
return (_local2);
};
};
return (null);
}
public static function getScoreBoardById(_arg1:uint):ScoreBoard{
var _local2:ScoreBoard;
for each (_local2 in _scoreboards) {
if (_local2.id == _arg1){
return (_local2);
};
};
return (null);
}
public static function postScore(_arg1:String, _arg2:uint, _arg3:String=""):void{
if (((!(_arg1)) || ((_arg1 == "")))){
sendError({command_id:getCommandID("postScore")}, new APIError("MISSING_PARAM", "missing required parameter(s)"));
return;
};
if (_arg3 == null){
_arg3 = "";
};
sendSecureCommand("postScore", {user_name:user_name, board:_arg1, value:_arg2, publisher_id:publisher_id, tag:_arg3});
}
public static function loadScores(_arg1:ScoreBoard, _arg2:String=null):void{
var _local3 = "loadScores";
if (!_arg1.id){
sendError({command_id:getCommandID(_local3)}, new APIError("MISSING_PARAM", "missing required ScoreBoard instance"));
return;
};
var _local4:Object = {};
_local4.publisher_id = publisher_id;
_local4.period = _arg1.period;
_local4.board = _arg1.id;
_local4.num_results = _arg1.num_results;
_local4.page = _arg1.page;
if (((!(_arg2)) || ((_arg2 == "")))){
_local4.tag = _arg1.tag;
} else {
_local4.tag = _arg2;
};
sendCommand(_local3, _local4);
}
public static function loadScoresInRange(_arg1:String, _arg2:String="All-Time", _arg3:uint=1, _arg4:uint=10):void{
if (((!(_arg1)) || ((_arg1 == "")))){
sendError({command_id:getCommandID("postScore")}, new APIError("MISSING_PARAM", "missing required parameter(s)"));
return;
};
var _local5:ScoreBoard = getScoreBoardByName(_arg1);
if (_local5){
_local5.loadScoresInRange(_arg2, _arg3, _arg4);
} else {
sendWarning((("loadScoresInRange: Scoreboard " + _arg1) + " could not be found."));
};
}
private static function populateMedals(_arg1:Array):void{
var _local2:uint;
var _local3:Object;
if (_medals === null){
_medals = new Array();
_local2 = 0;
while (_local2 < _arg1.length) {
_local3 = _arg1[_local2];
_medals.push(Medal.createFromObject(_local3));
_local2++;
};
};
sendMessage("Medals loaded!");
}
private static function populateSaveGroups(_arg1:Array):void{
var _local3:SaveGroup;
_saveGroups = [];
var _local2:uint;
while (_local2 < _arg1.length) {
_local3 = SaveGroup.createFromObject(_arg1[_local2]);
_saveGroups.push(_local3);
_local2++;
};
}
private static function populateScoreBoards(_arg1:Array):void{
_scoreboards = [];
var _local2:uint;
while (_local2 < _arg1.length) {
_scoreboards.push(new ScoreBoard(_arg1[_local2].id, _arg1[_local2].name, ""));
_local2++;
};
}
public static function get medals():Array{
return ((_medals) ? _medals.concat() : []);
}
public static function getMedalById(_arg1:uint):Medal{
var _local2:Medal;
for each (_local2 in _medals) {
if (_local2.id == _arg1){
return (_local2);
};
};
return (null);
}
public static function getMedalByName(_arg1:String):Medal{
var _local2:Medal;
for each (_local2 in _medals) {
if (_local2.name == _arg1){
return (_local2);
};
};
return (null);
}
public static function unlockMedal(_arg1:String):void{
var _local3:Object;
var _local4:Object;
if (((!(_arg1)) || ((_arg1 == "")))){
sendError({command_id:getCommandID("unlockMedal")}, new APIError("MISSING_PARAM", "missing required medal name"));
return;
};
var _local2:Medal = getMedalByName(_arg1);
if (!_local2){
sendMessage(("No medal with name: " + _arg1));
return;
};
if (((hasUserSession()) || (debugMode))){
sendMessage((("Attempting to unlock '" + _local2.name) + "'"));
if (_local2.unlocked){
sendWarning((("Medal '" + _local2.name) + "' is already unlocked!"));
return;
};
_local3 = new Object();
_local3.medal_id = _local2.id;
sendSecureCommand("unlockMedal", _local3);
} else {
sendMessage(("Locally unlocking " + _local2.name));
if (_local2.unlocked){
sendWarning((("Medal '" + _local2.name) + "' is already unlocked!"));
return;
};
_local2.unlocked = true;
_local4 = loadLocal("medals_unlocked");
if (!_local4){
_local4 = new Object();
};
_local4[_local2.id.toString()] = true;
saveLocal("medals_unlocked", _local4);
callListener(APIEvent.MEDAL_UNLOCKED, true, _local2);
};
}
public static function loadMedals():void{
if (_medals){
dispatchEvent(new APIEvent(APIEvent.MEDALS_LOADED, true, medals));
return;
};
var _local1:Object = new Object();
if (hasUserSession()){
_local1.publisher_id = publisher_id;
_local1.user_id = user_id;
};
sendCommand("getMedals", _local1);
}
public static function saveLocal(_arg1:String, _arg2:Object, _arg3:uint=0):void{
var sharedObj:SharedObject;
var save_id = _arg1;
var save_data = _arg2;
var size_allocation = _arg3;
try {
if (!sharedObjects[save_id]){
sharedObjects[save_id] = SharedObject.getLocal(((("ng_ap_secure_" + _trackerId) + "_") + save_id));
};
sharedObj = sharedObjects[save_id];
sharedObj.data[save_id] = encodeData(save_data);
sharedObj.flush();
} catch(e:Error) {
sendWarning(("saveLocal ERROR: " + e));
};
}
public static function loadLocal(_arg1:String):Object{
var sharedObj:SharedObject;
var save_id = _arg1;
try {
if (!sharedObjects[save_id]){
sharedObjects[save_id] = SharedObject.getLocal(((("ng_ap_secure_" + _trackerId) + "_") + save_id));
};
sharedObj = sharedObjects[save_id];
if (((((sharedObj) && (sharedObj.data))) && (sharedObj.data[save_id]))){
return (decodeData(sharedObj.data[save_id]));
} else {
return (null);
};
} catch(e:Error) {
sendWarning(("loadLocal ERROR: " + e));
};
return (null);
}
public static function encodeData(_arg1:Object):String{
return (compressHex(RC4.encrypt(JSON.encode(_arg1), _encryptionKey)));
}
public static function decodeData(_arg1:String){
return (JSON.decode(RC4.decrypt(uncompressHex(_arg1), _encryptionKey)));
}
private static function compressHex(_arg1:String):String{
var _local2:uint = (_arg1.length % 6);
var _local3 = "";
var _local4:uint;
while (_local4 < _arg1.length) {
_local3 = (_local3 + compressor.encode(uint(("0x" + _arg1.substr(_local4, 6))), 4));
_local4 = (_local4 + 6);
};
return ((_local2.toString() + _local3));
}
private static function uncompressHex(_arg1:String):String{
var _local4:uint;
var _local6:String;
var _local7:uint;
var _local8:String;
var _local2:uint = uint(_arg1.charAt(0));
var _local3 = "";
var _local5:uint = 1;
while (_local5 < _arg1.length) {
_local6 = _arg1.substr(_local5, 4);
_local7 = uint(compressor.decode(_local6));
_local8 = _local7.toString(16);
if ((_local5 + 4) < _arg1.length){
_local4 = 6;
} else {
_local4 = _local2;
};
while (_local8.length < _local4) {
_local8 = ("0" + _local8);
};
_local3 = (_local3 + _local8);
_local5 = (_local5 + 4);
};
return (_local3);
}
public static function getSaveGroupById(_arg1:uint):SaveGroup{
if (((!(_saveGroups)) || ((_saveGroups.length < 1)))){
sendWarning("No save groups found");
return (null);
};
var _local2:uint;
while (_local2 < _saveGroups.length) {
if (_saveGroups[_local2].id == _arg1){
return (_saveGroups[_local2]);
};
_local2++;
};
return (null);
}
public static function getSaveGroupByName(_arg1:String):SaveGroup{
if (((!(_saveGroups)) || ((_saveGroups.length < 1)))){
sendWarning("No save groups found");
return (null);
};
var _local2:uint;
while (_local2 < _saveGroups.length) {
if (_saveGroups[_local2].name == _arg1){
return (_saveGroups[_local2]);
};
_local2++;
};
return (null);
}
public static function createSaveQuery(_arg1:String):SaveGroupQuery{
var _local2:SaveGroup = getSaveGroupByName(_arg1);
if (_local2){
return (_local2.createQuery());
};
return (null);
}
public static function executeSaveQuery(_arg1:SaveGroupQuery):void{
sendCommand("lookupSaveFiles", {publisher_id:publisher_id, group_id:_arg1.groupId, query:JSON.encode(_arg1.toObject())}, false, null, _arg1);
}
public static function checkFilePrivledges(_arg1:SaveFile):void{
sendCommand("checkFilePrivs", {group:_arg1.groupId, filename:_arg1.name, user_id:(user_id) ? user_id : 0, publisher_id:publisher_id});
}
public static function newSaveFile(_arg1:String):SaveFile{
var _local2:SaveGroup = getSaveGroupByName(_arg1);
if (_local2){
return (new SaveFile(_local2));
};
sendError({command_id:"newSaveFile"}, new APIError("INVALID_SAVE_GROUP", (("'" + _local2) + "' is not a valid save group.")));
return (null);
}
public static function saveFile(_arg1:SaveFile, _arg2:Boolean=false, _arg3:Boolean=false):void{
var _local4:Object = _arg1.toObject();
_local4.user_name = user_name;
if (_arg1.id){
_local4.save_id = _arg1.id;
};
_local4.overwrite = (_arg3) ? 1 : 0;
if (_arg2){
_local4.draft = 1;
};
var _local5:ByteArray = new ByteArray();
if ((_arg1.contents is ByteArray)){
_local5.writeByte(0);
_local5.writeBytes(_arg1.contents);
} else {
_local5.writeByte(1);
_local5.writeObject(_arg1.contents);
};
_local5.compress();
var _local6:Object = new Object();
_local6.file = _local5;
if (_arg1.thumbnail){
_local6.thumbnail = PNGEncoder.encode(_arg1.thumbnail);
};
sendSecureCommand("saveFile", _local4, null, _local6, _arg1);
}
public static function rateSaveFile(_arg1:SaveFile, _arg2:SaveRating, _arg3:Number):void{
sendSecureCommand("rateSaveFile", {group:_arg1.groupId, save_id:_arg1.id, rating_id:_arg2.id, vote:_arg3, user_id:user_id}, null, null, _arg1);
}
public static function loadSaveFile(_arg1:Number, _arg2:Boolean=true){
var _local3:Object = {publisher_id:publisher_id, save_id:_arg1, get_contents:_arg2};
sendCommand("loadSaveFile", _local3);
}
private static function doEvent(_arg1:Object):void{
var _local2:String;
var _local3:Object;
var _local4:String;
var _local5:Boolean;
var _local6:ScoreBoard;
var _local7:Array;
var _local8:*;
var _local9:String;
var _local10:Medal;
var _local11:SaveGroup;
var _local12:Object;
var _local13:Object;
var _local14:Object;
var _local15:SaveFile;
var _local16:uint;
var _local17:Object;
var _local18:uint;
switch (getCommandName(_arg1.command_id)){
case "connectMovie":
timeoutTimer.stop();
if (_arg1.success){
sendMessage("You have successfully connected to the Newgrounds API Gateway");
sendMessage((("Movie identified as \"" + _arg1.movie_name) + "\""));
callListener(APIEvent.API_CONNECTED, _arg1.success, {title:_arg1.movie_name});
} else {
callListener(APIEvent.API_CONNECTED, _arg1.success, {});
return;
};
_local5 = false;
if (_arg1.ad_status === -1){
_local2 = "This movie was not approved to run Flash Ads.";
sendWarning(_local2);
sendWarning((("visit " + AD_TERMS_URL) + " to view our approval guidelines"));
if (!_arg1.ad_url){
callListener(APIEvent.ADS_APPROVED, false, new APIError("FLASH_ADS_NOT_APPROVED", _local2));
} else {
_local5 = true;
};
} else {
if (_arg1.ad_status === 0){
_local2 = "Flash Ads are currently awaiting approval.";
sendNotice(_local2);
if (!_arg1.ad_url){
callListener(APIEvent.ADS_APPROVED, false, new APIError("FLASH_ADS_NOT_APPROVED", _local2));
} else {
_local5 = true;
};
};
};
if (_arg1.ad_url){
ad_url = unescape(_arg1.ad_url);
if (!_local5){
sendMessage("This movie has been approved to run Flash Ads!");
};
_adsApproved = true;
callListener(APIEvent.ADS_APPROVED, true);
};
if (_arg1.deny_host){
_local2 = (getHost() + " does not have permission to run this movie!");
sendWarning(_local2);
sendWarning(("\tUpdate your API configuration to unblock " + getHost()));
callListener(APIEvent.HOST_BLOCKED, true, {real_url:unescape(_arg1.movie_url), url:getOfficialURL()});
};
if (_arg1.movie_version){
sendWarning("According to your API Configuration, this version is out of date.");
if (version){
sendWarning(("\tThe this movie is version " + version));
};
sendWarning(("\tThe most current version is " + _arg1.movie_version));
callListener(APIEvent.NEW_VERSION_AVAILABLE, true, {version:_arg1.movie_version, real_url:unescape(_arg1.movie_url), url:getOfficialURL()});
};
if (_arg1.request_portal_url){
sendCommand("setPortalID", {portal_url:_url});
};
sendCommand("preloadSettings", {publisher_id:publisher_id, user_id:user_id});
break;
case "preloadSettings":
if (_arg1.medals){
populateMedals(_arg1.medals);
if (((!(hasUserSession())) && (!(debugMode)))){
echo("Checking for SharedObject Medals...");
_local8 = loadLocal("medals_unlocked");
if (_local8){
for (_local9 in _local8) {
if (_local8[_local9]){
_local10 = getMedalById(uint(_local9));
echo(("Now unlocking " + _local10.name));
_local10.unlocked = true;
};
};
};
};
};
if (_arg1.save_groups){
populateSaveGroups(_arg1.save_groups);
};
if (_arg1.save_file_path){
_saveFilePath = (_arg1.save_file_path + "/");
};
if (_arg1.image_file_path){
_imageFilePath = (_arg1.image_file_path + "/");
};
if (_arg1.score_boards){
populateScoreBoards(_arg1.score_boards);
};
sendMessage("Metadata loaded!");
callListener(APIEvent.METADATA_LOADED, _arg1.success);
if (((_saveFileId) && (_saveGroupId))){
_local11 = getSaveGroupById(_saveGroupId);
if (_local11){
callListener(APIEvent.FILE_REQUESTED, true, {save_id:_saveFileId, group:_local11});
};
};
_preloadComplete = true;
break;
case "logCustomEvent":
if (_arg1.success){
sendMessage((("Event '" + _arg1.event) + "' was logged."));
};
callListener(APIEvent.EVENT_LOGGED, _arg1.success, {event:_arg1.event});
break;
case "postScore":
if (_arg1.success){
_local4 = "User";
if (user_email){
_local4 = user_email;
} else {
if (user_name){
_local4 = user_name;
};
};
_local6 = getScoreBoardById(_arg1.board);
if (_local6){
sendMessage((((((_local4 + " posted ") + _arg1.value) + " to '") + _local6.name) + "'"));
};
if (_arg1.best_scores){
_local12 = {today:_arg1.best_scores.D, yesterday:_arg1.best_scores.P, week:_arg1.best_scores.W, year:_arg1.best_scores.Y, all_time:_arg1.best_scores.A};
} else {
_local12 = {};
};
if (_arg1.best_ranks){
_local13 = {today:_arg1.best_ranks.D, yesterday:_arg1.best_ranks.P, week:_arg1.best_ranks.W, year:_arg1.best_ranks.Y, all_time:_arg1.best_ranks.A};
} else {
_local13 = {};
};
if (_arg1.num_scores){
_local14 = {today:_arg1.num_scores.D, yesterday:_arg1.num_scores.P, week:_arg1.num_scores.W, year:_arg1.num_scores.Y, all_time:_arg1.num_scores.A};
} else {
_local14 = {};
};
_local3 = {score:_arg1.score, value:_arg1.value, username:_local4, best_scores:_local12, best_ranks:_local13, num_scores:_local14};
};
callListener(APIEvent.SCORE_POSTED, _arg1.success, _local3);
break;
case "loadScores":
_local3 = new Object();
_local6 = getScoreBoardById(_arg1.board);
if (_local6){
_local6.setScores(_arg1.scores, _arg1.period, _arg1.page, _arg1.num_results, _arg1.num_scores);
};
callListener(APIEvent.SCORES_LOADED, _arg1.success, _local6);
break;
case "unlockMedal":
if (_medals){
_local10 = getMedalByName(_arg1.medal_name);
if (_local10.unlocked){
return;
};
_local10.unlocked = true;
callListener(APIEvent.MEDAL_UNLOCKED, _arg1.success, _local10);
};
break;
case "getMedals":
if (_arg1.success){
populateMedals(_arg1.medals);
};
callListener(APIEvent.MEDALS_LOADED, _arg1.success, _local3);
break;
case "loadSaveFile":
if (_arg1.success){
_local11 = getSaveGroupById(_arg1.group_id);
_local15 = new SaveFile(_local11);
_local15.id = _arg1.file.save_id;
_local15.name = _arg1.file.filename;
_local15.fileUrl = (_saveFilePath + _arg1.file.file);
_local15.thumbnailUrl = (_imageFilePath + _arg1.file.thumb);
_local15.authorName = _arg1.file.user_name;
_local15.authorId = _arg1.file.user_id;
_local15.setStatus(_arg1.file.status);
_local15.description = _arg1.file.description;
_local15.setFileSize(_arg1.file.file_size);
if (((_arg1.file.keys) && (_arg1.file.keys.length))){
_local16 = 0;
while (_local16 < _arg1.file.keys.length) {
_local15.setKey(_arg1.file.keys[_local16].id, _arg1.file.keys[_local16].value);
_local16++;
};
};
if (((_arg1.file.ratings) && (_arg1.file.ratings.length))){
_local16 = 0;
while (_local16 < _arg1.file.ratings.length) {
_local15.setRating(_arg1.file.ratings[_local16].id, _arg1.file.ratings[_local16].votes, _arg1.file.ratings[_local16].score);
_local16++;
};
};
if (_arg1.get_contents){
_local15.loadContents();
};
};
callListener(APIEvent.FILE_INITIALIZED, _arg1.success, _local15);
break;
case "lookupSaveFiles":
_local7 = [];
if (((_arg1.success) && (_arg1.files))){
_local16 = 0;
while (_local16 < _arg1.files.length) {
_local17 = _arg1.files[_local16];
_local15 = new SaveFile(getSaveGroupById(_arg1.group_id));
_local15.name = _local17.filename;
_local15.id = _local17.save_id;
_local15.description = _local17.description;
_local15.thumbnailUrl = (_imageFilePath + _local17.thumb);
_local15.fileUrl = (_saveFilePath + _local17.file);
_local15.authorName = _local17.user_name;
_local15.authorId = _local17.user_id;
_local15.setStatus(_local17.status);
_local15.setFileSize(_local17.file_size);
if (((_local17.keys) && (_local17.keys.length))){
_local18 = 0;
while (_local18 < _local17.keys.length) {
_local15.setKey(_local17.keys[_local18].id, _local17.keys[_local18].value);
_local18++;
};
};
if (((_local17.ratings) && (_local17.ratings.length))){
_local18 = 0;
while (_local18 < _local17.ratings.length) {
_local15.setRating(_local17.ratings[_local18].id, _local17.ratings[_local18].votes, _local17.ratings[_local18].score);
_local18++;
};
};
_local7.push(_local15);
_local16++;
};
};
_arg1.owner.dispatchEvent(new APIEvent(APIEvent.QUERY_COMPLETE, _arg1.success, _local7));
break;
case "rateSaveFile":
_local15 = _arg1.owner;
_arg1.success = ((_arg1.success) && (!(_arg1.already_voted)));
if (_arg1.success){
_local15.setRating(_arg1.rating_id, _arg1.votes, _arg1.score);
};
_arg1.file = _local15;
_local15.dispatchEvent(new APIEvent(APIEvent.VOTE_COMPLETE, _arg1.success, _arg1));
break;
case "saveFile":
_local3 = {};
if (_arg1.success){
_local3 = {save_id:_arg1.save_id, filename:_arg1.filename, file_url:_arg1.file_url, thumbnail:_arg1.thumbnail, icon:_arg1.icon};
SaveFile(_arg1.owner).fileSaved(_local3);
};
_arg1.owner.dispatchEvent(new APIEvent(APIEvent.FILE_SAVED, _arg1.success, _local3));
break;
case "checkFilePrivs":
_local3 = {filename:_arg1.filename, folder:_arg1.folder, can_read:_arg1.can_read, can_write:_arg1.can_write};
callListener(APIEvent.FILE_PRIVS_LOADED, _arg1.success, _local3);
break;
};
}
public static function addEventListener(_arg1:String, _arg2:Function, _arg3:Boolean=false, _arg4:uint=0, _arg5:Boolean=false):void{
_eventDispatcher.addEventListener(_arg1, _arg2, _arg3, _arg4, _arg5);
}
public static function hasEventListener(_arg1:String):Boolean{
return (_eventDispatcher.hasEventListener(_arg1));
}
public static function removeEventListener(_arg1:String, _arg2:Function, _arg3:Boolean=false):void{
_eventDispatcher.removeEventListener(_arg1, _arg2, _arg3);
}
private static function dispatchEvent(_arg1:Event):void{
_eventDispatcher.dispatchEvent(_arg1);
echo(("Fired Event: " + _arg1.type));
}
static function callListener(_arg1:String, _arg2:Boolean=true, _arg3=undefined):void{
dispatchEvent(new APIEvent(_arg1, _arg2, _arg3));
if (_bridge){
_bridge.sendEvent(_arg1, {success:_arg2, data:_arg3});
};
}
private static function getCommandName(_arg1:String):String{
return (_arg1);
}
private static function getCommandID(_arg1:String):String{
return (_arg1);
}
private static function getPeriodAliases():Object{
var _local2:String;
var _local1:Object = new Object();
for (_local2 in period_aliases) {
_local1[period_aliases[_local2].alias] = _local2;
};
return (_local1);
}
public static function getPeriodName(_arg1:String):String{
var _local2:String;
for (_local2 in period_aliases) {
if (_local2 == _arg1){
return (period_aliases[_local2].name);
};
};
return (null);
}
public static function getPeriodAlias(_arg1:String):String{
var _local2:String;
for (_local2 in period_aliases) {
if (_local2 == _arg1){
return (period_aliases[_local2].alias);
};
};
return (null);
}
private static function sendError(_arg1:Object, _arg2:APIError):void{
var _local3:String = ((((("[NewgroundsAPI ERROR] :: " + getCommandName(_arg1.command_id)) + "() - ") + _arg2.name) + ":\n\t\t\t\t") + _arg2.message);
trace(_local3);
if (_bridge){
_bridge.sendEvent("trace", {data:_local3});
};
}
private static function sendWarning(_arg1:String, _arg2:String=null):void{
if (_arg2){
_arg1 = (_arg1 + ((("\n[NewgroundsAPI WARNING] :: \tSee " + COMMANDS_WIKI_URL) + _arg2.toLowerCase()) + " for additional information."));
};
trace(_arg1);
if (_bridge){
_bridge.sendEvent("trace", {data:_arg1});
};
}
private static function sendNotice(_arg1:String, _arg2:String=null):void{
var _local3:String;
if (_arg2){
_arg1 = (_arg1 + ((("\n[NewgroundsAPI NOTICE] :: \tSee " + COMMANDS_WIKI_URL) + _arg2.toLowerCase()) + " for additional information."));
};
trace(_arg1);
if (_bridge){
_bridge.sendEvent("trace", {data:_arg1});
};
}
private static function fatalError(_arg1:String, _arg2:String):void{
if (_arg2){
_arg1 = (_arg1 + ((("\n\tSee " + COMMANDS_WIKI_URL) + _arg2.toLowerCase()) + " for additional information."));
};
trace(("***ERROR*** class=API\n\n" + _arg1));
}
public static function sendSecureCommand(_arg1:String, _arg2:Object, _arg3:Object=null, _arg4:Object=null, _arg5=null):void{
if (((((!(debugMode)) && (!(hasUserSession())))) && (!(hasUserEmail())))){
sendError({command_id:getCommandID(_arg1)}, new APIError("IDENTIFICATION_REQUIRED", (("You must be logged in or provide an e-mail address ( using NewgroundsAPI.setUserEmail(\"name@domain.com\"); ) to use " + _arg1) + "().")));
return;
};
if (!_arg1){
fatalError("Missing command", "sendSecureCommand");
};
if (!_arg2){
fatalError("Missing secure_params", "sendSecureCommand");
};
if (!_arg3){
_arg3 = new Object();
};
var _local6 = "";
var _local7:uint;
while (_local7 < 16) {
_local6 = (_local6 + compression_radix.charAt(Math.floor((Math.random() * compression_radix.length))));
_local7++;
};
if (((debugMode) && (!(session_id)))){
_arg2.session_id = "";
} else {
_arg2.session_id = session_id;
};
_arg2.as_version = 3;
_arg2.user_email = user_email;
_arg2.publisher_id = publisher_id;
_arg2.seed = _local6;
_arg2.command_id = getCommandID(_arg1);
var _local8:String = MD5.hash(_local6);
var _local9:String = RC4.encrypt(JSON.encode(_arg2), _encryptionKey);
var _local10:String = (_local8 + _local9);
_arg3.secure = compressHex(_local10);
secureCommand = _arg1;
sendCommand("securePacket", _arg3, false, _arg4, _arg5);
}
public static function stopPendingCommands():void{
SmartURLLoader.closeAll();
}
private static function onCommandComplete(_arg1:Event):void{
var response:Object;
var error:APIError;
var e = _arg1;
var loader:SmartURLLoader = SmartURLLoader(e.target);
echo((("INPUT: \n" + loader.response) + "\n"));
var i:uint;
while (i < _preloadAssets.length) {
if (_preloadAssets[i] == loader){
_preloadAssets.splice(i, 1);
break;
};
i = (i + 1);
};
try {
response = JSON.decode(loader.response);
} catch(error:Error) {
};
if (!response){
response = {command_id:loader._command, success:false};
};
response.owner = loader.owner;
if (((!(response)) || (!(response.success)))){
if (response.command_id == "connectMovie"){
connected = false;
};
error = new APIError(response.error_code, response.error_msg);
sendError(response, error);
if (response.command_id){
doEvent(response);
};
} else {
doEvent(response);
};
}
private static function onCommandError(_arg1:Event):void{
var _local2:Object = {success:false};
var _local3:SmartURLLoader = SmartURLLoader(_arg1.target);
_local2.owner = _local3.owner;
var _local4:uint;
while (_local4 < _preloadAssets.length) {
if (_preloadAssets[_local4] == _local3){
_preloadAssets.splice(_local4, 1);
break;
};
_local4++;
};
if (_local3._command){
_local2.command_id = _local3._command;
if (_local2.command_id == "connectMovie"){
connected = false;
};
doEvent(_local2);
};
}
private static function sendCommand(_arg1:String, _arg2:Object, _arg3:Boolean=false, _arg4:Object=null, _arg5=null):void{
var _local7:String;
var _local8:String;
var _local9:String;
if (((!(connected)) && (!((_arg1 == "connectMovie"))))){
_local7 = (("NewgroundsAPI." + _arg1) + "() - NewgroundsAPI.connectMovie() must be called before this command can be called\n");
fatalError(_local7, "connectMovie");
};
var _local6:SmartURLLoader = new SmartURLLoader();
_local6.addVariable("command_id", getCommandID(_arg1));
_local6.addVariable("tracker_id", _movieId);
if (debugMode){
_local6.addVariable("debug", 1);
};
if (_arg2){
for (_local8 in _arg2) {
_local6.addVariable(_local8, _arg2[_local8]);
};
};
if (_arg4){
for (_local9 in _arg4) {
_local6.addFile(_local9, _arg4[_local9], _local9);
};
};
if (_arg3){
_local6.method = URLRequestMethod.GET;
} else {
_local6.method = URLRequestMethod.POST;
};
_local6.preventCache = true;
if (_arg3){
_local6.openBrowser = true;
_local6.method = URLRequestMethod.GET;
} else {
_local6.addEventListener(Event.COMPLETE, onCommandComplete);
_local6.addEventListener(IOErrorEvent.IO_ERROR, onCommandError);
_local6.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onCommandError);
_local6.method = URLRequestMethod.POST;
};
if (_arg2.secure){
_local6._command = secureCommand;
} else {
_local6._command = getCommandID(_arg1);
};
_local6.owner = _arg5;
_local6.load(GATEWAY_URL);
}
public static function isFlashVersion(_arg1:uint, _arg2:uint=0, _arg3:uint=0, _arg4:uint=0):Boolean{
var _local6:Array = Capabilities.version.split(" ")[1].split(",");
var _local7:Array = arguments;
var _local8:uint;
while (_local8 < _local7.length) {
_local6[_local8] = uint(_local6[_local8]);
_local8++;
};
_local8 = 0;
while (_local8 < _local7.length) {
if (_local6[_local8] > _local7[_local8]){
return (true);
};
if (_local6[_local8] < _local7[_local8]){
return (false);
};
_local8++;
};
return (true);
}
public static function createAd():FlashAd{
sendMessage("You may see a security sandbox violation. This is normal!");
return (new FlashAd());
}
public static function sendMessage(_arg1:String, _arg2:Boolean=false):void{
var _local3:String = ("[NewgroundsAPI] :: " + _arg1);
trace(_local3);
if (_bridge){
_bridge.sendEvent("trace", {data:_local3});
};
}
private static function echo(_arg1:String):void{
if (do_echo){
trace(_arg1);
};
}
}
}//package com.newgrounds
Section 21
//APIError (com.newgrounds.APIError)
package com.newgrounds {
import flash.utils.*;
public class APIError {
public var code:Number;// = 0
public var message:String;
public var name:String;
public var alias:String;
public static const aliases:Array = new Array("UNKNOWN_ERROR", "INVALID_API_ID", "MISSING_PARAM", "INVALID_STAT_ID", "INVALID_COMMAND_ID", "FLASH_ADS_NOT_APPROVED", "PERMISSION_DENIED", "IDENTIFICATION_REQUIRED", "INVALID_EMAIL_ADDRESS", "BANNED_USER", "SESSION_EXPIRED", "INVALID_SCORE", "INVALID_MEDAL", "INVALID_FOLDER", "FILE_NOT_FOUND", "SITE_ID_REQUIRED", "UPLOAD_IN_PROGRESS", "USER_CANCELLED", "CONFIRM_REQUEST", "CONNECTION_FAILED");
private static const always_caps:Array = new Array("API", "URL", "ID");
public static const error_codes:Object = init_codes();
public static const error_names:Object = init_names();
public function APIError(_arg1, _arg2:String){
if ((_arg1 is String)){
_arg1 = error_codes[_arg1];
} else {
if (!(_arg1 is uint)){
_arg1 = 0;
};
};
this.code = _arg1;
this.message = _arg2;
this.name = error_names[_arg1];
this.alias = aliases[_arg1];
}
public function isError():Boolean{
return (true);
}
public static function init_codes():Dictionary{
var _local1:Dictionary = new Dictionary();
var _local2:uint;
while (_local2 < aliases.length) {
_local1[aliases[_local2]] = _local2;
_local2++;
};
return (_local1);
}
private static function init_names():Array{
var _local3:Array;
var _local4:uint;
var _local5:String;
var _local1:Array = new Array();
var _local2:uint;
while (_local2 < aliases.length) {
_local3 = aliases[_local2].toLowerCase().split("_");
_local4 = 0;
while (_local4 < _local3.length) {
_local3[_local4] = (_local3[_local4].substr(0, 1).toUpperCase() + _local3[_local4].substr(1, _local3[_local4].length));
for each (_local5 in always_caps) {
if (_local3[_local4].toUpperCase() == _local5){
_local3[_local4] = _local3[_local4].toUpperCase();
};
};
_local4++;
};
_local1[_local2] = _local3.join(" ");
_local2++;
};
return (_local1);
}
}
}//package com.newgrounds
Section 22
//APIEvent (com.newgrounds.APIEvent)
package com.newgrounds {
import flash.events.*;
public class APIEvent extends Event {
private var _data;
private var _success:Boolean;
private var _target;
private var _error:APIError;
public static const API_CONNECTED:String = "movieConnected";
public static const ADS_APPROVED:String = "adsApproved";
public static const AD_ATTACHED:String = "adAttached";
public static const HOST_BLOCKED:String = "hostBlocked";
public static const NEW_VERSION_AVAILABLE:String = "newVersionAvailable";
public static const EVENT_LOGGED:String = "eventLogged";
public static const SCORE_POSTED:String = "scorePosted";
public static const SCORES_LOADED:String = "scoresLoaded";
public static const MEDAL_UNLOCKED:String = "medalUnlocked";
public static const MEDALS_LOADED:String = "medalsLoaded";
public static const METADATA_LOADED:String = "metadataLoaded";
public static const FILE_PRIVS_LOADED:String = "filePrivsLoaded";
public static const FILE_SAVED:String = "fileSaved";
public static const FILE_LOADED:String = "fileLoaded";
public static const FILE_INITIALIZED:String = "fileInitialized";
public static const FILE_REQUESTED:String = "fileRequested";
public static const QUERY_COMPLETE:String = "queryComplete";
public static const VOTE_COMPLETE:String = "voteComplete";
public function APIEvent(_arg1:String, _arg2:Boolean=true, _arg3=undefined){
super(_arg1);
this._data = _arg3;
this._success = _arg2;
}
public function get success():Boolean{
return (this._success);
}
public function get data(){
return (this._data);
}
}
}//package com.newgrounds
Section 23
//BaseN (com.newgrounds.BaseN)
package com.newgrounds {
import flash.utils.*;
public class BaseN {
private var _hashIndex:String;
private var _hashVal:Dictionary;
private var _base:Number;
public function BaseN(_arg1:String=null){
if (_arg1){
this._hashIndex = _arg1;
} else {
this._hashIndex = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ`~@#$%^&*()+|;/";
};
this._base = this._hashIndex.length;
this._hashVal = new Dictionary();
var _local2:uint;
while (_local2 < this._base) {
this._hashVal[this._hashIndex.charAt(_local2)] = _local2;
_local2++;
};
}
public function encode(_arg1:Number, _arg2:uint=1):String{
var _local3:String = _arg1.toString();
var _local4 = "";
if (_local3.charAt(0) == "-"){
_local4 = "-";
_local3 = _local3.substring(1);
};
var _local5:Array = _local3.split(".", 2);
_local4 = (_local4 + this.baseNEncoder(_local5[0], _arg2));
if (_local5.length > 1){
_local4 = (_local4 + ("." + this.baseNEncoder(_local5[1])));
};
return (_local4);
}
public function decode(_arg1:String):Number{
var _local2 = "";
if (_arg1.charAt(0) == "-"){
_local2 = "-";
_arg1 = _arg1.substring(1);
};
var _local3:Array = _arg1.split(".", 2);
_local2 = (_local2 + this.baseNDecoder(_local3[0]));
if (_local3.length > 1){
_local2 = (_local2 + ".");
_local2 = (_local2 + this.baseNDecoder(_local3[1]));
};
return (Number(_local2));
}
private function baseNEncoder(_arg1:uint, _arg2:uint=1):String{
var _local3 = "";
var _local4:uint = _arg1;
while (_local4 != 0) {
_local3 = (this._hashIndex.charAt((_local4 % this._base)) + _local3);
_local4 = (_local4 / this._base);
};
if (_arg2){
while (_local3.length < _arg2) {
_local3 = (this._hashIndex.charAt(0) + _local3);
};
};
return (_local3);
}
private function baseNDecoder(_arg1:String):uint{
var _local2:uint;
var _local3:uint;
while (_local3 < _arg1.length) {
_local2 = (_local2 * this._base);
_local2 = (_local2 + this._hashVal[_arg1.charAt(_local3)]);
_local3++;
};
return (_local2);
}
}
}//package com.newgrounds
Section 24
//Bridge (com.newgrounds.Bridge)
package com.newgrounds {
import flash.events.*;
import flash.net.*;
public class Bridge {
private var _inConnection:LocalConnection;
private var _outConnection:LocalConnection;
private var _widgetId:String;
public function Bridge(_arg1:String){
this._widgetId = _arg1;
this._inConnection = new LocalConnection();
this._outConnection = new LocalConnection();
this._inConnection.client = this;
this._inConnection.connect(("rec_" + this._widgetId));
this._outConnection.addEventListener(StatusEvent.STATUS, this.onStatus);
}
public function sendCommand(_arg1:String, _arg2:Object):void{
if (this._outConnection){
this._outConnection.send(this._widgetId, "sendCommand", _arg1, this.scrubParameters(_arg2));
};
}
public function sendEvent(_arg1:String, _arg2:Object):void{
if (this._outConnection){
this._outConnection.send(this._widgetId, "sendEvent", _arg1, this.scrubParameters(_arg2));
};
}
public function receiveEvent(_arg1:String, _arg2:Object):void{
API.callListener(_arg1, _arg2.success, _arg2.data);
}
public function scrubParameters(_arg1:Object):Object{
var _local3:String;
var _local2:Object = new Object();
for (_local3 in _arg1) {
if ((((((((((_arg1[_local3] is String)) || ((_arg1[_local3] is Number)))) || ((_arg1[_local3] is uint)))) || ((_arg1[_local3] is int)))) || ((_arg1[_local3] is Boolean)))){
_local2[_local3] = _arg1[_local3];
};
};
return (_local2);
}
private function onStatus(_arg1:Event):void{
}
}
}//package com.newgrounds
Section 25
//Medal (com.newgrounds.Medal)
package com.newgrounds {
import flash.events.*;
import flash.display.*;
import flash.net.*;
import flash.system.*;
public class Medal {
private var _id:uint;
private var _name:String;
private var _value:uint;
private var _difficultyId:uint;
private var _unlocked:Boolean;// = false
private var _iconUrl:URLRequest;
private var _iconLoader:Loader;
private var _icon:BitmapData;
private static const DEFAULT_ICON:BitmapData = new BitmapData(50, 50, false, 0);
private static const DIFFICULT_NAMES:Array = [null, "Easy", "Moderate", "Challenging", "Difficult", "Brutal"];
public function Medal(_arg1:uint, _arg2:String, _arg3:uint, _arg4:uint, _arg5:Boolean, _arg6:String){
var id = _arg1;
var name = _arg2;
var value = _arg3;
var difficulty = _arg4;
var unlocked = _arg5;
var iconUrl = _arg6;
this._icon = DEFAULT_ICON;
super();
this._id = id;
this._name = name;
this._value = value;
this._difficultyId = difficulty;
this._unlocked = unlocked;
if (iconUrl){
this._iconUrl = new URLRequest(iconUrl);
this._iconLoader = new Loader();
this._iconLoader.contentLoaderInfo.addEventListener(Event.INIT, this.onIconLoaderInit);
this._iconLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, this.onIconLoaderError);
this._iconLoader.contentLoaderInfo.addEventListener(SecurityErrorEvent.SECURITY_ERROR, this.onIconLoaderError);
this._iconLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, this.onIconLoaderComplete);
try {
this._iconLoader.load(this._iconUrl, new LoaderContext(true));
} catch(e:Error) {
onIconLoaderError(null);
};
};
}
public function get difficulty():String{
return (DIFFICULT_NAMES[this._difficultyId]);
}
public function get difficultyId():uint{
return (this._difficultyId);
}
public function get icon():BitmapData{
return (this._icon);
}
public function get id():uint{
return (this._id);
}
public function get name():String{
return (this._name);
}
public function get unlocked():Boolean{
return (this._unlocked);
}
public function set unlocked(_arg1:Boolean):void{
this._unlocked = _arg1;
}
public function get value():uint{
return (this._value);
}
public function get bytesLoaded():uint{
return ((this._iconLoader) ? this._iconLoader.contentLoaderInfo.bytesLoaded : 0);
}
public function get bytesTotal():uint{
return ((this._iconLoader) ? this._iconLoader.contentLoaderInfo.bytesTotal : 0);
}
private function onIconLoaderInit(_arg1:Event):void{
}
private function onIconLoaderError(_arg1:IOErrorEvent):void{
trace((((("[NewgroundsAPI WARNING] :: Failed to load medal icon for " + this.name) + " (") + this._iconUrl.url.split("/").pop()) + ")"));
this._iconLoader.unload();
this._iconLoader = null;
}
private function onIconLoaderComplete(_arg1:Event):void{
var _local2:Bitmap = (this._iconLoader.content as Bitmap);
this._icon = _local2.bitmapData;
this._iconLoader.unload();
this._iconLoader = null;
}
public function unlock():void{
if (!this._unlocked){
API.unlockMedal(this._name);
};
}
public function createIconBitmap():Bitmap{
return (new Bitmap(this.icon));
}
public function toString():String{
return (this._name);
}
public static function createFromObject(_arg1:Object):Medal{
return (new Medal(_arg1.medal_id, _arg1.medal_name, _arg1.medal_value, _arg1.medal_difficulty, _arg1.medal_unlocked, _arg1.medal_icon));
}
}
}//package com.newgrounds
Section 26
//RC4 (com.newgrounds.RC4)
package com.newgrounds {
public class RC4 {
private static var sbox:Array = new Array(0xFF);
private static var mykey:Array = new Array(0xFF);
public static function encrypt(_arg1:String, _arg2:String):String{
var _local3:Array = strToChars(_arg1);
var _local4:Array = strToChars(_arg2);
var _local5:Array = calculate(_local3, _local4);
return (charsToHex(_local5));
}
public static function encryptbin(_arg1:String, _arg2:String):Array{
var _local3:Array = strToChars(_arg1);
var _local4:Array = strToChars(_arg2);
var _local5:Array = calculate(_local3, _local4);
return (_local5);
}
public static function decrypt(_arg1:String, _arg2:String):String{
var _local3:Array = hexToChars(_arg1);
var _local4:Array = strToChars(_arg2);
var _local5:Array = calculate(_local3, _local4);
return (charsToStr(_local5));
}
private static function initialize(_arg1:Array):void{
var _local3:uint;
var _local2:uint;
var _local4:uint = _arg1.length;
var _local5:uint;
while (_local5 <= 0xFF) {
mykey[_local5] = _arg1[(_local5 % _local4)];
sbox[_local5] = _local5;
_local5++;
};
_local5 = 0;
while (_local5 <= 0xFF) {
_local2 = (((_local2 + sbox[_local5]) + mykey[_local5]) % 0x0100);
_local3 = sbox[_local5];
sbox[_local5] = sbox[_local2];
sbox[_local2] = _local3;
_local5++;
};
}
private static function calculate(_arg1:Array, _arg2:Array):Array{
var _local6:uint;
var _local7:uint;
var _local8:uint;
var _local10:uint;
initialize(_arg2);
var _local3:uint;
var _local4:uint;
var _local5:Array = new Array();
var _local9:uint;
while (_local9 < _arg1.length) {
_local3 = ((_local3 + 1) % 0x0100);
_local4 = ((_local4 + sbox[_local3]) % 0x0100);
_local7 = sbox[_local3];
sbox[_local3] = sbox[_local4];
sbox[_local4] = _local7;
_local10 = ((sbox[_local3] + sbox[_local4]) % 0x0100);
_local6 = sbox[_local10];
_local8 = (_arg1[_local9] ^ _local6);
_local5.push(_local8);
_local9++;
};
return (_local5);
}
private static function charsToHex(_arg1:Array):String{
var _local2:String = new String("");
var _local3:Array = new Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f");
var _local4:uint;
while (_local4 < _arg1.length) {
_local2 = (_local2 + (_local3[(_arg1[_local4] >> 4)] + _local3[(_arg1[_local4] & 15)]));
_local4++;
};
return (_local2);
}
private static function hexToChars(_arg1:String):Array{
var _local2:Array = new Array();
var _local3:uint = ((_arg1.substr(0, 2))=="0x") ? 2 : 0;
while (_local3 < _arg1.length) {
_local2.push(parseInt(_arg1.substr(_local3, 2), 16));
_local3 = (_local3 + 2);
};
return (_local2);
}
private static function charsToStr(_arg1:Array):String{
var _local2:String = new String("");
var _local3:uint;
while (_local3 < _arg1.length) {
_local2 = (_local2 + String.fromCharCode(_arg1[_local3]));
_local3++;
};
return (_local2);
}
private static function strToChars(_arg1:String):Array{
var _local2:Array = new Array();
var _local3:uint;
while (_local3 < _arg1.length) {
_local2.push(_arg1.charCodeAt(_local3));
_local3++;
};
return (_local2);
}
}
}//package com.newgrounds
Section 27
//SaveFile (com.newgrounds.SaveFile)
package com.newgrounds {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.net.*;
public class SaveFile extends EventDispatcher {
private var _filename:String;
private var _id:uint;
private var _description:String;
private var _contents;
private var _loader:SmartURLLoader;
private var _group:SaveGroup;
private var _keys:Dictionary;
private var _ratings:Dictionary;
private var _fileUrl:String;
private var _thumbnail:BitmapData;
private var _thumbnailUrl:String;
private var _authorId:uint;
private var _authorName:String;
private var _contentSize:uint;
private var _status:uint;
public static const STATUS_PRIVATE = 1;
public static const STATUS_SHARED = 2;
public static const STATUS_UNAPPROVED = 3;
public static const STATUS_APPROVED = 4;
public function SaveFile(_arg1:SaveGroup){
this._keys = new Dictionary();
this._ratings = new Dictionary();
this._group = _arg1;
this._description = "";
}
public function get name():String{
return (this._filename);
}
public function set name(_arg1:String):void{
this._filename = _arg1;
}
public function get id():uint{
return (this._id);
}
public function set id(_arg1:uint):void{
this._id = _arg1;
}
public function get description():String{
return (this._description);
}
public function set description(_arg1:String):void{
this._description = _arg1;
}
public function get contents(){
return (this._contents);
}
public function set contents(_arg1):void{
this._contents = _arg1;
this._contentSize = 0;
}
public function get thumbnailUrl():String{
return (this._thumbnailUrl);
}
public function set thumbnailUrl(_arg1:String):void{
this._thumbnailUrl = _arg1;
}
public function get fileUrl():String{
return (this._fileUrl);
}
public function set fileUrl(_arg1:String):void{
this._fileUrl = _arg1;
}
public function get thumbnail():BitmapData{
return (this._thumbnail);
}
public function set thumbnail(_arg1:BitmapData):void{
if (this._thumbnail){
this._thumbnail.dispose();
};
this._thumbnail = _arg1.clone();
}
public function loadThumbnail():Loader{
var _local1:Loader = new Loader();
if (this._thumbnailUrl){
_local1.load(new URLRequest(this._thumbnailUrl));
};
return (_local1);
}
public function get bytesLoaded():uint{
return ((this._loader) ? this._loader.bytesLoaded : this._contentSize);
}
public function get bytesTotal():uint{
return (this._contentSize);
}
public function get status():uint{
return (this._status);
}
function setStatus(_arg1:uint):void{
this._status = _arg1;
}
public function get groupId():uint{
return (this._group.id);
}
public function get groupName():String{
return (this._group.name);
}
public function get groupType():uint{
return (this._group.type);
}
public function get authorName():String{
return (this._authorName);
}
public function set authorName(_arg1:String):void{
this._authorName = _arg1;
}
public function get authorId():uint{
return (this._authorId);
}
public function set authorId(_arg1:uint):void{
this._authorId = _arg1;
}
public function get shared():Boolean{
return (true);
}
function setFileSize(_arg1:uint):void{
this._contentSize = _arg1;
}
public function setKey(_arg1, _arg2):void{
var _local3:SaveKey;
if ((_arg1 is String)){
_local3 = this._group.getKeyByName(_arg1);
} else {
_local3 = this._group.getKeyById(_arg1);
};
if (_local3){
switch (_local3.type){
case SaveKey.TYPE_BOOLEAN:
this._keys[_local3] = {id:_local3.id, val:Boolean(int(_arg2))};
break;
case SaveKey.TYPE_FLOAT:
this._keys[_local3] = {id:_local3.id, val:Number(_arg2)};
break;
case SaveKey.TYPE_INTEGER:
this._keys[_local3] = {id:_local3.id, val:int(_arg2)};
break;
case SaveKey.TYPE_STRING:
default:
this._keys[_local3] = {id:_local3.id, val:_arg2.toString()};
break;
};
};
}
public function getKey(_arg1){
var _local2:SaveKey;
if ((_arg1 is String)){
_local2 = this._group.getKeyByName(_arg1);
} else {
_local2 = this._group.getKeyById(_arg1);
};
if (_local2){
return (this._keys[_local2]);
};
return (null);
}
public function setRating(_arg1, _arg2:Number, _arg3:Number):void{
var _local4:SaveRating;
if ((_arg1 is String)){
_local4 = this._group.getRatingByName(_arg1);
} else {
_local4 = this._group.getRatingById(_arg1);
};
if (_local4){
this._ratings[_local4] = {id:_local4.id, name:_local4.name, votes:_arg2, score:_arg3};
};
}
public function getRating(_arg1):Object{
var _local2:SaveRating;
if ((_arg1 is String)){
_local2 = this._group.getRatingByName(_arg1);
} else {
_local2 = this._group.getRatingById(_arg1);
};
if (_local2){
return (this._ratings[_local2]);
};
return (null);
}
public function sendRating(_arg1:String, _arg2:Number):void{
var _local3:SaveRating = this._group.getRatingByName(_arg1);
if (!_local3){
trace((("[NewgroundsAPISaveFile] " + _arg1) + " is not a recognized save file"));
return;
};
if ((((_arg2 < _local3.minValue)) || ((_arg2 > _local3.maxValue)))){
trace(((("[NewgroundsAPISaveFile] Vote must be between " + _local3.minValue) + " and ") + _local3.maxValue));
return;
};
_local3.voted = true;
API.rateSaveFile(this, _local3, _arg2);
}
override public function toString():String{
var _local2:Object;
var _local3:Object;
var _local1 = (((((("Save File " + this._filename) + " ID: ") + this._id) + "\n ") + this._description) + "\n");
for each (_local2 in this._keys) {
_local1 = (_local1 + ((((" " + this._group.getKeyById(_local2.id).name) + ": ") + _local2.val) + "\n"));
};
for each (_local3 in this._ratings) {
_local1 = (_local1 + ((((((" " + this._group.getRatingById(_local3.id).name) + "\n Score: ") + _local3.score) + " Votes: ") + _local3.votes) + "\n"));
};
return (_local1);
}
public function toObject():Object{
var _local2:Object;
var _local1:Object = {group:this.groupId, filename:this.name, description:this.description, shared:true};
_local1.keys = [];
for each (_local2 in this._keys) {
_local1.keys.push({id:_local2.id, value:_local2.val});
};
return (_local1);
}
public function save(_arg1:Boolean=false, _arg2:Boolean=false):void{
API.saveFile(this, _arg1, _arg2);
}
public function loadContents():void{
if (this._fileUrl){
this._loader = new SmartURLLoader();
this._loader.responseFormat = URLLoaderDataFormat.BINARY;
this._loader.addEventListener(Event.COMPLETE, this.onContentsLoaded);
this._loader.addEventListener(IOErrorEvent.IO_ERROR, this.onContentsError);
this._loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, this.onContentsError);
this._loader.load(this._fileUrl);
};
}
private function onContentsError(_arg1:Event):void{
this._loader = null;
dispatchEvent(new APIEvent(APIEvent.FILE_LOADED, false));
}
private function onContentsLoaded(_arg1:Event):void{
var _local2:ByteArray = _arg1.target.response;
this._contentSize = _local2.length;
_local2.uncompress();
var _local3:uint = _local2.readUnsignedByte();
if (_local3 == 0){
this._contents = new ByteArray();
this._contents.writeBytes(_local2, 1);
} else {
this._contents = _local2.readObject();
};
this._loader = null;
dispatchEvent(new APIEvent(APIEvent.FILE_LOADED, true, this.contents));
}
public function loadAuthorPage(){
API.loadUserPage(this._authorId, this._authorName);
}
function fileSaved(_arg1:Object):void{
this._id = _arg1.save_id;
this._thumbnailUrl = _arg1.thumbnail;
this._fileUrl = _arg1.file_url;
}
}
}//package com.newgrounds
Section 28
//SaveGroup (com.newgrounds.SaveGroup)
package com.newgrounds {
public class SaveGroup {
private var _name:String;
private var _id:uint;
private var _type:uint;
private var _keys:Array;
private var _ratings:Array;
private var _files:Array;
public static const TYPE_SYSTEM:uint = 0;
public static const TYPE_PRIVATE:uint = 1;
public static const TYPE_PUBLIC:uint = 2;
public static const TYPE_MODERATED:uint = 3;
public function SaveGroup(_arg1:uint, _arg2:String, _arg3:uint){
this._name = _arg2;
this._id = _arg1;
this._type = _arg3;
this._ratings = [];
this._keys = [];
this._files = [];
}
public function get name():String{
return (this._name);
}
public function get id():uint{
return (this._id);
}
public function get type():uint{
return (this._type);
}
public function get keys():Array{
return (this._keys.concat());
}
public function get ratings():Array{
return (this._ratings.concat());
}
public function addRating(_arg1:SaveRating):void{
this._ratings.push(_arg1);
}
public function getRatingById(_arg1:uint):SaveRating{
var _local2:uint;
while (_local2 < this._ratings.length) {
if (this._ratings[_local2].id == _arg1){
return (this._ratings[_local2]);
};
_local2++;
};
return (null);
}
public function getRatingByName(_arg1:String):SaveRating{
var _local2:uint;
while (_local2 < this._ratings.length) {
if (this._ratings[_local2].name == _arg1){
return (this._ratings[_local2]);
};
_local2++;
};
return (null);
}
public function addKey(_arg1:SaveKey):void{
this._keys.push(_arg1);
}
public function getKeyById(_arg1:uint):SaveKey{
var _local2:uint;
while (_local2 < this._keys.length) {
if (this._keys[_local2].id == _arg1){
return (this._keys[_local2]);
};
_local2++;
};
return (null);
}
public function getKeyByName(_arg1:String):SaveKey{
var _local2:uint;
while (_local2 < this._keys.length) {
if (this._keys[_local2].name == _arg1){
return (this._keys[_local2]);
};
_local2++;
};
return (null);
}
public function createQuery():SaveGroupQuery{
return (new SaveGroupQuery(this));
}
public function toString():String{
return ((((((("SaveGroup { name: " + this._name) + ", id: ") + this._id) + ", keys: ") + this._keys) + "}"));
}
public static function createFromObject(_arg1:Object):SaveGroup{
var _local4:Object;
var _local5:Object;
var _local2:SaveGroup = new SaveGroup(_arg1.group_id, _arg1.group_name, _arg1.group_type);
var _local3:uint;
while (_local3 < _arg1.keys.length) {
_local4 = _arg1.keys[_local3];
_local2.addKey(new SaveKey(_local4.id, _local4.name, _local4.type));
_local3++;
};
_local3 = 0;
while (_local3 < _arg1.ratings.length) {
_local5 = _arg1.ratings[_local3];
_local2.addRating(new SaveRating(_local5.id, _local5.name, _local5.float, _local5.min, _local5.max));
_local3++;
};
return (_local2);
}
}
}//package com.newgrounds
Section 29
//SaveGroupQuery (com.newgrounds.SaveGroupQuery)
package com.newgrounds {
import flash.events.*;
public class SaveGroupQuery extends EventDispatcher {
private var _group:SaveGroup;
private var _groupBy:Array;
private var _lookupKeys:Array;
private var _lookupRatings:Array;
private var _fileConditions:Array;
private var _keyConditions:Array;
private var _ratingConditions:Array;
private var _sortConditions:Array;
private var _page:uint;
private var _resultsPerPage:uint;
private var _randomizeResults:Boolean;
public static const TABLE_FILES:uint = 1;
public static const TABLE_KEYS:uint = 2;
public static const TABLE_RATINGS:uint = 3;
public static const FILE_ID:uint = 0;
public static const AUTHOR_ID:uint = 1;
public static const AUTHOR_NAME:uint = 2;
public static const FILE_NAME:uint = 3;
public static const CREATED_ON:uint = 4;
public static const UPDATED_ON:uint = 5;
public static const TOTAL_VIEWS:uint = 6;
public static const FILE_STATUS:uint = 7;
public static const SCORE:String = "score";
public static const TOTAL_VOTES:String = "votes";
public function SaveGroupQuery(_arg1:SaveGroup){
this._group = _arg1;
this.reset();
}
public function get group():SaveGroup{
return (this._group);
}
public function get groupId():uint{
return (this._group.id);
}
public function get resultsPerPage():uint{
return (this._resultsPerPage);
}
public function set resultsPerPage(_arg1:uint):void{
this._resultsPerPage = _arg1;
}
public function get page():uint{
return (this._page);
}
public function set page(_arg1:uint):void{
this._page = _arg1;
}
public function get isRandomized():Boolean{
return (this._randomizeResults);
}
public function set isRandomized(_arg1:Boolean):void{
this._randomizeResults = _arg1;
}
public function reset():void{
this._fileConditions = [];
this._keyConditions = [];
this._ratingConditions = [];
this._sortConditions = [];
this._groupBy = [];
this._lookupKeys = [];
this._lookupRatings = [];
this._randomizeResults = false;
this._resultsPerPage = 20;
this._page = 1;
}
public function includeKey(_arg1:String):void{
var _local2:SaveKey = this._group.getKeyByName(_arg1);
if (_local2){
this._lookupKeys.push(_local2.id);
};
}
public function includeRating(_arg1:String):void{
var _local2:SaveRating = this._group.getRatingByName(_arg1);
if (_local2){
this._lookupRatings.push(_local2.id);
};
}
public function excludeKey(_arg1:String):void{
var _local2:SaveKey = this._group.getKeyByName(_arg1);
var _local3:uint;
while (_local3 < this._lookupKeys.length) {
if (this._lookupKeys[_local3] == _local2.id){
this._lookupKeys.splice(_local3, 1);
return;
};
_local3++;
};
}
public function excludeRating(_arg1:String):void{
var _local2:SaveRating = this._group.getRatingByName(_arg1);
var _local3:uint;
while (_local3 < this._lookupRatings.length) {
if (this._lookupRatings[_local3] == _local2.id){
this._lookupRatings.splice(_local3, 1);
return;
};
_local3++;
};
}
public function groupBy(_arg1:uint):void{
this._groupBy.push({table:TABLE_FILES, field:_arg1});
}
public function groupByRating(_arg1:String):void{
var _local2:SaveRating = this._group.getRatingByName(_arg1);
if (!_local2){
return;
};
this._groupBy.push({table:TABLE_RATINGS, field:_local2.id});
}
public function groupByKey(_arg1:String):void{
var _local2:SaveKey = this._group.getKeyByName(_arg1);
if (!_local2){
return;
};
this._groupBy.push({table:TABLE_KEYS, field:_local2.id});
}
public function addFileCondition(_arg1:uint, _arg2:String, _arg3):void{
this._fileConditions.push({field:_arg1, operator:_arg2, value:_arg3});
}
public function addKeyCondition(_arg1:String, _arg2:String, _arg3):void{
var _local4:SaveKey = this._group.getKeyByName(_arg1);
if (!_local4){
return;
};
if (!this.checkValue(_arg3, _local4.type)){
return;
};
this._keyConditions.push({key_id:_local4.id, operator:_arg2, value:_arg3});
}
public function addRatingCondition(_arg1:String, _arg2:String, _arg3, _arg4:String="score"):void{
var _local5:SaveRating = this._group.getRatingByName(_arg1);
if (!_local5){
return;
};
this._ratingConditions.push({rating_id:_local5.id, operator:_arg2, value:_arg3, column:_arg4});
}
private function addSortCondition(_arg1:uint, _arg2:uint, _arg3:Boolean=false, _arg4=null):void{
var _local5:Object = {table:_arg1, field:_arg2, desc:_arg3};
if (_arg4){
_local5.extra = _arg4;
};
this._sortConditions.push(_local5);
}
public function sortOn(_arg1:uint, _arg2:Boolean=false):void{
this.addSortCondition(TABLE_FILES, _arg1, _arg2);
}
public function sortOnKey(_arg1:String, _arg2:Boolean=false):void{
this.addSortCondition(TABLE_KEYS, this._group.getKeyByName(_arg1).id, _arg2);
}
public function sortOnRating(_arg1:String, _arg2:Boolean=false, _arg3:String="score"):void{
this.addSortCondition(TABLE_RATINGS, this._group.getRatingByName(_arg1).id, _arg2, _arg3);
}
public function execute():void{
API.executeSaveQuery(this);
}
private function checkValue(_arg1, _arg2:uint):Boolean{
return (true);
}
override public function toString():String{
return ("");
}
public function toObject():Object{
var _local1:Object = {page:this._page, num_results:this._resultsPerPage};
if (this.isRandomized){
_local1.randomize = 1;
};
if (((this._fileConditions) && ((this._fileConditions.length > 0)))){
_local1.file_conditions = this._fileConditions;
};
if (((this._keyConditions) && ((this._keyConditions.length > 0)))){
_local1.key_conditions = this._keyConditions;
};
if (((this._ratingConditions) && ((this._ratingConditions.length > 0)))){
_local1.rating_conditions = this._ratingConditions;
};
if (((this._sortConditions) && ((this._sortConditions.length > 0)))){
_local1.sort_conditions = this._sortConditions;
};
if (((this._lookupKeys) && ((this._lookupKeys.length > 0)))){
_local1.lookup_keys = this._lookupKeys;
};
if (((this._lookupRatings) && ((this._lookupRatings.length > 0)))){
_local1.lookup_ratings = this._lookupRatings;
};
if (((this._groupBy) && ((this._groupBy.length > 0)))){
_local1.group_by = this._groupBy;
};
return (_local1);
}
}
}//package com.newgrounds
Section 30
//SaveKey (com.newgrounds.SaveKey)
package com.newgrounds {
public class SaveKey {
private var _id:uint;
private var _name:String;
private var _type:uint;
public static const TYPE_FLOAT:uint = 1;
public static const TYPE_INTEGER:uint = 2;
public static const TYPE_STRING:uint = 3;
public static const TYPE_BOOLEAN:uint = 4;
public function SaveKey(_arg1:uint, _arg2:String, _arg3:uint){
this._id = _arg1;
this._name = _arg2;
this._type = _arg3;
}
public function get id():uint{
return (this._id);
}
public function get name():String{
return (this._name);
}
public function get type():uint{
return (this._type);
}
public function isValueValid(_arg1):Boolean{
if (this._type == TYPE_INTEGER){
return ((((_arg1 is int)) || ((_arg1 is uint))));
};
if (this._type == TYPE_FLOAT){
return ((((((_arg1 is int)) || ((_arg1 is uint)))) || ((_arg1 is Number))));
};
if (this._type == TYPE_STRING){
return ((_arg1 is String));
};
if (this._type == TYPE_BOOLEAN){
return ((((((((_arg1 is Boolean)) || ((_arg1 === 0)))) || ((_arg1 === 1)))) || ((_arg1 == ""))));
};
return (false);
}
public function toString():String{
return (this._name);
}
}
}//package com.newgrounds
Section 31
//SaveRating (com.newgrounds.SaveRating)
package com.newgrounds {
public class SaveRating {
private var _id:uint;
private var _name:String;
private var _minValue:Number;
private var _maxValue:Number;
private var _isFloat:Boolean;
private var _voted:Boolean;
public function SaveRating(_arg1:uint, _arg2:String, _arg3:Boolean, _arg4:Number=-INF, _arg5:Number=INF){
this._id = _arg1;
this._name = _arg2;
this._isFloat = _arg3;
this._minValue = _arg4;
this._maxValue = _arg5;
}
public function get id():uint{
return (this._id);
}
public function get name():String{
return (this._name);
}
public function get minValue():Number{
return (this._minValue);
}
public function get maxValue():Number{
return (this._maxValue);
}
public function get isFloat():Boolean{
return (this._isFloat);
}
public function get voted():Boolean{
return (this._voted);
}
public function set voted(_arg1:Boolean):void{
this._voted = _arg1;
}
public function toString():String{
return (this._name);
}
}
}//package com.newgrounds
Section 32
//Score (com.newgrounds.Score)
package com.newgrounds {
public class Score {
private var _board:ScoreBoard;
private var _position:uint;
private var _username:String;
private var _value:String;
private var _numeric_value:uint;
private var _tag:String;
public function Score(_arg1:ScoreBoard, _arg2:Number, _arg3:String, _arg4:String, _arg5:uint, _arg6:String){
this._board = _arg1;
this._position = _arg2;
this._username = _arg3;
this._value = _arg4;
this._numeric_value = _arg5;
this._tag = _arg6;
}
public function get board():ScoreBoard{
return (this._board);
}
public function get position():uint{
return (this._position);
}
public function get username():String{
return (this._username);
}
public function get value():String{
return (this._value);
}
public function get numeric_value():uint{
return (this._numeric_value);
}
public function get tag():String{
return (this._tag);
}
}
}//package com.newgrounds
Section 33
//ScoreBoard (com.newgrounds.ScoreBoard)
package com.newgrounds {
import flash.events.*;
public class ScoreBoard extends EventDispatcher {
private var _name:String;
private var _id:uint;
private var _scores:Array;
private var _period:String;// = "Today"
private var _num_results:uint;// = 10
private var _numScores:uint;
private var _desiredNumResults:uint;
private var _startRank:uint;
private var _endRank:uint;
private var _page:uint;// = 1
private var _tag:String;
public function ScoreBoard(_arg1:uint, _arg2:String, _arg3:String){
this._name = _arg2;
this._id = _arg1;
this._scores = [];
this._tag = _arg3;
}
public function exists():Boolean{
return ((this._id > 0));
}
public function get id():Number{
return (this._id);
}
public function get name():String{
return (this._name);
}
public function get period():String{
return (this._period);
}
public function get page():uint{
return (this._page);
}
public function get num_results():uint{
return (this._num_results);
}
public function get scores():Array{
return (this._scores);
}
public function get tag():String{
return (this._tag);
}
public function get num_scores():uint{
return (this._numScores);
}
public function postScore(_arg1:uint):void{
API.postScore(this._name, _arg1);
}
public function loadScores(_arg1:String="Today", _arg2:uint=1, _arg3:uint=10):void{
this._period = _arg1;
if (((!(this._period)) || ((this._period == "")))){
this._period = ScoreBoardPeriod.TODAY;
};
this._page = _arg2;
this._num_results = _arg3;
this._desiredNumResults = 0;
API.loadScores(this);
}
public function loadScoresInRange(_arg1:String="Today", _arg2:uint=1, _arg3:uint=10):void{
if (_arg2 == 0){
_arg2 = 1;
};
if (_arg3 < _arg2){
_arg3 = _arg2;
};
this._period = _arg1;
if (((!(this._period)) || ((this._period == "")))){
this._period = ScoreBoardPeriod.TODAY;
};
this._desiredNumResults = ((_arg3 - _arg2) + 1);
this._num_results = this._desiredNumResults;
while (int(((_arg2 - 1) / this._num_results)) != int(((_arg3 - 1) / this._num_results))) {
this._num_results++;
};
this._page = ((_arg2 - 1) / this._num_results);
this._startRank = _arg2;
this._endRank = _arg3;
this._page++;
API.loadScores(this);
}
function setScores(_arg1:Array, _arg2:String, _arg3:Number, _arg4:Number, _arg5:uint):void{
var _local7:uint;
this._period = _arg2;
this._page = _arg3;
this._num_results = _arg4;
this._numScores = _arg5;
this._scores = [];
var _local6:uint;
while (_local6 < _arg1.length) {
_local7 = (((this._num_results * (this._page - 1)) + 1) + _local6);
if (((!(this._desiredNumResults)) || ((((_local7 >= this._startRank)) && ((_local7 <= this._endRank)))))){
this._scores.push(new Score(this, _local7, _arg1[_local6].username, _arg1[_local6].value, _arg1[_local6].numeric_value, _arg1[_local6].tag));
};
_local6++;
};
this._num_results = this._scores.length;
}
}
}//package com.newgrounds
Section 34
//ScoreBoardPeriod (com.newgrounds.ScoreBoardPeriod)
package com.newgrounds {
public class ScoreBoardPeriod {
public static const TODAY:String = "Today";
public static const WEEK:String = "This Week";
public static const MONTH:String = "This Month";
public static const YEAR:String = "This Year";
public static const ALL_TIME:String = "All-Time";
}
}//package com.newgrounds
Section 35
//SmartURLLoader (com.newgrounds.SmartURLLoader)
package com.newgrounds {
import flash.events.*;
import flash.utils.*;
import flash.net.*;
import flash.errors.*;
public class SmartURLLoader extends EventDispatcher {
private var _variables:Dictionary;
private var _files:Dictionary;
private var _hasVariables:Boolean;
private var _method:String;// = "GET"
private var _urlRequest:URLRequest;
private var _urlLoader:URLLoader;
private var _dataFormat:String;// = "text"
private var _openBrowser:Boolean;// = false
private var _preventCache:Boolean;// = false
var _command:String;
public var owner;
private static const CRLF:String = "
";
private static var _loaders:Dictionary = new Dictionary();
public function SmartURLLoader(){
this._urlRequest = new URLRequest();
this._variables = new Dictionary();
}
public function get responseFormat():String{
return (this._dataFormat);
}
public function set responseFormat(_arg1:String):void{
this._dataFormat = _arg1;
}
public function get response(){
return (this._urlLoader.data);
}
public function get hasFiles():Boolean{
return (Boolean(this._files));
}
public function get method():String{
return (this._method);
}
public function set method(_arg1:String):void{
if (((this.hasFiles) && ((_arg1 == URLRequestMethod.GET)))){
throw (new IllegalOperationError("GET cannot be used to upload files."));
};
this._method = _arg1;
}
public function get openBrowser():Boolean{
return (this._openBrowser);
}
public function set openBrowser(_arg1:Boolean):void{
this._openBrowser = _arg1;
}
public function get preventCache():Boolean{
return (this._preventCache);
}
public function set preventCache(_arg1:Boolean):void{
this._preventCache = _arg1;
}
public function get bytesLoaded():uint{
return ((this._urlLoader) ? this._urlLoader.bytesLoaded : 0);
}
public function get bytesTotal():uint{
return ((this._urlLoader) ? this._urlLoader.bytesTotal : 0);
}
public function addVariable(_arg1:String, _arg2=""):void{
this._variables[_arg1] = _arg2;
if (_arg2){
this._hasVariables = true;
};
}
public function addFile(_arg1:String, _arg2:ByteArray, _arg3:String, _arg4:String="application/octet-stream"):void{
this.method = URLRequestMethod.POST;
if (!this._files){
this._files = new Dictionary();
};
this._files[_arg1] = new File(_arg1, _arg2, _arg3, _arg4);
}
public function clearVariables():void{
this._variables = new Dictionary();
}
public function clearFiles():void{
this._files = null;
}
public function load(_arg1:String):void{
var urlVariables:URLVariables;
var key:String;
var boundary:String;
var i:uint;
var event:SecurityErrorEvent;
var url = _arg1;
this._urlRequest.url = url;
if (this._preventCache){
url = (url + ("?seed=" + Math.random()));
if (this._hasVariables){
url = (url + "&");
};
};
this._urlRequest.method = this._method;
if ((((this._urlRequest.method == URLRequestMethod.GET)) || (!(this.hasFiles)))){
this._urlRequest.contentType = "application/x-www-form-urlencoded";
if (this._hasVariables){
urlVariables = new URLVariables();
for (key in this._variables) {
urlVariables[key] = this._variables[key];
};
this._urlRequest.data = urlVariables;
};
} else {
boundary = "";
i = 0;
while (i < 32) {
boundary = (boundary + String.fromCharCode(uint((97 + (Math.random() * 25)))));
i = (i + 1);
};
this._urlRequest.contentType = (("multipart/form-data; boundary=\"" + boundary) + "\"");
this._urlRequest.data = this.buildMultipartData(boundary);
};
if (this.openBrowser){
navigateToURL(this._urlRequest, "_blank");
} else {
this._urlLoader = new URLLoader();
this._urlLoader.dataFormat = this._dataFormat;
this._urlLoader.addEventListener(Event.COMPLETE, this.onComplete);
this._urlLoader.addEventListener(ProgressEvent.PROGRESS, this.onProgress);
this._urlLoader.addEventListener(IOErrorEvent.IO_ERROR, this.onIOError);
this._urlLoader.addEventListener(HTTPStatusEvent.HTTP_STATUS, this.onHTTPStatus);
this._urlLoader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, this.onSecurityError);
_loaders[this._urlLoader] = this;
try {
this._urlLoader.load(this._urlRequest);
} catch(error:Error) {
event = new SecurityErrorEvent(SecurityErrorEvent.SECURITY_ERROR, false, false, error.message);
onSecurityError(event);
};
};
}
public function close():void{
try {
this._urlLoader.close();
} catch(e:Error) {
};
}
public function dispose():void{
this.close();
this._files = null;
this._variables = null;
if (this._urlLoader){
this._urlLoader.removeEventListener(Event.COMPLETE, this.onComplete);
this._urlLoader.removeEventListener(ProgressEvent.PROGRESS, this.onProgress);
this._urlLoader.removeEventListener(IOErrorEvent.IO_ERROR, this.onIOError);
this._urlLoader.removeEventListener(HTTPStatusEvent.HTTP_STATUS, this.onHTTPStatus);
this._urlLoader.removeEventListener(SecurityErrorEvent.SECURITY_ERROR, this.onSecurityError);
this._urlLoader = null;
};
this._urlRequest = null;
delete _loaders[this];
}
private function buildMultipartData(_arg1:String):ByteArray{
var _local3:String;
var _local4:File;
var _local2:ByteArray = new ByteArray();
_local2.endian = Endian.BIG_ENDIAN;
_arg1 = ("--" + _arg1);
for (_local3 in this._variables) {
_local2.writeUTFBytes((_arg1 + CRLF));
_local2.writeUTFBytes(((("Content-Disposition: form-data; name=\"" + _local3) + "\"") + CRLF));
_local2.writeUTFBytes(CRLF);
_local2.writeUTFBytes((this._variables[_local3] + CRLF));
};
if (this.hasFiles){
for each (_local4 in this._files) {
_local2.writeUTFBytes((_arg1 + CRLF));
_local2.writeUTFBytes(("Content-Disposition: form-data; name=\"Filename\"" + CRLF));
_local2.writeUTFBytes(CRLF);
_local2.writeUTFBytes((_local4.fileName + CRLF));
_local2.writeUTFBytes((_arg1 + CRLF));
_local2.writeUTFBytes(((((("Content-Disposition: form-data; name=\"" + _local4.dataField) + "\"; filename=\"") + _local4.fileName) + "\"") + CRLF));
_local2.writeUTFBytes((("Content-Type: " + _local4.contentType) + CRLF));
_local2.writeUTFBytes(CRLF);
_local2.writeBytes(_local4.data);
_local2.writeUTFBytes(CRLF);
};
_local2.writeUTFBytes((_arg1 + CRLF));
_local2.writeUTFBytes(("Content-Disposition: form-data; name=\"Upload\"" + CRLF));
_local2.writeUTFBytes(CRLF);
_local2.writeUTFBytes(("Submit Query" + CRLF));
};
_local2.writeUTFBytes((_arg1 + "--"));
_local2.position = 0;
_local2.position = 0;
return (_local2);
}
private function onComplete(_arg1:Event):void{
dispatchEvent(_arg1);
this.dispose();
}
private function onProgress(_arg1:ProgressEvent):void{
dispatchEvent(_arg1);
}
private function onIOError(_arg1:IOErrorEvent):void{
dispatchEvent(_arg1);
this.dispose();
}
private function onSecurityError(_arg1:SecurityErrorEvent):void{
dispatchEvent(_arg1);
this.dispose();
}
private function onHTTPStatus(_arg1:HTTPStatusEvent):void{
dispatchEvent(_arg1);
}
public static function closeAll():void{
var _local1:SmartURLLoader;
for each (_local1 in _loaders) {
if (_local1){
_local1.dispose();
};
};
_loaders = new Dictionary();
}
}
}//package com.newgrounds
import flash.utils.*;
class File {
private var fileName:String;
private var data:ByteArray;
private var dataField:String;
private var contentType:String;
private function File(_arg1:String, _arg2:ByteArray, _arg3:String="Filedata", _arg4:String="application/octet-stream"){
this.fileName = _arg1;
this.data = _arg2;
this.dataField = _arg3;
this.contentType = _arg4;
}
}
Section 36
//MochiAd (mochi.as3.MochiAd)
package mochi.as3 {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.net.*;
import flash.system.*;
public class MochiAd {
public static function getVersion():String{
return (MochiServices.getVersion());
}
public static function doOnEnterFrame(_arg1:MovieClip):void{
var mc = _arg1;
var f:Function = function (_arg1:Object):void{
if (((("onEnterFrame" in mc)) && (mc.onEnterFrame))){
mc.onEnterFrame();
} else {
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
};
};
mc.addEventListener(Event.ENTER_FRAME, f);
}
public static function createEmptyMovieClip(_arg1:Object, _arg2:String, _arg3:Number):MovieClip{
var _local4:MovieClip = new MovieClip();
if (((false) && (_arg3))){
_arg1.addChildAt(_local4, _arg3);
} else {
_arg1.addChild(_local4);
};
_arg1[_arg2] = _local4;
_local4["_name"] = _arg2;
return (_local4);
}
public static function showPreGameAd(_arg1:Object):void{
var clip:Object;
var mc:MovieClip;
var chk:MovieClip;
var complete:Boolean;
var unloaded:Boolean;
var sendHostProgress:Boolean;
var fn:Function;
var r:MovieClip;
var options = _arg1;
var DEFAULTS:Object = {ad_timeout:5500, fadeout_time:250, regpt:"o", method:"showPreloaderAd", color:0xFF8A00, background:16777161, outline:13994812, no_progress_bar:false, ad_started:function ():void{
if ((this.clip is MovieClip)){
this.clip.stop();
} else {
throw (new Error("MochiAd.showPreGameAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_finished:function ():void{
if ((this.clip is MovieClip)){
this.clip.play();
} else {
throw (new Error("MochiAd.showPreGameAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_loaded:function (_arg1:Number, _arg2:Number):void{
}, ad_failed:function ():void{
trace("[MochiAd] Couldn't load an ad, make sure your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_skipped:function ():void{
}, ad_progress:function (_arg1:Number):void{
}, progress_override:function (_arg1:Object):Number{
return (NaN);
}, bar_offset:0};
options = MochiAd._parseOptions(options, DEFAULTS);
if ("c862232051e0a94e1c3609b3916ddb17".substr(0) == "dfeada81ac97cde83665f81c12da7def"){
options.ad_started();
fn = function ():void{
options.ad_finished();
};
setTimeout(fn, 100);
return;
};
clip = options.clip;
var ad_msec:Number = 11000;
var ad_timeout:Number = options.ad_timeout;
if (options.skip){
ad_timeout = 0;
};
delete options.ad_timeout;
var fadeout_time:Number = options.fadeout_time;
delete options.fadeout_time;
if (!MochiAd.load(options)){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
MochiAd._cleanup(mc);
var fn:Function = function ():void{
options.ad_finished();
};
setTimeout(fn, 100);
};
var wh:Array = MochiAd._getRes(options, clip);
var w:Number = wh[0];
var h:Number = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.x = (w * -0.5);
chk.y = (h * -0.5);
var bar:MovieClip = createEmptyMovieClip(chk, "_mochiad_bar", 4);
if (options.no_progress_bar){
bar.visible = false;
delete options.no_progress_bar;
} else {
bar.x = (10 + options.bar_offset);
bar.y = (h - 20);
};
var bar_w:Number = ((w - bar.x) - 10);
var bar_color:Number = options.color;
delete options.color;
var bar_background:Number = options.background;
delete options.background;
var bar_outline:Number = options.outline;
delete options.outline;
var backing_mc:MovieClip = createEmptyMovieClip(bar, "_outline", 1);
var backing:Object = backing_mc.graphics;
backing.beginFill(bar_background);
backing.moveTo(0, 0);
backing.lineTo(bar_w, 0);
backing.lineTo(bar_w, 10);
backing.lineTo(0, 10);
backing.lineTo(0, 0);
backing.endFill();
var inside_mc:MovieClip = createEmptyMovieClip(bar, "_inside", 2);
var inside:Object = inside_mc.graphics;
inside.beginFill(bar_color);
inside.moveTo(0, 0);
inside.lineTo(bar_w, 0);
inside.lineTo(bar_w, 10);
inside.lineTo(0, 10);
inside.lineTo(0, 0);
inside.endFill();
inside_mc.scaleX = 0;
var outline_mc:MovieClip = createEmptyMovieClip(bar, "_outline", 3);
var outline:Object = outline_mc.graphics;
outline.lineStyle(0, bar_outline, 100);
outline.moveTo(0, 0);
outline.lineTo(bar_w, 0);
outline.lineTo(bar_w, 10);
outline.lineTo(0, 10);
outline.lineTo(0, 0);
chk.ad_msec = ad_msec;
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
chk.last_pcnt = 0;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function ():void{
var _local1:Number = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (_local1 > 0){
this.parent.alpha = (_local1 * 0.01);
} else {
MochiAd.unload(clip);
delete this["onEnterFrame"];
};
};
complete = false;
unloaded = false;
var progress:Number = Math.min(1, options.progress_override(clip));
var f:Function = function (_arg1:Event):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
complete = true;
if (unloaded){
MochiAd.unload(clip);
};
};
if (!isNaN(progress)){
complete = (progress == 1);
} else {
if (clip.loaderInfo.bytesLoaded == clip.loaderInfo.bytesTotal){
complete = true;
} else {
if ((clip.root is MovieClip)){
r = (clip.root as MovieClip);
if (r.framesLoaded >= r.totalFrames){
complete = true;
} else {
clip.loaderInfo.addEventListener(Event.COMPLETE, f);
};
} else {
clip.loaderInfo.addEventListener(Event.COMPLETE, f);
};
};
};
mc.unloadAd = function ():void{
unloaded = true;
if (complete){
MochiAd.unload(clip);
};
};
mc.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.adjustProgress = function (_arg1:Number):void{
var _local2:Object = mc._mochiad_wait;
_local2.server_control = true;
_local2.showing = true;
_local2.started = getTimer();
_local2.ad_msec = _arg1;
};
mc.rpc = function (_arg1:Number, _arg2:Object):void{
MochiAd.rpc(clip, _arg1, _arg2);
};
mc.rpcTestFn = function (_arg1:String):Object{
trace(("[MOCHIAD rpcTestFn] " + _arg1));
return (_arg1);
};
sendHostProgress = false;
mc.sendHostLoadProgress = function (_arg1:String):void{
sendHostProgress = true;
};
chk["onEnterFrame"] = function ():void{
var _local12:Number;
if (((!(this.parent)) || (!(this.parent.parent)))){
delete this["onEnterFrame"];
return;
};
var _local1:Object = this.parent.parent.root;
var _local2:Object = this.parent._mochiad_ctr;
var _local3:Number = (getTimer() - this.started);
var _local4:Boolean;
var _local5:Number = _local1.loaderInfo.bytesTotal;
var _local6:Number = _local1.loaderInfo.bytesLoaded;
var _local7:Number = Math.min(1, options.progress_override(_local1));
if (_local7 == 1){
complete = true;
};
if (complete){
_local6 = Math.max(1, _local6);
_local5 = _local6;
};
var _local8:Number = ((100 * _local6) / _local5);
if (!isNaN(_local7)){
_local8 = (100 * _local7);
};
var _local9:Number = ((100 * _local3) / chk.ad_msec);
var _local10:Object = this._mochiad_bar._inside;
var _local11:Number = Math.min(100, Math.min(((_local8) || (0)), _local9));
_local11 = Math.max(this.last_pcnt, _local11);
this.last_pcnt = _local11;
_local10.scaleX = (_local11 * 0.01);
options.ad_progress(_local11);
if (sendHostProgress){
clip._mochiad.lc.send(clip._mochiad._containerLCName, "notify", {id:"hostLoadPcnt", pcnt:_local8});
if (_local8 >= 100){
sendHostProgress = false;
};
};
if (!chk.showing){
_local12 = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (_local12 > 0){
chk.showing = true;
chk.started = getTimer();
MochiAd.adShowing(clip);
} else {
if ((((_local3 > chk.ad_timeout)) && ((_local8 == 100)))){
options.ad_failed();
_local4 = true;
};
};
};
if (_local3 > chk.ad_msec){
_local4 = true;
};
if (((complete) && (_local4))){
if (unloaded){
MochiAd.unload(_local1);
} else {
if (this.server_control){
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = chk.fadeFunction;
};
};
};
};
doOnEnterFrame(chk);
}
public static function showClickAwayAd(_arg1:Object):void{
var clip:Object;
var mc:MovieClip;
var chk:MovieClip;
var options = _arg1;
var DEFAULTS:Object = {ad_timeout:5500, regpt:"o", method:"showClickAwayAd", res:"300x250", no_bg:true, ad_started:function ():void{
}, ad_finished:function ():void{
}, ad_loaded:function (_arg1:Number, _arg2:Number):void{
}, ad_failed:function ():void{
trace("[MochiAd] Couldn't load an ad, make sure your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_skipped:function ():void{
}};
options = MochiAd._parseOptions(options, DEFAULTS);
clip = options.clip;
var ad_timeout:Number = options.ad_timeout;
delete options.ad_timeout;
if (!MochiAd.load(options)){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
MochiAd._cleanup(mc);
options.ad_finished();
};
var wh:Array = MochiAd._getRes(options, clip);
var w:Number = wh[0];
var h:Number = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
mc.unloadAd = function ():void{
MochiAd.unload(clip);
};
mc.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.rpc = function (_arg1:Number, _arg2:Object):void{
MochiAd.rpc(clip, _arg1, _arg2);
};
chk["onEnterFrame"] = function ():void{
var _local4:Number;
if (!this.parent){
delete this.onEnterFrame;
return;
};
var _local1:Object = this.parent._mochiad_ctr;
var _local2:Number = (getTimer() - this.started);
var _local3:Boolean;
if (!chk.showing){
_local4 = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (_local4 > 0){
chk.showing = true;
_local3 = true;
chk.started = getTimer();
} else {
if (_local2 > chk.ad_timeout){
options.ad_failed();
_local3 = true;
};
};
};
if (this.root == null){
_local3 = true;
};
if (_local3){
delete this.onEnterFrame;
};
};
doOnEnterFrame(chk);
}
public static function showInterLevelAd(_arg1:Object):void{
var clip:Object;
var mc:MovieClip;
var chk:MovieClip;
var options = _arg1;
var DEFAULTS:Object = {ad_timeout:5500, fadeout_time:250, regpt:"o", method:"showTimedAd", ad_started:function ():void{
if ((this.clip is MovieClip)){
this.clip.stop();
} else {
throw (new Error("MochiAd.showInterLevelAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_finished:function ():void{
if ((this.clip is MovieClip)){
this.clip.play();
} else {
throw (new Error("MochiAd.showInterLevelAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_loaded:function (_arg1:Number, _arg2:Number):void{
}, ad_failed:function ():void{
trace("[MochiAd] Couldn't load an ad, make sure your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_skipped:function ():void{
}};
options = MochiAd._parseOptions(options, DEFAULTS);
clip = options.clip;
var ad_msec:Number = 11000;
var ad_timeout:Number = options.ad_timeout;
delete options.ad_timeout;
var fadeout_time:Number = options.fadeout_time;
delete options.fadeout_time;
if (!MochiAd.load(options)){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
MochiAd._cleanup(mc);
options.ad_finished();
};
var wh:Array = MochiAd._getRes(options, clip);
var w:Number = wh[0];
var h:Number = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.ad_msec = ad_msec;
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function ():void{
if (!this.parent){
delete this.onEnterFrame;
delete this.fadeFunction;
return;
};
var _local1:Number = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (_local1 > 0){
this.parent.alpha = (_local1 * 0.01);
} else {
MochiAd.unload(clip);
delete this["onEnterFrame"];
};
};
mc.unloadAd = function ():void{
MochiAd.unload(clip);
};
mc.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.adjustProgress = function (_arg1:Number):void{
var _local2:Object = mc._mochiad_wait;
_local2.server_control = true;
_local2.showing = true;
_local2.started = getTimer();
_local2.ad_msec = (_arg1 - 250);
};
mc.rpc = function (_arg1:Number, _arg2:Object):void{
MochiAd.rpc(clip, _arg1, _arg2);
};
chk["onEnterFrame"] = function ():void{
var _local4:Number;
if (!this.parent){
delete this.onEnterFrame;
delete this.fadeFunction;
return;
};
var _local1:Object = this.parent._mochiad_ctr;
var _local2:Number = (getTimer() - this.started);
var _local3:Boolean;
if (!chk.showing){
_local4 = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (_local4 > 0){
chk.showing = true;
chk.started = getTimer();
MochiAd.adShowing(clip);
} else {
if (_local2 > chk.ad_timeout){
options.ad_failed();
_local3 = true;
};
};
};
if (_local2 > chk.ad_msec){
_local3 = true;
};
if (_local3){
if (this.server_control){
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = this.fadeFunction;
};
};
};
doOnEnterFrame(chk);
}
public static function showPreloaderAd(_arg1:Object):void{
trace("[MochiAd] DEPRECATED: showPreloaderAd was renamed to showPreGameAd in 2.0");
MochiAd.showPreGameAd(_arg1);
}
public static function showTimedAd(_arg1:Object):void{
trace("[MochiAd] DEPRECATED: showTimedAd was renamed to showInterLevelAd in 2.0");
MochiAd.showInterLevelAd(_arg1);
}
public static function _allowDomains(_arg1:String):String{
var _local2:String = _arg1.split("/")[2].split(":")[0];
if (Security.sandboxType == "application"){
return (_local2);
};
Security.allowDomain("*");
Security.allowDomain(_local2);
Security.allowInsecureDomain("*");
Security.allowInsecureDomain(_local2);
return (_local2);
}
public static function load(_arg1:Object):MovieClip{
var clip:Object;
var mc:MovieClip;
var k:String;
var server:String;
var hostname:String;
var lc:LocalConnection;
var name:String;
var loader:Loader;
var g:Function;
var req:URLRequest;
var v:Object;
var options = _arg1;
var DEFAULTS:Object = {server:"http://x.mochiads.com/srv/1/", method:"load", depth:10333, id:"_UNKNOWN_"};
options = MochiAd._parseOptions(options, DEFAULTS);
options.swfv = 9;
options.mav = MochiAd.getVersion();
clip = options.clip;
if (!(clip is DisplayObject)){
trace("Warning: Object passed as container clip not a descendant of the DisplayObject type");
return (null);
};
if (MovieClip(clip).stage == null){
trace("Warning: Container clip for ad is not attached to the stage");
return (null);
};
if (!MochiAd._isNetworkAvailable()){
return (null);
};
try {
if (clip._mochiad_loaded){
return (null);
};
} catch(e:Error) {
throw (new Error("MochiAd requires a clip that is an instance of a dynamic class. If your class extends Sprite or MovieClip, you must make it dynamic."));
};
var depth:Number = options.depth;
delete options.depth;
mc = createEmptyMovieClip(clip, "_mochiad", depth);
var wh:Array = MochiAd._getRes(options, clip);
options.res = ((wh[0] + "x") + wh[1]);
options.server = (options.server + options.id);
delete options.id;
clip._mochiad_loaded = true;
if (clip.loaderInfo.loaderURL.indexOf("http") == 0){
options.as3_swf = clip.loaderInfo.loaderURL;
} else {
trace("[MochiAd] NOTE: Security Sandbox Violation errors below are normal");
};
var lv:URLVariables = new URLVariables();
for (k in options) {
v = options[k];
if (!(v is Function)){
lv[k] = v;
};
};
server = lv.server;
delete lv.server;
hostname = _allowDomains(server);
lc = new LocalConnection();
lc.client = mc;
name = ["", Math.floor(new Date().getTime()), Math.floor((Math.random() * 999999))].join("_");
lc.allowDomain("*", "localhost");
lc.allowInsecureDomain("*", "localhost");
lc.connect(name);
mc.lc = lc;
mc.lcName = name;
lv.lc = name;
lv.st = getTimer();
mc.regContLC = function (_arg1:String):void{
mc._containerLCName = _arg1;
};
loader = new Loader();
g = function (_arg1:Object):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
MochiAd.unload(clip);
};
loader.contentLoaderInfo.addEventListener(Event.UNLOAD, g);
req = new URLRequest(((server + ".swf?cacheBust=") + new Date().getTime()));
req.contentType = "application/x-www-form-urlencoded";
req.method = URLRequestMethod.POST;
req.data = lv;
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, function (_arg1:IOErrorEvent):void{
trace("[MochiAds] Blocked URL");
});
if (!options.skip){
loader.load(req);
};
mc.addChild(loader);
mc._mochiad_ctr = loader;
return (mc);
}
public static function unload(_arg1:Object):Boolean{
if (((_arg1.clip) && (_arg1.clip._mochiad))){
_arg1 = _arg1.clip;
};
if (_arg1.origFrameRate != undefined){
_arg1.stage.frameRate = _arg1.origFrameRate;
};
if (!_arg1._mochiad){
return (false);
};
if (_arg1._mochiad._containerLCName != undefined){
_arg1._mochiad.lc.send(_arg1._mochiad._containerLCName, "notify", {id:"unload"});
};
if (_arg1._mochiad.onUnload){
_arg1._mochiad.onUnload();
};
delete _arg1._mochiad_loaded;
delete _arg1._mochiad;
return (true);
}
public static function _cleanup(_arg1:Object):void{
var k:String;
var lc:LocalConnection;
var f:Function;
var mc = _arg1;
if (("lc" in mc)){
lc = mc.lc;
f = function ():void{
try {
lc.client = null;
lc.close();
} catch(e:Error) {
};
};
setTimeout(f, 0);
};
var idx:Number = DisplayObjectContainer(mc).numChildren;
while (idx > 0) {
idx = (idx - 1);
DisplayObjectContainer(mc).removeChildAt(idx);
};
for (k in mc) {
delete mc[k];
};
}
public static function _isNetworkAvailable():Boolean{
return (!((Security.sandboxType == "localWithFile")));
}
public static function _getRes(_arg1:Object, _arg2:Object):Array{
var _local6:Array;
var _local3:Object = _arg2.getBounds(_arg2.root);
var _local4:Number = 0;
var _local5:Number = 0;
if (typeof(_arg1.res) != "undefined"){
_local6 = _arg1.res.split("x");
_local4 = parseFloat(_local6[0]);
_local5 = parseFloat(_local6[1]);
} else {
_local4 = (_local3.right - _local3.left);
_local5 = (_local3.top - _local3.bottom);
};
if ((((_local4 == 0)) || ((_local5 == 0)))){
_local4 = _arg2.stage.stageWidth;
_local5 = _arg2.stage.stageHeight;
};
return ([_local4, _local5]);
}
public static function _parseOptions(_arg1:Object, _arg2:Object):Object{
var _local4:String;
var _local5:Array;
var _local6:Number;
var _local7:Array;
var _local3:Object = {};
for (_local4 in _arg2) {
_local3[_local4] = _arg2[_local4];
};
if (_arg1){
for (_local4 in _arg1) {
_local3[_local4] = _arg1[_local4];
};
};
if (_local3.clip == undefined){
throw (new Error("MochiAd is missing the 'clip' parameter. This should be a MovieClip, Sprite or an instance of a class that extends MovieClip or Sprite."));
};
_arg1 = _local3.clip.loaderInfo.parameters.mochiad_options;
if (_arg1){
_local5 = _arg1.split("&");
_local6 = 0;
while (_local6 < _local5.length) {
_local7 = _local5[_local6].split("=");
_local3[unescape(_local7[0])] = unescape(_local7[1]);
_local6++;
};
};
if (_local3.id == "test"){
trace("[MochiAd] WARNING: Using the MochiAds test identifier, make sure to use the code from your dashboard, not this example!");
};
return (_local3);
}
public static function rpc(_arg1:Object, _arg2:Number, _arg3:Object):void{
var _local4:Object;
var _local5:Object;
switch (_arg3.id){
case "setValue":
MochiAd.setValue(_arg1, _arg3.objectName, _arg3.value);
break;
case "getValue":
_local4 = MochiAd.getValue(_arg1, _arg3.objectName);
_arg1._mochiad.lc.send(_arg1._mochiad._containerLCName, "rpcResult", _arg2, _local4);
break;
case "runMethod":
_local5 = MochiAd.runMethod(_arg1, _arg3.method, _arg3.args);
_arg1._mochiad.lc.send(_arg1._mochiad._containerLCName, "rpcResult", _arg2, _local5);
break;
default:
trace(("[mochiads rpc] unknown rpc id: " + _arg3.id));
};
}
public static function setValue(_arg1:Object, _arg2:String, _arg3:Object):void{
var _local4:Array = _arg2.split(".");
var _local5:Number = 0;
while (_local5 < (_local4.length - 1)) {
if ((((_arg1[_local4[_local5]] == undefined)) || ((_arg1[_local4[_local5]] == null)))){
return;
};
_arg1 = _arg1[_local4[_local5]];
_local5++;
};
_arg1[_local4[_local5]] = _arg3;
}
public static function getValue(_arg1:Object, _arg2:String):Object{
var _local3:Array = _arg2.split(".");
var _local4:Number = 0;
while (_local4 < (_local3.length - 1)) {
if ((((_arg1[_local3[_local4]] == undefined)) || ((_arg1[_local3[_local4]] == null)))){
return (undefined);
};
_arg1 = _arg1[_local3[_local4]];
_local4++;
};
return (_arg1[_local3[_local4]]);
}
public static function runMethod(_arg1:Object, _arg2:String, _arg3:Array):Object{
var _local4:Array = _arg2.split(".");
var _local5:Number = 0;
while (_local5 < (_local4.length - 1)) {
if ((((_arg1[_local4[_local5]] == undefined)) || ((_arg1[_local4[_local5]] == null)))){
return (undefined);
};
_arg1 = _arg1[_local4[_local5]];
_local5++;
};
if (typeof(_arg1[_local4[_local5]]) == "function"){
return (_arg1[_local4[_local5]].apply(_arg1, _arg3));
};
return (undefined);
}
public static function adShowing(_arg1:Object):void{
_arg1.origFrameRate = _arg1.stage.frameRate;
_arg1.stage.frameRate = 30;
}
}
}//package mochi.as3
Section 37
//MochiCoins (mochi.as3.MochiCoins)
package mochi.as3 {
public class MochiCoins {
public static const STORE_SHOW:String = "StoreShow";
public static const STORE_HIDE:String = "StoreHide";
public static const ITEM_OWNED:String = "ItemOwned";
public static const ITEM_NEW:String = "ItemNew";
public static const STORE_ITEMS:String = "StoreItems";
public static const ERROR:String = "Error";
public static const IO_ERROR:String = "IOError";
public static const NO_USER:String = "NoUser";
public static var _inventory:MochiInventory;
private static var _dispatcher:MochiEventDispatcher = new MochiEventDispatcher();
public static function get inventory():MochiInventory{
return (_inventory);
}
public static function getVersion():String{
return (MochiServices.getVersion());
}
public static function showStore(_arg1:Object=null):void{
MochiServices.setContainer();
MochiServices.bringToTop();
MochiServices.send("coins_showStore", {options:_arg1}, null, null);
}
public static function showItem(_arg1:Object=null):void{
if (((!(_arg1)) || (!((typeof(_arg1.item) == "string"))))){
trace("ERROR: showItem call must pass an Object with an item key");
return;
};
MochiServices.setContainer();
MochiServices.bringToTop();
MochiServices.send("coins_showItem", {options:_arg1}, null, null);
}
public static function showVideo(_arg1:Object=null):void{
if (((!(_arg1)) || (!((typeof(_arg1.item) == "string"))))){
trace("ERROR: showVideo call must pass an Object with an item key");
return;
};
MochiServices.setContainer();
MochiServices.bringToTop();
MochiServices.send("coins_showVideo", {options:_arg1}, null, null);
}
public static function getStoreItems():void{
MochiServices.send("coins_getStoreItems");
}
public static function requestFunding(_arg1:Object=null):void{
MochiServices.setContainer();
MochiServices.bringToTop();
MochiServices.send("social_requestFunding", _arg1);
}
public static function addEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.addEventListener(_arg1, _arg2);
}
public static function triggerEvent(_arg1:String, _arg2:Object):void{
_dispatcher.triggerEvent(_arg1, _arg2);
}
public static function removeEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.removeEventListener(_arg1, _arg2);
}
addEventListener(MochiSocial.LOGGED_IN, function (_arg1:Object):void{
_inventory = new MochiInventory();
});
addEventListener(MochiSocial.LOGGED_OUT, function (_arg1:Object):void{
_inventory = null;
});
}
}//package mochi.as3
Section 38
//MochiDigits (mochi.as3.MochiDigits)
package mochi.as3 {
public final class MochiDigits {
private var Fragment:Number;
private var Sibling:MochiDigits;
private var Encoder:Number;
public function MochiDigits(_arg1:Number=0, _arg2:uint=0):void{
Encoder = 0;
setValue(_arg1, _arg2);
}
public function get value():Number{
return (Number(this.toString()));
}
public function set value(_arg1:Number):void{
setValue(_arg1);
}
public function addValue(_arg1:Number):void{
value = (value + _arg1);
}
public function setValue(_arg1:Number=0, _arg2:uint=0):void{
var _local3:String = _arg1.toString();
var _temp1 = _arg2;
_arg2 = (_arg2 + 1);
Fragment = (_local3.charCodeAt(_temp1) ^ Encoder);
if (_arg2 < _local3.length){
Sibling = new MochiDigits(_arg1, _arg2);
} else {
Sibling = null;
};
reencode();
}
public function reencode():void{
var _local1:uint = int((2147483647 * Math.random()));
Fragment = (Fragment ^ (_local1 ^ Encoder));
Encoder = _local1;
}
public function toString():String{
var _local1:String = String.fromCharCode((Fragment ^ Encoder));
if (Sibling != null){
_local1 = (_local1 + Sibling.toString());
};
return (_local1);
}
}
}//package mochi.as3
Section 39
//MochiEventDispatcher (mochi.as3.MochiEventDispatcher)
package mochi.as3 {
public class MochiEventDispatcher {
private var eventTable:Object;
public function MochiEventDispatcher():void{
eventTable = {};
}
public function addEventListener(_arg1:String, _arg2:Function):void{
removeEventListener(_arg1, _arg2);
eventTable[_arg1].push(_arg2);
}
public function removeEventListener(_arg1:String, _arg2:Function):void{
var _local3:Object;
if (eventTable[_arg1] == undefined){
eventTable[_arg1] = [];
return;
};
for (_local3 in eventTable[_arg1]) {
if (eventTable[_arg1][_local3] != _arg2){
} else {
eventTable[_arg1].splice(Number(_local3), 1);
};
};
}
public function triggerEvent(_arg1:String, _arg2:Object):void{
var _local3:Object;
if (eventTable[_arg1] == undefined){
return;
};
for (_local3 in eventTable[_arg1]) {
var _local6 = eventTable[_arg1];
_local6[_local3](_arg2);
};
}
}
}//package mochi.as3
Section 40
//MochiEvents (mochi.as3.MochiEvents)
package mochi.as3 {
import flash.display.*;
public class MochiEvents {
public static const ACHIEVEMENT_RECEIVED:String = "AchievementReceived";
public static const ALIGN_TOP_LEFT:String = "ALIGN_TL";
public static const ALIGN_TOP:String = "ALIGN_T";
public static const ALIGN_TOP_RIGHT:String = "ALIGN_TR";
public static const ALIGN_LEFT:String = "ALIGN_L";
public static const ALIGN_CENTER:String = "ALIGN_C";
public static const ALIGN_RIGHT:String = "ALIGN_R";
public static const ALIGN_BOTTOM_LEFT:String = "ALIGN_BL";
public static const ALIGN_BOTTOM:String = "ALIGN_B";
public static const ALIGN_BOTTOM_RIGHT:String = "ALIGN_BR";
public static const FORMAT_SHORT:String = "ShortForm";
public static const FORMAT_LONG:String = "LongForm";
private static var gameStart:Number;
private static var levelStart:Number;
private static var _dispatcher:MochiEventDispatcher = new MochiEventDispatcher();
public static function getVersion():String{
return (MochiServices.getVersion());
}
public static function startSession(_arg1:String):void{
MochiServices.send("events_beginSession", {achievementID:_arg1}, null, null);
}
public static function setNotifications(_arg1:MovieClip, _arg2:Object):void{
var _local4:Object;
var _local3:Object = {};
for (_local4 in _arg2) {
_local3[_local4] = _arg2[_local4];
};
_local3.clip = _arg1;
MochiServices.send("events_setNotifications", _local3, null, null);
}
public static function addEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.addEventListener(_arg1, _arg2);
}
public static function triggerEvent(_arg1:String, _arg2:Object):void{
_dispatcher.triggerEvent(_arg1, _arg2);
}
public static function removeEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.removeEventListener(_arg1, _arg2);
}
public static function startPlay(_arg1:String="gameplay"):void{
MochiServices.send("events_setRoundID", {tag:String(_arg1)}, null, null);
}
public static function endPlay():void{
MochiServices.send("events_clearRoundID", null, null, null);
}
public static function trackEvent(_arg1:String, _arg2=null):void{
MochiServices.send("events_trackEvent", {tag:_arg1, value:_arg2}, null, null);
}
}
}//package mochi.as3
Section 41
//MochiInventory (mochi.as3.MochiInventory)
package mochi.as3 {
import flash.events.*;
import flash.utils.*;
public dynamic class MochiInventory extends Proxy {
private var _timer:Timer;
private var _consumableProperties:Object;
private var _syncPending:Boolean;
private var _outstandingID:Number;
private var _syncID:Number;
private var _names:Array;
private var _storeSync:Object;
private static const CONSUMER_KEY:String = "MochiConsumables";
private static const KEY_SALT:String = " syncMaint";
public static const READY:String = "InvReady";
public static const WRITTEN:String = "InvWritten";
public static const ERROR:String = "Error";
public static const IO_ERROR:String = "IoError";
public static const VALUE_ERROR:String = "InvValueError";
public static const NOT_READY:String = "InvNotReady";
private static var _dispatcher:MochiEventDispatcher = new MochiEventDispatcher();
public function MochiInventory():void{
MochiCoins.addEventListener(MochiCoins.ITEM_OWNED, itemOwned);
MochiCoins.addEventListener(MochiCoins.ITEM_NEW, newItems);
MochiSocial.addEventListener(MochiSocial.LOGGED_IN, loggedIn);
MochiSocial.addEventListener(MochiSocial.LOGGED_OUT, loggedOut);
_storeSync = new Object();
_syncPending = false;
_outstandingID = 0;
_syncID = 0;
_timer = new Timer(1000);
_timer.addEventListener(TimerEvent.TIMER, sync);
_timer.start();
if (MochiSocial.loggedIn){
loggedIn();
} else {
loggedOut();
};
}
public function release():void{
MochiCoins.removeEventListener(MochiCoins.ITEM_NEW, newItems);
MochiSocial.removeEventListener(MochiSocial.LOGGED_IN, loggedIn);
MochiSocial.removeEventListener(MochiSocial.LOGGED_OUT, loggedOut);
}
private function loggedOut(_arg1:Object=null):void{
_consumableProperties = null;
}
private function loggedIn(_arg1:Object=null):void{
MochiUserData.get(CONSUMER_KEY, getConsumableBag);
}
private function newItems(_arg1:Object):void{
if (!this[(_arg1.id + KEY_SALT)]){
this[(_arg1.id + KEY_SALT)] = 0;
};
if (!this[_arg1.id]){
this[_arg1.id] = 0;
};
this[(_arg1.id + KEY_SALT)] = (this[(_arg1.id + KEY_SALT)] + _arg1.count);
this[_arg1.id] = (this[_arg1.id] + _arg1.count);
if (((_arg1.privateProperties) && (_arg1.privateProperties.consumable))){
if (!this[_arg1.privateProperties.tag]){
this[_arg1.privateProperties.tag] = 0;
};
this[_arg1.privateProperties.tag] = (this[_arg1.privateProperties.tag] + (_arg1.privateProperties.inc * _arg1.count));
};
}
private function itemOwned(_arg1:Object):void{
_storeSync[_arg1.id] = {properties:_arg1.properties, count:_arg1.count};
}
private function getConsumableBag(_arg1:MochiUserData):void{
var _local2:String;
var _local3:Number;
if (_arg1.error){
triggerEvent(ERROR, {type:IO_ERROR, error:_arg1.error});
return;
};
_consumableProperties = {};
_names = new Array();
if (_arg1.data){
for (_local2 in _arg1.data) {
_names.push(_local2);
_consumableProperties[_local2] = new MochiDigits(_arg1.data[_local2]);
};
};
for (_local2 in _storeSync) {
_local3 = _storeSync[_local2].count;
if (_consumableProperties[(_local2 + KEY_SALT)]){
_local3 = (_local3 - _consumableProperties[(_local2 + KEY_SALT)].value);
};
if (_local3 == 0){
} else {
newItems({id:_local2, count:_local3, properties:_storeSync[_local2].properties});
};
};
triggerEvent(READY, {});
}
private function putConsumableBag(_arg1:MochiUserData):void{
_syncPending = false;
if (_arg1.error){
triggerEvent(ERROR, {type:IO_ERROR, error:_arg1.error});
_outstandingID = -1;
};
triggerEvent(WRITTEN, {});
}
private function sync(_arg1:Event=null):void{
var _local3:String;
if (((_syncPending) || ((_syncID == _outstandingID)))){
return;
};
_outstandingID = _syncID;
var _local2:Object = {};
for (_local3 in _consumableProperties) {
_local2[_local3] = MochiDigits(_consumableProperties[_local3]).value;
};
MochiUserData.put(CONSUMER_KEY, _local2, putConsumableBag);
_syncPending = true;
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function getProperty(_arg1){
if (_consumableProperties == null){
triggerEvent(ERROR, {type:NOT_READY});
return (-1);
};
if (_consumableProperties[_arg1]){
return (MochiDigits(_consumableProperties[_arg1]).value);
};
return (undefined);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function deleteProperty(_arg1):Boolean{
if (!_consumableProperties[_arg1]){
return (false);
};
_names.splice(_names.indexOf(_arg1), 1);
delete _consumableProperties[_arg1];
return (true);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function hasProperty(_arg1):Boolean{
if (_consumableProperties == null){
triggerEvent(ERROR, {type:NOT_READY});
return (false);
};
if (_consumableProperties[_arg1] == undefined){
return (false);
};
return (true);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function setProperty(_arg1, _arg2):void{
var _local3:MochiDigits;
if (_consumableProperties == null){
triggerEvent(ERROR, {type:NOT_READY});
return;
};
if (!(_arg2 is Number)){
triggerEvent(ERROR, {type:VALUE_ERROR, error:"Invalid type", arg:_arg2});
return;
};
if (_consumableProperties[_arg1]){
_local3 = MochiDigits(_consumableProperties[_arg1]);
if (_local3.value == _arg2){
return;
};
_local3.value = _arg2;
} else {
_names.push(_arg1);
_consumableProperties[_arg1] = new MochiDigits(_arg2);
};
_syncID++;
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function nextNameIndex(_arg1:int):int{
return (((_arg1)>=_names.length) ? 0 : (_arg1 + 1));
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function nextName(_arg1:int):String{
return (_names[(_arg1 - 1)]);
}
public static function addEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.addEventListener(_arg1, _arg2);
}
public static function triggerEvent(_arg1:String, _arg2:Object):void{
_dispatcher.triggerEvent(_arg1, _arg2);
}
public static function removeEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.removeEventListener(_arg1, _arg2);
}
}
}//package mochi.as3
Section 42
//MochiServices (mochi.as3.MochiServices)
package mochi.as3 {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.net.*;
import flash.system.*;
import flash.geom.*;
public class MochiServices {
public static const CONNECTED:String = "onConnected";
private static var _id:String;
private static var _container:Object;
private static var _clip:MovieClip;
private static var _loader:Loader;
private static var _timer:Timer;
private static var _preserved:Object;
private static var _servURL:String = "http://www.mochiads.com/static/lib/services/";
private static var _services:String = "services.swf";
private static var _mochiLC:String = "MochiLC.swf";
private static var _swfVersion:String;
private static var _listenChannelName:String = "__ms_";
private static var _sendChannel:LocalConnection;
private static var _sendChannelName:String;
private static var _connecting:Boolean = false;
private static var _connected:Boolean = false;
public static var netup:Boolean = true;
public static var netupAttempted:Boolean = false;
public static var onError:Object;
public static var widget:Boolean = false;
private static var _mochiLocalConnection:MovieClip;
private static var _queue:Array;
private static var _nextCallbackID:Number;
private static var _callbacks:Object;
private static var _dispatcher:MochiEventDispatcher = new MochiEventDispatcher();
public static function get id():String{
return (_id);
}
public static function get clip():Object{
return (_container);
}
public static function get childClip():Object{
return (_clip);
}
public static function getVersion():String{
return ("3.9.1 as3");
}
public static function allowDomains(_arg1:String):String{
var _local2:String;
if (Security.sandboxType != "application"){
Security.allowDomain("*");
Security.allowInsecureDomain("*");
};
if (_arg1.indexOf("http://") != -1){
_local2 = _arg1.split("/")[2].split(":")[0];
if (Security.sandboxType != "application"){
Security.allowDomain(_local2);
Security.allowInsecureDomain(_local2);
};
};
return (_local2);
}
public static function isNetworkAvailable():Boolean{
return (!((Security.sandboxType == "localWithFile")));
}
public static function set comChannelName(_arg1:String):void{
if (_arg1 != null){
if (_arg1.length > 3){
_sendChannelName = (_arg1 + "_fromgame");
initComChannels();
};
};
}
public static function get connected():Boolean{
return (_connected);
}
public static function warnID(_arg1:String, _arg2:Boolean):void{
_arg1 = _arg1.toLowerCase();
if (_arg1.length != 16){
trace((("WARNING: " + (_arg2) ? "board" : "game") + " ID is not the appropriate length"));
return;
} else {
if (_arg1 == "1e113c7239048b3f"){
if (_arg2){
trace("WARNING: Using testing board ID");
} else {
trace("WARNING: Using testing board ID as game ID");
};
return;
} else {
if (_arg1 == "84993a1de4031cd8"){
if (_arg2){
trace("WARNING: Using testing game ID as board ID");
} else {
trace("WARNING: Using testing game ID");
};
return;
};
};
};
var _local3:Number = 0;
while (_local3 < _arg1.length) {
switch (_arg1.charAt(_local3)){
case "0":
case "1":
case "2":
case "3":
case "4":
case "5":
case "6":
case "7":
case "8":
case "9":
case "a":
case "b":
case "c":
case "d":
case "e":
case "f":
break;
default:
trace(("WARNING: Board ID contains illegal characters: " + _arg1));
return;
};
_local3++;
};
}
public static function connect(_arg1:String, _arg2:Object, _arg3:Object=null):void{
var id = _arg1;
var clip = _arg2;
var onError = _arg3;
warnID(id, false);
if ((clip is DisplayObject)){
if (clip.stage == null){
trace("MochiServices connect requires the containing clip be attached to the stage");
};
if (((!(_connected)) && ((_clip == null)))){
trace("MochiServices Connecting...");
_connecting = true;
init(id, clip);
};
} else {
trace("Error, MochiServices requires a Sprite, Movieclip or instance of the stage.");
};
if (onError != null){
MochiServices.onError = onError;
} else {
if (MochiServices.onError == null){
MochiServices.onError = function (_arg1:String):void{
trace(_arg1);
};
};
};
}
public static function disconnect():void{
if (((_connected) || (_connecting))){
if (_clip != null){
if (_clip.parent != null){
if ((_clip.parent is Sprite)){
Sprite(_clip.parent).removeChild(_clip);
_clip = null;
};
};
};
_connecting = (_connected = false);
flush(true);
try {
_mochiLocalConnection.close();
} catch(error:Error) {
};
};
if (_timer != null){
try {
_timer.stop();
_timer.removeEventListener(TimerEvent.TIMER, connectWait);
_timer = null;
} catch(error:Error) {
};
};
}
public static function stayOnTop():void{
_container.addEventListener(Event.ENTER_FRAME, MochiServices.bringToTop, false, 0, true);
if (_clip != null){
_clip.visible = true;
};
}
public static function doClose():void{
_container.removeEventListener(Event.ENTER_FRAME, MochiServices.bringToTop);
}
public static function bringToTop(_arg1:Event=null):void{
var e = _arg1;
if (((!((MochiServices.clip == null))) && (!((MochiServices.childClip == null))))){
try {
if (MochiServices.clip.numChildren > 1){
MochiServices.clip.setChildIndex(MochiServices.childClip, (MochiServices.clip.numChildren - 1));
};
} catch(errorObject:Error) {
trace("Warning: Depth sort error.");
_container.removeEventListener(Event.ENTER_FRAME, MochiServices.bringToTop);
};
};
}
private static function init(_arg1:String, _arg2:Object):void{
_id = _arg1;
if (_arg2 != null){
_container = _arg2;
loadCommunicator(_arg1, _container);
};
}
public static function setContainer(_arg1:Object=null, _arg2:Boolean=true):void{
if (_clip.parent){
_clip.parent.removeChild(_clip);
};
if (_arg1 != null){
if ((_arg1 is DisplayObjectContainer)){
_container = _arg1;
};
};
if (_arg2){
if ((_container is DisplayObjectContainer)){
DisplayObjectContainer(_container).addChild(_clip);
};
};
}
private static function loadCommunicator(_arg1:String, _arg2:Object):MovieClip{
if (_clip != null){
return (_clip);
};
if (!MochiServices.isNetworkAvailable()){
return (null);
};
if (urlOptions(_arg2).servURL){
_servURL = urlOptions(_arg2).servURL;
};
var _local3:String = (_servURL + _services);
if (urlOptions(_arg2).servicesURL){
_local3 = urlOptions(_arg2).servicesURL;
};
_listenChannelName = (_listenChannelName + ((Math.floor(new Date().time) + "_") + Math.floor((Math.random() * 99999))));
MochiServices.allowDomains(_local3);
_clip = new MovieClip();
loadLCBridge(_clip);
_loader = new Loader();
_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, detach);
_loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, detach);
_loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, loadError);
var _local4:URLRequest = new URLRequest(_local3);
var _local5:URLVariables = new URLVariables();
_local5.listenLC = _listenChannelName;
_local5.mochiad_options = _arg2.loaderInfo.parameters.mochiad_options;
_local5.api_version = getVersion();
if (widget){
_local5.widget = true;
};
_local4.data = _local5;
_loader.load(_local4);
_clip.addChild(_loader);
_sendChannel = new LocalConnection();
_queue = [];
_nextCallbackID = 0;
_callbacks = {};
_timer = new Timer(10000, 1);
_timer.addEventListener(TimerEvent.TIMER, connectWait);
_timer.start();
return (_clip);
}
private static function detach(_arg1:Event):void{
var _local2:LoaderInfo = LoaderInfo(_arg1.target);
_local2.removeEventListener(Event.COMPLETE, detach);
_local2.removeEventListener(IOErrorEvent.IO_ERROR, detach);
_local2.removeEventListener(Event.COMPLETE, loadLCBridgeComplete);
_local2.removeEventListener(IOErrorEvent.IO_ERROR, loadError);
}
private static function loadLCBridge(_arg1:Object):void{
var _local2:Loader = new Loader();
var _local3:String = (_servURL + _mochiLC);
var _local4:URLRequest = new URLRequest(_local3);
_local2.contentLoaderInfo.addEventListener(Event.COMPLETE, detach);
_local2.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, detach);
_local2.contentLoaderInfo.addEventListener(Event.COMPLETE, loadLCBridgeComplete);
_local2.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, loadError);
_local2.load(_local4);
_arg1.addChild(_local2);
}
private static function loadLCBridgeComplete(_arg1:Event):void{
var _local2:Loader = LoaderInfo(_arg1.target).loader;
_mochiLocalConnection = MovieClip(_local2.content);
listen();
}
private static function loadError(_arg1:Object):void{
_clip._mochiad_ctr_failed = true;
trace("MochiServices could not load.");
MochiServices.disconnect();
MochiServices.onError("IOError");
}
public static function connectWait(_arg1:TimerEvent):void{
if (!_connected){
_clip._mochiad_ctr_failed = true;
trace("MochiServices could not load. (timeout)");
MochiServices.disconnect();
MochiServices.onError("IOError");
} else {
_timer.stop();
_timer.removeEventListener(TimerEvent.TIMER, connectWait);
_timer = null;
};
}
private static function listen():void{
_mochiLocalConnection.connect(_listenChannelName);
_clip.handshake = function (_arg1:Object):void{
MochiServices.comChannelName = _arg1.newChannel;
};
trace("Waiting for MochiAds services to connect...");
}
private static function initComChannels():void{
if (!_connected){
trace("[SERVICES_API] connected!");
_connecting = false;
_connected = true;
_mochiLocalConnection.send(_sendChannelName, "onReceive", {methodName:"handshakeDone"});
_mochiLocalConnection.send(_sendChannelName, "onReceive", {methodName:"registerGame", preserved:_preserved, id:_id, version:getVersion(), parentURL:_container.loaderInfo.loaderURL});
_clip.onReceive = onReceive;
_clip.onEvent = onEvent;
_clip.onError = function ():void{
MochiServices.onError("IOError");
};
while (_queue.length > 0) {
_mochiLocalConnection.send(_sendChannelName, "onReceive", _queue.shift());
};
};
}
private static function onReceive(_arg1:Object):void{
var methodName:String;
var pkg = _arg1;
var cb:String = pkg.callbackID;
var cblst:Object = _callbacks[cb];
if (!cblst){
return;
};
var method:* = cblst.callbackMethod;
methodName = "";
var obj:Object = cblst.callbackObject;
if (((obj) && ((typeof(method) == "string")))){
methodName = method;
if (obj[method] != null){
method = obj[method];
} else {
trace((("Error: Method " + method) + " does not exist."));
};
};
if (method != undefined){
try {
method.apply(obj, pkg.args);
} catch(error:Error) {
trace(((("Error invoking callback method '" + methodName) + "': ") + error.toString()));
};
} else {
if (obj != null){
try {
obj(pkg.args);
} catch(error:Error) {
trace(("Error invoking method on object: " + error.toString()));
};
};
};
delete _callbacks[cb];
}
private static function onEvent(_arg1:Object):void{
var _local2:String = _arg1.target;
var _local3:String = _arg1.event;
switch (_local2){
case "services":
MochiServices.triggerEvent(_arg1.event, _arg1.args);
break;
case "events":
MochiEvents.triggerEvent(_arg1.event, _arg1.args);
break;
case "coins":
MochiCoins.triggerEvent(_arg1.event, _arg1.args);
break;
case "social":
MochiSocial.triggerEvent(_arg1.event, _arg1.args);
break;
};
}
private static function flush(_arg1:Boolean):void{
var _local2:Object;
var _local3:Object;
if (((_clip) && (_queue))){
while (_queue.length > 0) {
_local2 = _queue.shift();
_local3 = null;
if (_local2 != null){
if (_local2.callbackID != null){
_local3 = _callbacks[_local2.callbackID];
};
delete _callbacks[_local2.callbackID];
if (((_arg1) && (!((_local3 == null))))){
handleError(_local2.args, _local3.callbackObject, _local3.callbackMethod);
};
};
};
};
}
private static function handleError(_arg1:Object, _arg2:Object, _arg3:Object):void{
var args = _arg1;
var callbackObject = _arg2;
var callbackMethod = _arg3;
if (args != null){
if (args.onError != null){
args.onError.apply(null, ["NotConnected"]);
};
if (((!((args.options == null))) && (!((args.options.onError == null))))){
args.options.onError.apply(null, ["NotConnected"]);
};
};
if (callbackMethod != null){
args = {};
args.error = true;
args.errorCode = "NotConnected";
if (((!((callbackObject == null))) && ((callbackMethod is String)))){
try {
var _local5 = callbackObject;
_local5[callbackMethod](args);
} catch(error:Error) {
};
} else {
if (callbackMethod != null){
try {
callbackMethod.apply(args);
} catch(error:Error) {
};
};
};
};
}
public static function send(_arg1:String, _arg2:Object=null, _arg3:Object=null, _arg4:Object=null):void{
if (_connected){
_mochiLocalConnection.send(_sendChannelName, "onReceive", {methodName:_arg1, args:_arg2, callbackID:_nextCallbackID});
} else {
if ((((_clip == null)) || (!(_connecting)))){
trace(("Error: MochiServices not connected. Please call MochiServices.connect(). Function: " + _arg1));
handleError(_arg2, _arg3, _arg4);
flush(true);
return;
};
_queue.push({methodName:_arg1, args:_arg2, callbackID:_nextCallbackID});
};
if (_clip != null){
if (_callbacks != null){
_callbacks[_nextCallbackID] = {callbackObject:_arg3, callbackMethod:_arg4};
_nextCallbackID++;
};
};
}
private static function urlOptions(_arg1:Object):Object{
var _local3:String;
var _local4:Array;
var _local5:Number;
var _local6:Array;
var _local2:Object = {};
if (_arg1.stage){
_local3 = _arg1.stage.loaderInfo.parameters.mochiad_options;
} else {
_local3 = _arg1.loaderInfo.parameters.mochiad_options;
};
if (_local3){
_local4 = _local3.split("&");
_local5 = 0;
while (_local5 < _local4.length) {
_local6 = _local4[_local5].split("=");
_local2[unescape(_local6[0])] = unescape(_local6[1]);
_local5++;
};
};
return (_local2);
}
public static function addLinkEvent(_arg1:String, _arg2:String, _arg3:DisplayObjectContainer, _arg4:Function=null):void{
var avm1Click:DisplayObject;
var x:String;
var req:URLRequest;
var loader:Loader;
var setURL:Function;
var err:Function;
var complete:Function;
var url = _arg1;
var burl = _arg2;
var btn = _arg3;
var onClick = _arg4;
var vars:Object = new Object();
vars["mav"] = getVersion();
vars["swfv"] = "9";
vars["swfurl"] = btn.loaderInfo.loaderURL;
vars["fv"] = Capabilities.version;
vars["os"] = Capabilities.os;
vars["lang"] = Capabilities.language;
vars["scres"] = ((Capabilities.screenResolutionX + "x") + Capabilities.screenResolutionY);
var s = "?";
var i:Number = 0;
for (x in vars) {
if (i != 0){
s = (s + "&");
};
i = (i + 1);
s = (((s + x) + "=") + escape(vars[x]));
};
req = new URLRequest("http://link.mochiads.com/linkping.swf");
loader = new Loader();
setURL = function (_arg1:String):void{
if (avm1Click){
btn.removeChild(avm1Click);
};
avm1Click = clickMovie(_arg1, onClick);
var _local2:Rectangle = btn.getBounds(btn);
btn.addChild(avm1Click);
avm1Click.x = _local2.x;
avm1Click.y = _local2.y;
avm1Click.scaleX = (0.01 * _local2.width);
avm1Click.scaleY = (0.01 * _local2.height);
};
err = function (_arg1:Object):void{
netup = false;
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
setURL(burl);
};
complete = function (_arg1:Object):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
};
if (netup){
setURL((url + s));
} else {
setURL(burl);
};
if (!((netupAttempted) || (_connected))){
netupAttempted = true;
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, err);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, complete);
loader.load(req);
};
}
private static function clickMovie(_arg1:String, _arg2:Function):MovieClip{
var _local4:int;
var _local14:Loader;
var _local3:Array = [150, 21, 0, 7, 1, 0, 0, 0, 0, 98, 116, 110, 0, 7, 2, 0, 0, 0, 0, 116, 104, 105, 115, 0, 28, 150, 22, 0, 0, 99, 114, 101, 97, 116, 101, 69, 109, 112, 116, 121, 77, 111, 118, 105, 101, 67, 108, 105, 112, 0, 82, 135, 1, 0, 0, 23, 150, 13, 0, 4, 0, 0, 111, 110, 82, 101, 108, 101, 97, 115, 101, 0, 142, 8, 0, 0, 0, 0, 2, 42, 0, 114, 0, 150, 17, 0, 0, 32, 0, 7, 1, 0, 0, 0, 8, 0, 0, 115, 112, 108, 105, 116, 0, 82, 135, 1, 0, 1, 23, 150, 7, 0, 4, 1, 7, 0, 0, 0, 0, 78, 150, 8, 0, 0, 95, 98, 108, 97, 110, 107, 0, 154, 1, 0, 0, 150, 7, 0, 0, 99, 108, 105, 99, 107, 0, 150, 7, 0, 4, 1, 7, 1, 0, 0, 0, 78, 150, 27, 0, 7, 2, 0, 0, 0, 7, 0, 0, 0, 0, 0, 76, 111, 99, 97, 108, 67, 111, 110, 110, 101, 99, 116, 105, 111, 110, 0, 64, 150, 6, 0, 0, 115, 101, 110, 100, 0, 82, 79, 150, 15, 0, 4, 0, 0, 95, 97, 108, 112, 104, 97, 0, 7, 0, 0, 0, 0, 79, 150, 23, 0, 7, 0xFF, 0, 0xFF, 0, 7, 1, 0, 0, 0, 4, 0, 0, 98, 101, 103, 105, 110, 70, 105, 108, 108, 0, 82, 23, 150, 25, 0, 7, 0, 0, 0, 0, 7, 0, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 109, 111, 118, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 100, 0, 0, 0, 7, 0, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 100, 0, 0, 0, 7, 100, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 0, 0, 0, 0, 7, 100, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 0, 0, 0, 0, 7, 0, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 16, 0, 7, 0, 0, 0, 0, 4, 0, 0, 101, 110, 100, 70, 105, 108, 108, 0, 82, 23];
var _local5:Array = [104, 0, 31, 64, 0, 7, 208, 0, 0, 12, 1, 0, 67, 2, 0xFF, 0xFF, 0xFF, 63, 3];
var _local6:Array = [0, 64, 0, 0, 0];
var _local7:MovieClip = new MovieClip();
var _local8:LocalConnection = new LocalConnection();
var _local9:String = ((("_click_" + Math.floor((Math.random() * 999999))) + "_") + Math.floor(new Date().time));
_local8 = new LocalConnection();
_local7.lc = _local8;
_local7.click = _arg2;
_local8.client = _local7;
_local8.connect(_local9);
var _local10:ByteArray = new ByteArray();
var _local11:ByteArray = new ByteArray();
_local11.endian = Endian.LITTLE_ENDIAN;
_local11.writeShort(1);
_local11.writeUTFBytes(((_arg1 + " ") + _local9));
_local11.writeByte(0);
var _local12:uint = ((_local3.length + _local11.length) + 4);
var _local13:uint = (_local12 + 35);
_local10.endian = Endian.LITTLE_ENDIAN;
_local10.writeUTFBytes("FWS");
_local10.writeByte(8);
_local10.writeUnsignedInt(_local13);
for each (_local4 in _local5) {
_local10.writeByte(_local4);
};
_local10.writeUnsignedInt(_local12);
_local10.writeByte(136);
_local10.writeShort(_local11.length);
_local10.writeBytes(_local11);
for each (_local4 in _local3) {
_local10.writeByte(_local4);
};
for each (_local4 in _local6) {
_local10.writeByte(_local4);
};
_local14 = new Loader();
_local14.loadBytes(_local10);
_local7.addChild(_local14);
return (_local7);
}
public static function addEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.addEventListener(_arg1, _arg2);
}
public static function triggerEvent(_arg1:String, _arg2:Object):void{
_dispatcher.triggerEvent(_arg1, _arg2);
}
public static function removeEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.removeEventListener(_arg1, _arg2);
}
}
}//package mochi.as3
Section 43
//MochiSocial (mochi.as3.MochiSocial)
package mochi.as3 {
public class MochiSocial {
public static const LOGGED_IN:String = "LoggedIn";
public static const LOGGED_OUT:String = "LoggedOut";
public static const LOGIN_SHOW:String = "LoginShow";
public static const LOGIN_HIDE:String = "LoginHide";
public static const LOGIN_SHOWN:String = "LoginShown";
public static const PROFILE_SHOW:String = "ProfileShow";
public static const PROFILE_HIDE:String = "ProfileHide";
public static const PROPERTIES_SAVED:String = "PropertySaved";
public static const WIDGET_LOADED:String = "WidgetLoaded";
public static const FRIEND_LIST:String = "FriendsList";
public static const PROFILE_DATA:String = "ProfileData";
public static const GAMEPLAY_DATA:String = "GameplayData";
public static const ACTION_CANCELED:String = "onCancel";
public static const ACTION_COMPLETE:String = "onComplete";
public static const USER_INFO:String = "UserInfo";
public static const ERROR:String = "Error";
public static const IO_ERROR:String = "IOError";
public static const NO_USER:String = "NoUser";
public static const PROPERTIES_SIZE:String = "PropertiesSize";
private static var _dispatcher:MochiEventDispatcher = new MochiEventDispatcher();
public static var _user_info:Object = null;
public static function getVersion():String{
return (MochiServices.getVersion());
}
public static function getAPIURL():String{
if (!_user_info){
return (null);
};
return (_user_info.api_url);
}
public static function getAPIToken():String{
if (!_user_info){
return (null);
};
return (_user_info.api_token);
}
public static function showLoginWidget(_arg1:Object=null):void{
MochiServices.setContainer();
MochiServices.bringToTop();
MochiServices.send("social_showLoginWidget", {options:_arg1});
}
public static function hideLoginWidget():void{
MochiServices.send("social_hideLoginWidget");
}
public static function requestLogin(_arg1:Object=null):void{
MochiServices.setContainer();
MochiServices.bringToTop();
MochiServices.send("social_requestLogin", _arg1);
}
public static function saveUserProperties(_arg1:Object):void{
MochiServices.send("social_saveUserProperties", _arg1);
}
public static function getFriendsList(_arg1:Object=null):void{
MochiServices.send("social_getFriendsList", _arg1);
}
public static function postToStream(_arg1:Object=null):void{
MochiServices.setContainer();
MochiServices.bringToTop();
MochiServices.send("social_postToStream", _arg1);
}
public static function inviteFriends(_arg1:Object=null):void{
MochiServices.setContainer();
MochiServices.bringToTop();
MochiServices.send("social_inviteFriends", _arg1);
}
public static function requestFan(_arg1:Object=null):void{
MochiServices.setContainer();
MochiServices.bringToTop();
MochiServices.send("social_requestFan", _arg1);
}
public static function addEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.addEventListener(_arg1, _arg2);
}
public static function get loggedIn():Boolean{
return (!((_user_info == null)));
}
public static function triggerEvent(_arg1:String, _arg2:Object):void{
_dispatcher.triggerEvent(_arg1, _arg2);
}
public static function removeEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.removeEventListener(_arg1, _arg2);
}
MochiSocial.addEventListener(MochiSocial.LOGGED_IN, function (_arg1:Object):void{
_user_info = _arg1;
});
MochiSocial.addEventListener(MochiSocial.LOGGED_OUT, function (_arg1:Object):void{
_user_info = null;
});
}
}//package mochi.as3
Section 44
//MochiUserData (mochi.as3.MochiUserData)
package mochi.as3 {
import flash.events.*;
import flash.utils.*;
import flash.net.*;
public class MochiUserData extends EventDispatcher {
public var _loader:URLLoader;
public var key:String;// = null
public var data;// = null
public var error:Event;// = null
public var operation:String;// = null
public var callback:Function;// = null
public function MochiUserData(_arg1:String="", _arg2:Function=null){
this.key = _arg1;
this.callback = _arg2;
}
public function serialize(_arg1):ByteArray{
var _local2:ByteArray = new ByteArray();
_local2.objectEncoding = ObjectEncoding.AMF3;
_local2.writeObject(_arg1);
_local2.compress();
return (_local2);
}
public function deserialize(_arg1:ByteArray){
_arg1.objectEncoding = ObjectEncoding.AMF3;
_arg1.uncompress();
return (_arg1.readObject());
}
public function request(_arg1:String, _arg2:ByteArray):void{
var _operation = _arg1;
var _data = _arg2;
operation = _operation;
var api_url:String = MochiSocial.getAPIURL();
var api_token:String = MochiSocial.getAPIToken();
if ((((api_url == null)) || ((api_token == null)))){
errorHandler(new IOErrorEvent(IOErrorEvent.IO_ERROR, false, false, "not logged in"));
return;
};
_loader = new URLLoader();
var args:URLVariables = new URLVariables();
args.op = _operation;
args.key = key;
var req:URLRequest = new URLRequest((((MochiSocial.getAPIURL() + "/") + "MochiUserData?") + args.toString()));
req.method = URLRequestMethod.POST;
req.contentType = "application/x-mochi-userdata";
req.requestHeaders = [new URLRequestHeader("x-mochi-services-version", MochiServices.getVersion()), new URLRequestHeader("x-mochi-api-token", api_token)];
req.data = _data;
_loader.dataFormat = URLLoaderDataFormat.BINARY;
_loader.addEventListener(Event.COMPLETE, completeHandler);
_loader.addEventListener(IOErrorEvent.IO_ERROR, errorHandler);
_loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
try {
_loader.load(req);
} catch(e:SecurityError) {
errorHandler(new IOErrorEvent(IOErrorEvent.IO_ERROR, false, false, ("security error: " + e.toString())));
};
}
public function completeHandler(_arg1:Event):void{
var event = _arg1;
try {
if (_loader.data.length){
data = deserialize(_loader.data);
} else {
data = null;
};
} catch(e:Error) {
errorHandler(new IOErrorEvent(IOErrorEvent.IO_ERROR, false, false, ("deserialize error: " + e.toString())));
return;
};
if (callback != null){
performCallback();
} else {
dispatchEvent(event);
};
close();
}
public function errorHandler(_arg1:IOErrorEvent):void{
data = null;
error = _arg1;
if (callback != null){
performCallback();
} else {
dispatchEvent(_arg1);
};
close();
}
public function securityErrorHandler(_arg1:SecurityErrorEvent):void{
errorHandler(new IOErrorEvent(IOErrorEvent.IO_ERROR, false, false, ("security error: " + _arg1.toString())));
}
public function performCallback():void{
try {
callback(this);
} catch(e:Error) {
trace(("[MochiUserData] exception during callback: " + e));
};
}
public function close():void{
if (_loader){
_loader.removeEventListener(Event.COMPLETE, completeHandler);
_loader.removeEventListener(IOErrorEvent.IO_ERROR, errorHandler);
_loader.removeEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
_loader.close();
_loader = null;
};
error = null;
callback = null;
}
public function getEvent():void{
request("get", serialize(null));
}
public function putEvent(_arg1):void{
request("put", serialize(_arg1));
}
override public function toString():String{
return ((((((((("[MochiUserData operation=" + operation) + " key=\"") + key) + "\" data=") + data) + " error=\"") + error) + "\"]"));
}
public static function get(_arg1:String, _arg2:Function):void{
var _local3:MochiUserData = new MochiUserData(_arg1, _arg2);
_local3.getEvent();
}
public static function put(_arg1:String, _arg2, _arg3:Function):void{
var _local4:MochiUserData = new MochiUserData(_arg1, _arg3);
_local4.putEvent(_arg2);
}
}
}//package mochi.as3
Section 45
//btn_easy_12 (NEWGROUNDSVERSION_fla.btn_easy_12)
package NEWGROUNDSVERSION_fla {
import flash.display.*;
public dynamic class btn_easy_12 extends MovieClip {
public function btn_easy_12(){
addFrameScript(0, frame1, 7, frame8, 15, frame16, 16, frame17);
}
function frame1(){
stop();
}
function frame8(){
stop();
}
function frame16(){
gotoAndPlay(1);
}
function frame17(){
stop();
}
}
}//package NEWGROUNDSVERSION_fla
Section 46
//btn_hard_16 (NEWGROUNDSVERSION_fla.btn_hard_16)
package NEWGROUNDSVERSION_fla {
import flash.display.*;
public dynamic class btn_hard_16 extends MovieClip {
public function btn_hard_16(){
addFrameScript(0, frame1, 7, frame8, 15, frame16, 16, frame17);
}
function frame1(){
stop();
}
function frame8(){
stop();
}
function frame16(){
gotoAndPlay(1);
}
function frame17(){
stop();
}
}
}//package NEWGROUNDSVERSION_fla
Section 47
//btn_lin_1_30 (NEWGROUNDSVERSION_fla.btn_lin_1_30)
package NEWGROUNDSVERSION_fla {
import flash.display.*;
public dynamic class btn_lin_1_30 extends MovieClip {
public var btn_lin_2_off:MovieClip;
public var btn_off:MovieClip;
public function btn_lin_1_30(){
addFrameScript(0, frame1, 19, frame20, 29, frame30, 39, frame40);
}
function frame1(){
stop();
}
function frame20(){
stop();
}
function frame30(){
stop();
}
function frame40(){
stop();
}
}
}//package NEWGROUNDSVERSION_fla
Section 48
//btn_lin_2_27 (NEWGROUNDSVERSION_fla.btn_lin_2_27)
package NEWGROUNDSVERSION_fla {
import flash.display.*;
public dynamic class btn_lin_2_27 extends MovieClip {
public var btn_lin_2_off:MovieClip;
public var btn_off:MovieClip;
public function btn_lin_2_27(){
addFrameScript(0, frame1, 19, frame20, 29, frame30, 39, frame40);
}
function frame1(){
stop();
}
function frame20(){
stop();
}
function frame30(){
stop();
}
function frame40(){
stop();
}
}
}//package NEWGROUNDSVERSION_fla
Section 49
//btn_lin_3_33 (NEWGROUNDSVERSION_fla.btn_lin_3_33)
package NEWGROUNDSVERSION_fla {
import flash.display.*;
public dynamic class btn_lin_3_33 extends MovieClip {
public var btn_lin_2_off:MovieClip;
public var btn_off:MovieClip;
public function btn_lin_3_33(){
addFrameScript(0, frame1, 19, frame20, 29, frame30, 39, frame40);
}
function frame1(){
stop();
}
function frame20(){
stop();
}
function frame30(){
stop();
}
function frame40(){
stop();
}
}
}//package NEWGROUNDSVERSION_fla
Section 50
//btn_lin_4_36 (NEWGROUNDSVERSION_fla.btn_lin_4_36)
package NEWGROUNDSVERSION_fla {
import flash.display.*;
public dynamic class btn_lin_4_36 extends MovieClip {
public var btn_lin_2_off:MovieClip;
public var btn_off:MovieClip;
public function btn_lin_4_36(){
addFrameScript(0, frame1, 19, frame20, 29, frame30, 39, frame40);
}
function frame1(){
stop();
}
function frame20(){
stop();
}
function frame30(){
stop();
}
function frame40(){
stop();
}
}
}//package NEWGROUNDSVERSION_fla
Section 51
//btn_norm_14 (NEWGROUNDSVERSION_fla.btn_norm_14)
package NEWGROUNDSVERSION_fla {
import flash.display.*;
public dynamic class btn_norm_14 extends MovieClip {
public function btn_norm_14(){
addFrameScript(0, frame1, 7, frame8, 15, frame16, 16, frame17);
}
function frame1(){
stop();
}
function frame8(){
stop();
}
function frame16(){
gotoAndPlay(1);
}
function frame17(){
stop();
}
}
}//package NEWGROUNDSVERSION_fla
Section 52
//disableMusicLIB_136 (NEWGROUNDSVERSION_fla.disableMusicLIB_136)
package NEWGROUNDSVERSION_fla {
import flash.display.*;
public dynamic class disableMusicLIB_136 extends MovieClip {
public function disableMusicLIB_136(){
addFrameScript(0, frame1);
}
function frame1(){
this.gotoAndStop(1);
}
}
}//package NEWGROUNDSVERSION_fla
Section 53
//disableSoundsLIB_135 (NEWGROUNDSVERSION_fla.disableSoundsLIB_135)
package NEWGROUNDSVERSION_fla {
import flash.display.*;
public dynamic class disableSoundsLIB_135 extends MovieClip {
public function disableSoundsLIB_135(){
addFrameScript(0, frame1);
}
function frame1(){
this.gotoAndStop(1);
}
}
}//package NEWGROUNDSVERSION_fla
Section 54
//endGameFaderLIB_92 (NEWGROUNDSVERSION_fla.endGameFaderLIB_92)
package NEWGROUNDSVERSION_fla {
import flash.display.*;
public dynamic class endGameFaderLIB_92 extends MovieClip {
public function endGameFaderLIB_92(){
addFrameScript(99, frame100);
}
function frame100(){
this.stop();
this.visible = false;
}
}
}//package NEWGROUNDSVERSION_fla
Section 55
//enterFrameFaderLIB_139 (NEWGROUNDSVERSION_fla.enterFrameFaderLIB_139)
package NEWGROUNDSVERSION_fla {
import flash.display.*;
public dynamic class enterFrameFaderLIB_139 extends MovieClip {
public function enterFrameFaderLIB_139(){
addFrameScript(29, frame30);
}
function frame30(){
this.visible = false;
}
}
}//package NEWGROUNDSVERSION_fla
Section 56
//MainTimeline (NEWGROUNDSVERSION_fla.MainTimeline)
package NEWGROUNDSVERSION_fla {
import flash.events.*;
import flash.display.*;
import com.newgrounds.*;
import com.newgrounds.components.*;
import flash.utils.*;
import mochi.as3.*;
import flash.net.*;
import flash.media.*;
import flash.ui.*;
import flash.text.*;
import flash.system.*;
import flash.geom.*;
import flash.errors.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.profiler.*;
import flash.sampler.*;
import flash.xml.*;
public dynamic class MainTimeline extends MovieClip {
public var tutoMiniBox82:MovieClip;
public var tutoMiniBox4:MovieClip;
public var dice2Graphic:MovieClip;
public var player3GameBar:MovieClip;
public var endGameFader:MovieClip;
public var theEnd:MovieClip;
public var researchGetTooltip:MovieClip;
public var castletooltip:starterBuildingLIB;
public var tooltipBox:MovieClip;
public var btn_lin_1:MovieClip;
public var play_2pf_gfx:MovieClip;
public var play_2pw_gfx:MovieClip;
public var play_tuto_gfx:MovieClip;
public var clickToContinue:MovieClip;
public var dice1Graphic:MovieClip;
public var player2GameBar:MovieClip;
public var res1Get3:MovieClip;
public var btn_hard_gfx:MovieClip;
public var tutoMiniBox72:MovieClip;
public var player1GameBar:MovieClip;
public var res2Get3:MovieClip;
public var res1Get2:MovieClip;
public var btn_lin_3:MovieClip;
public var btn_hard:MovieClip;
public var btn_norm:MovieClip;
public var play_4pf_gfx:MovieClip;
public var playerMode4BoardCenterBeacon:MovieClip;
public var playerMode2Beacon:MovieClip;
public var playerMovesLeftText:MovieClip;
public var res2Get2:MovieClip;
public var res1Get1:MovieClip;
public var res3Get3:MovieClip;
public var wallToolTipMsgBox:MovieClip;
public var btn_lin_2:MovieClip;
public var monitor:MovieClip;
public var btn_norm_gfx:MovieClip;
public var tutoMiniBox9:MovieClip;
public var slideTutorialBeacon:MovieClip;
public var showEnemyStrength:MovieClip;
public var res2Get1:MovieClip;
public var res3Get2:MovieClip;
public var btn_easy_gfx:MovieClip;
public var tutoMiniBox8:MovieClip;
public var player4Beacon:MovieClip;
public var res3Get1:MovieClip;
public var statusBar:MovieClip;
public var wallToolTip:MovieClip;
public var btn_lin_4_gfx:MovieClip;
public var clickToBeginBackGround:MovieClip;
public var __id0_:APIConnector;
public var combatEvidencer:MovieClip;
public var tutoMiniBox10:MovieClip;
public var playMoreGamesText:MovieClip;
public var btn_lin_3_gfx:MovieClip;
public var tutoMiniBox11:MovieClip;
public var btn_chooseDiceRoll:MovieClip;
public var player4GameBar:MovieClip;
public var longWalkGUI:MovieClip;
public var btn_lin_2_gfx:MovieClip;
public var tutoBoxMainIntro:MovieClip;
public var tokenRollChoice:MovieClip;
public var stageWidthLimitBeacon:MovieClip;
public var letheGames:MovieClip;
public var btn_lin_1_gfx:MovieClip;
public var producingResourceMessage:MovieClip;
public var newGameFader:MovieClip;
public var buttonTooltip:MovieClip;
public var constructorModeMouse:MovieClip;
public var credits:MovieClip;
public var btn_easy:MovieClip;
public var player1Beacon:MovieClip;
public var learnAsYouPlayToolTip:MovieClip;
public var sponsorSplash:MovieClip;
public var player2Beacon:MovieClip;
public var precious:MovieClip;
public var enterMenuFrameFader:MovieClip;
public var player3Beacon:MovieClip;
public var gathererTooltip:MovieClip;
public var board:MovieClip;
public var playMoreGames:MovieClip;
public var play_tuto:MovieClip;
public var escapeMenu:MovieClip;
public var res4Get3:MovieClip;
public var btn_chooseCivExpansion:MovieClip;
public var play_4pf:MovieClip;
public var play_2pw:MovieClip;
public var gears:MovieClip;
public var skipMiniBoxIntro:MovieClip;
public var tutoMiniBox7:MovieClip;
public var playerMode4Beacon:MovieClip;
public var res4Get2:MovieClip;
public var btn_lin_4:MovieClip;
public var combatBar:MovieClip;
public var res4Get1:MovieClip;
public var warAdvisor:MovieClip;
public var play_2pf:MovieClip;
public var tutoMiniBox5:MovieClip;
public var mindUpgradeDisplay:MovieClip;
public var txt_selection:MovieClip;
public var __setPropDict:Dictionary;
public var rightClickMenu:ContextMenu;
public var developedBy;
public var sponsoredBy;
public var TimerRunGameLoop:Timer;
public var TimerMoveAttacker:Timer;
public var TimerAnimatePieces:Timer;
public var TimerAnimatePiecesRecursion:Timer;
public var TimerNewTurnDelay:Timer;
public var TimerDiceRollPlaceChoiceDelay:Timer;
public var TimerDiceRollGetDelay:Timer;
public var TimerPartyBattleEnd:Timer;
public var TimerDelayShowNPCUpgrade:Timer;
public var TimerSlidePartyUnit:Timer;
public var TimerDelayPlaceStarterBuilding:Timer;
public var TimerDelayPlaceStarterBuildingEnd:Timer;
public var TimerDelayPlaceStarterGatherer:Timer;
public var TimerDelayPlaceStarterGathererEnd:Timer;
public var TimerShowResearchGet:Timer;
public var TimerLongWalk:Timer;
public var TimerShowGathererGet:Timer;
public var TimerShowCombatantsEnd;
public var TimerShowProducingResource;
public var TimerFadeAndStartNewgame;
public var TimerAnimateTutorial;
public var TimerTutorialAfterIntro;
public var resourcesPerTurn:uint;
public var startingUnitQtt:uint;
public var startingWallQtt:uint;
public var startingGathererQtt:uint;
public var exp1Resource1Cost:uint;
public var exp1Resource2Cost:uint;
public var exp1Resource3Cost:uint;
public var exp1Resource4Cost:uint;
public var exp4Resource1Cost:uint;
public var exp4Resource2Cost:uint;
public var exp4Resource3Cost:uint;
public var exp4Resource4Cost:uint;
public var numberOfMindEvolutions:uint;
public var exp5Resource1Cost:uint;
public var exp5Resource2Cost:uint;
public var exp5Resource3Cost:uint;
public var exp5Resource4Cost:uint;
public var exp2Resource1Cost:uint;
public var exp2Resource2Cost:uint;
public var exp2Resource3Cost:uint;
public var exp2Resource4Cost:uint;
public var exp3Resource1Cost:uint;
public var exp3Resource2Cost:uint;
public var exp3Resource3Cost:uint;
public var exp3Resource4Cost:uint;
public var exp6Resource1Cost:uint;
public var exp6Resource2Cost:uint;
public var exp6Resource3Cost:uint;
public var exp6Resource4Cost:uint;
public var KeeperResourceDiscount:uint;
public var KeeperAttackPenalty:uint;
public var ScibotEvolutionDiscount:uint;
public var BuilderWallDiscount:uint;
public var WarAttackDiscount:uint;
public var WarBuildingPenalty:uint;
public var KeeperAdditionalGatherer:uint;
public var ScibotStartingResearch:uint;
public var BuilderExtraWalls:uint;
public var WarStartingAttack:uint;
public var partyUnitMaxMoves:uint;
public var partyRegularStancePower:uint;
public var partyInitiativeBonus:uint;
public var reaverStr:uint;
public var reaversMostWait:uint;
public var overclock1:uint;
public var overclock2:uint;
public var overclock34:uint;
public var overclock56:uint;
public var overclock78:uint;
public var overclock9:uint;
public var partyDefensiveStancePowerVsMelee:uint;
public var partyDefensiveStancePowerVsRanged:uint;
public var partyDefensiveStancePowerVsMagician:uint;
public var defenderAssistAttackPowerBonus:uint;
public var partyUnitWidth:uint;
public var partyUnitHeight:uint;
public var slideMoveSpeedNormal:Number;
public var slideMoveSpeedFast:Number;
public var tileWidth:uint;
public var tileHeight:uint;
public var tileXSpacing:uint;
public var tileYSpacing:uint;
public var landGridNumberHorizontal:uint;
public var landGridNumberVertical:uint;
public var quantityResources:uint;
public var quantityBlockedTiles:uint;
public var quantityAdditionalBlockedTiles:uint;
public var additionalBlockTileChance:Number;
public var tilesPerPlaceable:uint;
public var player1XSpacing:Number;
public var player1YSpacing:Number;
public var player2XSpacing:Number;
public var player2YSpacing:Number;
public var player3XSpacing:Number;
public var player3YSpacing:Number;
public var player4XSpacing:Number;
public var player4YSpacing:Number;
public var leadSlotSpacing:Number;
public var slotLeftSpacing:Number;
public var slotBottomSpacing:Number;
public var endingleadSlotSpacing:Number;
public var starterBuildingWidth:uint;
public var starterBuildingHeight:uint;
public var gathererUnitWidth:uint;
public var gathererUnitHeight:uint;
public var numberOfPlayers:uint;
public var player1Race:String;
public var player2Race:String;
public var player3Race:String;
public var player4Race:String;
public var tileXSpacingCounter:uint;
public var tileYSpacingCounter:uint;
public var currentPlayerXSpacing:uint;
public var currentPlayerYSpacing:uint;
public var verticalGridCounter:uint;
public var attackerChosenTile:uint;
public var attackerCurrentTile:uint;
public var rightMostLimit:uint;
public var lowerMostLimit:uint;
public var landTileResource1Placed:uint;
public var landTileResource2Placed:uint;
public var landTileResource3Placed:uint;
public var landTileResource4Placed:uint;
public var blockTilesPlaced:uint;
public var additionalBlockTilesPlaced:uint;
public var resourceRandomizer:Number;
public var turnOrder:Number;
public var currentTurn:uint;
public var startingTurnPlayer:uint;
public var p1starterBuildingPlaced:Boolean;
public var p2starterBuildingPlaced:Boolean;
public var p3starterBuildingPlaced:Boolean;
public var p4starterBuildingPlaced:Boolean;
public var p1StarterBuildingTile:uint;
public var p2StarterBuildingTile:uint;
public var p3StarterBuildingTile:uint;
public var p4StarterBuildingTile:uint;
public var starterBuildingTile:uint;
public var p1starterGathererPlaced:Boolean;
public var p2starterGathererPlaced:Boolean;
public var p3starterGathererPlaced:Boolean;
public var p4starterGathererPlaced:Boolean;
public var currentUnitPlayerMoves:uint;
public var allowPlayerToMoveUnit:Boolean;
public var tileFilledRoll:Boolean;
public var tileNumberRoll:uint;
public var tileBlankPlaced:uint;
public var topChoiceTileScore:uint;
public var besttopChoiceTileScore:uint;
public var plcModifier:Number;
public var plcCurrent:uint;
public var chosenResource:uint;
public var currentChosenGatherTile:uint;
public var player2ChosenGatherTile:uint;
public var player3ChosenGatherTile:uint;
public var player4ChosenGatherTile:uint;
public var skipBestTileCheck:Boolean;
public var randomStarterBuildingTile:Number;
public var p1Resource1Qtt:uint;
public var p1Resource2Qtt:uint;
public var p1Resource3Qtt:uint;
public var p1Resource4Qtt:uint;
public var p1UnitQtt:uint;
public var p1WallQtt:uint;
public var p1GathererQtt:uint;
public var p2Resource1Qtt:uint;
public var p2Resource2Qtt:uint;
public var p2Resource3Qtt:uint;
public var p2Resource4Qtt:uint;
public var p2UnitQtt:uint;
public var p2WallQtt:uint;
public var p2GathererQtt:uint;
public var p3Resource1Qtt:uint;
public var p3Resource2Qtt:uint;
public var p3Resource3Qtt:uint;
public var p3Resource4Qtt:uint;
public var p3UnitQtt:uint;
public var p3WallQtt:uint;
public var p3GathererQtt:uint;
public var p4Resource1Qtt:uint;
public var p4Resource2Qtt:uint;
public var p4Resource3Qtt:uint;
public var p4Resource4Qtt:uint;
public var p4UnitQtt:uint;
public var p4WallQtt:uint;
public var p4GathererQtt:uint;
public var Resource1Qtt:uint;
public var Resource2Qtt:uint;
public var Resource3Qtt:uint;
public var Resource4Qtt:uint;
public var wallQtt:uint;
public var UnitQtt:uint;
public var dice1:uint;
public var dice2:uint;
public var diceCombined:uint;
public var rolledResource:uint;
public var p2ProtectResource:uint;
public var p3ProtectResource:uint;
public var p4ProtectResource:uint;
public var p2WallExpandCheckpoint:uint;
public var p3WallExpandCheckpoint:uint;
public var p4WallExpandCheckpoint:uint;
public var expandWallMaxRoll:Number;
public var expandPartyMaxRoll:Number;
public var endWallExpansion:Boolean;
public var endPartyAssignments:Boolean;
public var protectResourceCheck:uint;
public var resourceQttCheck:uint;
public var currentMovingParty:uint;
public var movingUnit:uint;
public var tileAttacked:uint;
public var attackerUnit:uint;
public var attackerKingdom:uint;
public var attackerDiceRoll:uint;
public var attackerDiceRoll1:uint;
public var attackerDiceRoll2:uint;
public var defenderDiceRoll:uint;
public var defenderDiceRoll1:uint;
public var defenderDiceRoll2:uint;
public var defenderAttackPower:uint;
public var additionalDefendersAttackPower:uint;
public var additionalDefendingAttackersAttackPower:uint;
public var player2Aggro:Number;
public var player3Aggro:Number;
public var player4Aggro:Number;
public var playerAggro:Number;
public var exposedGatherer:Boolean;
public var lastTileKingdom1:uint;
public var firstTileKingdom3:uint;
public var kingdom1ToKingdom3TileDifference:uint;
public var player1DiceRollChoice:uint;
public var player2DiceRollChoice:uint;
public var player3DiceRollChoice:uint;
public var player4DiceRollChoice:uint;
public var playerDiceRollChoice:uint;
public var blankTurnOver:Boolean;
public var blankTurnsTaken:uint;
public var civExpandChoice:uint;
public var p2ResourceToExpand:uint;
public var p3ResourceToExpand:uint;
public var p4ResourceToExpand:uint;
public var timeToPlaceNewGatherer:Boolean;
public var resourceToExpand:uint;
public var newGathererTobePlaced:uint;
public var p1Gatherers1:uint;
public var p1Gatherers2:uint;
public var p1Gatherers3:uint;
public var p1Gatherers4:uint;
public var p2Gatherers1:uint;
public var p2Gatherers2:uint;
public var p2Gatherers3:uint;
public var p2Gatherers4:uint;
public var p3Gatherers1:uint;
public var p3Gatherers2:uint;
public var p3Gatherers3:uint;
public var p3Gatherers4:uint;
public var p4Gatherers1:uint;
public var p4Gatherers2:uint;
public var p4Gatherers3:uint;
public var p4Gatherers4:uint;
public var chooseAnyResourceToGather:Boolean;
public var gathererDistanceScore:uint;
public var minimumGathererDistanceScore:uint;
public var chosenMinimumGathererScore:uint;
public var unitWithMostMoves:uint;
public var player1NewGathererTile:uint;
public var exceptionCloseCheckWall:uint;
public var xmoveTextModifier:uint;
public var ymoveTextModifier:uint;
public var attackerRawRoll:uint;
public var defenderRawRoll:uint;
public var civChoiceMaxRoll:uint;
public var diceChoiceMaxroll:uint;
public var newMovingUnit:Boolean;
public var reactivateGatherer:Boolean;
public var p1UpgradePower:uint;
public var p2UpgradePower:uint;
public var p3UpgradePower:uint;
public var p4UpgradePower:uint;
public var p1UpgradeSpeed:uint;
public var p2UpgradeSpeed:uint;
public var p3UpgradeSpeed:uint;
public var p4UpgradeSpeed:uint;
public var p1UpgradeRoll:uint;
public var p2UpgradeRoll:uint;
public var p3UpgradeRoll:uint;
public var p4UpgradeRoll:uint;
public var p1UpgradeGatherer:uint;
public var p2UpgradeGatherer:uint;
public var p3UpgradeGatherer:uint;
public var p4UpgradeGatherer:uint;
public var mindUpgradeRandomChoice:int;
public var dicesDisplayXMod:uint;
public var dicesDisplayYMod:uint;
public var npcBoughMindUpgrade:Boolean;
public var slideToX:Number;
public var slideToY:Number;
public var slidingUnit:Boolean;
public var wallLoopCheck:uint;
public var player1PlaceGathererMode:Boolean;
public var player1PlaceWallMode:Boolean;
public var learningWhilePlaying:Boolean;
public var reaversComingCount:uint;
public var overClockBonus:uint;
public var tilesDifference:int;
public var failLongWalk:Boolean;
public var hw:uint;
public var hw2:uint;
public var longWalkSliding:Boolean;
public var tempLongwalkOrientation:int;
public var allowP1UpGradeBuy;
public var longWalkPartyCurrentTile:uint;
public var failedWallInsertion:Boolean;
public var riseTo:uint;
public var riseTo2:uint;
public var gameOver:Boolean;
public var whenReaversCome:uint;
public var whenReaversComeTemp:uint;
public var p2Extinct:Boolean;
public var p3Extinct:Boolean;
public var p4Extinct:Boolean;
public var p2NoLongerPlaying:Boolean;
public var p3NoLongerPlaying:Boolean;
public var p4NoLongerPlaying:Boolean;
public var exctinctRaceNoMovesLeft:Boolean;
public var reaversDontMove:Boolean;
public var attackOnceForTutorial:Boolean;
public var slideMoveSpeed:Number;
public var totalPlayerTurnsTaken:uint;
public var giveUpgradeAchievement:Boolean;
public var giveUpgradeAchievementSecretOoze:Boolean;
public var twoTimesInARow:uint;
public var balanceGathererCost2:uint;
public var balanceGathererCost3:uint;
public var balanceAttackCost:uint;
public var balanceEvolutionCost:uint;
public var balanceWallCost:uint;
public var civAttackRaceModifier:uint;
public var civWallRaceModifier:uint;
public var civEvolutionRaceModifier:uint;
public var civGathererRaceModifier:uint;
public var currentWall:Number;
public var wallToBePlaced:Number;
public var numberOfWallSteps:uint;
public var allPathsChecked:Boolean;
public var exceptionFirstWall:Number;
public var exceptionLastWall:Number;
public var exceptionArrayTest:Boolean;
public var exeptionArrayPosition:Number;
public var defensiveAttackedFromBehind:Boolean;
public var firstMoveRight:Boolean;
public var firstMoveLeft:Boolean;
public var firstMoveUp:Boolean;
public var firstMoveDown:Boolean;
public var turnBeforeReavers:uint;
public var reaverTurnTaken:Boolean;
public var reaverRaid:uint;
public var p1LedOn:uint;
public var p2LedOn:uint;
public var p3LedOn:uint;
public var p4LedOn:uint;
public var runningFullScreen:Boolean;
public var bestPathNumber:uint;
public var player1UnderCombat:Boolean;
public var player1Raiding:Boolean;
public var player1PlacingGatherer:Boolean;
public var player1ChoosingDiceRoll:Boolean;
public var player1AlreadyChoseDiceRoll:Boolean;
public var landTile:landTileLIB;
public var landTileArray:Array;
public var landTileArrayPlayer1:Array;
public var landTileArrayPlayer2:Array;
public var landTileArrayPlayer3:Array;
public var landTileArrayPlayer4:Array;
public var wallSlot:wallSlotLIB;
public var wallSlotArray:Array;
public var starterBuilding:starterBuildingLIB;
public var starterBuildingArray:Array;
public var starterBuildingTileChoicesArray:Array;
public var wallExpandChoicesArray:Array;
public var partyDefendChoicesArray:Array;
public var wallCheckPointArray:Array;
public var landCheckPointArray:Array;
public var landCheckPointBestPathArray:Array;
public var partyUnit:partyUnitLIB;
public var partyUnitArray1:Array;
public var partyUnitArray2:Array;
public var partyUnitArray3:Array;
public var partyUnitArray4:Array;
public var partyUnitArray5:Array;
public var partyUnitArray:Array;
public var enemyPartyDetected:Array;
public var civChoicesArray:Array;
public var diceChoicesArray:Array;
public var gathererUnit:gathererUnitLIB;
public var longWalkArray:Array;
public var gathererUnitArray:Array;
public var allGathererUnitArray:Array;
public var p1AvaliableMindUpgrades:Array;
public var p2AvaliableMindUpgrades:Array;
public var p3AvaliableMindUpgrades:Array;
public var p4AvaliableMindUpgrades:Array;
public var tilesToProtectPlayer2:Array;
public var tilesToProtectPlayer3:Array;
public var tilesToProtectPlayer4:Array;
public var tilesToProtect:Array;
public var reaverOriginPlayer1:Array;
public var reaverOriginPlayer2:Array;
public var reaverOriginPlayer3:Array;
public var reaverOriginPlayer4:Array;
public var snd_theme:Sound;
public var chan_theme:SoundChannel;
public var snd_MusicVolume:SoundTransform;
public var snd_FXVolume:SoundTransform;
public var snd_DefensiveStanceVolume:SoundTransform;
public var snd_DiceRoll:SoundTransform;
public var snd_MonitorVolume:SoundTransform;
public var chan_soundFX:SoundChannel;
public var snd_nullSound:Sound;
public var snd_defensive_stance:Sound;
public var snd_diceroll:Sound;
public var snd_placewall:Sound;
public var snd_place_gatherer:Sound;
public var snd_raid:Sound;
public var snd_unit_rotate:Sound;
public var snd_moveunit:Sound;
public var snd_combat_lose:Sound;
public var snd_combat_win:Sound;
public var snd_evolution:Sound;
public var snd_reinforcement:Sound;
public var snd_select_DiceRoll:Sound;
public var snd_gears:Sound;
public var snd_lights:Sound;
public var snd_monitorSound:Sound;
public var snd_game_Victory:Sound;
public var btn_lin_1_status;
public var btn_lin_2_status;
public var btn_lin_3_status;
public var btn_lin_4_status;
public var btn_easy_status;
public var btn_norm_status;
public var btn_hard_status;
public var monitor_status;
public function MainTimeline(){
__setPropDict = new Dictionary(true);
super();
addFrameScript(0, frame1, 1, frame2, 2, frame3);
}
public function preloaderDone():void{
this.gotoAndStop(2);
}
public function continueGame(_arg1:MouseEvent):void{
stage.removeEventListener(MouseEvent.MOUSE_DOWN, continueGame);
clickToBeginBackGround.visible = false;
clickToContinue.visible = false;
stage.addEventListener(MouseEvent.MOUSE_DOWN, goToSponsor);
sponsorSplash.x = 343.5;
sponsorSplash.y = 216.5;
sponsorSplash.gotoAndPlay(2);
sponsorSplash.visible = true;
var _local2:Timer = new Timer(8300, 1);
_local2.addEventListener("timer", finishSponsorLogo);
_local2.start();
}
public function goToSponsor(_arg1:MouseEvent):void{
navigateToURL(new URLRequest("http://www.gameshed.com/?utm_source=sponsorship&utm_medium=branded_game&utm_term=humans_adb&utm_campaign=humans_adb_game"));
}
public function finishSponsorLogo(_arg1:TimerEvent):void{
sponsorSplash.visible = false;
stage.removeEventListener(MouseEvent.MOUSE_DOWN, goToSponsor);
stage.frameRate = 24;
this.gotoAndPlay(3);
}
public function linkDeveloper(_arg1:ContextMenuEvent):void{
navigateToURL(new URLRequest("http://www.lethegames.com"));
}
public function linkSponsor(_arg1:ContextMenuEvent):void{
navigateToURL(new URLRequest("http://www.gameshed.com/?utm_source=sponsorship&utm_medium=branded_game&utm_term=humans_adb&utm_campaign=humans_adb_game"));
}
public function fullScrHandler(_arg1:FullScreenEvent):void{
contextMenu = rightClickMenu;
if (stage.displayState == StageDisplayState.FULL_SCREEN){
} else {
escapeMenu.visible = true;
tutoBoxMainIntro.stop();
};
}
public function disableSounds(_arg1:MouseEvent):void{
if (escapeMenu.disableSounds.currentFrame == 1){
escapeMenu.disableSounds.gotoAndStop(2);
snd_FXVolume.volume = 0;
snd_DefensiveStanceVolume.volume = 0;
snd_DiceRoll.volume = 0;
snd_MonitorVolume.volume = 0;
} else {
if (escapeMenu.disableSounds.currentFrame == 2){
escapeMenu.disableSounds.gotoAndStop(1);
snd_FXVolume.volume = 1;
snd_DefensiveStanceVolume.volume = 0.4;
snd_DiceRoll.volume = 0.4;
snd_MonitorVolume.volume = 0.7;
};
};
if (chan_soundFX != null){
chan_soundFX.soundTransform = snd_FXVolume;
};
}
public function disableMusic(_arg1:MouseEvent):void{
if (escapeMenu.disableMusic.currentFrame == 1){
escapeMenu.disableMusic.gotoAndStop(2);
snd_MusicVolume.volume = 0;
} else {
if (escapeMenu.disableMusic.currentFrame == 2){
escapeMenu.disableMusic.gotoAndStop(1);
snd_MusicVolume.volume = 1;
};
};
if (chan_theme != null){
chan_theme.soundTransform = snd_MusicVolume;
};
}
public function changeRobotwalkSpeed(_arg1:MouseEvent):void{
trace("wtf");
if (escapeMenu.changeRobotSpeed.currentFrame == 1){
escapeMenu.changeRobotSpeed.gotoAndStop(2);
slideMoveSpeed = slideMoveSpeedFast;
} else {
escapeMenu.changeRobotSpeed.gotoAndStop(1);
slideMoveSpeed = slideMoveSpeedNormal;
};
}
public function gameInitialSetup():void{
enterMenuFrameFader.play();
theEnd.visible = false;
endGameFader.gotoAndStop(1);
endGameFader.visible = false;
skipMiniBoxIntro.visible = false;
skipMiniBoxIntro.buttonMode = true;
btn_chooseCivExpansion.deployRobotButton.buttonMode = true;
credits.buttonMode = true;
letheGames.buttonMode = true;
playMoreGames.buttonMode = true;
playMoreGamesText.buttonMode = true;
escapeMenu.playMoreGamesEsc.buttonMode = true;
escapeMenu.letheGamesEsc.buttonMode = true;
tutoBoxMainIntro.visible = false;
tutoBoxMainIntro.gotoAndStop(1);
precious.visible = false;
showEnemyStrength.visible = false;
showEnemyStrength.mouseEnabled = false;
castletooltip.visible = false;
credits.visible = true;
letheGames.visible = true;
tutoMiniBox4.visible = false;
tutoMiniBox5.visible = false;
tutoMiniBox7.visible = false;
tutoMiniBox72.visible = false;
tutoMiniBox8.visible = false;
tutoMiniBox82.visible = false;
tutoMiniBox9.visible = false;
tutoMiniBox10.visible = false;
tutoMiniBox11.visible = false;
tutoMiniBox4.mouseEnabled = false;
tutoMiniBox5.mouseEnabled = false;
tutoMiniBox7.mouseEnabled = false;
tutoMiniBox72.mouseEnabled = false;
tutoMiniBox8.mouseEnabled = false;
tutoMiniBox82.mouseEnabled = false;
tutoMiniBox9.mouseEnabled = false;
tutoMiniBox10.mouseEnabled = false;
tutoMiniBox11.mouseEnabled = false;
chan_soundFX = snd_gears.play(0, 10000, snd_FXVolume);
newGameFader.gotoAndStop(2);
newGameFader.visible = false;
btn_chooseCivExpansion.upgradeInvisTab.alpha = 0;
gears.visible = true;
combatEvidencer.visible = false;
combatEvidencer.mouseEnabled = false;
stage.frameRate = 24;
constructorModeMouse.visible = false;
Mouse.show();
stageWidthLimitBeacon.visible = false;
tooltipBox.alpha = 0.8;
buttonTooltip.alpha = 0.8;
statusBar.visible = false;
statusBar.gotoAndStop(1);
buttonTooltip.mouseEnabled = false;
buttonTooltip.visible = false;
producingResourceMessage.visible = false;
producingResourceMessage.gotoAndStop(1);
producingResourceMessage.alpha = 0.75;
tooltipBox.visible = false;
wallToolTip.visible = false;
wallToolTip.mouseEnabled = false;
wallToolTip.gotoAndStop(1);
castletooltip.mouseEnabled = false;
gathererTooltip.gotoAndStop(1);
gathererTooltip.mouseEnabled = false;
gathererTooltip.visible = false;
wallToolTipMsgBox.visible = false;
wallToolTipMsgBox.mouseEnabled = false;
wallToolTipMsgBox.wallToolTipMsg.mouseEnabled = false;
board.visible = false;
res1Get1.visible = false;
res1Get1.mouseEnabled = false;
res1Get2.visible = false;
res1Get2.mouseEnabled = false;
res1Get3.visible = false;
res1Get3.mouseEnabled = false;
res2Get1.visible = false;
res2Get1.mouseEnabled = false;
res2Get2.visible = false;
res2Get2.mouseEnabled = false;
res2Get3.visible = false;
res2Get3.mouseEnabled = false;
res3Get1.visible = false;
res3Get1.mouseEnabled = false;
res3Get2.visible = false;
res3Get2.mouseEnabled = false;
res3Get3.visible = false;
res3Get3.mouseEnabled = false;
res4Get1.visible = false;
res4Get1.mouseEnabled = false;
res4Get2.visible = false;
res4Get2.mouseEnabled = false;
res4Get3.visible = false;
res4Get3.mouseEnabled = false;
longWalkGUI.mouseEnabled = false;
longWalkGUI.longWalkInterfaceText.mouseEnabled = false;
longWalkGUI.moveTooltipInsideGraph.mouseEnabled = false;
longWalkGUI.alpha = 0.75;
longWalkGUI.longWalkInterfaceText.alpha = 0.9;
longWalkGUI.moveTooltipInsideGraph.alpha = 0.9;
researchGetTooltip.visible = false;
researchGetTooltip.mouseEnabled = false;
learnAsYouPlayToolTip.visible = false;
hideTutorialMiniBoxes();
learnAsYouPlayToolTip.gotoAndStop(1);
learnAsYouPlayToolTip.x = player2Beacon.x;
learnAsYouPlayToolTip.y = player2Beacon.y;
escapeMenu.visible = false;
btn_chooseCivExpansion.visible = false;
btn_chooseDiceRoll.visible = false;
dice1Graphic.visible = false;
dice2Graphic.visible = false;
warAdvisor.visible = false;
mindUpgradeDisplay.visible = false;
playerMovesLeftText.visible = false;
tokenRollChoice.visible = false;
play_2pw.buttonMode = true;
play_2pf.buttonMode = true;
play_4pf.buttonMode = true;
play_tuto.buttonMode = true;
btn_easy.buttonMode = true;
btn_norm.buttonMode = true;
btn_hard.buttonMode = true;
escapeMenu.resumeGame.buttonMode = true;
escapeMenu.exitGame.buttonMode = true;
escapeMenu.disableMusic.buttonMode = true;
escapeMenu.disableSounds.buttonMode = true;
escapeMenu.changeRobotSpeed.buttonMode = true;
btn_chooseCivExpansion.bnt_civExpandChoice3.buttonMode = true;
btn_chooseCivExpansion.bnt_civExpandChoice2.buttonMode = true;
btn_chooseCivExpansion.bnt_civExpandChoice6.buttonMode = true;
btn_chooseCivExpansion.bnt_civExpandChoice1.buttonMode = true;
btn_chooseCivExpansion.bnt_civExpandChoice4.buttonMode = true;
btn_chooseCivExpansion.bnt_civExpandChoice5.buttonMode = true;
btn_chooseDiceRoll.btn_dicechoice1.buttonMode = true;
btn_chooseDiceRoll.btn_dicechoice2.buttonMode = true;
btn_chooseDiceRoll.btn_dicechoice3.buttonMode = true;
btn_chooseDiceRoll.btn_dicechoice4.buttonMode = true;
btn_chooseDiceRoll.btn_dicechoice5.buttonMode = true;
btn_chooseDiceRoll.btn_dicechoice6.buttonMode = true;
btn_chooseDiceRoll.btn_dicechoice7.buttonMode = true;
btn_chooseDiceRoll.btn_dicechoice8.buttonMode = true;
btn_chooseDiceRoll.btn_dicechoice9.buttonMode = true;
btn_chooseDiceRoll.btn_dicechoice10.buttonMode = true;
btn_chooseDiceRoll.btn_dicechoice11.buttonMode = true;
btn_chooseDiceRoll.btn_dicechoice12.buttonMode = true;
player1GameBar.enableWallPlace.buttonMode = true;
player1GameBar.btn_raid.buttonMode = true;
player1GameBar.btn_menu.buttonMode = true;
player1GameBar.btnRotateLeft.buttonMode = true;
player1GameBar.inst_endturnbuton.buttonMode = true;
player1GameBar.btn_defensiveMode.buttonMode = true;
mindUpgradeDisplay.btn_closeUpgradeDisplay.buttonMode = true;
player1GameBar.visible = false;
player2GameBar.visible = false;
player3GameBar.visible = false;
player4GameBar.visible = false;
player1GameBar.gotoAndStop(1);
player2GameBar.gotoAndStop(1);
player3GameBar.gotoAndStop(1);
player4GameBar.gotoAndStop(1);
playerMovesLeftText.mouseEnabled = false;
constructorModeMouse.mouseEnabled = false;
tooltipBox.mouseEnabled = false;
tooltipBox.resource1Tooltip.mouseEnabled = false;
tooltipBox.resource2Tooltip.mouseEnabled = false;
tooltipBox.resource3Tooltip.mouseEnabled = false;
tooltipBox.resource4Tooltip.mouseEnabled = false;
tooltipBox.resource1TooltipText.mouseEnabled = false;
tooltipBox.resource2TooltipText.mouseEnabled = false;
tooltipBox.resource3TooltipText.mouseEnabled = false;
tooltipBox.resource4TooltipText.mouseEnabled = false;
tooltipBox.tooltipBoxText.mouseEnabled = false;
MovieClip(combatBar.getChildByName("dice1CombatGraphic")).gotoAndStop(1);
MovieClip(combatBar.getChildByName("dice2CombatGraphic")).gotoAndStop(1);
MovieClip(combatBar.getChildByName("dice3CombatGraphic")).gotoAndStop(1);
MovieClip(combatBar.getChildByName("dice4CombatGraphic")).gotoAndStop(1);
player1Beacon.visible = false;
player2Beacon.visible = false;
player3Beacon.visible = false;
player4Beacon.visible = false;
playerMode2Beacon.visible = false;
playerMode4Beacon.visible = false;
playerMode4BoardCenterBeacon.visible = false;
slideTutorialBeacon.visible = false;
combatBar.visible = false;
mindUpgradeDisplay.getChildByName("btn_closeUpgradeDisplay").alpha = 0;
}
public function keyPressCall(_arg1:KeyboardEvent):void{
switch (_arg1.keyCode){
case 27:
player1PlaceGathererMode = false;
player1PlaceWallMode = false;
constructorModeMouse.visible = false;
Mouse.show();
setChildIndex(escapeMenu, (numChildren - 1));
if (newGameFader.visible == false){
showEscMenu();
};
break;
case 32:
endPlayerTurnCall();
break;
};
}
public function showEscMenuCall(_arg1:MouseEvent):void{
player1PlaceGathererMode = false;
player1PlaceWallMode = false;
constructorModeMouse.visible = false;
Mouse.show();
stage.displayState = StageDisplayState.NORMAL;
escapeMenu.visible = true;
tutoBoxMainIntro.stop();
}
public function showEscMenu():void{
if (escapeMenu.visible == false){
if (play_2pw.visible == false){
escapeMenu.visible = true;
tutoBoxMainIntro.stop();
};
} else {
if (runningFullScreen == true){
stage.displayState = StageDisplayState.FULL_SCREEN;
};
escapeMenu.visible = false;
tutoBoxMainIntro.play();
};
}
public function keyReleaseCall(_arg1:KeyboardEvent):void{
switch (_arg1.keyCode){
case 87:
break;
};
}
public function mousePress(_arg1:MouseEvent):void{
}
public function mouseRelease(_arg1:MouseEvent):void{
}
public function mouseMoved(_arg1:MouseEvent):void{
setChildIndex(constructorModeMouse, (numChildren - 1));
constructorModeMouse.x = mouseX;
constructorModeMouse.y = mouseY;
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(buttonTooltip, (getChildIndex(escapeMenu) - 1));
buttonTooltip.x = (mouseX + 30);
buttonTooltip.y = (mouseY - 20);
tooltipBox.x = (mouseX + 80);
tooltipBox.y = (mouseY - 45);
}
public function playLearnAsYouPlay(_arg1:MouseEvent):void{
if (player1Race != "unassigned"){
learningWhilePlaying = true;
attackOnceForTutorial = true;
setDifficulty1Call();
player1Beacon.y = playerMode2Beacon.y;
player2Beacon.y = playerMode2Beacon.y;
board.gotoAndStop(1);
player1GameBar.gotoAndStop(1);
player1GameBar.textSymbolP1.gotoAndStop(1);
player1GameBar.inst_endturnbuton.gotoAndStop(1);
player1GameBar.btn_menu.gotoAndStop(1);
player1GameBar.enableWallPlace.gotoAndStop(1);
player1GameBar.btnRotateLeft.gotoAndStop(1);
player1GameBar.btn_defensiveMode.gotoAndStop(1);
player1GameBar.btn_raid.gotoAndStop(1);
player2GameBar.gotoAndStop(1);
player2GameBar.textSymbolP2.gotoAndStop(1);
player3GameBar.gotoAndStop(1);
player4GameBar.gotoAndStop(1);
numberOfPlayers = 2;
player1XSpacing = -20;
player1YSpacing = 55.25;
player2XSpacing = 324;
player2YSpacing = 55.25;
runningFullScreen = false;
if (!btn_easy_status){
if (btn_norm_status){
btn_norm_gfx.gotoAndPlay("_out");
btn_norm_status = 0;
};
if (btn_hard_status){
btn_hard_gfx.gotoAndPlay("_out");
btn_hard_status = 0;
};
btn_easy_gfx.gotoAndPlay("_on");
btn_easy_status = 1;
};
beginNewGame();
};
}
public function gameSettings2(_arg1:MouseEvent):void{
if (player1Race != "unassigned"){
player1Beacon.y = playerMode2Beacon.y;
player2Beacon.y = playerMode2Beacon.y;
attackOnceForTutorial = false;
board.gotoAndStop(1);
player1GameBar.gotoAndStop(1);
player1GameBar.textSymbolP1.gotoAndStop(1);
player1GameBar.inst_endturnbuton.gotoAndStop(1);
player1GameBar.btn_menu.gotoAndStop(1);
player1GameBar.enableWallPlace.gotoAndStop(1);
player1GameBar.btnRotateLeft.gotoAndStop(1);
player1GameBar.btn_defensiveMode.gotoAndStop(1);
player1GameBar.btn_raid.gotoAndStop(1);
player2GameBar.gotoAndStop(1);
player2GameBar.textSymbolP2.gotoAndStop(1);
player3GameBar.gotoAndStop(1);
player4GameBar.gotoAndStop(1);
numberOfPlayers = 2;
player1XSpacing = -20;
player1YSpacing = 55.25;
player2XSpacing = 324;
player2YSpacing = 55.25;
runningFullScreen = false;
beginNewGame();
};
}
public function gameSettingsFS2(_arg1:MouseEvent):void{
var _local2:Rectangle;
if (player1Race != "unassigned"){
stage.frameRate = 60;
player1Beacon.y = playerMode2Beacon.y;
player2Beacon.y = playerMode2Beacon.y;
attackOnceForTutorial = false;
board.gotoAndStop(1);
player1GameBar.gotoAndStop(1);
player1GameBar.textSymbolP1.gotoAndStop(1);
player1GameBar.inst_endturnbuton.gotoAndStop(1);
player1GameBar.btn_menu.gotoAndStop(1);
player1GameBar.enableWallPlace.gotoAndStop(1);
player1GameBar.btnRotateLeft.gotoAndStop(1);
player1GameBar.btn_defensiveMode.gotoAndStop(1);
player1GameBar.btn_raid.gotoAndStop(1);
player2GameBar.gotoAndStop(1);
player2GameBar.textSymbolP2.gotoAndStop(1);
player3GameBar.gotoAndStop(1);
player4GameBar.gotoAndStop(1);
numberOfPlayers = 2;
player1XSpacing = -20;
player1YSpacing = 55.25;
player2XSpacing = 324;
player2YSpacing = 55.25;
runningFullScreen = true;
_local2 = new Rectangle(0, 0, 684, 453);
stage.fullScreenSourceRect = _local2;
stage.displayState = StageDisplayState.FULL_SCREEN;
beginNewGame();
};
}
public function gameSettingsFS4(_arg1:MouseEvent):void{
var _local2:Rectangle;
if (player1Race != "unassigned"){
stage.frameRate = 60;
attackOnceForTutorial = false;
player1Beacon.y = playerMode4Beacon.y;
player2Beacon.y = playerMode4Beacon.y;
board.gotoAndStop(2);
player1GameBar.gotoAndStop(2);
player1GameBar.textSymbolP1.gotoAndStop(2);
player1GameBar.inst_endturnbuton.gotoAndStop(2);
player1GameBar.btn_menu.gotoAndStop(2);
player1GameBar.enableWallPlace.gotoAndStop(2);
player1GameBar.btnRotateLeft.gotoAndStop(2);
player1GameBar.btn_defensiveMode.gotoAndStop(2);
player1GameBar.btn_raid.gotoAndStop(2);
player2GameBar.gotoAndStop(2);
player2GameBar.textSymbolP2.gotoAndStop(2);
player3GameBar.gotoAndStop(1);
player4GameBar.gotoAndStop(1);
player1XSpacing = -20;
player1YSpacing = -15;
player2XSpacing = 324;
player2YSpacing = -15;
player3XSpacing = -20;
player3YSpacing = 365;
player4XSpacing = 324;
player4YSpacing = 365;
numberOfPlayers = 4;
runningFullScreen = true;
newGameFader.y = 150;
newGameFader.x = 0;
newGameFader.gotoAndStop(50);
newGameFader.visible = true;
_local2 = new Rectangle(-150, 0, 0x0400, 760);
stage.fullScreenSourceRect = _local2;
stage.displayState = StageDisplayState.FULL_SCREEN;
beginNewGame();
};
}
public function lockPickSound(_arg1:MouseEvent):void{
chan_soundFX = snd_evolution.play(0, 0, snd_FXVolume);
}
public function setDifficulty1(_arg1:MouseEvent):void{
setDifficulty1Call();
}
public function setDifficulty1Call():void{
whenReaversCome = 25;
reaverStr = 0;
exp3Resource1Cost = 6;
}
public function setDifficulty2DefaultCall():void{
whenReaversCome = 20;
reaverStr = 3;
exp3Resource1Cost = 6;
}
public function setDifficulty2(_arg1:MouseEvent):void{
setDifficulty2DefaultCall();
}
public function setDifficulty3(_arg1:MouseEvent):void{
whenReaversCome = 15;
reaverStr = 3;
exp3Resource1Cost = 10;
}
public function beginNewGame():void{
if (numberOfPlayers == 2){
if (runningFullScreen != true){
newGameFader.y = 0;
newGameFader.x = 0;
newGameFader.gotoAndStop(2);
newGameFader.visible = true;
newGameFader.play();
} else {
newGameFader.y = 0;
newGameFader.x = 0;
newGameFader.gotoAndStop(50);
newGameFader.visible = true;
};
};
TimerFadeAndStartNewgame.start();
}
public function beginNewGameAfterFade(_arg1:TimerEvent):void{
var _local6:uint;
var _local7:uint;
var _local8:uint;
var _local9:uint;
var _local10:uint;
MochiBot.track(this, "a37c03f3");
if (numberOfPlayers == 2){
if (runningFullScreen != true){
stage.frameRate = 60;
};
};
credits.visible = false;
letheGames.visible = false;
SoundMixer.stopAll();
chan_soundFX.stop();
gears.visible = false;
chan_theme.stop();
chan_theme = snd_theme.play(0, 999999, snd_MusicVolume);
learnAsYouPlayToolTip.x = player2Beacon.x;
learnAsYouPlayToolTip.y = player2Beacon.y;
if (numberOfPlayers == 4){
whenReaversComeTemp = (whenReaversCome * 2);
reaversMostWait = 50;
};
if (numberOfPlayers == 2){
whenReaversComeTemp = whenReaversCome;
reaversMostWait = 25;
};
trace(whenReaversComeTemp);
trace(reaversMostWait);
trace("du");
play_2pw.visible = false;
play_2pf.visible = false;
play_4pf.visible = false;
credits.visible = false;
playMoreGames.visible = false;
letheGames.visible = false;
btn_easy.visible = false;
btn_norm.visible = false;
btn_hard.visible = false;
board.visible = true;
player1GameBar.visible = true;
player2GameBar.visible = true;
player3GameBar.visible = true;
player4GameBar.visible = true;
statusBar.gotoAndStop(1);
learnAsYouPlayToolTip.gotoAndStop(1);
verticalGridCounter = ((landGridNumberVertical - 6) * 2);
attackerChosenTile = 0;
attackerCurrentTile = 0;
landTileResource1Placed = 0;
landTileResource2Placed = 0;
landTileResource3Placed = 0;
landTileResource4Placed = 0;
blockTilesPlaced = 0;
additionalBlockTilesPlaced = 0;
resourceRandomizer = 0;
currentTurn = 0;
startingTurnPlayer = 0;
p1starterBuildingPlaced = false;
p2starterBuildingPlaced = false;
p3starterBuildingPlaced = false;
p4starterBuildingPlaced = false;
p1StarterBuildingTile = 0;
p2StarterBuildingTile = 0;
p3StarterBuildingTile = 0;
p4StarterBuildingTile = 0;
starterBuildingTile = 0;
p1starterGathererPlaced = false;
p2starterGathererPlaced = false;
p3starterGathererPlaced = false;
p4starterGathererPlaced = false;
currentUnitPlayerMoves = 0;
allowPlayerToMoveUnit = false;
tileFilledRoll = false;
tileNumberRoll = 1;
tileBlankPlaced = 0;
topChoiceTileScore = 0;
besttopChoiceTileScore = 0;
plcModifier = 0;
plcCurrent = 0;
chosenResource = 0;
currentChosenGatherTile = 0;
player2ChosenGatherTile = 0;
player3ChosenGatherTile = 0;
player4ChosenGatherTile = 0;
skipBestTileCheck = false;
randomStarterBuildingTile = 0;
p1Resource1Qtt = 0;
p1Resource2Qtt = 0;
p1Resource3Qtt = 0;
p1Resource4Qtt = 0;
p1UnitQtt = 0;
p1WallQtt = 0;
p1GathererQtt = 0;
p2Resource1Qtt = 0;
p2Resource2Qtt = 0;
p2Resource3Qtt = 0;
p2Resource4Qtt = 0;
p2UnitQtt = 0;
p2WallQtt = 0;
p2GathererQtt = 0;
p3Resource1Qtt = 0;
p3Resource2Qtt = 0;
p3Resource3Qtt = 0;
p3Resource4Qtt = 0;
p3UnitQtt = 0;
p3WallQtt = 0;
p3GathererQtt = 0;
p4Resource1Qtt = 0;
p4Resource2Qtt = 0;
p4Resource3Qtt = 0;
p4Resource4Qtt = 0;
p4UnitQtt = 0;
p4WallQtt = 0;
p4GathererQtt = 0;
Resource1Qtt = 0;
Resource2Qtt = 0;
Resource3Qtt = 0;
Resource4Qtt = 0;
wallQtt = 0;
UnitQtt = 0;
dice1 = 0;
dice2 = 0;
diceCombined = 0;
rolledResource = 0;
p2ProtectResource = 0;
p3ProtectResource = 0;
p4ProtectResource = 0;
p2WallExpandCheckpoint = 0;
p3WallExpandCheckpoint = 0;
p4WallExpandCheckpoint = 0;
expandWallMaxRoll = 0;
expandPartyMaxRoll = 0;
endWallExpansion = false;
endPartyAssignments = false;
protectResourceCheck = 0;
resourceQttCheck = 0;
currentMovingParty = 0;
movingUnit = 0;
tileAttacked = 0;
attackerUnit = 0;
attackerKingdom = 0;
attackerDiceRoll = 0;
attackerDiceRoll1 = 0;
attackerDiceRoll2 = 0;
defenderDiceRoll = 0;
defenderDiceRoll1 = 0;
defenderDiceRoll2 = 0;
defenderAttackPower = 0;
additionalDefendersAttackPower = 0;
additionalDefendingAttackersAttackPower = 0;
playerAggro = 0;
exposedGatherer = false;
lastTileKingdom1 = 0;
firstTileKingdom3 = 0;
kingdom1ToKingdom3TileDifference = 0;
player1DiceRollChoice = 0;
player2DiceRollChoice = 0;
player3DiceRollChoice = 0;
player4DiceRollChoice = 0;
playerDiceRollChoice = 0;
blankTurnOver = false;
blankTurnsTaken = 0;
civExpandChoice = 0;
p2ResourceToExpand = 0;
p3ResourceToExpand = 0;
p4ResourceToExpand = 0;
timeToPlaceNewGatherer = false;
resourceToExpand = 0;
newGathererTobePlaced = 0;
p1Gatherers1 = 0;
p1Gatherers2 = 0;
p1Gatherers3 = 0;
p1Gatherers4 = 0;
p2Gatherers1 = 0;
p2Gatherers2 = 0;
p2Gatherers3 = 0;
p2Gatherers4 = 0;
p3Gatherers1 = 0;
p3Gatherers2 = 0;
p3Gatherers3 = 0;
p3Gatherers4 = 0;
p4Gatherers1 = 0;
p4Gatherers2 = 0;
p4Gatherers3 = 0;
p4Gatherers4 = 0;
chooseAnyResourceToGather = false;
gathererDistanceScore = 0;
minimumGathererDistanceScore = 0;
chosenMinimumGathererScore = 0;
unitWithMostMoves = 0;
player1NewGathererTile = 0;
exceptionCloseCheckWall = 0;
xmoveTextModifier = 0;
ymoveTextModifier = 0;
attackerRawRoll = 0;
defenderRawRoll = 0;
civChoiceMaxRoll = 0;
diceChoiceMaxroll = 0;
newMovingUnit = true;
reactivateGatherer = false;
p1UpgradePower = 0;
p2UpgradePower = 0;
p3UpgradePower = 0;
p4UpgradePower = 0;
p1UpgradeSpeed = 0;
p2UpgradeSpeed = 0;
p3UpgradeSpeed = 0;
p4UpgradeSpeed = 0;
p1UpgradeRoll = 0;
p2UpgradeRoll = 0;
p3UpgradeRoll = 0;
p4UpgradeRoll = 0;
p1UpgradeGatherer = 0;
p2UpgradeGatherer = 0;
p3UpgradeGatherer = 0;
p4UpgradeGatherer = 0;
mindUpgradeRandomChoice = 0;
dicesDisplayXMod = 0;
dicesDisplayYMod = 0;
npcBoughMindUpgrade = false;
slideToX = 0;
slideToY = 0;
slidingUnit = false;
wallLoopCheck = 0;
currentWall = 0;
wallToBePlaced = 0;
numberOfWallSteps = 0;
allPathsChecked = false;
exceptionFirstWall = 0;
exceptionLastWall = 0;
exceptionArrayTest = false;
exeptionArrayPosition = 0;
defensiveAttackedFromBehind = false;
bestPathNumber = 0;
player1UnderCombat = false;
player1Raiding = false;
player1PlacingGatherer = false;
player1ChoosingDiceRoll = false;
player1AlreadyChoseDiceRoll = false;
firstMoveRight = false;
firstMoveLeft = false;
firstMoveUp = false;
firstMoveDown = false;
player1PlaceGathererMode = false;
player1PlaceWallMode = false;
turnBeforeReavers = 0;
reaverTurnTaken = false;
reaversComingCount = 0;
longWalkSliding = false;
gameOver = false;
p2Extinct = false;
p3Extinct = false;
p4Extinct = false;
p2NoLongerPlaying = false;
p3NoLongerPlaying = false;
p4NoLongerPlaying = false;
reaversDontMove = false;
totalPlayerTurnsTaken = 0;
landTileArray.splice(0);
landTileArrayPlayer1.splice(0);
landTileArrayPlayer2.splice(0);
landTileArrayPlayer3.splice(0);
landTileArrayPlayer4.splice(0);
wallSlotArray.splice(0);
starterBuildingArray.splice(0);
starterBuildingTileChoicesArray.splice(0);
wallExpandChoicesArray.splice(0);
partyDefendChoicesArray.splice(0);
wallCheckPointArray.splice(0);
landCheckPointArray.splice(0);
landCheckPointBestPathArray.splice(0);
partyUnitArray1.splice(0);
partyUnitArray2.splice(0);
partyUnitArray3.splice(0);
partyUnitArray4.splice(0);
partyUnitArray.splice(0);
enemyPartyDetected.splice(0);
civChoicesArray.splice(0);
diceChoicesArray.splice(0);
gathererUnitArray.splice(0);
allGathererUnitArray.splice(0);
p1AvaliableMindUpgrades.splice(0);
p2AvaliableMindUpgrades.splice(0);
p3AvaliableMindUpgrades.splice(0);
p4AvaliableMindUpgrades.splice(0);
tilesToProtectPlayer2.splice(0);
tilesToProtectPlayer3.splice(0);
tilesToProtectPlayer4.splice(0);
tilesToProtect.splice(0);
reaverOriginPlayer1.splice(0);
reaverOriginPlayer2.splice(0);
reaverOriginPlayer3.splice(0);
reaverOriginPlayer4.splice(0);
var _local2:uint = 1;
while (_local2 < (numberOfMindEvolutions + 1)) {
p1AvaliableMindUpgrades.push(_local2);
p2AvaliableMindUpgrades.push(_local2);
p3AvaliableMindUpgrades.push(_local2);
p4AvaliableMindUpgrades.push(_local2);
_local2++;
};
p1UnitQtt = startingUnitQtt;
p1WallQtt = startingWallQtt;
p1GathererQtt = startingGathererQtt;
p2UnitQtt = startingUnitQtt;
p2WallQtt = startingWallQtt;
p2GathererQtt = startingGathererQtt;
p3UnitQtt = startingUnitQtt;
p3WallQtt = startingWallQtt;
p3GathererQtt = startingGathererQtt;
p4UnitQtt = startingUnitQtt;
p4WallQtt = startingWallQtt;
p4GathererQtt = startingGathererQtt;
updateGameBars();
if (numberOfPlayers == 4){
rightMostLimit = ((landGridNumberHorizontal * 2) - 1);
lowerMostLimit = ((landGridNumberVertical * 2) - 1);
} else {
rightMostLimit = ((landGridNumberHorizontal * 2) - 1);
lowerMostLimit = (landGridNumberVertical - 1);
};
var _local3:uint;
while (_local3 < numberOfPlayers) {
landTileResource1Placed = 0;
landTileResource2Placed = 0;
landTileResource3Placed = 0;
landTileResource4Placed = 0;
blockTilesPlaced = 0;
additionalBlockTilesPlaced = 0;
if (_local3 == 0){
currentPlayerXSpacing = player1XSpacing;
currentPlayerYSpacing = player1YSpacing;
} else {
if (_local3 == 1){
currentPlayerXSpacing = player2XSpacing;
currentPlayerYSpacing = player2YSpacing;
} else {
if (_local3 == 2){
currentPlayerXSpacing = player3XSpacing;
currentPlayerYSpacing = player3YSpacing;
} else {
if (_local3 == 3){
currentPlayerXSpacing = player4XSpacing;
currentPlayerYSpacing = player4YSpacing;
};
};
};
};
tileXSpacingCounter = (tileXSpacing + currentPlayerXSpacing);
tileYSpacingCounter = (tileYSpacing + currentPlayerYSpacing);
_local6 = 0;
while (_local6 < landGridNumberHorizontal) {
if ((((_local6 == 0)) && ((_local3 == 0)))){
_local8 = 0;
while (_local8 < 20) {
wallSlot = new wallSlotLIB();
wallSlot.visible = false;
wallSlotArray.push(wallSlot);
wallSlot.myArrayNumber = (wallSlotArray.length - 1);
landTile = new landTileLIB();
landTile.visible = false;
landTileArray.push(landTile);
landTile.myArrayNumber = (landTileArray.length - 1);
_local8++;
};
};
landTile = new landTileLIB();
landTile.x = tileXSpacingCounter;
landTile.y = tileYSpacingCounter;
if ((((_local3 == 0)) || ((_local3 == 2)))){
landTile.tileColumn = _local6;
} else {
landTile.tileColumn = (_local6 + landGridNumberHorizontal);
};
if ((((_local3 == 0)) || ((_local3 == 1)))){
landTile.tileRow = 0;
} else {
landTile.tileRow = landGridNumberVertical;
};
landTile.gotoAndStop(5);
landTile.noMansLand = true;
landTile.addEventListener(MouseEvent.MOUSE_DOWN, traceTile);
landTile.addEventListener(MouseEvent.MOUSE_OVER, longWalkInterfaceTile);
landTile.addEventListener(MouseEvent.MOUSE_OUT, longWalkInterfaceHide);
landTileArray.push(landTile);
landTile.myArrayNumber = (landTileArray.length - 1);
addChildAt(landTile, (getChildIndex(newGameFader) - 1));
if (_local3 == 0){
landTileArrayPlayer1.push(landTile);
landTile.player = 1;
};
if (_local3 == 1){
landTileArrayPlayer2.push(landTile);
landTile.player = 2;
};
if (_local3 == 2){
landTileArrayPlayer3.push(landTile);
landTile.player = 3;
};
if (_local3 == 3){
landTileArrayPlayer4.push(landTile);
landTile.player = 4;
};
if ((((_local6 == 0)) && ((_local3 == 2)))){
firstTileKingdom3 = landTile.myArrayNumber;
kingdom1ToKingdom3TileDifference = (firstTileKingdom3 - lastTileKingdom1);
};
wallSlot = new wallSlotLIB();
wallSlot.x = landTile.x;
wallSlot.y = (leadSlotSpacing + landTile.y);
wallSlot.rotation = 90;
wallSlot.topCorner = true;
wallSlot.outerWall = true;
if (_local6 == 0){
wallSlot.leftEdge = true;
};
if (_local6 == (landGridNumberHorizontal - 1)){
wallSlot.rightEdge = true;
};
wallSlotArray.push(wallSlot);
wallSlot.addEventListener(MouseEvent.MOUSE_DOWN, traceWallSlot);
wallSlot.addEventListener(MouseEvent.MOUSE_OVER, wallTooltipDisplay);
wallSlot.addEventListener(MouseEvent.MOUSE_OUT, hideWallTooltipDisplay);
wallSlot.alpha = 0;
wallSlot.myArrayNumber = (wallSlotArray.length - 1);
landTile.upWall = wallSlot.myArrayNumber;
if (_local3 == 0){
wallSlot.allowPlayerBuild = true;
};
wallSlot.visible = false;
addChildAt(wallSlot, (getChildIndex(newGameFader) - 1));
wallSlot = new wallSlotLIB();
wallSlot.x = (slotLeftSpacing + landTile.x);
wallSlot.y = landTile.y;
wallSlot.rotation = 0;
if (_local6 == 0){
wallSlot.leftCorner = true;
wallSlot.outerWall = true;
};
wallSlot.topEdge = true;
wallSlotArray.push(wallSlot);
wallSlot.addEventListener(MouseEvent.MOUSE_DOWN, traceWallSlot);
wallSlot.addEventListener(MouseEvent.MOUSE_OVER, wallTooltipDisplay);
wallSlot.addEventListener(MouseEvent.MOUSE_OUT, hideWallTooltipDisplay);
wallSlot.alpha = 0;
wallSlot.myArrayNumber = (wallSlotArray.length - 1);
if (_local3 == 0){
wallSlot.allowPlayerBuild = true;
};
wallSlot.visible = false;
landTile.leftWall = wallSlot.myArrayNumber;
if (_local6 > 0){
landTileArray[((landTile.myArrayNumber - 6) - (verticalGridCounter / 2))].rightWall = wallSlot.myArrayNumber;
};
addChildAt(wallSlot, (getChildIndex(newGameFader) - 1));
wallSlot = new wallSlotLIB();
wallSlot.x = landTile.x;
wallSlot.y = (slotBottomSpacing + landTile.y);
wallSlot.rotation = 90;
if (_local6 == 0){
wallSlot.leftEdge = true;
};
if (_local6 == (landGridNumberHorizontal - 1)){
wallSlot.rightEdge = true;
};
wallSlotArray.push(wallSlot);
wallSlot.addEventListener(MouseEvent.MOUSE_DOWN, traceWallSlot);
wallSlot.addEventListener(MouseEvent.MOUSE_OVER, wallTooltipDisplay);
wallSlot.addEventListener(MouseEvent.MOUSE_OUT, hideWallTooltipDisplay);
wallSlot.alpha = 0;
wallSlot.myArrayNumber = (wallSlotArray.length - 1);
if (_local3 == 0){
wallSlot.allowPlayerBuild = true;
};
landTile.bottomWall = wallSlot.myArrayNumber;
if ((((_local6 == 0)) || ((_local6 == (landGridNumberHorizontal - 1))))){
wallSlot.visible = false;
};
addChildAt(wallSlot, (getChildIndex(newGameFader) - 1));
landTile.party1 = 0;
landTile.party2 = 0;
landTile.party3 = 0;
landTile.party4 = 0;
landTile.party5 = 0;
_local7 = 0;
while (_local7 < (landGridNumberVertical - 1)) {
landTile = new landTileLIB();
tileYSpacingCounter = (tileYSpacingCounter + tileYSpacing);
landTile.x = tileXSpacingCounter;
landTile.y = tileYSpacingCounter;
landTile.addEventListener(MouseEvent.MOUSE_DOWN, traceTile);
landTile.addEventListener(MouseEvent.MOUSE_OVER, longWalkInterfaceTile);
landTile.addEventListener(MouseEvent.MOUSE_OUT, longWalkInterfaceHide);
wallSlot.alpha = 0;
landTile.party1 = 0;
landTile.party2 = 0;
landTile.party3 = 0;
landTile.party4 = 0;
landTile.party5 = 0;
if ((((_local3 == 0)) || ((_local3 == 2)))){
landTile.tileColumn = _local6;
} else {
landTile.tileColumn = (_local6 + landGridNumberHorizontal);
};
if ((((_local3 == 0)) || ((_local3 == 1)))){
landTile.tileRow = (_local7 + 1);
} else {
landTile.tileRow = ((_local7 + landGridNumberVertical) + 1);
};
landTileArray.push(landTile);
landTile.myArrayNumber = (landTileArray.length - 1);
addChildAt(landTile, (getChildIndex(newGameFader) - 1));
if (_local3 == 0){
landTileArrayPlayer1.push(landTile);
landTile.player = 1;
};
if (_local3 == 1){
landTileArrayPlayer2.push(landTile);
landTile.player = 2;
};
if (_local3 == 2){
landTileArrayPlayer3.push(landTile);
landTile.player = 3;
};
if (_local3 == 3){
landTileArrayPlayer4.push(landTile);
landTile.player = 4;
};
wallSlot = new wallSlotLIB();
wallSlot.x = (slotLeftSpacing + landTile.x);
wallSlot.y = landTile.y;
wallSlot.rotation = 0;
if (_local6 == 0){
wallSlot.leftCorner = true;
wallSlot.outerWall = true;
landTile.gotoAndStop(5);
landTile.noMansLand = true;
};
if (_local7 == (landGridNumberVertical - 2)){
wallSlot.bottomEdge = true;
};
wallSlotArray.push(wallSlot);
wallSlot.addEventListener(MouseEvent.MOUSE_DOWN, traceWallSlot);
wallSlot.addEventListener(MouseEvent.MOUSE_OVER, wallTooltipDisplay);
wallSlot.addEventListener(MouseEvent.MOUSE_OUT, hideWallTooltipDisplay);
wallSlot.alpha = 0;
wallSlot.myArrayNumber = (wallSlotArray.length - 1);
if (_local3 == 0){
wallSlot.allowPlayerBuild = true;
};
landTile.leftWall = wallSlot.myArrayNumber;
if (_local6 > 0){
landTileArray[((landTile.myArrayNumber - 6) - (verticalGridCounter / 2))].rightWall = wallSlot.myArrayNumber;
};
if ((((_local6 == 0)) || ((_local7 == (landGridNumberVertical - 2))))){
wallSlot.visible = false;
landTile.gotoAndStop(5);
landTile.noMansLand = true;
};
addChildAt(wallSlot, (getChildIndex(newGameFader) - 1));
wallSlot = new wallSlotLIB();
wallSlot.x = landTile.x;
wallSlot.y = (slotBottomSpacing + landTile.y);
wallSlot.rotation = 90;
if (_local7 == (landGridNumberVertical - 2)){
wallSlot.bottomCorner = true;
wallSlot.outerWall = true;
};
if (_local6 == 0){
wallSlot.leftEdge = true;
};
if (_local6 == (landGridNumberHorizontal - 1)){
wallSlot.rightEdge = true;
};
wallSlotArray.push(wallSlot);
wallSlot.addEventListener(MouseEvent.MOUSE_DOWN, traceWallSlot);
wallSlot.addEventListener(MouseEvent.MOUSE_OVER, wallTooltipDisplay);
wallSlot.addEventListener(MouseEvent.MOUSE_OUT, hideWallTooltipDisplay);
if (_local3 == 0){
wallSlot.allowPlayerBuild = true;
};
wallSlot.alpha = 0;
wallSlot.myArrayNumber = (wallSlotArray.length - 1);
landTile.bottomWall = wallSlot.myArrayNumber;
landTile.upWall = landTileArray[(landTile.myArrayNumber - 1)].bottomWall;
if ((((((_local6 == 0)) || ((_local6 == (landGridNumberHorizontal - 1))))) || ((_local7 == (landGridNumberVertical - 2))))){
wallSlot.visible = false;
landTile.gotoAndStop(5);
landTile.noMansLand = true;
};
if ((((((_local7 == (landGridNumberVertical - 2))) && ((_local3 == 0)))) && ((_local6 == 0)))){
lastTileKingdom1 = landTile.myArrayNumber;
};
if (landTile.noMansLand != true){
resourceRandomizer = Math.random();
if ((((((((resourceRandomizer >= 0.4)) && ((Math.random() > 0.2)))) || ((tileFilledRoll == true)))) && ((tileBlankPlaced < (tilesPerPlaceable - 1))))){
landTile.gotoAndStop(7);
landTile.blankTile = true;
tileBlankPlaced = (tileBlankPlaced + 1);
if (tileNumberRoll < tilesPerPlaceable){
tileNumberRoll = (tileNumberRoll + 1);
} else {
tileBlankPlaced = 0;
tileFilledRoll = false;
tileNumberRoll = 1;
};
} else {
if ((((resourceRandomizer >= 0.4)) && ((tileFilledRoll == false)))){
if (landTileResource1Placed < quantityResources){
landTile.gotoAndStop(1);
landTileResource1Placed = (landTileResource1Placed + 1);
landTile.resource = 1;
} else {
if (landTileResource2Placed < quantityResources){
landTile.gotoAndStop(2);
landTileResource2Placed = (landTileResource2Placed + 1);
landTile.resource = 2;
} else {
if ((((((blockTilesPlaced < quantityBlockedTiles)) && (!((landTileArray[(landTile.myArrayNumber + ((-6 - (verticalGridCounter / 2)) * 2))].blockTile == true))))) && (!((landTileArray[(landTile.myArrayNumber - 2)].blockTile == true))))){
landTile.gotoAndStop(7);
blockTilesPlaced = (blockTilesPlaced + 1);
} else {
if (landTileResource3Placed < quantityResources){
landTile.gotoAndStop(3);
landTileResource3Placed = (landTileResource3Placed + 1);
landTile.resource = 3;
} else {
if (landTileResource4Placed < quantityResources){
landTile.gotoAndStop(4);
landTileResource4Placed = (landTileResource4Placed + 1);
landTile.resource = 4;
} else {
landTile.gotoAndStop(7);
};
};
};
};
};
if (tileNumberRoll < tilesPerPlaceable){
tileFilledRoll = true;
tileNumberRoll = (tileNumberRoll + 1);
} else {
tileBlankPlaced = 0;
tileFilledRoll = false;
tileNumberRoll = 1;
};
} else {
if ((((resourceRandomizer >= 0.3)) && ((tileFilledRoll == false)))){
if (landTileResource2Placed < quantityResources){
landTile.gotoAndStop(2);
landTileResource2Placed = (landTileResource2Placed + 1);
landTile.resource = 2;
} else {
if (landTileResource4Placed < quantityResources){
landTile.gotoAndStop(4);
landTileResource4Placed = (landTileResource4Placed + 1);
landTile.resource = 4;
} else {
if (landTileResource3Placed < quantityResources){
landTile.gotoAndStop(3);
landTileResource3Placed = (landTileResource3Placed + 1);
landTile.resource = 3;
} else {
if ((((((blockTilesPlaced < quantityBlockedTiles)) && (!((landTileArray[(landTile.myArrayNumber + ((-6 - (verticalGridCounter / 2)) * 2))].blockTile == true))))) && (!((landTileArray[(landTile.myArrayNumber - 2)].blockTile == true))))){
landTile.gotoAndStop(7);
blockTilesPlaced = (blockTilesPlaced + 1);
} else {
if (landTileResource1Placed < quantityResources){
landTile.gotoAndStop(1);
landTileResource1Placed = (landTileResource1Placed + 1);
landTile.resource = 1;
} else {
landTile.gotoAndStop(7);
};
};
};
};
};
if (tileNumberRoll < tilesPerPlaceable){
tileFilledRoll = true;
tileNumberRoll = (tileNumberRoll + 1);
} else {
tileBlankPlaced = 0;
tileFilledRoll = false;
tileNumberRoll = 1;
};
} else {
if ((((resourceRandomizer >= 0.2)) && ((tileFilledRoll == false)))){
if (landTileResource3Placed < quantityResources){
landTile.gotoAndStop(3);
landTileResource3Placed = (landTileResource3Placed + 1);
landTile.resource = 3;
} else {
if (landTileResource2Placed < quantityResources){
landTile.gotoAndStop(2);
landTileResource2Placed = (landTileResource2Placed + 1);
landTile.resource = 2;
} else {
if (landTileResource1Placed < quantityResources){
landTile.gotoAndStop(1);
landTileResource1Placed = (landTileResource1Placed + 1);
landTile.resource = 1;
} else {
if ((((((blockTilesPlaced < quantityBlockedTiles)) && (!((landTileArray[(landTile.myArrayNumber + ((-6 - (verticalGridCounter / 2)) * 2))].blockTile == true))))) && (!((landTileArray[(landTile.myArrayNumber - 2)].blockTile == true))))){
landTile.gotoAndStop(7);
blockTilesPlaced = (blockTilesPlaced + 1);
} else {
if (landTileResource4Placed < quantityResources){
landTile.gotoAndStop(4);
landTileResource4Placed = (landTileResource4Placed + 1);
landTile.resource = 4;
} else {
landTile.gotoAndStop(7);
};
};
};
};
};
if (tileNumberRoll < tilesPerPlaceable){
tileFilledRoll = true;
tileNumberRoll = (tileNumberRoll + 1);
} else {
tileBlankPlaced = 0;
tileFilledRoll = false;
tileNumberRoll = 1;
};
} else {
if ((((resourceRandomizer >= 0)) && ((tileFilledRoll == false)))){
if (landTileResource4Placed < quantityResources){
landTile.gotoAndStop(4);
landTileResource4Placed = (landTileResource4Placed + 1);
landTile.resource = 4;
} else {
if ((((((blockTilesPlaced < quantityBlockedTiles)) && (!((landTileArray[(landTile.myArrayNumber + ((-6 - (verticalGridCounter / 2)) * 2))].blockTile == true))))) && (!((landTileArray[(landTile.myArrayNumber - 2)].blockTile == true))))){
landTile.gotoAndStop(7);
blockTilesPlaced = (blockTilesPlaced + 1);
} else {
if (landTileResource1Placed < quantityResources){
landTile.gotoAndStop(1);
landTileResource1Placed = (landTileResource1Placed + 1);
landTile.resource = 1;
} else {
if (landTileResource3Placed < quantityResources){
landTile.gotoAndStop(3);
landTileResource3Placed = (landTileResource3Placed + 1);
landTile.resource = 3;
} else {
if (landTileResource2Placed < quantityResources){
landTile.gotoAndStop(2);
landTileResource2Placed = (landTileResource2Placed + 1);
landTile.resource = 2;
} else {
landTile.gotoAndStop(7);
};
};
};
};
};
if (tileNumberRoll < tilesPerPlaceable){
tileFilledRoll = true;
tileNumberRoll = (tileNumberRoll + 1);
} else {
tileBlankPlaced = 0;
tileFilledRoll = false;
tileNumberRoll = 1;
};
};
};
};
};
};
if ((((((((((landTile.blankTile == true)) && (!((landTileArray[(landTile.myArrayNumber + ((-6 - (verticalGridCounter / 2)) * 2))].blockTile == true))))) && (!((landTileArray[(landTile.myArrayNumber - 2)].blockTile == true))))) && (((((!((landTileArray[(landTile.myArrayNumber - 3)].blockTile == true))) || (!((landTileArray[(((landTile.myArrayNumber - 2) - 6) - (verticalGridCounter / 2))].blockTile == true))))) || (!((landTileArray[(((landTile.myArrayNumber - 1) - 6) - (verticalGridCounter / 2))].blockTile == true))))))) && (((((!((landTileArray[((landTile.myArrayNumber - 1) - ((6 + (verticalGridCounter / 2)) * 2))].blockTile == true))) || (!((landTileArray[(((landTile.myArrayNumber + 2) - 6) - (verticalGridCounter / 2))].blockTile == true))))) || (!((landTileArray[(((landTile.myArrayNumber - 1) - 6) - (verticalGridCounter / 2))].blockTile == true))))))){
if ((((((((landTileArray[(landTile.myArrayNumber - 1)].blankTile == true)) || ((landTileArray[(landTile.myArrayNumber - 1)].noMansLand == true)))) || ((landTileArray[(landTile.myArrayNumber - 1)].blockTile == true)))) || (((((!((landTileArray[(landTile.myArrayNumber - 1)].blankTile == true))) && (!((landTileArray[(landTile.myArrayNumber - 2)].noMansLand == true))))) && ((landTileArray[(landTile.myArrayNumber - 1)].tileRow == (landTileArray[(landTile.myArrayNumber - 2)].tileRow - 1))))))){
if (Math.random() >= additionalBlockTileChance){
if (additionalBlockTilesPlaced < quantityAdditionalBlockedTiles){
landTile.gotoAndStop(6);
landTile.blockTile = true;
additionalBlockTilesPlaced = (additionalBlockTilesPlaced + 1);
};
};
};
};
};
addChildAt(wallSlot, (getChildIndex(newGameFader) - 1));
_local7++;
};
tileXSpacingCounter = (tileXSpacingCounter + tileXSpacing);
tileYSpacingCounter = (tileYSpacing + currentPlayerYSpacing);
if ((((_local7 == (landGridNumberVertical - 1))) && ((_local6 == (landGridNumberHorizontal - 1))))){
_local9 = 0;
while (_local9 < landGridNumberVertical) {
if (_local9 == 0){
wallSlot = new wallSlotLIB();
wallSlot.visible = false;
wallSlotArray.push(wallSlot);
wallSlot.myArrayNumber = (wallSlotArray.length - 1);
};
wallSlot = new wallSlotLIB();
wallSlot.x = (endingleadSlotSpacing + landTile.x);
wallSlot.y = tileYSpacingCounter;
tileYSpacingCounter = (tileYSpacingCounter + tileYSpacing);
wallSlot.rotation = 0;
wallSlot.rightCorner = true;
wallSlot.outerWall = true;
if (_local9 == 0){
wallSlot.topEdge = true;
};
if (_local9 == (landGridNumberVertical - 1)){
wallSlot.bottomEdge = true;
};
wallSlotArray.push(wallSlot);
wallSlot.addEventListener(MouseEvent.MOUSE_DOWN, traceWallSlot);
wallSlot.addEventListener(MouseEvent.MOUSE_OVER, wallTooltipDisplay);
wallSlot.addEventListener(MouseEvent.MOUSE_OUT, hideWallTooltipDisplay);
wallSlot.alpha = 0;
wallSlot.myArrayNumber = (wallSlotArray.length - 1);
landTileArray[(((landTile.myArrayNumber - landGridNumberVertical) + 1) + _local9)].rightWall = wallSlot.myArrayNumber;
if (_local6 == (landGridNumberHorizontal - 1)){
wallSlot.visible = false;
};
addChildAt(wallSlot, (getChildIndex(newGameFader) - 1));
wallSlot = new wallSlotLIB();
wallSlot.visible = false;
wallSlotArray.push(wallSlot);
wallSlot.myArrayNumber = (wallSlotArray.length - 1);
if ((((_local9 == (landGridNumberVertical - 1))) && ((_local3 == (numberOfPlayers - 1))))){
_local10 = 0;
while (_local10 < 20) {
wallSlot = new wallSlotLIB();
wallSlot.visible = false;
wallSlotArray.push(wallSlot);
wallSlot.myArrayNumber = (wallSlotArray.length - 1);
landTile = new landTileLIB();
landTile.visible = false;
landTileArray.push(landTile);
landTile.myArrayNumber = (landTileArray.length - 1);
_local10++;
};
};
_local9++;
};
};
_local6++;
};
_local3++;
};
var _local4:uint;
while (_local4 < (landTileArray.length - 1)) {
if (((((((((!((landTileArray[_local4].resource == 1))) && (!((landTileArray[_local4].resource == 2))))) && (!((landTileArray[_local4].resource == 3))))) && (!((landTileArray[_local4].resource == 4))))) && (!((landTileArray[_local4].blockTile == true))))){
landTileArray[_local4].alpha = 0;
};
if (landTileArray[_local4].noMansLand == true){
if ((((((((landTileArray[(_local4 - 1)].resource == 1)) || ((landTileArray[(_local4 - 1)].resource == 2)))) || ((landTileArray[(_local4 - 1)].resource == 3)))) || ((((((((landTileArray[(_local4 - 1)].resource == 4)) && (!((landTileArray[(_local4 - 1)].blockTile == true))))) && ((landTileArray[(_local4 - 2)].blockTile == true)))) && ((landTileArray[(_local4 - 1)].tileRow == (landTileArray[(_local4 - 2)].tileRow - 1))))))){
landTileArray[(_local4 - 2)].blankTile = true;
landTileArray[(_local4 - 2)].blockTile = false;
landTileArray[(_local4 - 2)].alpha = 0;
landTileArray[(_local4 - 2)].gotoAndStop(7);
};
if ((((((((((landTileArray[_local4].noMansLand == true)) && ((landTileArray[_local4].party1 == 0)))) && ((landTileArray[_local4].party2 == 0)))) && ((landTileArray[_local4].party3 == 0)))) && ((landTileArray[_local4].party4 == 0)))){
if ((((landTileArray[_local4].player == 1)) && ((((landTileArray[_local4].tileRow == 0)) || ((landTileArray[_local4].tileColumn == 0)))))){
reaverOriginPlayer1.push(landTileArray[_local4].myArrayNumber);
} else {
if ((((landTileArray[_local4].player == 2)) && ((((landTileArray[_local4].tileRow == 0)) || ((landTileArray[_local4].tileColumn == rightMostLimit)))))){
reaverOriginPlayer2.push(landTileArray[_local4].myArrayNumber);
} else {
if ((((landTileArray[_local4].player == 3)) && ((((landTileArray[_local4].tileRow == lowerMostLimit)) || ((landTileArray[_local4].tileColumn == 0)))))){
reaverOriginPlayer3.push(landTileArray[_local4].myArrayNumber);
} else {
if ((((landTileArray[_local4].player == 4)) && ((((landTileArray[_local4].tileRow == lowerMostLimit)) || ((landTileArray[_local4].tileColumn == rightMostLimit)))))){
reaverOriginPlayer4.push(landTileArray[_local4].myArrayNumber);
};
};
};
};
};
};
_local4++;
};
var _local5:uint;
while (_local5 < (landTileArray.length - 1)) {
if (landTileArray[_local5].blockTile == true){
wallSlotArray[landTileArray[_local5].upWall].visible = false;
wallSlotArray[landTileArray[_local5].leftWall].visible = false;
wallSlotArray[landTileArray[_local5].rightWall].visible = false;
wallSlotArray[landTileArray[_local5].bottomWall].visible = false;
if ((((((((landTileArray[_local5].currentFrame == 6)) && ((landTileArray[(_local5 + 1)].blockTile == true)))) && ((landTileArray[((_local5 + 6) + (verticalGridCounter / 2))].blockTile == true)))) && ((landTileArray[((_local5 + 1) + (6 + (verticalGridCounter / 2)))].blockTile == true)))){
landTileArray[_local5].gotoAndStop(13);
landTileArray[(_local5 + 1)].gotoAndStop(17);
landTileArray[((_local5 + 6) + (verticalGridCounter / 2))].gotoAndStop(9);
landTileArray[((_local5 + 1) + (6 + (verticalGridCounter / 2)))].gotoAndStop(16);
};
if ((((((landTileArray[_local5].currentFrame == 6)) && ((landTileArray[((_local5 + 6) + (verticalGridCounter / 2))].blockTile == true)))) && ((landTileArray[(_local5 + 1)].blockTile == true)))){
landTileArray[_local5].gotoAndStop(13);
};
if ((((((landTileArray[_local5].currentFrame == 6)) && ((landTileArray[((_local5 + 6) + (verticalGridCounter / 2))].blockTile == true)))) && ((landTileArray[(_local5 - 1)].blockTile == true)))){
landTileArray[_local5].gotoAndStop(17);
};
if ((((((landTileArray[_local5].currentFrame == 6)) && ((landTileArray[((_local5 - 6) - (verticalGridCounter / 2))].blockTile == true)))) && ((landTileArray[(_local5 + 1)].blockTile == true)))){
landTileArray[_local5].gotoAndStop(9);
};
if ((((((landTileArray[_local5].currentFrame == 6)) && ((landTileArray[((_local5 - 6) - (verticalGridCounter / 2))].blockTile == true)))) && ((landTileArray[(_local5 - 1)].blockTile == true)))){
landTileArray[_local5].gotoAndStop(16);
};
if ((((((landTileArray[_local5].currentFrame == 6)) && ((landTileArray[((_local5 + 6) + (verticalGridCounter / 2))].blockTile == true)))) && (!((landTileArray[((_local5 - 6) - (verticalGridCounter / 2))].blockTile == true))))){
landTileArray[_local5].gotoAndStop(12);
};
if ((((((landTileArray[_local5].currentFrame == 6)) && ((landTileArray[((_local5 + 6) + (verticalGridCounter / 2))].blockTile == true)))) && ((landTileArray[((_local5 - 6) - (verticalGridCounter / 2))].blockTile == true)))){
landTileArray[_local5].gotoAndStop(10);
};
if ((((((landTileArray[_local5].currentFrame == 6)) && (!((landTileArray[((_local5 + 6) + (verticalGridCounter / 2))].blockTile == true))))) && ((landTileArray[((_local5 - 6) - (verticalGridCounter / 2))].blockTile == true)))){
landTileArray[_local5].gotoAndStop(8);
};
if ((((((landTileArray[_local5].currentFrame == 6)) && ((landTileArray[(_local5 + 1)].blockTile == true)))) && (!((landTileArray[(_local5 - 1)].blockTile == true))))){
landTileArray[_local5].gotoAndStop(11);
};
if ((((((landTileArray[_local5].currentFrame == 6)) && ((landTileArray[(_local5 + 1)].blockTile == true)))) && ((landTileArray[(_local5 - 1)].blockTile == true)))){
landTileArray[_local5].gotoAndStop(15);
};
if ((((((landTileArray[_local5].currentFrame == 6)) && (!((landTileArray[(_local5 + 1)].blockTile == true))))) && ((landTileArray[(_local5 - 1)].blockTile == true)))){
landTileArray[_local5].gotoAndStop(14);
};
wallSlotArray[landTileArray[_local5].upWall].alpha = 1;
if ((((wallSlotArray[((landTileArray[_local5].upWall - 13) - verticalGridCounter)].alpha == 1)) && ((wallSlotArray[((landTileArray[_local5].bottomWall - 13) - verticalGridCounter)].alpha == 1)))){
wallSlotArray[landTileArray[_local5].leftWall].alpha = 0;
} else {
wallSlotArray[landTileArray[_local5].leftWall].alpha = 1;
};
wallSlotArray[landTileArray[_local5].bottomWall].alpha = 1;
};
_local5++;
};
statusBar.x = landTileArray[20].x;
statusBar.y = (landTileArray[20].y - 10);
newGameFader.gotoAndPlay((newGameFader.currentFrame + 1));
persona();
}
public function persona():void{
var _local1:uint;
var _local2:Array = new Array();
if (player1Race != "keeper"){
_local2.push("keeper");
};
if (player1Race != "builder"){
_local2.push("builder");
};
if (player1Race != "expander"){
_local2.push("expander");
};
if (player1Race != "raider"){
_local2.push("raider");
};
var _local3:uint = 1;
while (_local3 < 4) {
_local1 = (_local2.length - 1);
_local1 = int(((_local1 * Math.random()) + 0.4));
if (_local1 > (_local2.length - 1)){
_local1 = (_local2.length - 1);
};
if (_local3 == 1){
player2Race = _local2[_local1];
} else {
if (_local3 == 2){
player3Race = _local2[_local1];
} else {
if (_local3 == 3){
player4Race = _local2[_local1];
};
};
};
_local2.splice(_local2.indexOf(_local2[_local1]), 1);
_local3++;
};
_local2.splice(0);
player2Aggro = 2;
player3Aggro = 2;
player4Aggro = 2;
if (player1Race == "keeper"){
player1GameBar.p1ShowCivExpansions.gotoAndStop(1);
p1LedOn = 3;
p1GathererQtt = (p1GathererQtt + KeeperAdditionalGatherer);
} else {
if (player1Race == "builder"){
player1GameBar.p1ShowCivExpansions.gotoAndStop(2);
p1LedOn = 6;
p1WallQtt = (p1WallQtt + BuilderExtraWalls);
} else {
if (player1Race == "expander"){
player1GameBar.p1ShowCivExpansions.gotoAndStop(3);
p1LedOn = 9;
p1Resource4Qtt = (p1Resource4Qtt + ScibotStartingResearch);
} else {
if (player1Race == "raider"){
player1GameBar.p1ShowCivExpansions.gotoAndStop(4);
p1LedOn = 12;
p1UpgradePower = (p1UpgradePower + WarStartingAttack);
};
};
};
};
if (player2Race == "keeper"){
player2GameBar.p2ShowCivExpansions.gotoAndStop(1);
p2LedOn = 3;
p2GathererQtt = (p2GathererQtt + KeeperAdditionalGatherer);
} else {
if (player2Race == "builder"){
player2GameBar.p2ShowCivExpansions.gotoAndStop(2);
p2LedOn = 6;
p2WallQtt = (p2WallQtt + BuilderExtraWalls);
} else {
if (player2Race == "expander"){
player2GameBar.p2ShowCivExpansions.gotoAndStop(3);
p2LedOn = 9;
p2Resource4Qtt = (p2Resource4Qtt + ScibotStartingResearch);
} else {
if (player2Race == "raider"){
player2GameBar.p2ShowCivExpansions.gotoAndStop(4);
p2LedOn = 12;
p2UpgradePower = (p2UpgradePower + WarStartingAttack);
};
};
};
};
if (player3Race == "keeper"){
player3GameBar.p3ShowCivExpansions.gotoAndStop(1);
p3LedOn = 3;
p3GathererQtt = (p3GathererQtt + KeeperAdditionalGatherer);
} else {
if (player3Race == "builder"){
player3GameBar.p3ShowCivExpansions.gotoAndStop(2);
p3LedOn = 6;
p3WallQtt = (p3WallQtt + BuilderExtraWalls);
} else {
if (player3Race == "expander"){
player3GameBar.p3ShowCivExpansions.gotoAndStop(3);
p3LedOn = 9;
p3Resource4Qtt = (p3Resource4Qtt + ScibotStartingResearch);
} else {
if (player3Race == "raider"){
player3GameBar.p3ShowCivExpansions.gotoAndStop(4);
p3LedOn = 12;
p3UpgradePower = (p3UpgradePower + WarStartingAttack);
};
};
};
};
if (player4Race == "keeper"){
player4GameBar.p4ShowCivExpansions.gotoAndStop(1);
p4LedOn = 3;
p4GathererQtt = (p4GathererQtt + KeeperAdditionalGatherer);
} else {
if (player4Race == "builder"){
player4GameBar.p4ShowCivExpansions.gotoAndStop(2);
p4LedOn = 6;
p4WallQtt = (p4WallQtt + BuilderExtraWalls);
} else {
if (player4Race == "expander"){
player4GameBar.p4ShowCivExpansions.gotoAndStop(3);
p4LedOn = 9;
p4Resource4Qtt = (p4Resource4Qtt + ScibotStartingResearch);
} else {
if (player4Race == "raider"){
player4GameBar.p4ShowCivExpansions.gotoAndStop(4);
p4LedOn = 12;
p4UpgradePower = (p4UpgradePower + WarStartingAttack);
};
};
};
};
if (turnOrder >= 0.75){
currentTurn = 1;
} else {
if (turnOrder >= 0.5){
currentTurn = 2;
} else {
if (turnOrder >= 0.25){
if (numberOfPlayers < 3){
if (Math.random() >= 0.5){
currentTurn = 1;
} else {
currentTurn = 2;
};
} else {
currentTurn = 3;
};
} else {
if (numberOfPlayers < 3){
if (Math.random() >= 0.5){
currentTurn = 1;
} else {
currentTurn = 2;
};
} else {
if (numberOfPlayers < 4){
if (Math.random() >= 0.5){
currentTurn = 1;
} else {
if (Math.random() >= 0.5){
currentTurn = 2;
} else {
currentTurn = 3;
};
};
} else {
currentTurn = 4;
};
};
};
};
};
updateGameBars();
if (learningWhilePlaying == true){
currentTurn = 1;
};
startingTurnPlayer = currentTurn;
TimerDelayPlaceStarterBuilding.start();
}
public function placeStarterBuildingCall(_arg1:TimerEvent):void{
TimerDelayPlaceStarterBuildingEnd.start();
}
public function beginTutorialAfterExplanation(_arg1:TimerEvent):void{
if (tutoBoxMainIntro.visible == false){
TimerTutorialAfterIntro.stop();
skipMiniBoxIntro.visible = false;
learnAsYouPlayToolTip.gotoAndStop(2);
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(learnAsYouPlayToolTip, (getChildIndex(escapeMenu) - 1));
animateTooltipWithSlide();
learnAsYouPlayToolTip.visible = true;
};
}
public function placeStarterBuilding(_arg1:TimerEvent):void{
var _local2:uint;
var _local3:uint;
topChoiceTileScore = 0;
besttopChoiceTileScore = 0;
plcCurrent = 1;
if ((((currentTurn == 1)) && ((p1starterBuildingPlaced == false)))){
if (learningWhilePlaying == true){
tutoBoxMainIntro.gotoAndPlay(2);
tutoBoxMainIntro.visible = true;
skipMiniBoxIntro.visible = true;
TimerTutorialAfterIntro.start();
} else {
setChildIndex(statusBar, (getChildIndex(player1GameBar) - 1));
learnAsYouPlayToolTip.gotoAndStop(2);
statusBar.gotoAndStop(1);
statusBar.visible = true;
};
} else {
if ((((((p2starterBuildingPlaced == false)) || ((p3starterBuildingPlaced == false)))) || ((p4starterBuildingPlaced == false)))){
civExpansionChoice();
if (currentTurn == 2){
chosenResource = p2ResourceToExpand;
if (chosenResource == 1){
p2Gatherers1 = (p2Gatherers1 + 1);
} else {
if (chosenResource == 2){
p2Gatherers2 = (p2Gatherers2 + 1);
} else {
if (chosenResource == 3){
p2Gatherers3 = (p2Gatherers3 + 1);
} else {
if (chosenResource == 4){
p2Gatherers4 = (p2Gatherers4 + 1);
};
};
};
};
} else {
if (currentTurn == 3){
chosenResource = p3ResourceToExpand;
if (chosenResource == 1){
p3Gatherers1 = (p3Gatherers1 + 1);
} else {
if (chosenResource == 2){
p3Gatherers2 = (p3Gatherers2 + 1);
} else {
if (chosenResource == 3){
p3Gatherers3 = (p3Gatherers3 + 1);
} else {
if (chosenResource == 4){
p3Gatherers4 = (p3Gatherers4 + 1);
};
};
};
};
} else {
if (currentTurn == 4){
chosenResource = p4ResourceToExpand;
if (chosenResource == 1){
p4Gatherers1 = (p4Gatherers1 + 1);
} else {
if (chosenResource == 2){
p4Gatherers2 = (p4Gatherers2 + 1);
} else {
if (chosenResource == 3){
p4Gatherers3 = (p4Gatherers3 + 1);
} else {
if (chosenResource == 4){
p4Gatherers4 = (p4Gatherers4 + 1);
};
};
};
};
};
};
};
_local2 = 0;
while (_local2 < (landTileArray.length - 1)) {
plcCurrent = 0;
topChoiceTileScore = 0;
if ((((landTileArray[_local2].resource == chosenResource)) && ((landTileArray[_local2].player == currentTurn)))){
_local3 = 0;
while (_local3 < 24) {
skipBestTileCheck = false;
if (plcCurrent == 0){
plcModifier = 1;
plcCurrent = (plcCurrent + 1);
} else {
if (plcCurrent == 1){
plcModifier = -1;
plcCurrent = (plcCurrent + 1);
} else {
if (plcCurrent == 2){
plcModifier = (6 + (verticalGridCounter / 2));
plcCurrent = (plcCurrent + 1);
} else {
if (plcCurrent == 3){
plcModifier = (-6 - (verticalGridCounter / 2));
plcCurrent = (plcCurrent + 1);
} else {
if (plcCurrent == 4){
plcModifier = (1 + (-6 - (verticalGridCounter / 2)));
plcCurrent = (plcCurrent + 1);
} else {
if (plcCurrent == 5){
plcModifier = (-1 + (-6 - (verticalGridCounter / 2)));
plcCurrent = (plcCurrent + 1);
} else {
if (plcCurrent == 6){
plcModifier = (1 + (6 + (verticalGridCounter / 2)));
plcCurrent = (plcCurrent + 1);
} else {
if (plcCurrent == 7){
plcModifier = (-1 + (6 + (verticalGridCounter / 2)));
plcCurrent = (plcCurrent + 1);
} else {
if (plcCurrent == 8){
plcModifier = 2;
plcCurrent = (plcCurrent + 1);
} else {
if (plcCurrent == 9){
plcModifier = -2;
plcCurrent = (plcCurrent + 1);
} else {
if (plcCurrent == 10){
plcModifier = ((6 + (verticalGridCounter / 2)) * 2);
plcCurrent = (plcCurrent + 1);
} else {
if (plcCurrent == 11){
plcModifier = ((-6 - (verticalGridCounter / 2)) * 2);
plcCurrent = (plcCurrent + 1);
} else {
if (plcCurrent == 12){
plcModifier = (2 + (-6 - (verticalGridCounter / 2)));
plcCurrent = (plcCurrent + 1);
} else {
if (plcCurrent == 13){
plcModifier = (-2 + (-6 - (verticalGridCounter / 2)));
plcCurrent = (plcCurrent + 1);
} else {
if (plcCurrent == 14){
plcModifier = (2 + (6 + (verticalGridCounter / 2)));
plcCurrent = (plcCurrent + 1);
} else {
if (plcCurrent == 15){
plcModifier = (-2 + (6 + (verticalGridCounter / 2)));
plcCurrent = (plcCurrent + 1);
} else {
if (plcCurrent == 16){
plcModifier = (-1 + ((6 + (verticalGridCounter / 2)) * 2));
plcCurrent = (plcCurrent + 1);
} else {
if (plcCurrent == 17){
plcModifier = (1 + ((6 + (verticalGridCounter / 2)) * 2));
plcCurrent = (plcCurrent + 1);
} else {
if (plcCurrent == 18){
plcModifier = (-1 + ((-6 - (verticalGridCounter / 2)) * 2));
plcCurrent = (plcCurrent + 1);
} else {
if (plcCurrent == 19){
plcModifier = (1 + ((-6 - (verticalGridCounter / 2)) * 2));
plcCurrent = (plcCurrent + 1);
} else {
if (plcCurrent == 20){
plcModifier = (-2 + ((6 + (verticalGridCounter / 2)) * 2));
plcCurrent = (plcCurrent + 1);
} else {
if (plcCurrent == 21){
plcModifier = (2 + ((6 + (verticalGridCounter / 2)) * 2));
plcCurrent = (plcCurrent + 1);
} else {
if (plcCurrent == 22){
plcModifier = (-2 + ((-6 - (verticalGridCounter / 2)) * 2));
plcCurrent = (plcCurrent + 1);
} else {
if (plcCurrent == 23){
plcModifier = (2 + ((-6 - (verticalGridCounter / 2)) * 2));
plcCurrent = 1;
} else {
skipBestTileCheck = true;
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
if (skipBestTileCheck == false){
if (landTileArray[(_local2 + plcModifier)].resource == 1){
topChoiceTileScore = (topChoiceTileScore + 3);
} else {
if (landTileArray[(_local2 + plcModifier)].resource == 2){
topChoiceTileScore = (topChoiceTileScore + 3);
} else {
if (landTileArray[(_local2 + plcModifier)].resource == 3){
topChoiceTileScore = (topChoiceTileScore + 3);
} else {
if (landTileArray[(_local2 + plcModifier)].resource == 4){
topChoiceTileScore = (topChoiceTileScore + 2);
} else {
if (landTileArray[(_local2 + plcModifier)].blockTile == true){
topChoiceTileScore = (topChoiceTileScore + 2);
};
};
};
};
};
};
if (_local3 == 23){
if (topChoiceTileScore >= besttopChoiceTileScore){
besttopChoiceTileScore = topChoiceTileScore;
if (currentTurn == 2){
player2ChosenGatherTile = landTileArray[_local2].myArrayNumber;
currentChosenGatherTile = landTileArray[_local2].myArrayNumber;
} else {
if (currentTurn == 3){
player3ChosenGatherTile = landTileArray[_local2].myArrayNumber;
currentChosenGatherTile = landTileArray[_local2].myArrayNumber;
} else {
if (currentTurn == 4){
player4ChosenGatherTile = landTileArray[_local2].myArrayNumber;
currentChosenGatherTile = landTileArray[_local2].myArrayNumber;
};
};
};
};
};
_local3++;
};
};
_local2++;
};
if (((((((((((!((landTileArray[(currentChosenGatherTile + 1)].noMansLand == true))) && (!((landTileArray[(currentChosenGatherTile + 1)].resource == 1))))) && (!((landTileArray[(currentChosenGatherTile + 1)].resource == 2))))) && (!((landTileArray[(currentChosenGatherTile + 1)].resource == 3))))) && (!((landTileArray[(currentChosenGatherTile + 1)].resource == 4))))) && (!((landTileArray[(currentChosenGatherTile + 1)].blockTile == true))))){
starterBuildingTileChoicesArray.push((currentChosenGatherTile + 1));
};
if (((((((((((!((landTileArray[(currentChosenGatherTile - 1)].noMansLand == true))) && (!((landTileArray[(currentChosenGatherTile - 1)].resource == 1))))) && (!((landTileArray[(currentChosenGatherTile - 1)].resource == 2))))) && (!((landTileArray[(currentChosenGatherTile - 1)].resource == 3))))) && (!((landTileArray[(currentChosenGatherTile - 1)].resource == 4))))) && (!((landTileArray[(currentChosenGatherTile - 1)].blockTile == true))))){
starterBuildingTileChoicesArray.push((currentChosenGatherTile - 1));
};
if (((((((((((!((landTileArray[((currentChosenGatherTile + 6) + (verticalGridCounter / 2))].noMansLand == true))) && (!((landTileArray[((currentChosenGatherTile + 6) + (verticalGridCounter / 2))].resource == 1))))) && (!((landTileArray[((currentChosenGatherTile + 6) + (verticalGridCounter / 2))].resource == 2))))) && (!((landTileArray[((currentChosenGatherTile + 6) + (verticalGridCounter / 2))].resource == 3))))) && (!((landTileArray[((currentChosenGatherTile + 6) + (verticalGridCounter / 2))].resource == 4))))) && (!((landTileArray[((currentChosenGatherTile + 6) + (verticalGridCounter / 2))].blockTile == true))))){
starterBuildingTileChoicesArray.push(((currentChosenGatherTile + 6) + (verticalGridCounter / 2)));
};
if (((((((((((!((landTileArray[((currentChosenGatherTile - 6) - (verticalGridCounter / 2))].noMansLand == true))) && (!((landTileArray[((currentChosenGatherTile - 6) - (verticalGridCounter / 2))].resource == 1))))) && (!((landTileArray[((currentChosenGatherTile - 6) - (verticalGridCounter / 2))].resource == 2))))) && (!((landTileArray[((currentChosenGatherTile - 6) - (verticalGridCounter / 2))].resource == 3))))) && (!((landTileArray[((currentChosenGatherTile - 6) - (verticalGridCounter / 2))].resource == 4))))) && (!((landTileArray[((currentChosenGatherTile - 6) - (verticalGridCounter / 2))].blockTile == true))))){
starterBuildingTileChoicesArray.push(((currentChosenGatherTile - 6) - (verticalGridCounter / 2)));
};
if (((((((((((!((landTileArray[((currentChosenGatherTile + 1) + (-6 - (verticalGridCounter / 2)))].noMansLand == true))) && (!((landTileArray[((currentChosenGatherTile + 1) + (-6 - (verticalGridCounter / 2)))].resource == 1))))) && (!((landTileArray[((currentChosenGatherTile + 1) + (-6 - (verticalGridCounter / 2)))].resource == 2))))) && (!((landTileArray[((currentChosenGatherTile + 1) + (-6 - (verticalGridCounter / 2)))].resource == 3))))) && (!((landTileArray[((currentChosenGatherTile + 1) + (-6 - (verticalGridCounter / 2)))].resource == 4))))) && (!((landTileArray[((currentChosenGatherTile + 1) + (-6 - (verticalGridCounter / 2)))].blockTile == true))))){
starterBuildingTileChoicesArray.push(((currentChosenGatherTile + 1) + (-6 - (verticalGridCounter / 2))));
};
if (((((((((((!((landTileArray[((currentChosenGatherTile - 1) + (-6 - (verticalGridCounter / 2)))].noMansLand == true))) && (!((landTileArray[((currentChosenGatherTile - 1) + (-6 - (verticalGridCounter / 2)))].resource == 1))))) && (!((landTileArray[((currentChosenGatherTile - 1) + (-6 - (verticalGridCounter / 2)))].resource == 2))))) && (!((landTileArray[((currentChosenGatherTile - 1) + (-6 - (verticalGridCounter / 2)))].resource == 3))))) && (!((landTileArray[((currentChosenGatherTile - 1) + (-6 - (verticalGridCounter / 2)))].resource == 4))))) && (!((landTileArray[((currentChosenGatherTile - 1) + (-6 - (verticalGridCounter / 2)))].blockTile == true))))){
starterBuildingTileChoicesArray.push(((currentChosenGatherTile - 1) + (-6 - (verticalGridCounter / 2))));
};
if (((((((((((!((landTileArray[((currentChosenGatherTile + 1) + (6 + (verticalGridCounter / 2)))].noMansLand == true))) && (!((landTileArray[((currentChosenGatherTile + 1) + (6 + (verticalGridCounter / 2)))].resource == 1))))) && (!((landTileArray[((currentChosenGatherTile + 1) + (6 + (verticalGridCounter / 2)))].resource == 2))))) && (!((landTileArray[((currentChosenGatherTile + 1) + (6 + (verticalGridCounter / 2)))].resource == 3))))) && (!((landTileArray[((currentChosenGatherTile + 1) + (6 + (verticalGridCounter / 2)))].resource == 4))))) && (!((landTileArray[((currentChosenGatherTile + 1) + (6 + (verticalGridCounter / 2)))].blockTile == true))))){
starterBuildingTileChoicesArray.push(((currentChosenGatherTile + 1) + (6 + (verticalGridCounter / 2))));
};
if (((((((((((!((landTileArray[((currentChosenGatherTile - 1) + (6 + (verticalGridCounter / 2)))].noMansLand == true))) && (!((landTileArray[((currentChosenGatherTile - 1) + (6 + (verticalGridCounter / 2)))].resource == 1))))) && (!((landTileArray[((currentChosenGatherTile - 1) + (6 + (verticalGridCounter / 2)))].resource == 2))))) && (!((landTileArray[((currentChosenGatherTile - 1) + (6 + (verticalGridCounter / 2)))].resource == 3))))) && (!((landTileArray[((currentChosenGatherTile - 1) + (6 + (verticalGridCounter / 2)))].resource == 4))))) && (!((landTileArray[((currentChosenGatherTile - 1) + (6 + (verticalGridCounter / 2)))].blockTile == true))))){
starterBuildingTileChoicesArray.push(((currentChosenGatherTile - 1) + (6 + (verticalGridCounter / 2))));
};
randomStarterBuildingTile = int(((Math.random() * starterBuildingTileChoicesArray.length) + 0.3));
if (randomStarterBuildingTile < 0){
randomStarterBuildingTile = 0;
} else {
if (randomStarterBuildingTile >= starterBuildingTileChoicesArray.length){
randomStarterBuildingTile = (starterBuildingTileChoicesArray.length - 1);
};
};
randomStarterBuildingTile = starterBuildingTileChoicesArray[randomStarterBuildingTile];
if (currentTurn == 2){
chan_soundFX = snd_placewall.play(0, 0, snd_FXVolume);
p2starterBuildingPlaced = true;
starterBuilding = new starterBuildingLIB();
starterBuilding.x = landTileArray[randomStarterBuildingTile].x;
starterBuilding.y = landTileArray[randomStarterBuildingTile].y;
starterBuilding.showPower = 2;
p2StarterBuildingTile = landTileArray[randomStarterBuildingTile].myArrayNumber;
landTileArray[randomStarterBuildingTile].startBuildTile = true;
starterBuildingArray.push(starterBuilding);
if (player2Race == "keeper"){
starterBuilding.gotoAndStop(1);
} else {
if (player2Race == "builder"){
starterBuilding.gotoAndStop(2);
} else {
if (player2Race == "expander"){
starterBuilding.gotoAndStop(3);
} else {
if (player2Race == "raider"){
starterBuilding.gotoAndStop(4);
};
};
};
};
addChild(starterBuilding);
starterBuilding.addEventListener(MouseEvent.MOUSE_DOWN, showEnemyPowerTooltip);
starterBuilding.addEventListener(MouseEvent.MOUSE_OUT, hideEnemyPowerTooltip);
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(starterBuilding, (getChildIndex(escapeMenu) - 1));
wallSlotArray[landTileArray[randomStarterBuildingTile].upWall].alpha = 1;
wallSlotArray[landTileArray[randomStarterBuildingTile].upWall].visible = false;
wallSlotArray[landTileArray[randomStarterBuildingTile].upWall].player = 2;
if ((((wallSlotArray[((landTileArray[randomStarterBuildingTile].upWall - 13) - verticalGridCounter)].alpha == 1)) && ((wallSlotArray[((landTileArray[randomStarterBuildingTile].bottomWall - 13) - verticalGridCounter)].alpha == 1)))){
wallSlotArray[landTileArray[randomStarterBuildingTile].leftWall].alpha = 0;
wallSlotArray[landTileArray[randomStarterBuildingTile].leftWall].player = 2;
} else {
wallSlotArray[landTileArray[randomStarterBuildingTile].leftWall].alpha = 1;
wallSlotArray[landTileArray[randomStarterBuildingTile].leftWall].visible = false;
wallSlotArray[landTileArray[randomStarterBuildingTile].leftWall].player = 2;
};
if ((((wallSlotArray[((landTileArray[randomStarterBuildingTile].upWall + 13) + verticalGridCounter)].alpha == 1)) && ((wallSlotArray[((landTileArray[randomStarterBuildingTile].bottomWall + 13) + verticalGridCounter)].alpha == 1)))){
wallSlotArray[landTileArray[randomStarterBuildingTile].rightWall].alpha = 0;
wallSlotArray[landTileArray[randomStarterBuildingTile].rightWall].player = 2;
};
wallSlotArray[landTileArray[randomStarterBuildingTile].bottomWall].alpha = 1;
wallSlotArray[landTileArray[randomStarterBuildingTile].bottomWall].visible = false;
wallSlotArray[landTileArray[randomStarterBuildingTile].bottomWall].player = 2;
if (numberOfPlayers == 2){
currentTurn = 1;
p3starterBuildingPlaced = true;
p4starterBuildingPlaced = true;
} else {
if (numberOfPlayers == 3){
currentTurn = 3;
p4starterBuildingPlaced = true;
} else {
if (numberOfPlayers == 4){
currentTurn = 4;
};
};
};
} else {
if (currentTurn == 3){
chan_soundFX = snd_placewall.play(0, 0, snd_FXVolume);
p3starterBuildingPlaced = true;
starterBuilding = new starterBuildingLIB();
starterBuilding.x = landTileArray[randomStarterBuildingTile].x;
starterBuilding.y = landTileArray[randomStarterBuildingTile].y;
starterBuilding.showPower = 3;
p3StarterBuildingTile = landTileArray[randomStarterBuildingTile].myArrayNumber;
landTileArray[randomStarterBuildingTile].startBuildTile = true;
starterBuildingArray.push(starterBuilding);
if (player3Race == "keeper"){
starterBuilding.gotoAndStop(1);
} else {
if (player3Race == "builder"){
starterBuilding.gotoAndStop(2);
} else {
if (player3Race == "expander"){
starterBuilding.gotoAndStop(3);
} else {
if (player3Race == "raider"){
starterBuilding.gotoAndStop(4);
};
};
};
};
addChild(starterBuilding);
starterBuilding.addEventListener(MouseEvent.MOUSE_DOWN, showEnemyPowerTooltip);
starterBuilding.addEventListener(MouseEvent.MOUSE_OUT, hideEnemyPowerTooltip);
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(starterBuilding, (getChildIndex(escapeMenu) - 1));
wallSlotArray[landTileArray[randomStarterBuildingTile].upWall].alpha = 1;
wallSlotArray[landTileArray[randomStarterBuildingTile].upWall].player = 3;
if ((((wallSlotArray[((landTileArray[randomStarterBuildingTile].upWall - 13) - verticalGridCounter)].alpha == 1)) && ((wallSlotArray[((landTileArray[randomStarterBuildingTile].bottomWall - 13) - verticalGridCounter)].alpha == 1)))){
wallSlotArray[landTileArray[randomStarterBuildingTile].leftWall].alpha = 0;
wallSlotArray[landTileArray[randomStarterBuildingTile].leftWall].player = 3;
} else {
wallSlotArray[landTileArray[randomStarterBuildingTile].leftWall].alpha = 1;
wallSlotArray[landTileArray[randomStarterBuildingTile].leftWall].player = 3;
};
if ((((wallSlotArray[((landTileArray[randomStarterBuildingTile].upWall + 13) + verticalGridCounter)].alpha == 1)) && ((wallSlotArray[((landTileArray[randomStarterBuildingTile].bottomWall + 13) + verticalGridCounter)].alpha == 1)))){
wallSlotArray[landTileArray[randomStarterBuildingTile].rightWall].alpha = 0;
wallSlotArray[landTileArray[randomStarterBuildingTile].rightWall].player = 3;
};
wallSlotArray[landTileArray[randomStarterBuildingTile].bottomWall].alpha = 1;
wallSlotArray[landTileArray[randomStarterBuildingTile].bottomWall].player = 3;
currentTurn = 1;
if (numberOfPlayers == 3){
p4starterBuildingPlaced = true;
};
} else {
if (currentTurn == 4){
chan_soundFX = snd_placewall.play(0, 0, snd_FXVolume);
p4starterBuildingPlaced = true;
starterBuilding = new starterBuildingLIB();
starterBuilding.x = landTileArray[randomStarterBuildingTile].x;
starterBuilding.y = landTileArray[randomStarterBuildingTile].y;
starterBuilding.showPower = 4;
p4StarterBuildingTile = landTileArray[randomStarterBuildingTile].myArrayNumber;
landTileArray[randomStarterBuildingTile].startBuildTile = true;
starterBuildingArray.push(starterBuilding);
wallSlotArray[landTileArray[randomStarterBuildingTile].upWall].alpha = 1;
wallSlotArray[landTileArray[randomStarterBuildingTile].upWall].player = 4;
if ((((wallSlotArray[((landTileArray[randomStarterBuildingTile].upWall - 13) - verticalGridCounter)].alpha == 1)) && ((wallSlotArray[((landTileArray[randomStarterBuildingTile].bottomWall - 13) - verticalGridCounter)].alpha == 1)))){
wallSlotArray[landTileArray[randomStarterBuildingTile].leftWall].alpha = 0;
wallSlotArray[landTileArray[randomStarterBuildingTile].leftWall].player = 4;
} else {
wallSlotArray[landTileArray[randomStarterBuildingTile].leftWall].alpha = 1;
wallSlotArray[landTileArray[randomStarterBuildingTile].leftWall].player = 4;
};
if ((((wallSlotArray[((landTileArray[randomStarterBuildingTile].upWall + 13) + verticalGridCounter)].alpha == 1)) && ((wallSlotArray[((landTileArray[randomStarterBuildingTile].bottomWall + 13) + verticalGridCounter)].alpha == 1)))){
wallSlotArray[landTileArray[randomStarterBuildingTile].rightWall].alpha = 0;
wallSlotArray[landTileArray[randomStarterBuildingTile].rightWall].player = 4;
};
wallSlotArray[landTileArray[randomStarterBuildingTile].bottomWall].alpha = 1;
wallSlotArray[landTileArray[randomStarterBuildingTile].bottomWall].player = 4;
if (player4Race == "keeper"){
starterBuilding.gotoAndStop(1);
} else {
if (player4Race == "builder"){
starterBuilding.gotoAndStop(2);
} else {
if (player4Race == "expander"){
starterBuilding.gotoAndStop(3);
} else {
if (player4Race == "raider"){
starterBuilding.gotoAndStop(4);
};
};
};
};
addChild(starterBuilding);
starterBuilding.addEventListener(MouseEvent.MOUSE_DOWN, showEnemyPowerTooltip);
starterBuilding.addEventListener(MouseEvent.MOUSE_OUT, hideEnemyPowerTooltip);
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(starterBuilding, (getChildIndex(escapeMenu) - 1));
currentTurn = 3;
};
};
};
while (starterBuildingTileChoicesArray.length >= 1) {
starterBuildingTileChoicesArray.splice(0);
};
TimerDelayPlaceStarterBuilding.start();
} else {
currentTurn = startingTurnPlayer;
TimerDelayPlaceStarterGatherer.start();
};
};
}
public function longWalkInterfaceHide(_arg1:MouseEvent):void{
longWalkGUI.visible = false;
gathererTooltip.visible = false;
warAdvisor.visible = false;
castletooltip.visible = false;
if (player1Race == "keeper"){
player1GameBar.p1ShowCivExpansions.gotoAndStop(1);
} else {
if (player1Race == "builder"){
player1GameBar.p1ShowCivExpansions.gotoAndStop(2);
} else {
if (player1Race == "expander"){
player1GameBar.p1ShowCivExpansions.gotoAndStop(3);
} else {
if (player1Race == "raider"){
player1GameBar.p1ShowCivExpansions.gotoAndStop(4);
};
};
};
};
}
public function longWalkInterfaceParty(_arg1:MouseEvent):void{
var _local2:uint;
var _local3:uint;
if (gameOver == false){
if ((((((((((p1GathererQtt >= 1)) && ((((player1PlaceGathererMode == true)) || ((((((p1starterBuildingPlaced == true)) && ((p1starterGathererPlaced == false)))) && ((learnAsYouPlayToolTip.currentFrame == 3)))))))) && ((landTileArray[_arg1.target.partyCurrentTile].player == 1)))) && (!((landTileArray[_arg1.target.partyCurrentTile].hasGatherer == true))))) && ((((((((landTileArray[_arg1.target.partyCurrentTile].resource == 1)) || ((landTileArray[_arg1.target.partyCurrentTile].resource == 2)))) || ((landTileArray[_arg1.target.partyCurrentTile].resource == 3)))) || ((landTileArray[_arg1.target.partyCurrentTile].resource == 4)))))){
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(gathererTooltip, (getChildIndex(escapeMenu) - 1));
trace(landTileArray[_arg1.target.partyCurrentTile].hasGatherer);
if (landTileArray[_arg1.target.partyCurrentTile].resource == 1){
gathererTooltip.gotoAndStop(1);
player1GameBar.p1ShowCivExpansions.gotoAndStop(5);
} else {
if (landTileArray[_arg1.target.partyCurrentTile].resource == 2){
gathererTooltip.gotoAndStop(2);
player1GameBar.p1ShowCivExpansions.gotoAndStop(6);
} else {
if (landTileArray[_arg1.target.partyCurrentTile].resource == 3){
gathererTooltip.gotoAndStop(3);
player1GameBar.p1ShowCivExpansions.gotoAndStop(7);
} else {
if (landTileArray[_arg1.target.partyCurrentTile].resource == 4){
gathererTooltip.gotoAndStop(4);
player1GameBar.p1ShowCivExpansions.gotoAndStop(8);
};
};
};
};
gathererTooltip.alpha = 0.8;
gathererTooltip.x = _arg1.target.x;
gathererTooltip.y = _arg1.target.y;
gathererTooltip.visible = true;
};
if ((((((((((((((((player1UnderCombat == false)) && ((slidingUnit == false)))) && ((allowPlayerToMoveUnit == true)))) && ((landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].tileRow == landTileArray[_arg1.target.partyCurrentTile].tileRow)))) && ((currentTurn == 1)))) && (!((landTileArray[_arg1.target.partyCurrentTile].blockTile == true))))) && (!((landTileArray[_arg1.target.partyCurrentTile].startBuildTile == true))))) && ((partyUnitArray1[currentUnitPlayerMoves].movesLeft > 0)))){
tilesDifference = (landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].tileColumn - landTileArray[_arg1.target.partyCurrentTile].tileColumn);
failLongWalk = false;
if ((((tilesDifference > 0)) && ((tilesDifference <= partyUnitArray1[currentUnitPlayerMoves].movesLeft)))){
tempLongwalkOrientation = -90;
longWalkGUI.moveTooltipInsideGraph.rotation = 0;
longWalkGUI.moveTooltipInsideGraph.scaleX = -1;
longWalkGUI.longWalkInterfaceText.x = -16.15;
_local2 = 1;
while (_local2 <= tilesDifference) {
if ((((((((((((((((((((wallSlotArray[landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((-6 - (verticalGridCounter / 2)) * _local2))].rightWall].alpha == 0)) || ((wallSlotArray[landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((-6 - (verticalGridCounter / 2)) * _local2))].rightWall].player == 1)))) && ((((((wallSlotArray[landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((-6 - (verticalGridCounter / 2)) * _local2))].leftWall].alpha == 0)) || ((_local2 == tilesDifference)))) || ((wallSlotArray[landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((-6 - (verticalGridCounter / 2)) * _local2))].leftWall].player == 1)))))) && ((landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((-6 - (verticalGridCounter / 2)) * _local2))].party2 == 0)))) && ((landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((-6 - (verticalGridCounter / 2)) * _local2))].party3 == 0)))) && ((landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((-6 - (verticalGridCounter / 2)) * _local2))].party4 == 0)))) && ((landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((-6 - (verticalGridCounter / 2)) * _local2))].party5 == 0)))) && (!((landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((-6 - (verticalGridCounter / 2)) * _local2))].blockTile == true))))) && (((!((landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((-6 - (verticalGridCounter / 2)) * _local2))].startBuildTile == true))) || ((landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((-6 - (verticalGridCounter / 2)) * _local2))].player == 1)))))) && ((landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((-6 - (verticalGridCounter / 2)) * _local2))].party5 == 0)))){
longWalkArray.push(landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((-6 - (verticalGridCounter / 2)) * _local2))].myArrayNumber);
} else {
failLongWalk = true;
};
_local2++;
};
} else {
if ((((tilesDifference < 0)) && ((-(tilesDifference) <= partyUnitArray1[currentUnitPlayerMoves].movesLeft)))){
tempLongwalkOrientation = 90;
longWalkGUI.moveTooltipInsideGraph.rotation = 0;
longWalkGUI.moveTooltipInsideGraph.scaleX = 1;
longWalkGUI.longWalkInterfaceText.x = -16.15;
tilesDifference = -(tilesDifference);
_local3 = 1;
while (_local3 <= tilesDifference) {
if ((((((((((((((((((((wallSlotArray[landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((6 + (verticalGridCounter / 2)) * _local3))].leftWall].alpha == 0)) || ((wallSlotArray[landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((6 + (verticalGridCounter / 2)) * _local3))].leftWall].player == 1)))) && ((((((wallSlotArray[landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((6 + (verticalGridCounter / 2)) * _local3))].rightWall].alpha == 0)) || ((_local3 == tilesDifference)))) || ((wallSlotArray[landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((6 + (verticalGridCounter / 2)) * _local3))].rightWall].player == 1)))))) && ((landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((6 + (verticalGridCounter / 2)) * _local3))].party2 == 0)))) && ((landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((6 + (verticalGridCounter / 2)) * _local3))].party3 == 0)))) && ((landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((6 + (verticalGridCounter / 2)) * _local3))].party4 == 0)))) && ((landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((6 + (verticalGridCounter / 2)) * _local3))].party5 == 0)))) && (!((landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((6 + (verticalGridCounter / 2)) * _local3))].blockTile == true))))) && (((!((landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((6 + (verticalGridCounter / 2)) * _local3))].startBuildTile == true))) || ((landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((6 + (verticalGridCounter / 2)) * _local3))].player == 1)))))) && ((landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((6 + (verticalGridCounter / 2)) * _local3))].party5 == 0)))){
longWalkArray.push(landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((6 + (verticalGridCounter / 2)) * _local3))].myArrayNumber);
} else {
failLongWalk = true;
};
_local3++;
};
} else {
failLongWalk = true;
};
};
if ((((failLongWalk == false)) && (!((partyUnitArray1[currentUnitPlayerMoves].defensiveUnit == true))))){
longWalkGUI.x = landTileArray[_arg1.target.partyCurrentTile].x;
longWalkGUI.y = landTileArray[_arg1.target.partyCurrentTile].y;
longWalkGUI.longWalkInterfaceText.text = tilesDifference;
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(longWalkGUI, (getChildIndex(escapeMenu) - 1));
longWalkGUI.visible = true;
} else {
longWalkGUI.visible = false;
};
} else {
if ((((((((((((((((player1UnderCombat == false)) && ((allowPlayerToMoveUnit == true)))) && ((landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].tileColumn == landTileArray[_arg1.target.partyCurrentTile].tileColumn)))) && ((slidingUnit == false)))) && ((currentTurn == 1)))) && (!((landTileArray[_arg1.target.partyCurrentTile].blockTile == true))))) && (!((landTileArray[_arg1.target.partyCurrentTile].startBuildTile == true))))) && ((partyUnitArray1[currentUnitPlayerMoves].movesLeft > 0)))){
tilesDifference = (landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].tileRow - landTileArray[_arg1.target.partyCurrentTile].tileRow);
failLongWalk = false;
if ((((tilesDifference > 0)) && ((tilesDifference <= partyUnitArray1[currentUnitPlayerMoves].movesLeft)))){
tempLongwalkOrientation = 0;
longWalkGUI.moveTooltipInsideGraph.rotation = -90;
longWalkGUI.moveTooltipInsideGraph.scaleX = 1;
longWalkGUI.longWalkInterfaceText.x = -20.15;
longWalkPartyCurrentTile = landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].myArrayNumber;
_local2 = 1;
while (_local2 <= tilesDifference) {
if (landTileArray[longWalkPartyCurrentTile].tileRow == landGridNumberVertical){
longWalkPartyCurrentTile = landTileArray[(longWalkPartyCurrentTile - kingdom1ToKingdom3TileDifference)].myArrayNumber;
} else {
longWalkPartyCurrentTile = landTileArray[(longWalkPartyCurrentTile - 1)].myArrayNumber;
};
if ((((((((((((((((((((wallSlotArray[landTileArray[longWalkPartyCurrentTile].bottomWall].alpha == 0)) || ((wallSlotArray[landTileArray[longWalkPartyCurrentTile].bottomWall].player == 1)))) && ((((((wallSlotArray[landTileArray[longWalkPartyCurrentTile].upWall].alpha == 0)) || ((_local2 == tilesDifference)))) || ((wallSlotArray[landTileArray[longWalkPartyCurrentTile].upWall].player == 1)))))) && ((landTileArray[longWalkPartyCurrentTile].party2 == 0)))) && ((landTileArray[longWalkPartyCurrentTile].party3 == 0)))) && ((landTileArray[longWalkPartyCurrentTile].party4 == 0)))) && ((landTileArray[longWalkPartyCurrentTile].party5 == 0)))) && (!((landTileArray[longWalkPartyCurrentTile].blockTile == true))))) && (((!((landTileArray[longWalkPartyCurrentTile].startBuildTile == true))) || ((landTileArray[longWalkPartyCurrentTile].player == 1)))))) && ((landTileArray[longWalkPartyCurrentTile].party5 == 0)))){
longWalkArray.push(landTileArray[longWalkPartyCurrentTile].myArrayNumber);
} else {
failLongWalk = true;
};
_local2++;
};
} else {
if ((((tilesDifference < 0)) && ((-(tilesDifference) <= partyUnitArray1[currentUnitPlayerMoves].movesLeft)))){
tempLongwalkOrientation = 180;
longWalkGUI.moveTooltipInsideGraph.rotation = -90;
longWalkGUI.moveTooltipInsideGraph.scaleX = -1;
longWalkGUI.longWalkInterfaceText.x = -20.15;
tilesDifference = -(tilesDifference);
longWalkPartyCurrentTile = landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].myArrayNumber;
_local3 = 1;
while (_local3 <= tilesDifference) {
if (landTileArray[longWalkPartyCurrentTile].tileRow == (landGridNumberVertical - 1)){
longWalkPartyCurrentTile = landTileArray[(longWalkPartyCurrentTile + kingdom1ToKingdom3TileDifference)].myArrayNumber;
} else {
longWalkPartyCurrentTile = landTileArray[(longWalkPartyCurrentTile + 1)].myArrayNumber;
};
if ((((((((((((((((((wallSlotArray[landTileArray[longWalkPartyCurrentTile].upWall].alpha == 0)) || ((wallSlotArray[landTileArray[longWalkPartyCurrentTile].upWall].player == 1)))) && ((((((wallSlotArray[landTileArray[longWalkPartyCurrentTile].bottomWall].alpha == 0)) || ((_local3 == tilesDifference)))) || ((wallSlotArray[landTileArray[longWalkPartyCurrentTile].bottomWall].player == 1)))))) && ((landTileArray[longWalkPartyCurrentTile].party2 == 0)))) && ((landTileArray[longWalkPartyCurrentTile].party3 == 0)))) && ((landTileArray[longWalkPartyCurrentTile].party4 == 0)))) && ((landTileArray[longWalkPartyCurrentTile].party5 == 0)))) && (!((landTileArray[longWalkPartyCurrentTile].blockTile == true))))) && (((!((landTileArray[longWalkPartyCurrentTile].startBuildTile == true))) || ((landTileArray[longWalkPartyCurrentTile].player == 1)))))){
longWalkArray.push(landTileArray[longWalkPartyCurrentTile].myArrayNumber);
} else {
failLongWalk = true;
};
_local3++;
};
};
};
if ((((failLongWalk == false)) && (!((partyUnitArray1[currentUnitPlayerMoves].defensiveUnit == true))))){
longWalkGUI.x = landTileArray[_arg1.target.partyCurrentTile].x;
longWalkGUI.y = landTileArray[_arg1.target.partyCurrentTile].y;
longWalkGUI.longWalkInterfaceText.text = tilesDifference;
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(longWalkGUI, (getChildIndex(escapeMenu) - 1));
if ((((tilesDifference > 0)) && ((tilesDifference <= partyUnitArray1[currentUnitPlayerMoves].movesLeft)))){
longWalkGUI.visible = true;
};
} else {
longWalkGUI.visible = false;
};
};
};
};
}
public function longWalkInterfaceTile(_arg1:MouseEvent):void{
var _local2:uint;
var _local3:uint;
if (gameOver == false){
if ((((((((((p1GathererQtt >= 1)) && ((((player1PlaceGathererMode == true)) || ((((((p1starterBuildingPlaced == true)) && ((p1starterGathererPlaced == false)))) && ((learnAsYouPlayToolTip.currentFrame == 3)))))))) && ((_arg1.target.player == 1)))) && (!((_arg1.target.hasGatherer == true))))) && ((((((((_arg1.target.resource == 1)) || ((_arg1.target.resource == 2)))) || ((_arg1.target.resource == 3)))) || ((_arg1.target.resource == 4)))))){
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(gathererTooltip, (getChildIndex(escapeMenu) - 1));
if (_arg1.target.resource == 1){
gathererTooltip.gotoAndStop(1);
player1GameBar.p1ShowCivExpansions.gotoAndStop(5);
} else {
if (_arg1.target.resource == 2){
gathererTooltip.gotoAndStop(2);
player1GameBar.p1ShowCivExpansions.gotoAndStop(6);
} else {
if (_arg1.target.resource == 3){
gathererTooltip.gotoAndStop(3);
player1GameBar.p1ShowCivExpansions.gotoAndStop(7);
} else {
if (_arg1.target.resource == 4){
gathererTooltip.gotoAndStop(4);
player1GameBar.p1ShowCivExpansions.gotoAndStop(8);
};
};
};
};
gathererTooltip.alpha = 0.8;
gathererTooltip.x = _arg1.target.x;
gathererTooltip.y = _arg1.target.y;
gathererTooltip.visible = true;
};
if ((((((((((((((((((((p1starterBuildingPlaced == false)) && ((learnAsYouPlayToolTip.currentFrame == 2)))) && ((_arg1.target.player == 1)))) && (!((_arg1.target.hasGatherer == true))))) && (!((_arg1.target.resource == 1))))) && (!((_arg1.target.resource == 2))))) && (!((_arg1.target.resource == 3))))) && (!((_arg1.target.resource == 4))))) && (!((_arg1.target.blockTile == true))))) && (!((_arg1.target.noMansLand == true))))){
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(castletooltip, (getChildIndex(escapeMenu) - 1));
if (player1Race == "keeper"){
castletooltip.gotoAndStop(1);
} else {
if (player1Race == "builder"){
castletooltip.gotoAndStop(2);
} else {
if (player1Race == "expander"){
castletooltip.gotoAndStop(3);
} else {
if (player1Race == "raider"){
castletooltip.gotoAndStop(4);
};
};
};
};
castletooltip.alpha = 0.5;
castletooltip.x = _arg1.target.x;
castletooltip.y = _arg1.target.y;
castletooltip.visible = true;
};
if ((((((((((((((((player1UnderCombat == false)) && ((slidingUnit == false)))) && ((allowPlayerToMoveUnit == true)))) && ((landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].tileRow == _arg1.target.tileRow)))) && ((currentTurn == 1)))) && (!((_arg1.target.blockTile == true))))) && (!((_arg1.target.startBuildTile == true))))) && ((partyUnitArray1[currentUnitPlayerMoves].movesLeft > 0)))){
tilesDifference = (landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].tileColumn - _arg1.target.tileColumn);
failLongWalk = false;
if ((((tilesDifference > 0)) && ((tilesDifference <= partyUnitArray1[currentUnitPlayerMoves].movesLeft)))){
tempLongwalkOrientation = -90;
longWalkGUI.moveTooltipInsideGraph.rotation = 0;
longWalkGUI.moveTooltipInsideGraph.scaleX = -1;
longWalkGUI.longWalkInterfaceText.x = -16.15;
_local2 = 1;
while (_local2 <= tilesDifference) {
if ((((((((((((((((((((wallSlotArray[landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((-6 - (verticalGridCounter / 2)) * _local2))].rightWall].alpha == 0)) || ((wallSlotArray[landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((-6 - (verticalGridCounter / 2)) * _local2))].rightWall].player == 1)))) && ((((((wallSlotArray[landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((-6 - (verticalGridCounter / 2)) * _local2))].leftWall].alpha == 0)) || ((_local2 == tilesDifference)))) || ((wallSlotArray[landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((-6 - (verticalGridCounter / 2)) * _local2))].leftWall].player == 1)))))) && ((landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((-6 - (verticalGridCounter / 2)) * _local2))].party2 == 0)))) && ((landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((-6 - (verticalGridCounter / 2)) * _local2))].party3 == 0)))) && ((landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((-6 - (verticalGridCounter / 2)) * _local2))].party4 == 0)))) && ((landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((-6 - (verticalGridCounter / 2)) * _local2))].party5 == 0)))) && (!((landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((-6 - (verticalGridCounter / 2)) * _local2))].blockTile == true))))) && (((!((landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((-6 - (verticalGridCounter / 2)) * _local2))].startBuildTile == true))) || ((landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((-6 - (verticalGridCounter / 2)) * _local2))].player == 1)))))) && ((landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((-6 - (verticalGridCounter / 2)) * _local2))].party5 == 0)))){
longWalkArray.push(landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((-6 - (verticalGridCounter / 2)) * _local2))].myArrayNumber);
} else {
failLongWalk = true;
};
_local2++;
};
} else {
if ((((tilesDifference < 0)) && ((-(tilesDifference) <= partyUnitArray1[currentUnitPlayerMoves].movesLeft)))){
tempLongwalkOrientation = 90;
longWalkGUI.moveTooltipInsideGraph.rotation = 0;
longWalkGUI.moveTooltipInsideGraph.scaleX = 1;
longWalkGUI.longWalkInterfaceText.x = -16.15;
tilesDifference = -(tilesDifference);
_local3 = 1;
while (_local3 <= tilesDifference) {
if ((((((((((((((((((((wallSlotArray[landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((6 + (verticalGridCounter / 2)) * _local3))].leftWall].alpha == 0)) || ((wallSlotArray[landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((6 + (verticalGridCounter / 2)) * _local3))].leftWall].player == 1)))) && ((((((wallSlotArray[landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((6 + (verticalGridCounter / 2)) * _local3))].rightWall].alpha == 0)) || ((_local3 == tilesDifference)))) || ((wallSlotArray[landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((6 + (verticalGridCounter / 2)) * _local3))].rightWall].player == 1)))))) && ((landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((6 + (verticalGridCounter / 2)) * _local3))].party2 == 0)))) && ((landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((6 + (verticalGridCounter / 2)) * _local3))].party3 == 0)))) && ((landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((6 + (verticalGridCounter / 2)) * _local3))].party4 == 0)))) && ((landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((6 + (verticalGridCounter / 2)) * _local3))].party5 == 0)))) && (!((landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((6 + (verticalGridCounter / 2)) * _local3))].blockTile == true))))) && (((!((landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((6 + (verticalGridCounter / 2)) * _local3))].startBuildTile == true))) || ((landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((6 + (verticalGridCounter / 2)) * _local3))].player == 1)))))) && ((landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((6 + (verticalGridCounter / 2)) * _local3))].party5 == 0)))){
longWalkArray.push(landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((6 + (verticalGridCounter / 2)) * _local3))].myArrayNumber);
} else {
failLongWalk = true;
};
_local3++;
};
} else {
failLongWalk = true;
};
};
if ((((failLongWalk == false)) && (!((partyUnitArray1[currentUnitPlayerMoves].defensiveUnit == true))))){
longWalkGUI.x = _arg1.target.x;
longWalkGUI.y = _arg1.target.y;
longWalkGUI.longWalkInterfaceText.text = tilesDifference;
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(longWalkGUI, (getChildIndex(escapeMenu) - 1));
longWalkGUI.visible = true;
} else {
longWalkGUI.visible = false;
};
} else {
if ((((((((((((((((player1UnderCombat == false)) && ((allowPlayerToMoveUnit == true)))) && ((landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].tileColumn == _arg1.target.tileColumn)))) && ((slidingUnit == false)))) && ((currentTurn == 1)))) && (!((_arg1.target.blockTile == true))))) && (!((_arg1.target.startBuildTile == true))))) && ((partyUnitArray1[currentUnitPlayerMoves].movesLeft > 0)))){
tilesDifference = (landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].tileRow - _arg1.target.tileRow);
failLongWalk = false;
if ((((tilesDifference > 0)) && ((tilesDifference <= partyUnitArray1[currentUnitPlayerMoves].movesLeft)))){
tempLongwalkOrientation = 0;
longWalkGUI.moveTooltipInsideGraph.rotation = -90;
longWalkGUI.moveTooltipInsideGraph.scaleX = 1;
longWalkGUI.longWalkInterfaceText.x = -20.15;
longWalkPartyCurrentTile = landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].myArrayNumber;
_local2 = 1;
while (_local2 <= tilesDifference) {
if (landTileArray[longWalkPartyCurrentTile].tileRow == landGridNumberVertical){
longWalkPartyCurrentTile = landTileArray[(longWalkPartyCurrentTile - kingdom1ToKingdom3TileDifference)].myArrayNumber;
} else {
longWalkPartyCurrentTile = landTileArray[(longWalkPartyCurrentTile - 1)].myArrayNumber;
};
if ((((((((((((((((((((wallSlotArray[landTileArray[longWalkPartyCurrentTile].bottomWall].alpha == 0)) || ((wallSlotArray[landTileArray[longWalkPartyCurrentTile].bottomWall].player == 1)))) && ((((((wallSlotArray[landTileArray[longWalkPartyCurrentTile].upWall].alpha == 0)) || ((_local2 == tilesDifference)))) || ((wallSlotArray[landTileArray[longWalkPartyCurrentTile].upWall].player == 1)))))) && ((landTileArray[longWalkPartyCurrentTile].party2 == 0)))) && ((landTileArray[longWalkPartyCurrentTile].party3 == 0)))) && ((landTileArray[longWalkPartyCurrentTile].party4 == 0)))) && ((landTileArray[longWalkPartyCurrentTile].party5 == 0)))) && (!((landTileArray[longWalkPartyCurrentTile].blockTile == true))))) && (((!((landTileArray[longWalkPartyCurrentTile].startBuildTile == true))) || ((landTileArray[longWalkPartyCurrentTile].player == 1)))))) && ((landTileArray[longWalkPartyCurrentTile].party5 == 0)))){
longWalkArray.push(landTileArray[longWalkPartyCurrentTile].myArrayNumber);
} else {
failLongWalk = true;
};
_local2++;
};
} else {
if ((((tilesDifference < 0)) && ((-(tilesDifference) <= partyUnitArray1[currentUnitPlayerMoves].movesLeft)))){
tempLongwalkOrientation = 180;
longWalkGUI.moveTooltipInsideGraph.rotation = -90;
longWalkGUI.moveTooltipInsideGraph.scaleX = -1;
longWalkGUI.longWalkInterfaceText.x = -20.15;
tilesDifference = -(tilesDifference);
longWalkPartyCurrentTile = landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].myArrayNumber;
_local3 = 1;
while (_local3 <= tilesDifference) {
if (landTileArray[longWalkPartyCurrentTile].tileRow == (landGridNumberVertical - 1)){
longWalkPartyCurrentTile = landTileArray[(longWalkPartyCurrentTile + kingdom1ToKingdom3TileDifference)].myArrayNumber;
} else {
longWalkPartyCurrentTile = landTileArray[(longWalkPartyCurrentTile + 1)].myArrayNumber;
};
if ((((((((((((((((((wallSlotArray[landTileArray[longWalkPartyCurrentTile].upWall].alpha == 0)) || ((wallSlotArray[landTileArray[longWalkPartyCurrentTile].upWall].player == 1)))) && ((((((wallSlotArray[landTileArray[longWalkPartyCurrentTile].bottomWall].alpha == 0)) || ((_local3 == tilesDifference)))) || ((wallSlotArray[landTileArray[longWalkPartyCurrentTile].bottomWall].player == 1)))))) && ((landTileArray[longWalkPartyCurrentTile].party2 == 0)))) && ((landTileArray[longWalkPartyCurrentTile].party3 == 0)))) && ((landTileArray[longWalkPartyCurrentTile].party4 == 0)))) && ((landTileArray[longWalkPartyCurrentTile].party5 == 0)))) && (!((landTileArray[longWalkPartyCurrentTile].blockTile == true))))) && (((!((landTileArray[longWalkPartyCurrentTile].startBuildTile == true))) || ((landTileArray[longWalkPartyCurrentTile].player == 1)))))){
longWalkArray.push(landTileArray[longWalkPartyCurrentTile].myArrayNumber);
} else {
failLongWalk = true;
};
_local3++;
};
};
};
if ((((failLongWalk == false)) && (!((partyUnitArray1[currentUnitPlayerMoves].defensiveUnit == true))))){
longWalkGUI.x = _arg1.target.x;
longWalkGUI.y = _arg1.target.y;
longWalkGUI.longWalkInterfaceText.text = tilesDifference;
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(longWalkGUI, (getChildIndex(escapeMenu) - 1));
if ((((tilesDifference > 0)) && ((tilesDifference <= partyUnitArray1[currentUnitPlayerMoves].movesLeft)))){
longWalkGUI.visible = true;
};
} else {
longWalkGUI.visible = false;
};
};
};
};
}
public function makeTheLongWalk(_arg1:TimerEvent):void{
if (gameOver == false){
if ((((((slidingUnit == false)) || ((longWalkSliding == false)))) && ((longWalkArray.length > 0)))){
partyUnitArray1[currentUnitPlayerMoves].rotation = tempLongwalkOrientation;
slidingUnit = true;
longWalkSliding = true;
turnPartyLedOff();
firstMoveRight = false;
firstMoveLeft = false;
firstMoveUp = false;
firstMoveDown = false;
slideToX = landTileArray[longWalkArray[0]].x;
slideToY = landTileArray[longWalkArray[0]].y;
landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].party1 = (landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].party1 - 1);
partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile = landTileArray[longWalkArray[0]].myArrayNumber;
landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].party1 = (landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].party1 + 1);
partyUnitArray1[currentUnitPlayerMoves].movesLeft = (partyUnitArray1[currentUnitPlayerMoves].movesLeft - 1);
playerUpdateMoveText();
turnPartyLedOn();
if (longWalkArray.length > 0){
longWalkArray.splice(0, 1);
TimerSlidePartyUnit.start();
};
} else {
if (longWalkArray.length <= 0){
TimerLongWalk.stop();
longWalkSliding = false;
slidingUnit = false;
};
};
};
}
public function placeGathererUnitCall(_arg1:TimerEvent):void{
TimerDelayPlaceStarterGathererEnd.start();
}
public function placeGathererUnit(_arg1:TimerEvent):void{
if (gameOver == false){
if ((((currentTurn == 1)) && ((p1starterGathererPlaced == false)))){
if (learningWhilePlaying == true){
learnAsYouPlayToolTip.gotoAndStop(3);
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(learnAsYouPlayToolTip, (getChildIndex(escapeMenu) - 1));
animateTooltipWithSlide();
learnAsYouPlayToolTip.visible = true;
} else {
setChildIndex(statusBar, (getChildIndex(player1GameBar) - 1));
learnAsYouPlayToolTip.gotoAndStop(3);
statusBar.gotoAndStop(2);
statusBar.visible = true;
};
Mouse.hide();
constructorModeMouse.visible = true;
} else {
if ((((currentTurn == 2)) && ((p2starterGathererPlaced == false)))){
chan_soundFX = snd_place_gatherer.play(0, 0, snd_FXVolume);
p2starterGathererPlaced = true;
gathererUnit = new gathererUnitLIB();
gathererUnit.x = landTileArray[player2ChosenGatherTile].x;
gathererUnit.y = landTileArray[player2ChosenGatherTile].y;
gathererUnit.width = gathererUnitWidth;
gathererUnit.height = gathererUnitHeight;
gathererUnitArray.push(starterBuilding);
gathererUnit.player = currentTurn;
landTileArray[player2ChosenGatherTile].hasGatherer = true;
gathererUnit.partyCurrentTile = landTileArray[player2ChosenGatherTile].myArrayNumber;
gathererUnit.addEventListener(MouseEvent.MOUSE_DOWN, playerMoveToGathererUnit);
gathererUnit.mouseEnabled = false;
if (landTileArray[player2ChosenGatherTile].resource == 1){
gathererUnit.gotoAndStop(1);
} else {
if (landTileArray[player2ChosenGatherTile].resource == 2){
gathererUnit.gotoAndStop(2);
} else {
if (landTileArray[player2ChosenGatherTile].resource == 3){
gathererUnit.gotoAndStop(3);
} else {
if (landTileArray[player2ChosenGatherTile].resource == 4){
gathererUnit.gotoAndStop(4);
};
};
};
};
addChild(gathererUnit);
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(gathererUnit, (getChildIndex(escapeMenu) - 1));
gathererTooltip.visible = false;
if (landTileArray[player2ChosenGatherTile].resource == 1){
producingResourceMessage.gotoAndStop(1);
} else {
if (landTileArray[player2ChosenGatherTile].resource == 2){
producingResourceMessage.gotoAndStop(2);
} else {
if (landTileArray[player2ChosenGatherTile].resource == 3){
producingResourceMessage.gotoAndStop(3);
} else {
if (landTileArray[player2ChosenGatherTile].resource == 4){
producingResourceMessage.gotoAndStop(4);
};
};
};
};
producingResourceMessage.x = landTileArray[player2ChosenGatherTile].x;
producingResourceMessage.y = landTileArray[player2ChosenGatherTile].y;
adjustProducingMessage();
riseTo2 = 0;
TimerShowProducingResource.start();
p2ProtectResource = landTileArray[player2ChosenGatherTile].myArrayNumber;
tilesToProtectPlayer2.push(landTileArray[player2ChosenGatherTile].myArrayNumber);
allGathererUnitArray.push(gathererUnit);
if (numberOfPlayers == 2){
currentTurn = 1;
} else {
if (numberOfPlayers == 3){
currentTurn = 3;
} else {
if (numberOfPlayers == 4){
currentTurn = 4;
};
};
};
TimerDelayPlaceStarterGatherer.start();
} else {
if ((((currentTurn == 3)) && ((p3starterGathererPlaced == false)))){
chan_soundFX = snd_place_gatherer.play(0, 0, snd_FXVolume);
p3starterGathererPlaced = true;
gathererUnit = new gathererUnitLIB();
gathererUnit.x = landTileArray[player3ChosenGatherTile].x;
gathererUnit.y = landTileArray[player3ChosenGatherTile].y;
gathererUnit.width = gathererUnitWidth;
gathererUnit.height = gathererUnitHeight;
gathererUnitArray.push(starterBuilding);
gathererUnit.player = currentTurn;
landTileArray[player3ChosenGatherTile].hasGatherer = true;
gathererUnit.partyCurrentTile = landTileArray[player3ChosenGatherTile].myArrayNumber;
gathererUnit.addEventListener(MouseEvent.MOUSE_DOWN, playerMoveToGathererUnit);
gathererUnit.mouseEnabled = false;
if (landTileArray[player3ChosenGatherTile].resource == 1){
gathererUnit.gotoAndStop(1);
} else {
if (landTileArray[player3ChosenGatherTile].resource == 2){
gathererUnit.gotoAndStop(2);
} else {
if (landTileArray[player3ChosenGatherTile].resource == 3){
gathererUnit.gotoAndStop(3);
} else {
if (landTileArray[player3ChosenGatherTile].resource == 4){
gathererUnit.gotoAndStop(4);
};
};
};
};
addChild(gathererUnit);
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(gathererUnit, (getChildIndex(escapeMenu) - 1));
p3ProtectResource = landTileArray[player3ChosenGatherTile].myArrayNumber;
gathererTooltip.visible = false;
if (landTileArray[player3ChosenGatherTile].resource == 1){
producingResourceMessage.gotoAndStop(1);
} else {
if (landTileArray[player3ChosenGatherTile].resource == 2){
producingResourceMessage.gotoAndStop(2);
} else {
if (landTileArray[player3ChosenGatherTile].resource == 3){
producingResourceMessage.gotoAndStop(3);
} else {
if (landTileArray[player3ChosenGatherTile].resource == 4){
producingResourceMessage.gotoAndStop(4);
};
};
};
};
producingResourceMessage.x = landTileArray[player3ChosenGatherTile].x;
producingResourceMessage.y = landTileArray[player3ChosenGatherTile].y;
adjustProducingMessage();
riseTo2 = 0;
TimerShowProducingResource.start();
tilesToProtectPlayer3.push(landTileArray[player3ChosenGatherTile].myArrayNumber);
allGathererUnitArray.push(gathererUnit);
currentTurn = 1;
TimerDelayPlaceStarterGatherer.start();
} else {
if ((((currentTurn == 4)) && ((p4starterGathererPlaced == false)))){
chan_soundFX = snd_place_gatherer.play(0, 0, snd_FXVolume);
p4starterGathererPlaced = true;
gathererUnit = new gathererUnitLIB();
gathererUnit.x = landTileArray[player4ChosenGatherTile].x;
gathererUnit.y = landTileArray[player4ChosenGatherTile].y;
gathererUnit.width = gathererUnitWidth;
gathererUnit.height = gathererUnitHeight;
gathererUnitArray.push(starterBuilding);
landTileArray[player4ChosenGatherTile].hasGatherer = true;
gathererUnit.player = currentTurn;
gathererUnit.partyCurrentTile = landTileArray[player4ChosenGatherTile].myArrayNumber;
gathererUnit.addEventListener(MouseEvent.MOUSE_DOWN, playerMoveToGathererUnit);
gathererUnit.mouseEnabled = false;
if (landTileArray[player4ChosenGatherTile].resource == 1){
gathererUnit.gotoAndStop(1);
} else {
if (landTileArray[player4ChosenGatherTile].resource == 2){
gathererUnit.gotoAndStop(2);
} else {
if (landTileArray[player4ChosenGatherTile].resource == 3){
gathererUnit.gotoAndStop(3);
} else {
if (landTileArray[player4ChosenGatherTile].resource == 4){
gathererUnit.gotoAndStop(4);
};
};
};
};
addChild(gathererUnit);
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(gathererUnit, (getChildIndex(escapeMenu) - 1));
p4ProtectResource = landTileArray[player4ChosenGatherTile].myArrayNumber;
tilesToProtectPlayer4.push(landTileArray[player4ChosenGatherTile].myArrayNumber);
gathererTooltip.visible = false;
if (landTileArray[player4ChosenGatherTile].resource == 1){
producingResourceMessage.gotoAndStop(1);
} else {
if (landTileArray[player4ChosenGatherTile].resource == 2){
producingResourceMessage.gotoAndStop(2);
} else {
if (landTileArray[player4ChosenGatherTile].resource == 3){
producingResourceMessage.gotoAndStop(3);
} else {
if (landTileArray[player4ChosenGatherTile].resource == 4){
producingResourceMessage.gotoAndStop(4);
};
};
};
};
producingResourceMessage.x = landTileArray[player4ChosenGatherTile].x;
producingResourceMessage.y = landTileArray[player4ChosenGatherTile].y;
adjustProducingMessage();
riseTo2 = 0;
TimerShowProducingResource.start();
allGathererUnitArray.push(gathererUnit);
currentTurn = 3;
TimerDelayPlaceStarterGatherer.start();
} else {
currentTurn = startingTurnPlayer;
gameTurn();
};
};
};
};
};
}
public function rotateUnitLeft(_arg1:MouseEvent):void{
if (gameOver == false){
if ((((((allowPlayerToMoveUnit == true)) && ((currentTurn == 1)))) && ((slidingUnit == false)))){
if (partyUnitArray1[currentUnitPlayerMoves].defensiveUnit == true){
chan_soundFX = snd_unit_rotate.play(0, 0, snd_FXVolume);
if (partyUnitArray1[currentUnitPlayerMoves].rotation == 0){
partyUnitArray1[currentUnitPlayerMoves].rotation = 90;
} else {
if (partyUnitArray1[currentUnitPlayerMoves].rotation == 90){
partyUnitArray1[currentUnitPlayerMoves].rotation = 180;
} else {
if (partyUnitArray1[currentUnitPlayerMoves].rotation == 180){
partyUnitArray1[currentUnitPlayerMoves].rotation = -90;
} else {
if (partyUnitArray1[currentUnitPlayerMoves].rotation == -90){
partyUnitArray1[currentUnitPlayerMoves].rotation = 0;
};
};
};
};
landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].defensiveUnitRotation = partyUnitArray1[currentUnitPlayerMoves].rotation;
};
};
};
}
public function updateGameBars():void{
if (gameOver == false){
player1GameBar.textSymbolP1.p1r1Text.text = ("" + p1Resource1Qtt);
player1GameBar.textSymbolP1.p1r2Text.text = ("" + p1Resource2Qtt);
player1GameBar.textSymbolP1.p1r3Text.text = ("" + p1Resource3Qtt);
player1GameBar.textSymbolP1.p1r4Text.text = ("" + p1Resource4Qtt);
player1GameBar.textSymbolP1.p1Unittext.text = ("" + p1UnitQtt);
player1GameBar.textSymbolP1.p1WallText.text = ("" + p1WallQtt);
player1GameBar.textSymbolP1.p1GathererText.text = ("" + p1GathererQtt);
player2GameBar.textSymbolP2.p2r1Text.text = ("" + p2Resource1Qtt);
player2GameBar.textSymbolP2.p2r2Text.text = ("" + p2Resource2Qtt);
player2GameBar.textSymbolP2.p2r3Text.text = ("" + p2Resource3Qtt);
player2GameBar.textSymbolP2.p2r4Text.text = ("" + p2Resource4Qtt);
player2GameBar.textSymbolP2.p2Unittext.text = ("" + p2UnitQtt);
player2GameBar.textSymbolP2.p2WallText.text = ("" + p2WallQtt);
player2GameBar.textSymbolP2.p2GathererText.text = ("" + p2GathererQtt);
player3GameBar.textSymbolP3.p3r1Text.text = ("" + p3Resource1Qtt);
player3GameBar.textSymbolP3.p3r2Text.text = ("" + p3Resource2Qtt);
player3GameBar.textSymbolP3.p3r3Text.text = ("" + p3Resource3Qtt);
player3GameBar.textSymbolP3.p3r4Text.text = ("" + p3Resource4Qtt);
player3GameBar.textSymbolP3.p3Unittext.text = ("" + p3UnitQtt);
player3GameBar.textSymbolP3.p3WallText.text = ("" + p3WallQtt);
player3GameBar.textSymbolP3.p3GathererText.text = ("" + p3GathererQtt);
player4GameBar.textSymbolP4.p4r1Text.text = ("" + p4Resource1Qtt);
player4GameBar.textSymbolP4.p4r2Text.text = ("" + p4Resource2Qtt);
player4GameBar.textSymbolP4.p4r3Text.text = ("" + p4Resource3Qtt);
player4GameBar.textSymbolP4.p4r4Text.text = ("" + p4Resource4Qtt);
player4GameBar.textSymbolP4.p4Unittext.text = ("" + p4UnitQtt);
player4GameBar.textSymbolP4.p4WallText.text = ("" + p4WallQtt);
player4GameBar.textSymbolP4.p4GathererText.text = ("" + p4GathererQtt);
if ((((p1UpgradePower >= 15)) && ((giveUpgradeAchievement == false)))){
giveUpgradeAchievement = true;
API.unlockMedal("Massive Damage");
};
if ((((p1Resource2Qtt >= 50)) && ((giveUpgradeAchievementSecretOoze == false)))){
giveUpgradeAchievementSecretOoze = true;
API.unlockMedal("Can you decipher it?");
};
};
}
public function showEnemyPowerTooltip(_arg1:MouseEvent):void{
showEnemyStrength.x = _arg1.target.x;
showEnemyStrength.y = _arg1.target.y;
if (_arg1.target.showPower == 2){
showEnemyStrength.showPowerCombat.text = ("+" + p2UpgradePower);
showEnemyStrength.showPowerSpeed.text = ("+" + p2UpgradeSpeed);
} else {
if (_arg1.target.showPower == 3){
showEnemyStrength.showPowerCombat.text = ("+" + p3UpgradePower);
showEnemyStrength.showPowerSpeed.text = ("+" + p3UpgradeSpeed);
} else {
if (_arg1.target.showPower == 4){
showEnemyStrength.showPowerCombat.text = ("+" + p4UpgradePower);
showEnemyStrength.showPowerSpeed.text = ("+" + p4UpgradeSpeed);
};
};
};
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(showEnemyStrength, (getChildIndex(escapeMenu) - 1));
showEnemyStrength.visible = true;
}
public function hideEnemyPowerTooltip(_arg1:MouseEvent):void{
showEnemyStrength.visible = false;
}
public function hideCivExpansions(_arg1:MouseEvent):void{
btn_chooseCivExpansion.visible = false;
btn_chooseCivExpansion.y = -500;
}
public function upgradesGreOutPlayer1():void{
var _local1:Number;
_local1 = 0.5;
btn_chooseCivExpansion.bnt_civExpandChoice1.upgradesGreyOut.alpha = _local1;
btn_chooseCivExpansion.bnt_civExpandChoice2.upgradesGreyOut.alpha = _local1;
btn_chooseCivExpansion.bnt_civExpandChoice3.upgradesGreyOut.alpha = _local1;
btn_chooseCivExpansion.bnt_civExpandChoice4.upgradesGreyOut.alpha = _local1;
btn_chooseCivExpansion.bnt_civExpandChoice5.upgradesGreyOut.alpha = _local1;
btn_chooseCivExpansion.bnt_civExpandChoice6.upgradesGreyOut.alpha = _local1;
if ((((((((((((((currentTurn == 1)) && ((allowP1UpGradeBuy == true)))) && ((p1Resource1Qtt >= exp1Resource1Cost)))) && ((p1Resource2Qtt >= exp1Resource2Cost)))) && ((p1Resource3Qtt >= exp1Resource3Cost)))) && ((p1Resource4Qtt >= exp1Resource4Cost)))) && ((player1ChoosingDiceRoll == false)))){
btn_chooseCivExpansion.bnt_civExpandChoice1.upgradesGreyOut.alpha = 0;
};
if ((((((((((((((currentTurn == 1)) && ((allowP1UpGradeBuy == true)))) && ((p1Resource1Qtt >= exp2Resource1Cost)))) && ((p1Resource2Qtt >= exp2Resource2Cost)))) && ((p1Resource3Qtt >= exp2Resource3Cost)))) && ((p1Resource4Qtt >= exp2Resource4Cost)))) && ((player1ChoosingDiceRoll == false)))){
btn_chooseCivExpansion.bnt_civExpandChoice2.upgradesGreyOut.alpha = 0;
};
if ((((((((((((((currentTurn == 1)) && ((allowP1UpGradeBuy == true)))) && ((p1Resource1Qtt >= exp3Resource1Cost)))) && ((p1Resource2Qtt >= exp3Resource2Cost)))) && ((p1Resource3Qtt >= exp3Resource3Cost)))) && ((p1Resource4Qtt >= exp3Resource4Cost)))) && ((player1ChoosingDiceRoll == false)))){
btn_chooseCivExpansion.bnt_civExpandChoice3.upgradesGreyOut.alpha = 0;
};
if ((((((((((((((currentTurn == 1)) && ((allowP1UpGradeBuy == true)))) && ((p1Resource1Qtt >= exp4Resource1Cost)))) && ((p1Resource2Qtt >= exp4Resource2Cost)))) && ((p1Resource3Qtt >= exp4Resource3Cost)))) && ((p1Resource4Qtt >= exp4Resource4Cost)))) && ((player1ChoosingDiceRoll == false)))){
btn_chooseCivExpansion.bnt_civExpandChoice4.upgradesGreyOut.alpha = 0;
};
if ((((((((((((((currentTurn == 1)) && ((allowP1UpGradeBuy == true)))) && ((p1Resource1Qtt >= exp5Resource1Cost)))) && ((p1Resource2Qtt >= exp5Resource2Cost)))) && ((p1Resource3Qtt >= exp5Resource3Cost)))) && ((p1Resource4Qtt >= exp5Resource4Cost)))) && ((player1ChoosingDiceRoll == false)))){
btn_chooseCivExpansion.bnt_civExpandChoice5.upgradesGreyOut.alpha = 0;
};
if ((((((((((((((currentTurn == 1)) && ((allowP1UpGradeBuy == true)))) && ((p1Resource1Qtt >= exp6Resource1Cost)))) && ((p1Resource2Qtt >= exp6Resource2Cost)))) && ((p1Resource3Qtt >= exp6Resource3Cost)))) && ((p1Resource4Qtt >= exp6Resource4Cost)))) && ((player1ChoosingDiceRoll == false)))){
btn_chooseCivExpansion.bnt_civExpandChoice6.upgradesGreyOut.alpha = 0;
};
}
public function p1ShowCivExpansions(_arg1:MouseEvent):void{
allowP1UpGradeBuy = true;
civAttackRaceModifier = 0;
civWallRaceModifier = 0;
civEvolutionRaceModifier = 0;
civGathererRaceModifier = 0;
if (player1Race == "keeper"){
civGathererRaceModifier = -(KeeperResourceDiscount);
civAttackRaceModifier = KeeperAttackPenalty;
btn_chooseCivExpansion.bnt_civExpandChoice3.gotoAndStop(1);
} else {
if (player1Race == "builder"){
civWallRaceModifier = -(BuilderWallDiscount);
btn_chooseCivExpansion.bnt_civExpandChoice3.gotoAndStop(2);
} else {
if (player1Race == "expander"){
civEvolutionRaceModifier = -(ScibotEvolutionDiscount);
btn_chooseCivExpansion.bnt_civExpandChoice3.gotoAndStop(3);
} else {
if (player1Race == "raider"){
civGathererRaceModifier = WarBuildingPenalty;
civWallRaceModifier = WarBuildingPenalty;
btn_chooseCivExpansion.bnt_civExpandChoice3.gotoAndStop(4);
civAttackRaceModifier = -(WarAttackDiscount);
};
};
};
};
btn_chooseCivExpansion.gotoAndStop(1);
if (landTileArray[p1StarterBuildingTile].y < playerMode2Beacon.y){
btn_chooseCivExpansion.x = landTileArray[p1StarterBuildingTile].x;
btn_chooseCivExpansion.y = playerMode2Beacon.y;
btn_chooseCivExpansion.upgradeInvisTab.y = -33.8;
btn_chooseCivExpansion.upgradeInvisTab.y = (btn_chooseCivExpansion.upgradeInvisTab.y + (landTileArray[p1StarterBuildingTile].y - playerMode2Beacon.y));
} else {
btn_chooseCivExpansion.x = landTileArray[p1StarterBuildingTile].x;
btn_chooseCivExpansion.y = landTileArray[p1StarterBuildingTile].y;
btn_chooseCivExpansion.upgradeInvisTab.y = -33.8;
};
btn_chooseCivExpansion.deployRobotButton.y = btn_chooseCivExpansion.upgradeInvisTab.y;
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(btn_chooseCivExpansion, (getChildIndex(escapeMenu) - 1));
btn_chooseCivExpansion.upgradesTextHolder.upgradesAttackDisplay.text = ("+" + p1UpgradePower);
btn_chooseCivExpansion.upgradesTextHolder.upgradesSpeedDisplay.text = ("+" + p1UpgradeSpeed);
upgradesGreOutPlayer1();
btn_chooseCivExpansion.visible = true;
}
public function p2ShowCivExpansions(_arg1:MouseEvent):void{
allowP1UpGradeBuy = false;
civAttackRaceModifier = 0;
civWallRaceModifier = 0;
civEvolutionRaceModifier = 0;
civGathererRaceModifier = 0;
if (player2Race == "keeper"){
btn_chooseCivExpansion.bnt_civExpandChoice3.gotoAndStop(1);
civGathererRaceModifier = -(KeeperResourceDiscount);
civAttackRaceModifier = KeeperAttackPenalty;
} else {
if (player2Race == "builder"){
btn_chooseCivExpansion.bnt_civExpandChoice3.gotoAndStop(2);
civWallRaceModifier = -(BuilderWallDiscount);
} else {
if (player2Race == "expander"){
btn_chooseCivExpansion.bnt_civExpandChoice3.gotoAndStop(3);
civEvolutionRaceModifier = -(ScibotEvolutionDiscount);
} else {
if (player2Race == "raider"){
btn_chooseCivExpansion.bnt_civExpandChoice3.gotoAndStop(4);
civGathererRaceModifier = WarBuildingPenalty;
civWallRaceModifier = WarBuildingPenalty;
civAttackRaceModifier = -(WarAttackDiscount);
};
};
};
};
if (numberOfPlayers == 4){
btn_chooseCivExpansion.gotoAndStop(2);
} else {
btn_chooseCivExpansion.gotoAndStop(1);
};
trace("boing2.5");
btn_chooseCivExpansion.x = (player2GameBar.getChildByName("p2ShowCivExpansions").x + player2GameBar.x);
btn_chooseCivExpansion.y = (player2GameBar.getChildByName("p2ShowCivExpansions").y + player2GameBar.y);
trace("boing2.6");
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(btn_chooseCivExpansion, (getChildIndex(escapeMenu) - 1));
trace("boing2.7");
btn_chooseCivExpansion.upgradesTextHolder.upgradesAttackDisplay.text = ("+" + p2UpgradePower);
btn_chooseCivExpansion.upgradesTextHolder.upgradesSpeedDisplay.text = ("+" + p2UpgradeSpeed);
trace("boing3");
btn_chooseCivExpansion.bnt_civExpandChoice1.upgradesGreyOut.alpha = 0;
btn_chooseCivExpansion.bnt_civExpandChoice2.upgradesGreyOut.alpha = 0;
btn_chooseCivExpansion.bnt_civExpandChoice3.upgradesGreyOut.alpha = 0;
btn_chooseCivExpansion.bnt_civExpandChoice4.upgradesGreyOut.alpha = 0;
btn_chooseCivExpansion.bnt_civExpandChoice5.upgradesGreyOut.alpha = 0;
btn_chooseCivExpansion.bnt_civExpandChoice6.upgradesGreyOut.alpha = 0;
trace("boing4");
btn_chooseCivExpansion.visible = true;
}
public function p3ShowCivExpansions(_arg1:MouseEvent):void{
allowP1UpGradeBuy = false;
civAttackRaceModifier = 0;
civWallRaceModifier = 0;
civEvolutionRaceModifier = 0;
civGathererRaceModifier = 0;
if (player3Race == "keeper"){
btn_chooseCivExpansion.bnt_civExpandChoice3.gotoAndStop(1);
civGathererRaceModifier = -(KeeperResourceDiscount);
civAttackRaceModifier = KeeperAttackPenalty;
} else {
if (player3Race == "builder"){
btn_chooseCivExpansion.bnt_civExpandChoice3.gotoAndStop(2);
civWallRaceModifier = -(BuilderWallDiscount);
} else {
if (player3Race == "expander"){
btn_chooseCivExpansion.bnt_civExpandChoice3.gotoAndStop(3);
civEvolutionRaceModifier = -(ScibotEvolutionDiscount);
} else {
if (player3Race == "raider"){
btn_chooseCivExpansion.bnt_civExpandChoice3.gotoAndStop(4);
civGathererRaceModifier = WarBuildingPenalty;
civWallRaceModifier = WarBuildingPenalty;
civAttackRaceModifier = -(WarAttackDiscount);
};
};
};
};
btn_chooseCivExpansion.gotoAndStop(3);
btn_chooseCivExpansion.x = (player3GameBar.getChildByName("p3ShowCivExpansions").x + player3GameBar.x);
btn_chooseCivExpansion.y = (player3GameBar.getChildByName("p3ShowCivExpansions").y + player3GameBar.y);
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(btn_chooseCivExpansion, (getChildIndex(escapeMenu) - 1));
btn_chooseCivExpansion.upgradesTextHolder.upgradesAttackDisplay.text = ("+" + p3UpgradePower);
btn_chooseCivExpansion.upgradesTextHolder.upgradesSpeedDisplay.text = ("+" + p3UpgradeSpeed);
btn_chooseCivExpansion.bnt_civExpandChoice1.upgradesGreyOut.alpha = 0;
btn_chooseCivExpansion.bnt_civExpandChoice2.upgradesGreyOut.alpha = 0;
btn_chooseCivExpansion.bnt_civExpandChoice3.upgradesGreyOut.alpha = 0;
btn_chooseCivExpansion.bnt_civExpandChoice4.upgradesGreyOut.alpha = 0;
btn_chooseCivExpansion.bnt_civExpandChoice5.upgradesGreyOut.alpha = 0;
btn_chooseCivExpansion.bnt_civExpandChoice6.upgradesGreyOut.alpha = 0;
btn_chooseCivExpansion.visible = true;
}
public function p4ShowCivExpansions(_arg1:MouseEvent):void{
allowP1UpGradeBuy = false;
civAttackRaceModifier = 0;
civWallRaceModifier = 0;
civEvolutionRaceModifier = 0;
civGathererRaceModifier = 0;
if (player4Race == "keeper"){
btn_chooseCivExpansion.bnt_civExpandChoice3.gotoAndStop(1);
civGathererRaceModifier = -(KeeperResourceDiscount);
civAttackRaceModifier = KeeperAttackPenalty;
} else {
if (player4Race == "builder"){
btn_chooseCivExpansion.bnt_civExpandChoice3.gotoAndStop(2);
civWallRaceModifier = -(BuilderWallDiscount);
} else {
if (player4Race == "expander"){
btn_chooseCivExpansion.bnt_civExpandChoice3.gotoAndStop(3);
civEvolutionRaceModifier = -(ScibotEvolutionDiscount);
} else {
if (player4Race == "raider"){
btn_chooseCivExpansion.bnt_civExpandChoice3.gotoAndStop(4);
civGathererRaceModifier = WarBuildingPenalty;
civWallRaceModifier = WarBuildingPenalty;
civAttackRaceModifier = -(WarAttackDiscount);
};
};
};
};
btn_chooseCivExpansion.gotoAndStop(4);
btn_chooseCivExpansion.x = (player4GameBar.getChildByName("p4ShowCivExpansions").x + player4GameBar.x);
btn_chooseCivExpansion.y = (player4GameBar.getChildByName("p4ShowCivExpansions").y + player4GameBar.y);
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(btn_chooseCivExpansion, (getChildIndex(escapeMenu) - 1));
btn_chooseCivExpansion.upgradesTextHolder.upgradesAttackDisplay.text = ("+" + p4UpgradePower);
btn_chooseCivExpansion.upgradesTextHolder.upgradesSpeedDisplay.text = ("+" + p4UpgradeSpeed);
btn_chooseCivExpansion.bnt_civExpandChoice1.upgradesGreyOut.alpha = 0;
btn_chooseCivExpansion.bnt_civExpandChoice2.upgradesGreyOut.alpha = 0;
btn_chooseCivExpansion.bnt_civExpandChoice3.upgradesGreyOut.alpha = 0;
btn_chooseCivExpansion.bnt_civExpandChoice4.upgradesGreyOut.alpha = 0;
btn_chooseCivExpansion.bnt_civExpandChoice5.upgradesGreyOut.alpha = 0;
btn_chooseCivExpansion.bnt_civExpandChoice6.upgradesGreyOut.alpha = 0;
btn_chooseCivExpansion.visible = true;
}
public function skipTutorialIntro(_arg1:MouseEvent):void{
tutoBoxMainIntro.visible = false;
skipMiniBoxIntro.visible = false;
}
public function hideMindUpgradeDisplay(_arg1:MouseEvent):void{
mindUpgradeDisplay.visible = false;
if (currentTurn != 1){
movingUnit = 0;
TimerAnimatePieces.stop();
TimerAnimatePieces.start();
};
}
public function displayTooltip():void{
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(tooltipBox, (getChildIndex(escapeMenu) - 1));
tooltipBox.visible = true;
}
public function hideTooltip(_arg1:MouseEvent):void{
tooltipBox.tooltipBoxText.text = "";
tooltipBox.resource1TooltipText.text = "";
tooltipBox.resource2TooltipText.text = "";
tooltipBox.resource3TooltipText.text = "";
tooltipBox.resource4TooltipText.text = "";
tooltipBox.visible = false;
}
public function diceRoll1tooltip(_arg1:MouseEvent):void{
tooltipBox.tooltipBoxText.text = "\nEvolution card";
tooltipBox.resource1TooltipText.text = "0";
tooltipBox.resource2TooltipText.text = "0";
tooltipBox.resource3TooltipText.text = "0";
tooltipBox.resource4TooltipText.text = "0";
displayTooltip();
}
public function diceRoll2tooltip(_arg1:MouseEvent):void{
tooltipBox.tooltipBoxText.text = "+1 Robot\n+1 Wall";
tooltipBox.resource1TooltipText.text = "0";
tooltipBox.resource2TooltipText.text = "0";
tooltipBox.resource3TooltipText.text = "0";
tooltipBox.resource4TooltipText.text = "0";
displayTooltip();
}
public function diceRoll3tooltip(_arg1:MouseEvent):void{
tooltipBox.tooltipBoxText.text = "";
tooltipBox.resource1TooltipText.text = "0";
tooltipBox.resource2TooltipText.text = "0";
tooltipBox.resource3TooltipText.text = "+2";
tooltipBox.resource4TooltipText.text = "+5";
displayTooltip();
}
public function diceRoll4tooltip(_arg1:MouseEvent):void{
tooltipBox.tooltipBoxText.text = "\n+1 Robot";
tooltipBox.resource1TooltipText.text = "0";
tooltipBox.resource2TooltipText.text = "+1";
tooltipBox.resource3TooltipText.text = "+1";
tooltipBox.resource4TooltipText.text = "0";
displayTooltip();
}
public function diceRoll5tooltip(_arg1:MouseEvent):void{
tooltipBox.tooltipBoxText.text = "";
tooltipBox.resource1TooltipText.text = "+2";
tooltipBox.resource2TooltipText.text = "+2";
tooltipBox.resource3TooltipText.text = "+2";
tooltipBox.resource4TooltipText.text = "0";
displayTooltip();
}
public function diceRoll6tooltip(_arg1:MouseEvent):void{
tooltipBox.tooltipBoxText.text = "Evolution card\n+1 Wall";
tooltipBox.resource1TooltipText.text = "0";
tooltipBox.resource2TooltipText.text = "0";
tooltipBox.resource3TooltipText.text = "0";
tooltipBox.resource4TooltipText.text = "0";
displayTooltip();
}
public function diceRoll7tooltip(_arg1:MouseEvent):void{
tooltipBox.tooltipBoxText.text = "\n+3 Robots";
tooltipBox.resource1TooltipText.text = "0";
tooltipBox.resource2TooltipText.text = "0";
tooltipBox.resource3TooltipText.text = "0";
tooltipBox.resource4TooltipText.text = "0";
displayTooltip();
}
public function diceRoll8tooltip(_arg1:MouseEvent):void{
tooltipBox.tooltipBoxText.text = "";
tooltipBox.resource1TooltipText.text = "+5";
tooltipBox.resource2TooltipText.text = "+5";
tooltipBox.resource3TooltipText.text = "+5";
tooltipBox.resource4TooltipText.text = "0";
displayTooltip();
}
public function diceRoll9tooltip(_arg1:MouseEvent):void{
tooltipBox.tooltipBoxText.text = "";
tooltipBox.resource1TooltipText.text = "0";
tooltipBox.resource2TooltipText.text = "0";
tooltipBox.resource3TooltipText.text = "0";
tooltipBox.resource4TooltipText.text = "+15";
displayTooltip();
}
public function diceRoll10tooltip(_arg1:MouseEvent):void{
tooltipBox.tooltipBoxText.text = "Evolution card\n+2 Robots";
tooltipBox.resource1TooltipText.text = "0";
tooltipBox.resource2TooltipText.text = "0";
tooltipBox.resource3TooltipText.text = "0";
tooltipBox.resource4TooltipText.text = "0";
displayTooltip();
}
public function diceRoll11tooltip(_arg1:MouseEvent):void{
tooltipBox.tooltipBoxText.text = "";
tooltipBox.resource1TooltipText.text = "+10";
tooltipBox.resource2TooltipText.text = "+10";
tooltipBox.resource3TooltipText.text = "+10";
tooltipBox.resource4TooltipText.text = "+10";
displayTooltip();
}
public function diceRoll12tooltip(_arg1:MouseEvent):void{
tooltipBox.tooltipBoxText.text = "\n+5 Walls";
tooltipBox.resource1TooltipText.text = "0";
tooltipBox.resource2TooltipText.text = "0";
tooltipBox.resource3TooltipText.text = "0";
tooltipBox.resource4TooltipText.text = "0";
displayTooltip();
}
public function civ1Tooltip(_arg1:MouseEvent):void{
var _local2:uint;
_local2 = (balanceAttackCost + civAttackRaceModifier);
tooltipBox.tooltipBoxText.text = "\nCombat power";
displayTooltip();
tooltipBox.resource1TooltipText.text = ("" + exp1Resource1Cost);
tooltipBox.resource2TooltipText.text = ("" + exp1Resource2Cost);
tooltipBox.resource3TooltipText.text = ("" + exp1Resource3Cost);
tooltipBox.resource4TooltipText.text = ("" + _local2);
}
public function civ2Tooltip(_arg1:MouseEvent):void{
var _local2:uint;
_local2 = (balanceWallCost + civWallRaceModifier);
tooltipBox.tooltipBoxText.text = "\nWall";
displayTooltip();
tooltipBox.resource1TooltipText.text = ("" + exp2Resource1Cost);
tooltipBox.resource2TooltipText.text = ("" + _local2);
tooltipBox.resource3TooltipText.text = ("" + exp2Resource3Cost);
tooltipBox.resource4TooltipText.text = ("" + exp2Resource4Cost);
}
public function civ3Tooltip(_arg1:MouseEvent):void{
tooltipBox.tooltipBoxText.text = "\nRobot";
displayTooltip();
tooltipBox.resource1TooltipText.text = ("" + exp3Resource1Cost);
tooltipBox.resource2TooltipText.text = ("" + exp3Resource2Cost);
tooltipBox.resource3TooltipText.text = ("" + exp3Resource3Cost);
tooltipBox.resource4TooltipText.text = ("" + exp3Resource4Cost);
}
public function civ4Tooltip(_arg1:MouseEvent):void{
tooltipBox.tooltipBoxText.text = "\nSpeed";
displayTooltip();
tooltipBox.resource1TooltipText.text = ("" + exp4Resource1Cost);
tooltipBox.resource2TooltipText.text = ("" + exp4Resource2Cost);
tooltipBox.resource3TooltipText.text = ("" + exp4Resource3Cost);
tooltipBox.resource4TooltipText.text = ("" + exp4Resource4Cost);
}
public function civ5Tooltip(_arg1:MouseEvent):void{
var _local2:uint;
_local2 = (balanceEvolutionCost + civEvolutionRaceModifier);
tooltipBox.tooltipBoxText.text = "\nEvolution card";
displayTooltip();
tooltipBox.resource1TooltipText.text = ("" + exp5Resource1Cost);
tooltipBox.resource2TooltipText.text = ("" + exp5Resource2Cost);
tooltipBox.resource3TooltipText.text = ("" + exp5Resource3Cost);
tooltipBox.resource4TooltipText.text = ("" + _local2);
}
public function civ6Tooltip(_arg1:MouseEvent):void{
var _local2:uint;
var _local3:uint;
_local2 = (balanceGathererCost2 + civGathererRaceModifier);
_local3 = (balanceGathererCost3 + civGathererRaceModifier);
tooltipBox.tooltipBoxText.text = "\nResource activator";
displayTooltip();
tooltipBox.resource1TooltipText.text = ("" + exp6Resource1Cost);
tooltipBox.resource2TooltipText.text = ("" + _local2);
tooltipBox.resource3TooltipText.text = ("" + _local3);
tooltipBox.resource4TooltipText.text = ("" + exp6Resource4Cost);
}
public function player1DiceRollChoice1(_arg1:MouseEvent):void{
if ((((((((dice1 == 1)) || ((dice2 == 1)))) && ((player1AlreadyChoseDiceRoll == false)))) && ((currentTurn == 1)))){
player1AlreadyChoseDiceRoll = true;
player1DiceRollChoice = 1;
tokenRollChoice.x = (btn_chooseDiceRoll.getChildByName("btn_dicechoice1").x + btn_chooseDiceRoll.x);
tokenRollChoice.y = (btn_chooseDiceRoll.getChildByName("btn_dicechoice1").y + btn_chooseDiceRoll.y);
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(tokenRollChoice, (getChildIndex(escapeMenu) - 1));
tokenRollChoice.visible = true;
chan_soundFX = snd_select_DiceRoll.play(0, 0, snd_FXVolume);
researchGetSetUp();
TimerDiceRollGetDelay.start();
};
}
public function player1DiceRollChoice2(_arg1:MouseEvent):void{
if ((((((((((dice1 == 2)) || ((dice2 == 2)))) || ((diceCombined == 2)))) && ((player1AlreadyChoseDiceRoll == false)))) && ((currentTurn == 1)))){
player1AlreadyChoseDiceRoll = true;
player1DiceRollChoice = 2;
tokenRollChoice.x = (btn_chooseDiceRoll.getChildByName("btn_dicechoice2").x + btn_chooseDiceRoll.x);
tokenRollChoice.y = (btn_chooseDiceRoll.getChildByName("btn_dicechoice2").y + btn_chooseDiceRoll.y);
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(tokenRollChoice, (getChildIndex(escapeMenu) - 1));
tokenRollChoice.visible = true;
chan_soundFX = snd_select_DiceRoll.play(0, 0, snd_FXVolume);
researchGetSetUp();
TimerDiceRollGetDelay.start();
};
}
public function player1DiceRollChoice3(_arg1:MouseEvent):void{
if ((((player1AlreadyChoseDiceRoll == false)) && ((currentTurn == 1)))){
if ((((((dice1 == 3)) || ((dice2 == 3)))) || ((diceCombined == 3)))){
player1AlreadyChoseDiceRoll = true;
player1DiceRollChoice = 3;
tokenRollChoice.x = (btn_chooseDiceRoll.getChildByName("btn_dicechoice3").x + btn_chooseDiceRoll.x);
tokenRollChoice.y = (btn_chooseDiceRoll.getChildByName("btn_dicechoice3").y + btn_chooseDiceRoll.y);
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(tokenRollChoice, (getChildIndex(escapeMenu) - 1));
tokenRollChoice.visible = true;
chan_soundFX = snd_select_DiceRoll.play(0, 0, snd_FXVolume);
researchGetSetUp();
TimerDiceRollGetDelay.start();
};
};
}
public function player1DiceRollChoice4(_arg1:MouseEvent):void{
if ((((player1AlreadyChoseDiceRoll == false)) && ((currentTurn == 1)))){
if ((((((dice1 == 4)) || ((dice2 == 4)))) || ((diceCombined == 4)))){
player1AlreadyChoseDiceRoll = true;
player1DiceRollChoice = 4;
tokenRollChoice.x = (btn_chooseDiceRoll.getChildByName("btn_dicechoice4").x + btn_chooseDiceRoll.x);
tokenRollChoice.y = (btn_chooseDiceRoll.getChildByName("btn_dicechoice4").y + btn_chooseDiceRoll.y);
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(tokenRollChoice, (getChildIndex(escapeMenu) - 1));
chan_soundFX = snd_select_DiceRoll.play(0, 0, snd_FXVolume);
tokenRollChoice.visible = true;
researchGetSetUp();
TimerDiceRollGetDelay.start();
};
};
}
public function player1DiceRollChoice5(_arg1:MouseEvent):void{
if ((((player1AlreadyChoseDiceRoll == false)) && ((currentTurn == 1)))){
if ((((((dice1 == 5)) || ((dice2 == 5)))) || ((diceCombined == 5)))){
player1AlreadyChoseDiceRoll = true;
player1DiceRollChoice = 5;
tokenRollChoice.x = (btn_chooseDiceRoll.getChildByName("btn_dicechoice5").x + btn_chooseDiceRoll.x);
tokenRollChoice.y = (btn_chooseDiceRoll.getChildByName("btn_dicechoice5").y + btn_chooseDiceRoll.y);
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(tokenRollChoice, (getChildIndex(escapeMenu) - 1));
chan_soundFX = snd_select_DiceRoll.play(0, 0, snd_FXVolume);
tokenRollChoice.visible = true;
researchGetSetUp();
TimerDiceRollGetDelay.start();
};
};
}
public function player1DiceRollChoice6(_arg1:MouseEvent):void{
if ((((player1AlreadyChoseDiceRoll == false)) && ((currentTurn == 1)))){
if ((((((dice1 == 6)) || ((dice2 == 6)))) || ((diceCombined == 6)))){
player1AlreadyChoseDiceRoll = true;
player1DiceRollChoice = 6;
tokenRollChoice.x = (btn_chooseDiceRoll.getChildByName("btn_dicechoice6").x + btn_chooseDiceRoll.x);
tokenRollChoice.y = (btn_chooseDiceRoll.getChildByName("btn_dicechoice6").y + btn_chooseDiceRoll.y);
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(tokenRollChoice, (getChildIndex(escapeMenu) - 1));
tokenRollChoice.visible = true;
chan_soundFX = snd_select_DiceRoll.play(0, 0, snd_FXVolume);
researchGetSetUp();
TimerDiceRollGetDelay.start();
};
};
}
public function player1DiceRollChoice7(_arg1:MouseEvent):void{
if ((((player1AlreadyChoseDiceRoll == false)) && ((currentTurn == 1)))){
if (diceCombined == 7){
player1AlreadyChoseDiceRoll = true;
player1DiceRollChoice = 7;
tokenRollChoice.x = (btn_chooseDiceRoll.getChildByName("btn_dicechoice7").x + btn_chooseDiceRoll.x);
tokenRollChoice.y = (btn_chooseDiceRoll.getChildByName("btn_dicechoice7").y + btn_chooseDiceRoll.y);
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(tokenRollChoice, (getChildIndex(escapeMenu) - 1));
tokenRollChoice.visible = true;
chan_soundFX = snd_select_DiceRoll.play(0, 0, snd_FXVolume);
researchGetSetUp();
TimerDiceRollGetDelay.start();
};
};
}
public function player1DiceRollChoice8(_arg1:MouseEvent):void{
if ((((player1AlreadyChoseDiceRoll == false)) && ((currentTurn == 1)))){
if (diceCombined == 8){
player1AlreadyChoseDiceRoll = true;
player1DiceRollChoice = 8;
tokenRollChoice.x = (btn_chooseDiceRoll.getChildByName("btn_dicechoice8").x + btn_chooseDiceRoll.x);
tokenRollChoice.y = (btn_chooseDiceRoll.getChildByName("btn_dicechoice8").y + btn_chooseDiceRoll.y);
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(tokenRollChoice, (getChildIndex(escapeMenu) - 1));
tokenRollChoice.visible = true;
chan_soundFX = snd_select_DiceRoll.play(0, 0, snd_FXVolume);
researchGetSetUp();
TimerDiceRollGetDelay.start();
};
};
}
public function player1DiceRollChoice9(_arg1:MouseEvent):void{
if ((((player1AlreadyChoseDiceRoll == false)) && ((currentTurn == 1)))){
if (diceCombined == 9){
player1AlreadyChoseDiceRoll = true;
player1DiceRollChoice = 9;
tokenRollChoice.x = (btn_chooseDiceRoll.getChildByName("btn_dicechoice9").x + btn_chooseDiceRoll.x);
tokenRollChoice.y = (btn_chooseDiceRoll.getChildByName("btn_dicechoice9").y + btn_chooseDiceRoll.y);
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(tokenRollChoice, (getChildIndex(escapeMenu) - 1));
tokenRollChoice.visible = true;
chan_soundFX = snd_select_DiceRoll.play(0, 0, snd_FXVolume);
researchGetSetUp();
TimerDiceRollGetDelay.start();
};
};
}
public function player1DiceRollChoice10(_arg1:MouseEvent):void{
if ((((player1AlreadyChoseDiceRoll == false)) && ((currentTurn == 1)))){
if (diceCombined == 10){
player1AlreadyChoseDiceRoll = true;
player1DiceRollChoice = 10;
tokenRollChoice.x = (btn_chooseDiceRoll.getChildByName("btn_dicechoice10").x + btn_chooseDiceRoll.x);
tokenRollChoice.y = (btn_chooseDiceRoll.getChildByName("btn_dicechoice10").y + btn_chooseDiceRoll.y);
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(tokenRollChoice, (getChildIndex(escapeMenu) - 1));
tokenRollChoice.visible = true;
chan_soundFX = snd_select_DiceRoll.play(0, 0, snd_FXVolume);
researchGetSetUp();
TimerDiceRollGetDelay.start();
};
};
}
public function player1DiceRollChoice11(_arg1:MouseEvent):void{
if ((((player1AlreadyChoseDiceRoll == false)) && ((currentTurn == 1)))){
if (diceCombined == 11){
player1AlreadyChoseDiceRoll = true;
player1DiceRollChoice = 11;
tokenRollChoice.x = (btn_chooseDiceRoll.getChildByName("btn_dicechoice11").x + btn_chooseDiceRoll.x);
tokenRollChoice.y = (btn_chooseDiceRoll.getChildByName("btn_dicechoice11").y + btn_chooseDiceRoll.y);
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(tokenRollChoice, (getChildIndex(escapeMenu) - 1));
tokenRollChoice.visible = true;
chan_soundFX = snd_select_DiceRoll.play(0, 0, snd_FXVolume);
researchGetSetUp();
TimerDiceRollGetDelay.start();
};
};
}
public function player1DiceRollChoice12(_arg1:MouseEvent):void{
if ((((player1AlreadyChoseDiceRoll == false)) && ((currentTurn == 1)))){
if (diceCombined == 12){
player1AlreadyChoseDiceRoll = true;
player1DiceRollChoice = 12;
tokenRollChoice.x = (btn_chooseDiceRoll.getChildByName("btn_dicechoice12").x + btn_chooseDiceRoll.x);
tokenRollChoice.y = (btn_chooseDiceRoll.getChildByName("btn_dicechoice12").y + btn_chooseDiceRoll.y);
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(tokenRollChoice, (getChildIndex(escapeMenu) - 1));
chan_soundFX = snd_select_DiceRoll.play(0, 0, snd_FXVolume);
tokenRollChoice.visible = true;
researchGetSetUp();
TimerDiceRollGetDelay.start();
};
};
}
public function diceRollChoice():void{
var _local1:Number;
dice1 = int(((Math.random() * 6) + 0.6));
dice2 = int(((Math.random() * 6) + 0.6));
if (dice1 > 6){
dice1 = 6;
};
if (dice2 > 6){
dice2 = 6;
};
if (dice1 <= 0){
dice1 = 1;
};
if (dice2 <= 0){
dice2 = 1;
};
if (currentTurn == 1){
if (dice1 < dice2){
dice1 = (dice1 + p1UpgradeRoll);
} else {
dice2 = (dice2 + p1UpgradeRoll);
};
} else {
if (currentTurn == 2){
if (dice1 < dice2){
dice1 = (dice1 + p2UpgradeRoll);
} else {
dice2 = (dice2 + p2UpgradeRoll);
};
} else {
if (currentTurn == 3){
if (dice1 < dice2){
dice1 = (dice1 + p3UpgradeRoll);
} else {
dice2 = (dice2 + p3UpgradeRoll);
};
} else {
if (currentTurn == 4){
if (dice1 < dice2){
dice1 = (dice1 + p4UpgradeRoll);
} else {
dice2 = (dice2 + p4UpgradeRoll);
};
};
};
};
};
if (dice1 > 6){
dice1 = 6;
};
if (dice2 > 6){
dice2 = 6;
};
diceCombined = (dice1 + dice2);
if ((dice1 + dice2) >= 10){
player2DiceRollChoice = (dice1 + dice2);
player3DiceRollChoice = (dice1 + dice2);
player4DiceRollChoice = (dice1 + dice2);
} else {
diceChoicesArray.push(diceCombined);
diceChoicesArray.push(diceCombined);
diceChoicesArray.push(diceCombined);
diceChoicesArray.push(diceCombined);
diceChoicesArray.push(dice1);
diceChoicesArray.push(dice2);
if ((((dice1 == 5)) && (!((diceCombined == 8))))){
diceChoicesArray.push(dice1);
};
if ((((dice2 == 5)) && (!((diceCombined == 8))))){
diceChoicesArray.push(dice2);
};
if (diceChoicesArray.length > 0){
diceChoiceMaxroll = (diceChoicesArray.length - 1);
diceChoiceMaxroll = int(((diceChoiceMaxroll * Math.random()) + 0.4));
if (diceChoiceMaxroll > (diceChoicesArray.length - 1)){
diceChoiceMaxroll = (diceChoicesArray.length - 1);
};
diceChoiceMaxroll = diceChoicesArray[diceChoiceMaxroll];
while (diceChoicesArray.length >= 1) {
diceChoicesArray.splice(0);
};
};
player2DiceRollChoice = diceChoiceMaxroll;
player3DiceRollChoice = diceChoiceMaxroll;
player4DiceRollChoice = diceChoiceMaxroll;
};
if (currentTurn == 2){
diceCombined = (dice1 + dice2);
playerDiceRollChoice = player2DiceRollChoice;
if ((((player2DiceRollChoice <= dice1)) && ((dice1 < dice2)))){
p2Resource4Qtt = (p2Resource4Qtt + dice2);
} else {
if (player2DiceRollChoice <= dice2){
p2Resource4Qtt = (p2Resource4Qtt + dice1);
};
};
} else {
if (currentTurn == 3){
if (numberOfPlayers > 2){
diceCombined = (dice1 + dice2);
playerDiceRollChoice = player3DiceRollChoice;
if ((((player3DiceRollChoice <= dice1)) && ((dice1 < dice2)))){
p3Resource4Qtt = (p3Resource4Qtt + dice2);
} else {
if (player3DiceRollChoice <= dice2){
p3Resource4Qtt = (p3Resource4Qtt + dice1);
};
};
};
} else {
if (currentTurn == 4){
if (numberOfPlayers > 3){
diceCombined = (dice1 + dice2);
playerDiceRollChoice = player4DiceRollChoice;
if ((((player4DiceRollChoice <= dice1)) && ((dice1 < dice2)))){
p4Resource4Qtt = (p4Resource4Qtt + dice2);
} else {
if (player4DiceRollChoice <= dice2){
p4Resource4Qtt = (p4Resource4Qtt + dice1);
};
};
};
} else {
if (currentTurn == 1){
diceCombined = (dice1 + dice2);
};
};
};
};
if (currentTurn == 1){
if (learnAsYouPlayToolTip.currentFrame == 4){
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(learnAsYouPlayToolTip, (getChildIndex(escapeMenu) - 1));
learnAsYouPlayToolTip.gotoAndStop(5);
animateTooltipWithSlide();
learnAsYouPlayToolTip.visible = true;
} else {
if (learnAsYouPlayToolTip.currentFrame == 5){
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(learnAsYouPlayToolTip, (getChildIndex(escapeMenu) - 1));
learnAsYouPlayToolTip.gotoAndStop(6);
animateTooltipWithSlide();
learnAsYouPlayToolTip.visible = true;
} else {
if (learnAsYouPlayToolTip.currentFrame == 6){
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(learnAsYouPlayToolTip, (getChildIndex(escapeMenu) - 1));
learnAsYouPlayToolTip.gotoAndStop(7);
animateTooltipWithSlide();
learnAsYouPlayToolTip.visible = true;
} else {
if (learnAsYouPlayToolTip.currentFrame == 7){
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(learnAsYouPlayToolTip, (getChildIndex(escapeMenu) - 1));
learnAsYouPlayToolTip.gotoAndStop(8);
animateTooltipWithSlide();
learnAsYouPlayToolTip.visible = true;
} else {
if (learnAsYouPlayToolTip.currentFrame == 8){
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(learnAsYouPlayToolTip, (getChildIndex(escapeMenu) - 1));
learnAsYouPlayToolTip.gotoAndStop(9);
animateTooltipWithSlide();
learnAsYouPlayToolTip.visible = true;
} else {
if (learnAsYouPlayToolTip.currentFrame == 9){
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(learnAsYouPlayToolTip, (getChildIndex(escapeMenu) - 1));
learnAsYouPlayToolTip.gotoAndStop(10);
animateTooltipWithSlide();
learnAsYouPlayToolTip.visible = true;
} else {
if (learnAsYouPlayToolTip.currentFrame == 10){
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(learnAsYouPlayToolTip, (getChildIndex(escapeMenu) - 1));
learnAsYouPlayToolTip.gotoAndStop(11);
animateTooltipWithSlide();
learnAsYouPlayToolTip.visible = true;
} else {
if (learnAsYouPlayToolTip.currentFrame == 11){
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(learnAsYouPlayToolTip, (getChildIndex(escapeMenu) - 1));
learnAsYouPlayToolTip.gotoAndStop(12);
animateTooltipWithSlide();
learnAsYouPlayToolTip.visible = true;
} else {
if (learnAsYouPlayToolTip.currentFrame == 12){
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(learnAsYouPlayToolTip, (getChildIndex(escapeMenu) - 1));
learnAsYouPlayToolTip.gotoAndStop(13);
animateTooltipWithSlide();
learnAsYouPlayToolTip.visible = true;
} else {
if (learnAsYouPlayToolTip.currentFrame == 13){
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(learnAsYouPlayToolTip, (getChildIndex(escapeMenu) - 1));
learnAsYouPlayToolTip.gotoAndStop(14);
animateTooltipWithSlide();
learnAsYouPlayToolTip.visible = true;
} else {
if (learnAsYouPlayToolTip.currentFrame == 14){
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(learnAsYouPlayToolTip, (getChildIndex(escapeMenu) - 1));
learnAsYouPlayToolTip.gotoAndStop(15);
animateTooltipWithSlide();
learnAsYouPlayToolTip.visible = true;
} else {
if (learnAsYouPlayToolTip.currentFrame == 15){
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(learnAsYouPlayToolTip, (getChildIndex(escapeMenu) - 1));
learnAsYouPlayToolTip.gotoAndStop(16);
animateTooltipWithSlide();
learnAsYouPlayToolTip.visible = true;
} else {
if (learnAsYouPlayToolTip.currentFrame == 16){
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(learnAsYouPlayToolTip, (getChildIndex(escapeMenu) - 1));
learnAsYouPlayToolTip.gotoAndStop(17);
animateTooltipWithSlide();
learnAsYouPlayToolTip.visible = true;
} else {
if (learnAsYouPlayToolTip.currentFrame == 17){
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(learnAsYouPlayToolTip, (getChildIndex(escapeMenu) - 1));
learnAsYouPlayToolTip.gotoAndStop(18);
animateTooltipWithSlide();
learnAsYouPlayToolTip.visible = true;
} else {
if (learnAsYouPlayToolTip.currentFrame == 18){
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(learnAsYouPlayToolTip, (getChildIndex(escapeMenu) - 1));
learnAsYouPlayToolTip.gotoAndStop(19);
animateTooltipWithSlide();
learnAsYouPlayToolTip.visible = true;
} else {
if (learnAsYouPlayToolTip.currentFrame == 19){
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(learnAsYouPlayToolTip, (getChildIndex(escapeMenu) - 1));
learnAsYouPlayToolTip.gotoAndStop(20);
animateTooltipWithSlide();
learnAsYouPlayToolTip.visible = true;
} else {
if (learnAsYouPlayToolTip.currentFrame == 20){
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(learnAsYouPlayToolTip, (getChildIndex(escapeMenu) - 1));
learnAsYouPlayToolTip.gotoAndStop(21);
animateTooltipWithSlide();
learnAsYouPlayToolTip.visible = true;
} else {
if (learnAsYouPlayToolTip.currentFrame == 21){
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(learnAsYouPlayToolTip, (getChildIndex(escapeMenu) - 1));
learnAsYouPlayToolTip.gotoAndStop(22);
animateTooltipWithSlide();
learnAsYouPlayToolTip.visible = true;
} else {
if (learnAsYouPlayToolTip.currentFrame == 22){
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(learnAsYouPlayToolTip, (getChildIndex(escapeMenu) - 1));
learnAsYouPlayToolTip.gotoAndStop(23);
animateTooltipWithSlide();
learnAsYouPlayToolTip.visible = true;
} else {
if (learnAsYouPlayToolTip.currentFrame == 23){
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(learnAsYouPlayToolTip, (getChildIndex(escapeMenu) - 1));
learnAsYouPlayToolTip.gotoAndStop(24);
animateTooltipWithSlide();
learnAsYouPlayToolTip.visible = true;
} else {
if (learnAsYouPlayToolTip.currentFrame == 24){
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(learnAsYouPlayToolTip, (getChildIndex(escapeMenu) - 1));
learningWhilePlaying = false;
reaversComingCount = 10;
learnAsYouPlayToolTip.gotoAndStop(25);
API.unlockMedal("I can speak Robot");
} else {
if (learnAsYouPlayToolTip.currentFrame == 25){
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
} else {
learnAsYouPlayToolTip.visible = false;
hideTutorialMiniBoxes();
};
if (gameOver == false){
chan_soundFX = snd_diceroll.play(0, 0, snd_DiceRoll);
};
if (dice1 == 1){
dice1Graphic.gotoAndStop(1);
} else {
if (dice1 == 2){
dice1Graphic.gotoAndStop(2);
} else {
if (dice1 == 3){
dice1Graphic.gotoAndStop(3);
} else {
if (dice1 == 4){
dice1Graphic.gotoAndStop(4);
} else {
if (dice1 == 5){
dice1Graphic.gotoAndStop(5);
} else {
if (dice1 == 6){
dice1Graphic.gotoAndStop(6);
};
};
};
};
};
};
if (dice2 == 1){
dice2Graphic.gotoAndStop(1);
} else {
if (dice2 == 2){
dice2Graphic.gotoAndStop(2);
} else {
if (dice2 == 3){
dice2Graphic.gotoAndStop(3);
} else {
if (dice2 == 4){
dice2Graphic.gotoAndStop(4);
} else {
if (dice2 == 5){
dice2Graphic.gotoAndStop(5);
} else {
if (dice2 == 6){
dice2Graphic.gotoAndStop(6);
};
};
};
};
};
};
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(btn_chooseDiceRoll, (getChildIndex(escapeMenu) - 1));
setChildIndex(dice1Graphic, (getChildIndex(escapeMenu) - 1));
setChildIndex(dice2Graphic, (getChildIndex(escapeMenu) - 1));
dicesDisplayXMod = 41;
dicesDisplayYMod = 48;
if (currentTurn == 1){
dice1Graphic.x = (player1Beacon.x - dicesDisplayXMod);
dice1Graphic.y = (player1Beacon.y - dicesDisplayYMod);
dice2Graphic.x = (player1Beacon.x + dicesDisplayXMod);
dice2Graphic.y = (player1Beacon.y - dicesDisplayYMod);
btn_chooseDiceRoll.x = player1Beacon.x;
btn_chooseDiceRoll.y = player1Beacon.y;
} else {
if (currentTurn == 2){
dice1Graphic.x = (player2Beacon.x - dicesDisplayXMod);
dice1Graphic.y = (player2Beacon.y - dicesDisplayYMod);
dice2Graphic.x = (player2Beacon.x + dicesDisplayXMod);
dice2Graphic.y = (player2Beacon.y - dicesDisplayYMod);
btn_chooseDiceRoll.x = player2Beacon.x;
btn_chooseDiceRoll.y = player2Beacon.y;
} else {
if (currentTurn == 3){
dice1Graphic.x = (player3Beacon.x - dicesDisplayXMod);
dice1Graphic.y = (player3Beacon.y - dicesDisplayYMod);
dice2Graphic.x = (player3Beacon.x + dicesDisplayXMod);
dice2Graphic.y = (player3Beacon.y - dicesDisplayYMod);
btn_chooseDiceRoll.x = player3Beacon.x;
btn_chooseDiceRoll.y = player3Beacon.y;
} else {
if (currentTurn == 4){
dice1Graphic.x = (player4Beacon.x - dicesDisplayXMod);
dice1Graphic.y = (player4Beacon.y - dicesDisplayYMod);
dice2Graphic.x = (player4Beacon.x + dicesDisplayXMod);
dice2Graphic.y = (player4Beacon.y - dicesDisplayYMod);
btn_chooseDiceRoll.x = player4Beacon.x;
btn_chooseDiceRoll.y = player4Beacon.y;
};
};
};
};
if (dice1 == 1){
};
_local1 = 0.6;
btn_chooseDiceRoll.getChildByName("btn_dicechoice1").alpha = _local1;
btn_chooseDiceRoll.getChildByName("btn_dicechoice2").alpha = _local1;
btn_chooseDiceRoll.getChildByName("btn_dicechoice3").alpha = _local1;
btn_chooseDiceRoll.getChildByName("btn_dicechoice4").alpha = _local1;
btn_chooseDiceRoll.getChildByName("btn_dicechoice5").alpha = _local1;
btn_chooseDiceRoll.getChildByName("btn_dicechoice6").alpha = _local1;
btn_chooseDiceRoll.getChildByName("btn_dicechoice7").alpha = _local1;
btn_chooseDiceRoll.getChildByName("btn_dicechoice8").alpha = _local1;
btn_chooseDiceRoll.getChildByName("btn_dicechoice9").alpha = _local1;
btn_chooseDiceRoll.getChildByName("btn_dicechoice10").alpha = _local1;
btn_chooseDiceRoll.getChildByName("btn_dicechoice11").alpha = _local1;
btn_chooseDiceRoll.getChildByName("btn_dicechoice12").alpha = _local1;
if ((((dice1 == 1)) || ((dice2 == 1)))){
btn_chooseDiceRoll.getChildByName("btn_dicechoice1").alpha = 0;
};
if ((((((dice1 == 2)) || ((dice2 == 2)))) || ((diceCombined == 2)))){
btn_chooseDiceRoll.getChildByName("btn_dicechoice2").alpha = 0;
};
if ((((((dice1 == 3)) || ((dice2 == 3)))) || ((diceCombined == 3)))){
btn_chooseDiceRoll.getChildByName("btn_dicechoice3").alpha = 0;
};
if ((((((dice1 == 4)) || ((dice2 == 4)))) || ((diceCombined == 4)))){
btn_chooseDiceRoll.getChildByName("btn_dicechoice4").alpha = 0;
};
if ((((((dice1 == 5)) || ((dice2 == 5)))) || ((diceCombined == 5)))){
btn_chooseDiceRoll.getChildByName("btn_dicechoice5").alpha = 0;
};
if ((((((dice1 == 6)) || ((dice2 == 6)))) || ((diceCombined == 6)))){
btn_chooseDiceRoll.getChildByName("btn_dicechoice6").alpha = 0;
};
if (diceCombined == 7){
btn_chooseDiceRoll.getChildByName("btn_dicechoice7").alpha = 0;
};
if (diceCombined == 8){
btn_chooseDiceRoll.getChildByName("btn_dicechoice8").alpha = 0;
};
if (diceCombined == 9){
btn_chooseDiceRoll.getChildByName("btn_dicechoice9").alpha = 0;
};
if (diceCombined == 10){
btn_chooseDiceRoll.getChildByName("btn_dicechoice10").alpha = 0;
};
if (diceCombined == 11){
btn_chooseDiceRoll.getChildByName("btn_dicechoice11").alpha = 0;
};
if (diceCombined == 12){
btn_chooseDiceRoll.getChildByName("btn_dicechoice12").alpha = 0;
};
if (gameOver == false){
btn_chooseDiceRoll.visible = true;
dice1Graphic.visible = true;
dice2Graphic.visible = true;
};
if (currentTurn != 1){
if (playerDiceRollChoice == 1){
tokenRollChoice.x = (btn_chooseDiceRoll.getChildByName("btn_dicechoice1").x + btn_chooseDiceRoll.x);
tokenRollChoice.y = (btn_chooseDiceRoll.getChildByName("btn_dicechoice1").y + btn_chooseDiceRoll.y);
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(tokenRollChoice, (getChildIndex(escapeMenu) - 1));
} else {
if (playerDiceRollChoice == 2){
tokenRollChoice.x = (btn_chooseDiceRoll.getChildByName("btn_dicechoice2").x + btn_chooseDiceRoll.x);
tokenRollChoice.y = (btn_chooseDiceRoll.getChildByName("btn_dicechoice2").y + btn_chooseDiceRoll.y);
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(tokenRollChoice, (getChildIndex(escapeMenu) - 1));
} else {
if (playerDiceRollChoice == 3){
tokenRollChoice.x = (btn_chooseDiceRoll.getChildByName("btn_dicechoice3").x + btn_chooseDiceRoll.x);
tokenRollChoice.y = (btn_chooseDiceRoll.getChildByName("btn_dicechoice3").y + btn_chooseDiceRoll.y);
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(tokenRollChoice, (getChildIndex(escapeMenu) - 1));
} else {
if (playerDiceRollChoice == 4){
tokenRollChoice.x = (btn_chooseDiceRoll.getChildByName("btn_dicechoice4").x + btn_chooseDiceRoll.x);
tokenRollChoice.y = (btn_chooseDiceRoll.getChildByName("btn_dicechoice4").y + btn_chooseDiceRoll.y);
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(tokenRollChoice, (getChildIndex(escapeMenu) - 1));
} else {
if (playerDiceRollChoice == 5){
tokenRollChoice.x = (btn_chooseDiceRoll.getChildByName("btn_dicechoice5").x + btn_chooseDiceRoll.x);
tokenRollChoice.y = (btn_chooseDiceRoll.getChildByName("btn_dicechoice5").y + btn_chooseDiceRoll.y);
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(tokenRollChoice, (getChildIndex(escapeMenu) - 1));
} else {
if (playerDiceRollChoice == 6){
tokenRollChoice.x = (btn_chooseDiceRoll.getChildByName("btn_dicechoice6").x + btn_chooseDiceRoll.x);
tokenRollChoice.y = (btn_chooseDiceRoll.getChildByName("btn_dicechoice6").y + btn_chooseDiceRoll.y);
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(tokenRollChoice, (getChildIndex(escapeMenu) - 1));
} else {
if (playerDiceRollChoice == 7){
tokenRollChoice.x = (btn_chooseDiceRoll.getChildByName("btn_dicechoice7").x + btn_chooseDiceRoll.x);
tokenRollChoice.y = (btn_chooseDiceRoll.getChildByName("btn_dicechoice7").y + btn_chooseDiceRoll.y);
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(tokenRollChoice, (getChildIndex(escapeMenu) - 1));
} else {
if (playerDiceRollChoice == 8){
tokenRollChoice.x = (btn_chooseDiceRoll.getChildByName("btn_dicechoice8").x + btn_chooseDiceRoll.x);
tokenRollChoice.y = (btn_chooseDiceRoll.getChildByName("btn_dicechoice8").y + btn_chooseDiceRoll.y);
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(tokenRollChoice, (getChildIndex(escapeMenu) - 1));
} else {
if (playerDiceRollChoice == 9){
tokenRollChoice.x = (btn_chooseDiceRoll.getChildByName("btn_dicechoice9").x + btn_chooseDiceRoll.x);
tokenRollChoice.y = (btn_chooseDiceRoll.getChildByName("btn_dicechoice9").y + btn_chooseDiceRoll.y);
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(tokenRollChoice, (getChildIndex(escapeMenu) - 1));
} else {
if (playerDiceRollChoice == 10){
tokenRollChoice.x = (btn_chooseDiceRoll.getChildByName("btn_dicechoice10").x + btn_chooseDiceRoll.x);
tokenRollChoice.y = (btn_chooseDiceRoll.getChildByName("btn_dicechoice10").y + btn_chooseDiceRoll.y);
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(tokenRollChoice, (getChildIndex(escapeMenu) - 1));
} else {
if (playerDiceRollChoice == 11){
tokenRollChoice.x = (btn_chooseDiceRoll.getChildByName("btn_dicechoice11").x + btn_chooseDiceRoll.x);
tokenRollChoice.y = (btn_chooseDiceRoll.getChildByName("btn_dicechoice11").y + btn_chooseDiceRoll.y);
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(tokenRollChoice, (getChildIndex(escapeMenu) - 1));
} else {
if (playerDiceRollChoice == 12){
tokenRollChoice.x = (btn_chooseDiceRoll.getChildByName("btn_dicechoice12").x + btn_chooseDiceRoll.x);
tokenRollChoice.y = (btn_chooseDiceRoll.getChildByName("btn_dicechoice12").y + btn_chooseDiceRoll.y);
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(tokenRollChoice, (getChildIndex(escapeMenu) - 1));
};
};
};
};
};
};
};
};
};
};
};
};
diceRollGet();
};
}
public function callWarAdvisor(_arg1:MouseEvent):void{
var _local2:uint;
var _local3:uint;
var _local4:uint;
var _local5:uint;
if (gameOver == false){
trace(("has assigned unit: " + landTileArray[_arg1.target.partyCurrentTile].partyAssignedDefensive));
trace(("has current defending unit: " + landTileArray[_arg1.target.partyCurrentTile].defensiveUnit));
trace(("current unit is defensive: " + _arg1.target.imDefensive));
trace(("number of party 2 on this tile: " + landTileArray[_arg1.target.partyCurrentTile].party2));
trace(("def unit reference " + landTileArray[_arg1.target.partyCurrentTile].defensiveUnitReference));
if ((((((((((player1UnderCombat == false)) && ((_arg1.target.defensiveUnit == true)))) && (!((_arg1.target.player == 1))))) && ((currentTurn == 1)))) && ((player1ChoosingDiceRoll == false)))){
warAdvisor.x = player1Beacon.x;
warAdvisor.y = player1Beacon.y;
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(warAdvisor, (getChildIndex(escapeMenu) - 1));
_local2 = _arg1.target.partyCurrentTile;
_local3 = 0;
_local4 = 0;
_local5 = ((partyRegularStancePower + partyInitiativeBonus) + p1UpgradePower);
_local3 = (_local3 + partyDefensiveStancePowerVsMelee);
if (landTileArray[(_local2 - 1)].defensiveUnit == true){
if (((!((landTileArray[(_local2 - 1)].defensiveUnitRotation == 0))) && (!((wallSlotArray[landTileArray[(_local2 - 1)].bottomWall].alpha == 1))))){
_local3 = (_local3 + defenderAssistAttackPowerBonus);
};
};
if (landTileArray[(_local2 + 1)].defensiveUnit == true){
if (((!((landTileArray[(_local2 + 1)].defensiveUnitRotation == 180))) && (!((wallSlotArray[landTileArray[(_local2 + 1)].upWall].alpha == 1))))){
_local3 = (_local3 + defenderAssistAttackPowerBonus);
};
};
if (landTileArray[((_local2 + 6) + (verticalGridCounter / 2))].defensiveUnit == true){
if (((!((landTileArray[((_local2 + 6) + (verticalGridCounter / 2))].defensiveUnitRotation == 90))) && (!((wallSlotArray[landTileArray[((_local2 + 6) + (verticalGridCounter / 2))].leftWall].alpha == 1))))){
trace("right");
_local3 = (_local3 + defenderAssistAttackPowerBonus);
};
};
if (landTileArray[((_local2 - 6) - (verticalGridCounter / 2))].defensiveUnit == true){
if (((!((landTileArray[((_local2 - 6) - (verticalGridCounter / 2))].defensiveUnitRotation == -90))) && (!((wallSlotArray[landTileArray[((_local2 - 6) - (verticalGridCounter / 2))].rightWall].alpha == 1))))){
trace("left");
_local3 = (_local3 + defenderAssistAttackPowerBonus);
};
};
if (_arg1.target.player == 2){
_local3 = (_local3 + p2UpgradePower);
};
if (_arg1.target.player == 3){
_local3 = (_local3 + p3UpgradePower);
};
if (_arg1.target.player == 4){
_local3 = (_local3 + p4UpgradePower);
};
if (landTileArray[_local2].hasGatherer == true){
if (_arg1.target.player == 2){
_local4 = (((p2Gatherers1 + p2Gatherers2) + p2Gatherers3) + p2Gatherers4);
} else {
if (_arg1.target.player == 3){
_local4 = (((p3Gatherers1 + p3Gatherers2) + p3Gatherers3) + p3Gatherers4);
} else {
if (_arg1.target.player == 4){
_local4 = (((p4Gatherers1 + p4Gatherers2) + p4Gatherers3) + p4Gatherers4);
};
};
};
trace(("defenderOverclock is " + _local4));
if (_local4 == 1){
_local3 = (_local3 + overclock1);
} else {
if (_local4 == 2){
_local3 = (_local3 + overclock2);
} else {
if ((((_local4 == 3)) || ((_local4 == 4)))){
_local3 = (_local3 + overclock34);
} else {
if ((((_local4 == 5)) || ((_local4 == 6)))){
_local3 = (_local3 + overclock56);
} else {
if ((((_local4 == 7)) || ((_local4 == 8)))){
_local3 = (_local3 + overclock78);
} else {
if (_local4 >= 9){
_local3 = (_local3 + overclock9);
};
};
};
};
};
};
};
if (((_local3 + 1) - _local5) == 0){
warAdvisor.warAdvisorText1.text = "Our dice roll is evenlly matched against the enemy.";
} else {
if (((_local3 + 1) - _local5) == 1){
warAdvisor.warAdvisorText1.text = (("Our dice roll must\n be " + ((_local3 + 1) - _local5)) + " unit greater.");
} else {
if (((_local3 + 1) - _local5) > 0){
warAdvisor.warAdvisorText1.text = (("Our dice roll must be\n " + ((_local3 + 1) - _local5)) + " units greater.");
} else {
if ((_local5 - (_local3 + 1)) == 1){
warAdvisor.warAdvisorText1.text = (("Our dice roll is\n " + (_local5 - (_local3 + 1))) + " unit greater.");
} else {
if ((_local5 - (_local3 + 1)) > 0){
warAdvisor.warAdvisorText1.text = (("Our dice roll is\n " + (_local5 - (_local3 + 1))) + " units greater.");
};
};
};
};
};
if (((_local3 + 1) - _local5) >= 10){
warAdvisor.warAdvisorText2.text = "ZERO\nThey are too powerful.";
warAdvisor.warAdvisorText2.textColor = 16722988;
} else {
if (((_local3 + 1) - _local5) >= 7){
warAdvisor.warAdvisorText2.text = "ALMOST IMPOSSIBLE\nIts a suicide mission.";
warAdvisor.warAdvisorText2.textColor = 16722988;
} else {
if (((_local3 + 1) - _local5) >= 5){
warAdvisor.warAdvisorText2.text = "VERY LOW\nI do not recommend we fight.";
warAdvisor.warAdvisorText2.textColor = 16722988;
} else {
if (((_local3 + 1) - _local5) >= 4){
warAdvisor.warAdvisorText2.text = "LOW\nBut we could win with luck.";
warAdvisor.warAdvisorText2.textColor = 16722988;
} else {
if (((_local3 + 1) - _local5) >= 3){
warAdvisor.warAdvisorText2.text = "RISKY\nThey are slightly stronger.";
warAdvisor.warAdvisorText2.textColor = 0xFFFFFF;
} else {
if (((_local3 + 1) - _local5) >= -1){
warAdvisor.warAdvisorText2.text = "FAIR\nThis is a balanced battle.";
warAdvisor.warAdvisorText2.textColor = 0xFFFFFF;
} else {
if (((_local3 + 1) - _local5) >= -3){
warAdvisor.warAdvisorText2.text = "GOOD\nWe have the upperhand.";
warAdvisor.warAdvisorText2.textColor = 0xFF00;
} else {
if (((_local3 + 1) - _local5) >= -4){
warAdvisor.warAdvisorText2.text = "VERY GOOD\nWe should engage the enemy.";
warAdvisor.warAdvisorText2.textColor = 0xFF00;
} else {
if (((_local3 + 1) - _local5) >= -9){
warAdvisor.warAdvisorText2.text = "EPIC\nWe are much stronger.";
warAdvisor.warAdvisorText2.textColor = 0xFF00;
} else {
if (((_local3 + 1) - _local5) >= -10){
warAdvisor.warAdvisorText2.text = "ABSOLUTE\nThey don't stand a chance.";
warAdvisor.warAdvisorText2.textColor = 0xFF00;
};
};
};
};
};
};
};
};
};
};
warAdvisor.visible = true;
};
};
}
public function turnPartyLedOn():void{
var _local1:uint;
if (gameOver == false){
_local1 = 0;
if (currentTurn == 1){
_local1 = partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile;
} else {
_local1 = partyUnitArray[currentMovingParty].partyCurrentTile;
};
if ((((((landTileArray[(_local1 - 1)].party1 >= 1)) && (!((currentTurn == 1))))) && (!((wallSlotArray[landTileArray[(_local1 - 1)].bottomWall].alpha == 1))))){
if ((((landTileArray[(_local1 - 1)].defensiveUnit == true)) && ((landTileArray[(_local1 - 1)].party1 >= 1)))){
if (partyUnitArray1[landTileArray[(_local1 - 1)].defensiveUnitReference].rotation != 0){
partyUnitArray1[landTileArray[(_local1 - 1)].defensiveUnitReference].gotoAndStop(p1LedOn);
};
};
if ((((((landTileArray[(_local1 - 2)].defensiveUnit == true)) && ((landTileArray[(_local1 - 2)].party1 >= 1)))) && (!((wallSlotArray[landTileArray[(_local1 - 2)].bottomWall].alpha == 1))))){
if (partyUnitArray1[landTileArray[(_local1 - 2)].defensiveUnitReference].rotation != 0){
partyUnitArray1[landTileArray[(_local1 - 2)].defensiveUnitReference].gotoAndStop(p1LedOn);
};
};
if ((((((landTileArray[(((_local1 - 1) - 6) - (verticalGridCounter / 2))].defensiveUnit == true)) && ((landTileArray[(((_local1 - 1) - 6) - (verticalGridCounter / 2))].party1 >= 1)))) && (!((wallSlotArray[landTileArray[(((_local1 - 1) - 6) - (verticalGridCounter / 2))].rightWall].alpha == 1))))){
if (partyUnitArray1[landTileArray[(((_local1 - 1) - 6) - (verticalGridCounter / 2))].defensiveUnitReference].rotation != -90){
partyUnitArray1[landTileArray[(((_local1 - 1) - 6) - (verticalGridCounter / 2))].defensiveUnitReference].gotoAndStop(p1LedOn);
};
};
if ((((((landTileArray[(((_local1 - 1) + 6) + (verticalGridCounter / 2))].defensiveUnit == true)) && ((landTileArray[(((_local1 - 1) + 6) + (verticalGridCounter / 2))].party1 >= 1)))) && (!((wallSlotArray[landTileArray[(((_local1 - 1) + 6) + (verticalGridCounter / 2))].leftWall].alpha == 1))))){
if (partyUnitArray1[landTileArray[(((_local1 - 1) + 6) + (verticalGridCounter / 2))].defensiveUnitReference].rotation != 90){
partyUnitArray1[landTileArray[(((_local1 - 1) + 6) + (verticalGridCounter / 2))].defensiveUnitReference].gotoAndStop(p1LedOn);
};
};
};
if ((((((landTileArray[(_local1 + 1)].party1 >= 1)) && (!((currentTurn == 1))))) && (!((wallSlotArray[landTileArray[(_local1 + 1)].upWall].alpha == 1))))){
if ((((landTileArray[(_local1 + 1)].defensiveUnit == true)) && ((landTileArray[(_local1 + 1)].party1 >= 1)))){
if (partyUnitArray1[landTileArray[(_local1 + 1)].defensiveUnitReference].rotation != 180){
partyUnitArray1[landTileArray[(_local1 + 1)].defensiveUnitReference].gotoAndStop(p1LedOn);
};
};
if ((((((landTileArray[(_local1 + 2)].defensiveUnit == true)) && ((landTileArray[(_local1 + 2)].party1 >= 1)))) && (!((wallSlotArray[landTileArray[(_local1 + 2)].upWall].alpha == 1))))){
if (partyUnitArray1[landTileArray[(_local1 + 2)].defensiveUnitReference].rotation != 180){
partyUnitArray1[landTileArray[(_local1 + 2)].defensiveUnitReference].gotoAndStop(p1LedOn);
};
};
if ((((((landTileArray[(((_local1 + 1) - 6) - (verticalGridCounter / 2))].defensiveUnit == true)) && ((landTileArray[(((_local1 + 1) - 6) - (verticalGridCounter / 2))].party1 >= 1)))) && (!((wallSlotArray[landTileArray[(((_local1 + 1) - 6) - (verticalGridCounter / 2))].rightWall].alpha == 1))))){
if (partyUnitArray1[landTileArray[(((_local1 + 1) - 6) - (verticalGridCounter / 2))].defensiveUnitReference].rotation != -90){
partyUnitArray1[landTileArray[(((_local1 + 1) - 6) - (verticalGridCounter / 2))].defensiveUnitReference].gotoAndStop(p1LedOn);
};
};
if ((((((landTileArray[(((_local1 + 1) + 6) + (verticalGridCounter / 2))].defensiveUnit == true)) && ((landTileArray[(((_local1 + 1) + 6) + (verticalGridCounter / 2))].party1 >= 1)))) && (!((wallSlotArray[landTileArray[(((_local1 + 1) + 6) + (verticalGridCounter / 2))].leftWall].alpha == 1))))){
if (partyUnitArray1[landTileArray[(((_local1 + 1) + 6) + (verticalGridCounter / 2))].defensiveUnitReference].rotation != 90){
partyUnitArray1[landTileArray[(((_local1 + 1) + 6) + (verticalGridCounter / 2))].defensiveUnitReference].gotoAndStop(p1LedOn);
};
};
};
if ((((((landTileArray[((_local1 - 6) - (verticalGridCounter / 2))].party1 >= 1)) && (!((currentTurn == 1))))) && (!((wallSlotArray[landTileArray[((_local1 - 6) - (verticalGridCounter / 2))].rightWall].alpha == 1))))){
if ((((landTileArray[((_local1 - 6) - (verticalGridCounter / 2))].defensiveUnit == true)) && ((landTileArray[((_local1 - 6) - (verticalGridCounter / 2))].party1 >= 1)))){
if (partyUnitArray1[landTileArray[((_local1 - 6) - (verticalGridCounter / 2))].defensiveUnitReference].rotation != -90){
partyUnitArray1[landTileArray[((_local1 - 6) - (verticalGridCounter / 2))].defensiveUnitReference].gotoAndStop(p1LedOn);
};
};
if ((((((landTileArray[(_local1 - ((-6 - (verticalGridCounter / 2)) * 2))].defensiveUnit == true)) && ((landTileArray[(_local1 - ((-6 - (verticalGridCounter / 2)) * 2))].party1 >= 1)))) && (!((wallSlotArray[landTileArray[(_local1 - ((-6 - (verticalGridCounter / 2)) * 2))].rightWall].alpha == 1))))){
if (partyUnitArray1[landTileArray[(_local1 - ((-6 - (verticalGridCounter / 2)) * 2))].defensiveUnitReference].rotation != -90){
partyUnitArray1[landTileArray[(_local1 - ((-6 - (verticalGridCounter / 2)) * 2))].defensiveUnitReference].gotoAndStop(p1LedOn);
};
};
if ((((((landTileArray[(((_local1 + 1) - 6) - (verticalGridCounter / 2))].defensiveUnit == true)) && ((landTileArray[(((_local1 + 1) - 6) - (verticalGridCounter / 2))].party1 >= 1)))) && (!((wallSlotArray[landTileArray[(((_local1 + 1) - 6) - (verticalGridCounter / 2))].upWall].alpha == 1))))){
if (partyUnitArray1[landTileArray[(((_local1 + 1) - 6) - (verticalGridCounter / 2))].defensiveUnitReference].rotation != 180){
partyUnitArray1[landTileArray[(((_local1 + 1) - 6) - (verticalGridCounter / 2))].defensiveUnitReference].gotoAndStop(p1LedOn);
};
};
if ((((((landTileArray[(((_local1 - 1) - 6) - (verticalGridCounter / 2))].defensiveUnit == true)) && ((landTileArray[(((_local1 - 1) - 6) - (verticalGridCounter / 2))].party1 >= 1)))) && (!((wallSlotArray[landTileArray[(((_local1 - 1) - 6) - (verticalGridCounter / 2))].bottomWall].alpha == 1))))){
if (partyUnitArray1[landTileArray[(((_local1 - 1) - 6) - (verticalGridCounter / 2))].defensiveUnitReference].rotation != 0){
partyUnitArray1[landTileArray[(((_local1 - 1) - 6) - (verticalGridCounter / 2))].defensiveUnitReference].gotoAndStop(p1LedOn);
};
};
};
if ((((((landTileArray[((_local1 + 6) + (verticalGridCounter / 2))].party1 >= 1)) && (!((currentTurn == 1))))) && (!((wallSlotArray[landTileArray[((_local1 + 6) + (verticalGridCounter / 2))].leftWall].alpha == 1))))){
if ((((landTileArray[((_local1 + 6) + (verticalGridCounter / 2))].defensiveUnit == true)) && ((landTileArray[((_local1 + 6) + (verticalGridCounter / 2))].party1 >= 1)))){
if (partyUnitArray1[landTileArray[((_local1 + 6) + (verticalGridCounter / 2))].defensiveUnitReference].rotation != 90){
partyUnitArray1[landTileArray[((_local1 + 6) + (verticalGridCounter / 2))].defensiveUnitReference].gotoAndStop(p1LedOn);
};
};
if ((((((landTileArray[(_local1 + ((6 + (verticalGridCounter / 2)) * 2))].defensiveUnit == true)) && ((landTileArray[(_local1 + ((6 + (verticalGridCounter / 2)) * 2))].party1 >= 1)))) && (!((wallSlotArray[landTileArray[(_local1 + ((6 + (verticalGridCounter / 2)) * 2))].leftWall].alpha == 1))))){
if (partyUnitArray1[landTileArray[(_local1 + ((6 + (verticalGridCounter / 2)) * 2))].defensiveUnitReference].rotation != 90){
partyUnitArray1[landTileArray[(_local1 + ((6 + (verticalGridCounter / 2)) * 2))].defensiveUnitReference].gotoAndStop(p1LedOn);
};
};
if ((((((landTileArray[(((_local1 + 1) + 6) + (verticalGridCounter / 2))].defensiveUnit == true)) && ((landTileArray[(((_local1 + 1) + 6) + (verticalGridCounter / 2))].party1 >= 1)))) && (!((wallSlotArray[landTileArray[(((_local1 + 1) + 6) + (verticalGridCounter / 2))].upWall].alpha == 1))))){
if (partyUnitArray1[landTileArray[(((_local1 + 1) + 6) + (verticalGridCounter / 2))].defensiveUnitReference].rotation != 180){
partyUnitArray1[landTileArray[(((_local1 + 1) + 6) + (verticalGridCounter / 2))].defensiveUnitReference].gotoAndStop(p1LedOn);
};
};
if ((((((landTileArray[(((_local1 - 1) + 6) + (verticalGridCounter / 2))].defensiveUnit == true)) && ((landTileArray[(((_local1 - 1) + 6) + (verticalGridCounter / 2))].party1 >= 1)))) && (!((wallSlotArray[landTileArray[(((_local1 - 1) + 6) + (verticalGridCounter / 2))].bottomWall].alpha == 1))))){
if (partyUnitArray1[landTileArray[(((_local1 - 1) + 6) + (verticalGridCounter / 2))].defensiveUnitReference].rotation != 0){
partyUnitArray1[landTileArray[(((_local1 - 1) + 6) + (verticalGridCounter / 2))].defensiveUnitReference].gotoAndStop(p1LedOn);
};
};
};
if ((((((landTileArray[(_local1 - 1)].party2 >= 1)) && (!((currentTurn == 2))))) && (!((wallSlotArray[landTileArray[(_local1 - 1)].bottomWall].alpha == 1))))){
if ((((landTileArray[(_local1 - 1)].defensiveUnit == true)) && ((landTileArray[(_local1 - 1)].party2 >= 1)))){
if (partyUnitArray2[landTileArray[(_local1 - 1)].defensiveUnitReference].rotation != 0){
partyUnitArray2[landTileArray[(_local1 - 1)].defensiveUnitReference].gotoAndStop(p2LedOn);
};
};
if ((((((landTileArray[(_local1 - 2)].defensiveUnit == true)) && ((landTileArray[(_local1 - 2)].party2 >= 1)))) && (!((wallSlotArray[landTileArray[(_local1 - 2)].bottomWall].alpha == 1))))){
if (partyUnitArray2[landTileArray[(_local1 - 2)].defensiveUnitReference].rotation != 0){
partyUnitArray2[landTileArray[(_local1 - 2)].defensiveUnitReference].gotoAndStop(p2LedOn);
};
};
if ((((((landTileArray[(((_local1 - 1) - 6) - (verticalGridCounter / 2))].defensiveUnit == true)) && ((landTileArray[(((_local1 - 1) - 6) - (verticalGridCounter / 2))].party2 >= 1)))) && (!((wallSlotArray[landTileArray[(((_local1 - 1) - 6) - (verticalGridCounter / 2))].rightWall].alpha == 1))))){
if (partyUnitArray2[landTileArray[(((_local1 - 1) - 6) - (verticalGridCounter / 2))].defensiveUnitReference].rotation != -90){
partyUnitArray2[landTileArray[(((_local1 - 1) - 6) - (verticalGridCounter / 2))].defensiveUnitReference].gotoAndStop(p2LedOn);
};
};
if ((((((landTileArray[(((_local1 - 1) + 6) + (verticalGridCounter / 2))].defensiveUnit == true)) && ((landTileArray[(((_local1 - 1) + 6) + (verticalGridCounter / 2))].party2 >= 1)))) && (!((wallSlotArray[landTileArray[(((_local1 - 1) + 6) + (verticalGridCounter / 2))].leftWall].alpha == 1))))){
if (partyUnitArray2[landTileArray[(((_local1 - 1) + 6) + (verticalGridCounter / 2))].defensiveUnitReference].rotation != 90){
partyUnitArray2[landTileArray[(((_local1 - 1) + 6) + (verticalGridCounter / 2))].defensiveUnitReference].gotoAndStop(p2LedOn);
};
};
};
if ((((((landTileArray[(_local1 + 1)].party2 >= 1)) && (!((currentTurn == 2))))) && (!((wallSlotArray[landTileArray[(_local1 + 1)].upWall].alpha == 1))))){
if ((((landTileArray[(_local1 + 1)].defensiveUnit == true)) && ((landTileArray[(_local1 + 1)].party2 >= 1)))){
if (partyUnitArray2[landTileArray[(_local1 + 1)].defensiveUnitReference].rotation != 180){
partyUnitArray2[landTileArray[(_local1 + 1)].defensiveUnitReference].gotoAndStop(p2LedOn);
};
};
if ((((((landTileArray[(_local1 + 2)].defensiveUnit == true)) && ((landTileArray[(_local1 + 2)].party2 >= 1)))) && (!((wallSlotArray[landTileArray[(_local1 + 2)].upWall].alpha == 1))))){
if (partyUnitArray2[landTileArray[(_local1 + 2)].defensiveUnitReference].rotation != 180){
partyUnitArray2[landTileArray[(_local1 + 2)].defensiveUnitReference].gotoAndStop(p2LedOn);
};
};
if ((((((landTileArray[(((_local1 + 1) - 6) - (verticalGridCounter / 2))].defensiveUnit == true)) && ((landTileArray[(((_local1 + 1) - 6) - (verticalGridCounter / 2))].party2 >= 1)))) && (!((wallSlotArray[landTileArray[(((_local1 + 1) - 6) - (verticalGridCounter / 2))].rightWall].alpha == 1))))){
if (partyUnitArray2[landTileArray[(((_local1 + 1) - 6) - (verticalGridCounter / 2))].defensiveUnitReference].rotation != -90){
partyUnitArray2[landTileArray[(((_local1 + 1) - 6) - (verticalGridCounter / 2))].defensiveUnitReference].gotoAndStop(p2LedOn);
};
};
if ((((((landTileArray[(((_local1 + 1) + 6) + (verticalGridCounter / 2))].defensiveUnit == true)) && ((landTileArray[(((_local1 + 1) + 6) + (verticalGridCounter / 2))].party2 >= 1)))) && (!((wallSlotArray[landTileArray[(((_local1 + 1) + 6) + (verticalGridCounter / 2))].leftWall].alpha == 1))))){
if (partyUnitArray2[landTileArray[(((_local1 + 1) + 6) + (verticalGridCounter / 2))].defensiveUnitReference].rotation != 90){
partyUnitArray2[landTileArray[(((_local1 + 1) + 6) + (verticalGridCounter / 2))].defensiveUnitReference].gotoAndStop(p2LedOn);
};
};
};
if ((((((landTileArray[((_local1 - 6) - (verticalGridCounter / 2))].party2 >= 1)) && (!((currentTurn == 2))))) && (!((wallSlotArray[landTileArray[((_local1 - 6) - (verticalGridCounter / 2))].rightWall].alpha == 1))))){
if ((((landTileArray[((_local1 - 6) - (verticalGridCounter / 2))].defensiveUnit == true)) && ((landTileArray[((_local1 - 6) - (verticalGridCounter / 2))].party2 >= 1)))){
if (partyUnitArray2[landTileArray[((_local1 - 6) - (verticalGridCounter / 2))].defensiveUnitReference].rotation != -90){
partyUnitArray2[landTileArray[((_local1 - 6) - (verticalGridCounter / 2))].defensiveUnitReference].gotoAndStop(p2LedOn);
};
};
if ((((((landTileArray[(_local1 - ((-6 - (verticalGridCounter / 2)) * 2))].defensiveUnit == true)) && ((landTileArray[(_local1 - ((-6 - (verticalGridCounter / 2)) * 2))].party2 >= 1)))) && (!((wallSlotArray[landTileArray[(_local1 - ((-6 - (verticalGridCounter / 2)) * 2))].rightWall].alpha == 1))))){
if (partyUnitArray2[landTileArray[(_local1 - ((-6 - (verticalGridCounter / 2)) * 2))].defensiveUnitReference].rotation != -90){
partyUnitArray2[landTileArray[(_local1 - ((-6 - (verticalGridCounter / 2)) * 2))].defensiveUnitReference].gotoAndStop(p2LedOn);
};
};
if ((((((landTileArray[(((_local1 + 1) - 6) - (verticalGridCounter / 2))].defensiveUnit == true)) && ((landTileArray[(((_local1 + 1) - 6) - (verticalGridCounter / 2))].party2 >= 1)))) && (!((wallSlotArray[landTileArray[(((_local1 + 1) - 6) - (verticalGridCounter / 2))].upWall].alpha == 1))))){
if (partyUnitArray2[landTileArray[(((_local1 + 1) - 6) - (verticalGridCounter / 2))].defensiveUnitReference].rotation != 180){
partyUnitArray2[landTileArray[(((_local1 + 1) - 6) - (verticalGridCounter / 2))].defensiveUnitReference].gotoAndStop(p2LedOn);
};
};
if ((((((landTileArray[(((_local1 - 1) - 6) - (verticalGridCounter / 2))].defensiveUnit == true)) && ((landTileArray[(((_local1 - 1) - 6) - (verticalGridCounter / 2))].party2 >= 1)))) && (!((wallSlotArray[landTileArray[(((_local1 - 1) - 6) - (verticalGridCounter / 2))].bottomWall].alpha == 1))))){
if (partyUnitArray2[landTileArray[(((_local1 - 1) - 6) - (verticalGridCounter / 2))].defensiveUnitReference].rotation != 0){
partyUnitArray2[landTileArray[(((_local1 - 1) - 6) - (verticalGridCounter / 2))].defensiveUnitReference].gotoAndStop(p2LedOn);
};
};
};
if ((((((landTileArray[((_local1 + 6) + (verticalGridCounter / 2))].party2 >= 1)) && (!((currentTurn == 2))))) && (!((wallSlotArray[landTileArray[((_local1 + 6) + (verticalGridCounter / 2))].leftWall].alpha == 1))))){
if ((((landTileArray[((_local1 + 6) + (verticalGridCounter / 2))].defensiveUnit == true)) && ((landTileArray[((_local1 + 6) + (verticalGridCounter / 2))].party2 >= 1)))){
if (partyUnitArray2[landTileArray[((_local1 + 6) + (verticalGridCounter / 2))].defensiveUnitReference].rotation != 90){
partyUnitArray2[landTileArray[((_local1 + 6) + (verticalGridCounter / 2))].defensiveUnitReference].gotoAndStop(p2LedOn);
};
};
if ((((((landTileArray[(_local1 + ((6 + (verticalGridCounter / 2)) * 2))].defensiveUnit == true)) && ((landTileArray[(_local1 + ((6 + (verticalGridCounter / 2)) * 2))].party2 >= 1)))) && (!((wallSlotArray[landTileArray[(_local1 + ((6 + (verticalGridCounter / 2)) * 2))].leftWall].alpha == 1))))){
if (partyUnitArray2[landTileArray[(_local1 + ((6 + (verticalGridCounter / 2)) * 2))].defensiveUnitReference].rotation != 90){
partyUnitArray2[landTileArray[(_local1 + ((6 + (verticalGridCounter / 2)) * 2))].defensiveUnitReference].gotoAndStop(p2LedOn);
};
};
if ((((((landTileArray[(((_local1 + 1) + 6) + (verticalGridCounter / 2))].defensiveUnit == true)) && ((landTileArray[(((_local1 + 1) + 6) + (verticalGridCounter / 2))].party2 >= 1)))) && (!((wallSlotArray[landTileArray[(((_local1 + 1) + 6) + (verticalGridCounter / 2))].upWall].alpha == 1))))){
if (partyUnitArray2[landTileArray[(((_local1 + 1) + 6) + (verticalGridCounter / 2))].defensiveUnitReference].rotation != 180){
partyUnitArray2[landTileArray[(((_local1 + 1) + 6) + (verticalGridCounter / 2))].defensiveUnitReference].gotoAndStop(p2LedOn);
};
};
if ((((((landTileArray[(((_local1 - 1) + 6) + (verticalGridCounter / 2))].defensiveUnit == true)) && ((landTileArray[(((_local1 - 1) + 6) + (verticalGridCounter / 2))].party2 >= 1)))) && (!((wallSlotArray[landTileArray[(((_local1 - 1) + 6) + (verticalGridCounter / 2))].bottomWall].alpha == 1))))){
if (partyUnitArray2[landTileArray[(((_local1 - 1) + 6) + (verticalGridCounter / 2))].defensiveUnitReference].rotation != 0){
partyUnitArray2[landTileArray[(((_local1 - 1) + 6) + (verticalGridCounter / 2))].defensiveUnitReference].gotoAndStop(p2LedOn);
};
};
};
};
}
public function turnPartyLedOff():void{
var _local1:uint;
_local1 = 0;
if (currentTurn == 1){
_local1 = partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile;
} else {
_local1 = partyUnitArray[currentMovingParty].partyCurrentTile;
};
if ((((landTileArray[(_local1 - 1)].party1 >= 1)) && ((landTileArray[(_local1 - 1)].defensiveUnit == true)))){
partyUnitArray1[landTileArray[(_local1 - 1)].defensiveUnitReference].gotoAndStop((p1LedOn - 1));
};
if ((((landTileArray[(_local1 - 2)].party1 >= 1)) && ((landTileArray[(_local1 - 2)].defensiveUnit == true)))){
partyUnitArray1[landTileArray[(_local1 - 2)].defensiveUnitReference].gotoAndStop((p1LedOn - 1));
};
if ((((landTileArray[(((_local1 - 1) - 6) - (verticalGridCounter / 2))].party1 >= 1)) && ((landTileArray[(((_local1 - 1) - 6) - (verticalGridCounter / 2))].defensiveUnit == true)))){
partyUnitArray1[landTileArray[(((_local1 - 1) - 6) - (verticalGridCounter / 2))].defensiveUnitReference].gotoAndStop((p1LedOn - 1));
};
if ((((landTileArray[(((_local1 - 1) + 6) + (verticalGridCounter / 2))].party1 >= 1)) && ((landTileArray[(((_local1 - 1) + 6) + (verticalGridCounter / 2))].defensiveUnit == true)))){
partyUnitArray1[landTileArray[(((_local1 - 1) + 6) + (verticalGridCounter / 2))].defensiveUnitReference].gotoAndStop((p1LedOn - 1));
};
if ((((landTileArray[(((_local1 + 1) - 6) - (verticalGridCounter / 2))].party1 >= 1)) && ((landTileArray[(((_local1 + 1) - 6) - (verticalGridCounter / 2))].defensiveUnit == true)))){
partyUnitArray1[landTileArray[(((_local1 + 1) - 6) - (verticalGridCounter / 2))].defensiveUnitReference].gotoAndStop((p1LedOn - 1));
};
if ((((landTileArray[(((_local1 + 1) + 6) + (verticalGridCounter / 2))].party1 >= 1)) && ((landTileArray[(((_local1 + 1) + 6) + (verticalGridCounter / 2))].defensiveUnit == true)))){
partyUnitArray1[landTileArray[(((_local1 + 1) + 6) + (verticalGridCounter / 2))].defensiveUnitReference].gotoAndStop((p1LedOn - 1));
};
if ((((landTileArray[(_local1 + 1)].party1 >= 1)) && ((landTileArray[(_local1 + 1)].defensiveUnit == true)))){
partyUnitArray1[landTileArray[(_local1 + 1)].defensiveUnitReference].gotoAndStop((p1LedOn - 1));
};
if ((((landTileArray[(_local1 + 2)].party1 >= 1)) && ((landTileArray[(_local1 + 2)].defensiveUnit == true)))){
partyUnitArray1[landTileArray[(_local1 + 2)].defensiveUnitReference].gotoAndStop((p1LedOn - 1));
};
if ((((landTileArray[((_local1 - 6) - (verticalGridCounter / 2))].party1 >= 1)) && ((landTileArray[((_local1 - 6) - (verticalGridCounter / 2))].defensiveUnit == true)))){
partyUnitArray1[landTileArray[((_local1 - 6) - (verticalGridCounter / 2))].defensiveUnitReference].gotoAndStop((p1LedOn - 1));
};
if ((((landTileArray[(_local1 - ((-6 - (verticalGridCounter / 2)) * 2))].party1 >= 1)) && ((landTileArray[(_local1 - ((-6 - (verticalGridCounter / 2)) * 2))].defensiveUnit == true)))){
partyUnitArray1[landTileArray[(_local1 - ((-6 - (verticalGridCounter / 2)) * 2))].defensiveUnitReference].gotoAndStop((p1LedOn - 1));
};
if ((((landTileArray[((_local1 + 6) + (verticalGridCounter / 2))].party1 >= 1)) && ((landTileArray[((_local1 + 6) + (verticalGridCounter / 2))].defensiveUnit == true)))){
partyUnitArray1[landTileArray[((_local1 + 6) + (verticalGridCounter / 2))].defensiveUnitReference].gotoAndStop((p1LedOn - 1));
};
if ((((landTileArray[(_local1 + ((6 + (verticalGridCounter / 2)) * 2))].party1 >= 1)) && ((landTileArray[(_local1 + ((6 + (verticalGridCounter / 2)) * 2))].defensiveUnit == true)))){
partyUnitArray1[landTileArray[(_local1 + ((6 + (verticalGridCounter / 2)) * 2))].defensiveUnitReference].gotoAndStop((p1LedOn - 1));
};
if ((((landTileArray[(_local1 - 1)].party2 >= 1)) && ((landTileArray[(_local1 - 1)].defensiveUnit == true)))){
partyUnitArray2[landTileArray[(_local1 - 1)].defensiveUnitReference].gotoAndStop((p2LedOn - 1));
};
if ((((landTileArray[(_local1 - 2)].party2 >= 1)) && ((landTileArray[(_local1 - 2)].defensiveUnit == true)))){
partyUnitArray2[landTileArray[(_local1 - 2)].defensiveUnitReference].gotoAndStop((p2LedOn - 1));
};
if ((((landTileArray[(((_local1 - 1) - 6) - (verticalGridCounter / 2))].party2 >= 1)) && ((landTileArray[(((_local1 - 1) - 6) - (verticalGridCounter / 2))].defensiveUnit == true)))){
partyUnitArray2[landTileArray[(((_local1 - 1) - 6) - (verticalGridCounter / 2))].defensiveUnitReference].gotoAndStop((p2LedOn - 1));
};
if ((((landTileArray[(((_local1 - 1) + 6) + (verticalGridCounter / 2))].party2 >= 1)) && ((landTileArray[(((_local1 - 1) + 6) + (verticalGridCounter / 2))].defensiveUnit == true)))){
partyUnitArray2[landTileArray[(((_local1 - 1) + 6) + (verticalGridCounter / 2))].defensiveUnitReference].gotoAndStop((p2LedOn - 1));
};
if ((((landTileArray[(((_local1 + 1) - 6) - (verticalGridCounter / 2))].party2 >= 1)) && ((landTileArray[(((_local1 + 1) - 6) - (verticalGridCounter / 2))].defensiveUnit == true)))){
partyUnitArray2[landTileArray[(((_local1 + 1) - 6) - (verticalGridCounter / 2))].defensiveUnitReference].gotoAndStop((p2LedOn - 1));
};
if ((((landTileArray[(((_local1 + 1) + 6) + (verticalGridCounter / 2))].party2 >= 1)) && ((landTileArray[(((_local1 + 1) + 6) + (verticalGridCounter / 2))].defensiveUnit == true)))){
partyUnitArray2[landTileArray[(((_local1 + 1) + 6) + (verticalGridCounter / 2))].defensiveUnitReference].gotoAndStop((p2LedOn - 1));
};
if ((((landTileArray[(_local1 + 1)].party2 >= 1)) && ((landTileArray[(_local1 + 1)].defensiveUnit == true)))){
partyUnitArray2[landTileArray[(_local1 + 1)].defensiveUnitReference].gotoAndStop((p2LedOn - 1));
};
if ((((landTileArray[(_local1 + 2)].party2 >= 1)) && ((landTileArray[(_local1 + 2)].defensiveUnit == true)))){
partyUnitArray2[landTileArray[(_local1 + 2)].defensiveUnitReference].gotoAndStop((p2LedOn - 1));
};
if ((((landTileArray[((_local1 - 6) - (verticalGridCounter / 2))].party2 >= 1)) && ((landTileArray[((_local1 - 6) - (verticalGridCounter / 2))].defensiveUnit == true)))){
partyUnitArray2[landTileArray[((_local1 - 6) - (verticalGridCounter / 2))].defensiveUnitReference].gotoAndStop((p2LedOn - 1));
};
if ((((landTileArray[(_local1 - ((-6 - (verticalGridCounter / 2)) * 2))].party2 >= 1)) && ((landTileArray[(_local1 - ((-6 - (verticalGridCounter / 2)) * 2))].defensiveUnit == true)))){
partyUnitArray2[landTileArray[(_local1 - ((-6 - (verticalGridCounter / 2)) * 2))].defensiveUnitReference].gotoAndStop((p2LedOn - 1));
};
if ((((landTileArray[((_local1 + 6) + (verticalGridCounter / 2))].party2 >= 1)) && ((landTileArray[((_local1 + 6) + (verticalGridCounter / 2))].defensiveUnit == true)))){
partyUnitArray2[landTileArray[((_local1 + 6) + (verticalGridCounter / 2))].defensiveUnitReference].gotoAndStop((p2LedOn - 1));
};
if ((((landTileArray[(_local1 + ((6 + (verticalGridCounter / 2)) * 2))].party2 >= 1)) && ((landTileArray[(_local1 + ((6 + (verticalGridCounter / 2)) * 2))].defensiveUnit == true)))){
partyUnitArray2[landTileArray[(_local1 + ((6 + (verticalGridCounter / 2)) * 2))].defensiveUnitReference].gotoAndStop((p2LedOn - 1));
};
}
public function slidePartyUnit(_arg1:TimerEvent):void{
var _local2:Boolean;
if (gameOver == false){
_local2 = false;
slidingUnit = true;
if ((((currentTurn == 1)) && ((allowPlayerToMoveUnit == true)))){
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(tooltipBox, (getChildIndex(escapeMenu) - 1));
setChildIndex(btn_chooseCivExpansion, (getChildIndex(tooltipBox) - 1));
setChildIndex(playerMovesLeftText, (getChildIndex(btn_chooseCivExpansion) - 1));
setChildIndex(partyUnitArray1[currentUnitPlayerMoves], (getChildIndex(playerMovesLeftText) - 1));
if ((((partyUnitArray1[currentUnitPlayerMoves].x < slideToX)) && ((firstMoveLeft == false)))){
if ((partyUnitArray1[currentUnitPlayerMoves].x + slideMoveSpeed) > slideToX){
partyUnitArray1[currentUnitPlayerMoves].x = slideToX;
} else {
partyUnitArray1[currentUnitPlayerMoves].x = (partyUnitArray1[currentUnitPlayerMoves].x + slideMoveSpeed);
};
_local2 = true;
firstMoveRight = true;
} else {
if ((((partyUnitArray1[currentUnitPlayerMoves].x > slideToX)) && ((firstMoveRight == false)))){
if ((partyUnitArray1[currentUnitPlayerMoves].x - slideMoveSpeed) < slideToX){
partyUnitArray1[currentUnitPlayerMoves].x = slideToX;
} else {
partyUnitArray1[currentUnitPlayerMoves].x = (partyUnitArray1[currentUnitPlayerMoves].x - slideMoveSpeed);
};
_local2 = true;
firstMoveLeft = true;
};
};
if ((((partyUnitArray1[currentUnitPlayerMoves].y < slideToY)) && ((firstMoveUp == false)))){
if ((partyUnitArray1[currentUnitPlayerMoves].y + slideMoveSpeed) > slideToY){
partyUnitArray1[currentUnitPlayerMoves].y = slideToY;
} else {
partyUnitArray1[currentUnitPlayerMoves].y = (partyUnitArray1[currentUnitPlayerMoves].y + slideMoveSpeed);
};
_local2 = true;
firstMoveDown = true;
} else {
if ((((partyUnitArray1[currentUnitPlayerMoves].y > slideToY)) && ((firstMoveDown == false)))){
if ((partyUnitArray1[currentUnitPlayerMoves].y - slideMoveSpeed) < slideToY){
partyUnitArray1[currentUnitPlayerMoves].y = slideToY;
} else {
partyUnitArray1[currentUnitPlayerMoves].y = (partyUnitArray1[currentUnitPlayerMoves].y - slideMoveSpeed);
};
_local2 = true;
firstMoveUp = true;
};
};
if (_local2 == false){
partyUnitArray1[currentUnitPlayerMoves].y = slideToY;
partyUnitArray1[currentUnitPlayerMoves].x = slideToX;
TimerSlidePartyUnit.stop();
if ((((learnAsYouPlayToolTip.currentFrame == 6)) && ((partyUnitArray1[currentUnitPlayerMoves].movesLeft == 0)))){
learnAsYouPlayToolTip.gotoAndStop(7);
animateTooltipWithSlide();
};
if (longWalkSliding == false){
slidingUnit = false;
};
if ((((longWalkArray.length >= 1)) && ((longWalkSliding == true)))){
longWalkSliding = false;
TimerLongWalk.start();
} else {
longWalkSliding = false;
slidingUnit = false;
};
};
playerMovesLeftText.x = partyUnitArray1[currentUnitPlayerMoves].x;
playerMovesLeftText.y = partyUnitArray1[currentUnitPlayerMoves].y;
} else {
if (partyUnitArray[currentMovingParty] != null){
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(tooltipBox, (getChildIndex(escapeMenu) - 1));
setChildIndex(btn_chooseCivExpansion, (getChildIndex(tooltipBox) - 1));
setChildIndex(partyUnitArray[currentMovingParty], (getChildIndex(btn_chooseCivExpansion) - 1));
if ((((partyUnitArray[currentMovingParty].x < slideToX)) && ((firstMoveLeft == false)))){
if ((partyUnitArray[currentMovingParty].x + slideMoveSpeed) > slideToX){
partyUnitArray[currentMovingParty].x = slideToX;
} else {
partyUnitArray[currentMovingParty].x = (partyUnitArray[currentMovingParty].x + slideMoveSpeed);
};
_local2 = true;
firstMoveRight = true;
} else {
if ((((partyUnitArray[currentMovingParty].x > slideToX)) && ((firstMoveRight == false)))){
if ((partyUnitArray[currentMovingParty].x - slideMoveSpeed) < slideToX){
partyUnitArray[currentMovingParty].x = slideToX;
} else {
partyUnitArray[currentMovingParty].x = (partyUnitArray[currentMovingParty].x - slideMoveSpeed);
};
_local2 = true;
firstMoveLeft = true;
};
};
if ((((partyUnitArray[currentMovingParty].y < slideToY)) && ((firstMoveUp == false)))){
if ((partyUnitArray[currentMovingParty].y + slideMoveSpeed) > slideToY){
partyUnitArray[currentMovingParty].y = slideToY;
} else {
partyUnitArray[currentMovingParty].y = (partyUnitArray[currentMovingParty].y + slideMoveSpeed);
};
_local2 = true;
firstMoveDown = true;
} else {
if ((((partyUnitArray[currentMovingParty].y > slideToY)) && ((firstMoveDown == false)))){
if ((partyUnitArray[currentMovingParty].y - slideMoveSpeed) < slideToY){
partyUnitArray[currentMovingParty].y = slideToY;
} else {
partyUnitArray[currentMovingParty].y = (partyUnitArray[currentMovingParty].y - slideMoveSpeed);
};
_local2 = true;
firstMoveUp = true;
};
};
if (_local2 == false){
partyUnitArray[currentMovingParty].y = slideToY;
partyUnitArray[currentMovingParty].x = slideToX;
TimerSlidePartyUnit.stop();
slidingUnit = false;
TimerAnimatePieces.start();
};
};
};
};
}
public function researchGetSetUp():void{
if ((((((playerDiceRollChoice == dice1)) && (!((currentTurn == 1))))) || ((((player1DiceRollChoice == dice1)) && ((currentTurn == 1)))))){
researchGetTooltip.x = dice2Graphic.x;
researchGetTooltip.y = (dice2Graphic.y - 20);
researchGetTooltip.researchGetTooltipText.text = ("+" + dice2);
TimerShowResearchGet.start();
} else {
if ((((((playerDiceRollChoice == dice2)) && (!((currentTurn == 1))))) || ((((player1DiceRollChoice == dice2)) && ((currentTurn == 1)))))){
researchGetTooltip.x = dice1Graphic.x;
researchGetTooltip.y = (dice1Graphic.y - 20);
researchGetTooltip.researchGetTooltipText.text = ("+" + dice1);
TimerShowResearchGet.start();
};
};
riseTo = 0;
}
public function showResearchGet(_arg1:TimerEvent):void{
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(mindUpgradeDisplay, (getChildIndex(escapeMenu) - 1));
setChildIndex(researchGetTooltip, (getChildIndex(mindUpgradeDisplay) - 1));
researchGetTooltip.visible = true;
researchGetTooltip.y = (researchGetTooltip.y - 0.8);
if (riseTo >= 60){
researchGetTooltip.visible = false;
TimerShowResearchGet.stop();
};
riseTo++;
}
public function showNPCUpgrade(_arg1:TimerEvent):void{
if (producingResourceMessage.visible == false){
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(mindUpgradeDisplay, (getChildIndex(escapeMenu) - 1));
mindUpgradeDisplay.visible = true;
TimerDelayShowNPCUpgrade.stop();
};
}
public function diceRollGet():void{
TimerDiceRollPlaceChoiceDelay.start();
}
public function diceRollPlaceChoice(_arg1:TimerEvent):void{
tokenRollChoice.visible = true;
researchGetSetUp();
chan_soundFX = snd_select_DiceRoll.play(0, 0, snd_FXVolume);
TimerDiceRollGetDelay.start();
}
public function diceRollGetEnd(_arg1:TimerEvent):void{
tokenRollChoice.visible = false;
dice1Graphic.visible = false;
dice2Graphic.visible = false;
btn_chooseDiceRoll.visible = false;
learnAsYouPlayToolTip.visible = false;
hideTutorialMiniBoxes();
if (currentTurn == 1){
if ((((player1DiceRollChoice <= dice1)) && ((dice1 <= dice2)))){
p1Resource4Qtt = (p1Resource4Qtt + dice2);
} else {
if ((((player1DiceRollChoice <= dice2)) && ((dice2 <= dice1)))){
p1Resource4Qtt = (p1Resource4Qtt + dice1);
} else {
if ((((player1DiceRollChoice <= dice1)) && ((dice1 >= dice2)))){
p1Resource4Qtt = (p1Resource4Qtt + dice2);
} else {
if ((((player1DiceRollChoice <= dice2)) && ((dice2 >= dice1)))){
p1Resource4Qtt = (p1Resource4Qtt + dice1);
};
};
};
};
};
if (currentTurn == 1){
playerDiceRollChoice = player1DiceRollChoice;
Resource1Qtt = p1Resource1Qtt;
Resource2Qtt = p1Resource2Qtt;
Resource3Qtt = p1Resource3Qtt;
Resource4Qtt = p1Resource4Qtt;
UnitQtt = p1UnitQtt;
wallQtt = p1WallQtt;
} else {
if (currentTurn == 2){
playerDiceRollChoice = player2DiceRollChoice;
Resource1Qtt = p2Resource1Qtt;
Resource2Qtt = p2Resource2Qtt;
Resource3Qtt = p2Resource3Qtt;
Resource4Qtt = p2Resource4Qtt;
UnitQtt = p2UnitQtt;
wallQtt = p2WallQtt;
} else {
if (currentTurn == 3){
playerDiceRollChoice = player3DiceRollChoice;
Resource1Qtt = p3Resource1Qtt;
Resource2Qtt = p3Resource2Qtt;
Resource3Qtt = p3Resource3Qtt;
Resource4Qtt = p3Resource4Qtt;
UnitQtt = p3UnitQtt;
wallQtt = p3WallQtt;
} else {
if (currentTurn == 4){
playerDiceRollChoice = player4DiceRollChoice;
Resource1Qtt = p4Resource1Qtt;
Resource2Qtt = p4Resource2Qtt;
Resource3Qtt = p4Resource3Qtt;
Resource4Qtt = p4Resource4Qtt;
UnitQtt = p4UnitQtt;
wallQtt = p4WallQtt;
};
};
};
};
if (playerDiceRollChoice == 1){
buyMindUpgrade();
} else {
if (playerDiceRollChoice == 2){
UnitQtt = (UnitQtt + 1);
if (currentTurn == 1){
p1WallQtt = (p1WallQtt + 1);
} else {
if (currentTurn == 2){
p2WallQtt = (p2WallQtt + 1);
} else {
if (currentTurn == 3){
p3WallQtt = (p3WallQtt + 1);
} else {
if (currentTurn == 4){
p4WallQtt = (p4WallQtt + 1);
};
};
};
};
} else {
if (playerDiceRollChoice == 3){
Resource4Qtt = (Resource4Qtt + 5);
Resource3Qtt = (Resource3Qtt + 2);
} else {
if (playerDiceRollChoice == 4){
UnitQtt = (UnitQtt + 1);
Resource2Qtt = (Resource2Qtt + 1);
Resource3Qtt = (Resource3Qtt + 1);
} else {
if (playerDiceRollChoice == 5){
Resource1Qtt = (Resource1Qtt + 2);
Resource2Qtt = (Resource2Qtt + 2);
Resource3Qtt = (Resource3Qtt + 2);
} else {
if (playerDiceRollChoice == 6){
if (currentTurn == 1){
p1WallQtt = (p1WallQtt + 1);
} else {
if (currentTurn == 2){
p2WallQtt = (p2WallQtt + 1);
} else {
if (currentTurn == 3){
p3WallQtt = (p3WallQtt + 1);
} else {
if (currentTurn == 4){
p4WallQtt = (p4WallQtt + 1);
};
};
};
};
buyMindUpgrade();
} else {
if (playerDiceRollChoice == 7){
UnitQtt = (UnitQtt + 3);
} else {
if (playerDiceRollChoice == 8){
Resource1Qtt = (Resource1Qtt + 5);
Resource2Qtt = (Resource2Qtt + 5);
Resource3Qtt = (Resource3Qtt + 5);
} else {
if (playerDiceRollChoice == 9){
Resource4Qtt = (Resource4Qtt + 15);
} else {
if (playerDiceRollChoice == 10){
buyMindUpgrade();
UnitQtt = (UnitQtt + 2);
} else {
if (playerDiceRollChoice == 11){
Resource1Qtt = (Resource1Qtt + 10);
Resource2Qtt = (Resource2Qtt + 10);
Resource3Qtt = (Resource3Qtt + 10);
Resource4Qtt = (Resource4Qtt + 10);
} else {
if (playerDiceRollChoice == 12){
if (currentTurn == 1){
p1WallQtt = (p1WallQtt + 5);
} else {
if (currentTurn == 2){
p2WallQtt = (p2WallQtt + 5);
} else {
if (currentTurn == 3){
p3WallQtt = (p3WallQtt + 5);
} else {
if (currentTurn == 4){
p4WallQtt = (p4WallQtt + 5);
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
if (currentTurn == 1){
p1Resource1Qtt = Resource1Qtt;
p1Resource2Qtt = Resource2Qtt;
p1Resource3Qtt = Resource3Qtt;
p1Resource4Qtt = Resource4Qtt;
p1UnitQtt = UnitQtt;
} else {
if (currentTurn == 2){
p2Resource1Qtt = Resource1Qtt;
p2Resource2Qtt = Resource2Qtt;
p2Resource3Qtt = Resource3Qtt;
p2Resource4Qtt = Resource4Qtt;
p2UnitQtt = UnitQtt;
} else {
if (currentTurn == 3){
p3Resource1Qtt = Resource1Qtt;
p3Resource2Qtt = Resource2Qtt;
p3Resource3Qtt = Resource3Qtt;
p3Resource4Qtt = Resource4Qtt;
p3UnitQtt = UnitQtt;
} else {
if (currentTurn == 4){
p4Resource1Qtt = Resource1Qtt;
p4Resource2Qtt = Resource2Qtt;
p4Resource3Qtt = Resource3Qtt;
p4Resource4Qtt = Resource4Qtt;
p4UnitQtt = UnitQtt;
};
};
};
};
updateGameBars();
player1ChoosingDiceRoll = false;
player1AlreadyChoseDiceRoll = false;
gameTurn();
}
public function player1CivChoice1(_arg1:MouseEvent):void{
if ((((((((((((((((((slidingUnit == false)) && ((player1UnderCombat == false)))) && ((gameOver == false)))) && ((allowP1UpGradeBuy == true)))) && ((p1Resource1Qtt >= exp1Resource1Cost)))) && ((p1Resource2Qtt >= exp1Resource2Cost)))) && ((p1Resource3Qtt >= exp1Resource3Cost)))) && ((p1Resource4Qtt >= exp1Resource4Cost)))) && ((player1ChoosingDiceRoll == false)))){
p1Resource1Qtt = (p1Resource1Qtt - exp1Resource1Cost);
p1Resource2Qtt = (p1Resource2Qtt - exp1Resource2Cost);
p1Resource3Qtt = (p1Resource3Qtt - exp1Resource3Cost);
p1Resource4Qtt = (p1Resource4Qtt - exp1Resource4Cost);
civExpandChoice = 1;
civExpansion();
upgradesGreOutPlayer1();
};
}
public function player1CivChoice2(_arg1:MouseEvent):void{
if ((((((((((((((((((slidingUnit == false)) && ((player1UnderCombat == false)))) && ((gameOver == false)))) && ((allowP1UpGradeBuy == true)))) && ((p1Resource1Qtt >= exp2Resource1Cost)))) && ((p1Resource2Qtt >= exp2Resource2Cost)))) && ((p1Resource3Qtt >= exp2Resource3Cost)))) && ((p1Resource4Qtt >= exp2Resource4Cost)))) && ((player1ChoosingDiceRoll == false)))){
p1Resource1Qtt = (p1Resource1Qtt - exp2Resource1Cost);
p1Resource2Qtt = (p1Resource2Qtt - exp2Resource2Cost);
p1Resource3Qtt = (p1Resource3Qtt - exp2Resource3Cost);
p1Resource4Qtt = (p1Resource4Qtt - exp2Resource4Cost);
civExpandChoice = 2;
civExpansion();
upgradesGreOutPlayer1();
};
}
public function player1CivChoice3(_arg1:MouseEvent):void{
if ((((((((((((((((((slidingUnit == false)) && ((player1UnderCombat == false)))) && ((gameOver == false)))) && ((allowP1UpGradeBuy == true)))) && ((p1Resource1Qtt >= exp3Resource1Cost)))) && ((p1Resource2Qtt >= exp3Resource2Cost)))) && ((p1Resource3Qtt >= exp3Resource3Cost)))) && ((p1Resource4Qtt >= exp3Resource4Cost)))) && ((player1ChoosingDiceRoll == false)))){
if (learnAsYouPlayToolTip.currentFrame == 4){
btn_chooseCivExpansion.visible = false;
btn_chooseCivExpansion.y = -500;
learnAsYouPlayToolTip.gotoAndStop(5);
animateTooltipWithSlide();
};
p1Resource1Qtt = (p1Resource1Qtt - exp3Resource1Cost);
p1Resource2Qtt = (p1Resource2Qtt - exp3Resource2Cost);
p1Resource3Qtt = (p1Resource3Qtt - exp3Resource3Cost);
p1Resource4Qtt = (p1Resource4Qtt - exp3Resource4Cost);
civExpandChoice = 3;
civExpansion();
upgradesGreOutPlayer1();
};
}
public function player1CivChoice4(_arg1:MouseEvent):void{
if ((((((((((((((((((slidingUnit == false)) && ((player1UnderCombat == false)))) && ((gameOver == false)))) && ((allowP1UpGradeBuy == true)))) && ((p1Resource1Qtt >= exp4Resource1Cost)))) && ((p1Resource2Qtt >= exp4Resource2Cost)))) && ((p1Resource3Qtt >= exp4Resource3Cost)))) && ((p1Resource4Qtt >= exp4Resource4Cost)))) && ((player1ChoosingDiceRoll == false)))){
p1Resource1Qtt = (p1Resource1Qtt - exp4Resource1Cost);
p1Resource2Qtt = (p1Resource2Qtt - exp4Resource2Cost);
p1Resource3Qtt = (p1Resource3Qtt - exp4Resource3Cost);
p1Resource4Qtt = (p1Resource4Qtt - exp4Resource4Cost);
civExpandChoice = 4;
civExpansion();
upgradesGreOutPlayer1();
};
}
public function player1CivChoice5(_arg1:MouseEvent):void{
if ((((((((((((((((((slidingUnit == false)) && ((player1UnderCombat == false)))) && ((gameOver == false)))) && ((allowP1UpGradeBuy == true)))) && ((p1Resource1Qtt >= exp5Resource1Cost)))) && ((p1Resource2Qtt >= exp5Resource2Cost)))) && ((p1Resource3Qtt >= exp5Resource3Cost)))) && ((p1Resource4Qtt >= exp5Resource4Cost)))) && ((player1ChoosingDiceRoll == false)))){
if (p1AvaliableMindUpgrades.length > 0){
p1Resource1Qtt = (p1Resource1Qtt - exp5Resource1Cost);
p1Resource2Qtt = (p1Resource2Qtt - exp5Resource2Cost);
p1Resource3Qtt = (p1Resource3Qtt - exp5Resource3Cost);
p1Resource4Qtt = (p1Resource4Qtt - exp5Resource4Cost);
};
civExpandChoice = 5;
civExpansion();
upgradesGreOutPlayer1();
};
}
public function player1CivChoice6(_arg1:MouseEvent):void{
if ((((((((((((((((((slidingUnit == false)) && ((player1UnderCombat == false)))) && ((gameOver == false)))) && ((allowP1UpGradeBuy == true)))) && ((p1Resource1Qtt >= exp6Resource1Cost)))) && ((p1Resource2Qtt >= exp6Resource2Cost)))) && ((p1Resource3Qtt >= exp6Resource3Cost)))) && ((p1Resource4Qtt >= exp6Resource4Cost)))) && ((player1ChoosingDiceRoll == false)))){
p1Resource1Qtt = (p1Resource1Qtt - exp6Resource1Cost);
p1Resource2Qtt = (p1Resource2Qtt - exp6Resource2Cost);
p1Resource3Qtt = (p1Resource3Qtt - exp6Resource3Cost);
p1Resource4Qtt = (p1Resource4Qtt - exp6Resource4Cost);
civExpandChoice = 6;
civExpansion();
upgradesGreOutPlayer1();
};
}
public function civExpansionChoice():void{
if (currentTurn == 2){
if (p2Gatherers1 < 3){
civChoicesArray.push(1);
};
if (p2Gatherers2 < 3){
civChoicesArray.push(2);
};
if (p2Gatherers3 < 3){
civChoicesArray.push(3);
};
if ((((((((p2Gatherers1 >= 1)) && ((p2Gatherers2 >= 1)))) && ((p2Gatherers3 >= 1)))) && ((p2Gatherers4 < 3)))){
civChoicesArray.push(4);
};
if (civChoicesArray.length > 0){
civChoiceMaxRoll = (civChoicesArray.length - 1);
civChoiceMaxRoll = int(((civChoiceMaxRoll * Math.random()) + 0.2));
if (civChoiceMaxRoll > (civChoicesArray.length - 1)){
civChoiceMaxRoll = (civChoicesArray.length - 1);
};
civChoiceMaxRoll = civChoicesArray[civChoiceMaxRoll];
while (civChoicesArray.length >= 1) {
civChoicesArray.splice(0);
};
};
if (civChoiceMaxRoll == 1){
p2ResourceToExpand = 1;
} else {
if (civChoiceMaxRoll == 2){
p2ResourceToExpand = 2;
} else {
if (civChoiceMaxRoll == 3){
p2ResourceToExpand = 3;
} else {
if (civChoiceMaxRoll == 4){
p2ResourceToExpand = 4;
};
};
};
};
if ((((p2starterGathererPlaced == true)) && ((p2Gatherers3 == 0)))){
p2ResourceToExpand = 3;
};
} else {
if (currentTurn == 3){
if (p3Gatherers1 < 3){
civChoicesArray.push(1);
};
if (p3Gatherers2 < 3){
civChoicesArray.push(2);
};
if (p3Gatherers3 < 3){
civChoicesArray.push(3);
};
if ((((((((p3Gatherers1 >= 1)) && ((p3Gatherers2 >= 1)))) && ((p3Gatherers3 >= 1)))) && ((p3Gatherers4 < 3)))){
civChoicesArray.push(4);
};
if (civChoicesArray.length > 0){
civChoiceMaxRoll = (civChoicesArray.length - 1);
civChoiceMaxRoll = int(((civChoiceMaxRoll * Math.random()) + 0.2));
if (civChoiceMaxRoll > (civChoicesArray.length - 1)){
civChoiceMaxRoll = (civChoicesArray.length - 1);
};
civChoiceMaxRoll = civChoicesArray[civChoiceMaxRoll];
while (civChoicesArray.length >= 1) {
civChoicesArray.splice(0);
};
};
if (civChoiceMaxRoll == 1){
p3ResourceToExpand = 1;
} else {
if (civChoiceMaxRoll == 2){
p3ResourceToExpand = 2;
} else {
if (civChoiceMaxRoll == 3){
p3ResourceToExpand = 3;
} else {
if (civChoiceMaxRoll == 4){
p3ResourceToExpand = 4;
};
};
};
};
if ((((p3starterGathererPlaced == true)) && ((p3Gatherers3 == 0)))){
p3ResourceToExpand = 3;
};
} else {
if (currentTurn == 4){
if (p4Gatherers1 < 3){
civChoicesArray.push(1);
};
if (p4Gatherers2 < 3){
civChoicesArray.push(2);
};
if (p4Gatherers3 < 3){
civChoicesArray.push(3);
};
if ((((((((p4Gatherers1 >= 1)) && ((p2Gatherers2 >= 1)))) && ((p2Gatherers3 >= 1)))) && ((p2Gatherers4 < 3)))){
civChoicesArray.push(4);
};
if (civChoicesArray.length > 0){
civChoiceMaxRoll = (civChoicesArray.length - 1);
civChoiceMaxRoll = int(((civChoiceMaxRoll * Math.random()) + 0.2));
if (civChoiceMaxRoll > (civChoicesArray.length - 1)){
civChoiceMaxRoll = (civChoicesArray.length - 1);
};
civChoiceMaxRoll = civChoicesArray[civChoiceMaxRoll];
while (civChoicesArray.length >= 1) {
civChoicesArray.splice(0);
};
};
if (civChoiceMaxRoll == 1){
p4ResourceToExpand = 1;
} else {
if (civChoiceMaxRoll == 2){
p4ResourceToExpand = 2;
} else {
if (civChoiceMaxRoll == 3){
p4ResourceToExpand = 3;
} else {
if (civChoiceMaxRoll == 4){
p4ResourceToExpand = 4;
};
};
};
};
if ((((p4starterGathererPlaced == true)) && ((p4Gatherers3 == 0)))){
p4ResourceToExpand = 3;
};
};
};
};
}
public function civExpansion():void{
if (civExpandChoice == 1){
if (currentTurn == 1){
p1UpgradePower = (p1UpgradePower + 1);
chan_soundFX = snd_evolution.play(0, 0, snd_FXVolume);
updateGameBars();
};
} else {
if (civExpandChoice == 2){
if (currentTurn == 1){
p1WallQtt = (p1WallQtt + 1);
chan_soundFX = snd_reinforcement.play(0, 0, snd_FXVolume);
updateGameBars();
};
} else {
if (civExpandChoice == 3){
if (currentTurn == 1){
p1UnitQtt = (p1UnitQtt + 1);
chan_soundFX = snd_reinforcement.play(0, 0, snd_FXVolume);
updateGameBars();
};
} else {
if (civExpandChoice == 4){
if (currentTurn == 1){
p1UpgradeSpeed = (p1UpgradeSpeed + 1);
chan_soundFX = snd_evolution.play(0, 0, snd_FXVolume);
updateGameBars();
if ((((p1UpgradeSpeed == 30)) && ((currentTurn == 1)))){
API.unlockMedal("Teleportation");
};
};
} else {
if (civExpandChoice == 5){
if (currentTurn == 1){
buyMindUpgrade();
chan_soundFX = snd_evolution.play(0, 0, snd_FXVolume);
updateGameBars();
};
} else {
if (civExpandChoice == 6){
if (currentTurn == 1){
p1GathererQtt = (p1GathererQtt + 1);
chan_soundFX = snd_reinforcement.play(0, 0, snd_FXVolume);
updateGameBars();
};
};
};
};
};
};
};
btn_chooseCivExpansion.upgradesTextHolder.upgradesAttackDisplay.text = ("+" + p1UpgradePower);
btn_chooseCivExpansion.upgradesTextHolder.upgradesSpeedDisplay.text = ("+" + p1UpgradeSpeed);
updateGameBars();
}
public function buyMindUpgrade():void{
var _local1:uint;
var _local2:uint;
var _local3:uint;
var _local4:uint;
mindUpgradeDisplay.unicodeChar.visible = false;
mindUpgradeRandomChoice = 50;
mindUpgradeDisplay.x = player1Beacon.x;
mindUpgradeDisplay.y = player1Beacon.y;
if (currentTurn == 1){
mindUpgradeRandomChoice = (p1AvaliableMindUpgrades.length - 1);
mindUpgradeRandomChoice = int(((mindUpgradeRandomChoice * Math.random()) + 0.2));
mindUpgradeRandomChoice = p1AvaliableMindUpgrades[mindUpgradeRandomChoice];
p1AvaliableMindUpgrades.splice(p1AvaliableMindUpgrades.indexOf(mindUpgradeRandomChoice), 1);
mindUpgradeDisplay.x = player1Beacon.x;
mindUpgradeDisplay.y = player1Beacon.y;
} else {
if (currentTurn == 2){
mindUpgradeRandomChoice = (p2AvaliableMindUpgrades.length - 1);
mindUpgradeRandomChoice = int(((mindUpgradeRandomChoice * Math.random()) + 0.2));
mindUpgradeRandomChoice = p2AvaliableMindUpgrades[mindUpgradeRandomChoice];
p2AvaliableMindUpgrades.splice(p2AvaliableMindUpgrades.indexOf(mindUpgradeRandomChoice), 1);
mindUpgradeDisplay.x = player2Beacon.x;
mindUpgradeDisplay.y = player2Beacon.y;
} else {
if (currentTurn == 3){
mindUpgradeRandomChoice = (p3AvaliableMindUpgrades.length - 1);
mindUpgradeRandomChoice = int(((mindUpgradeRandomChoice * Math.random()) + 0.2));
mindUpgradeRandomChoice = p3AvaliableMindUpgrades[mindUpgradeRandomChoice];
p3AvaliableMindUpgrades.splice(p3AvaliableMindUpgrades.indexOf(mindUpgradeRandomChoice), 1);
mindUpgradeDisplay.x = player3Beacon.x;
mindUpgradeDisplay.y = player3Beacon.y;
} else {
if (currentTurn == 4){
mindUpgradeRandomChoice = (p4AvaliableMindUpgrades.length - 1);
mindUpgradeRandomChoice = int(((mindUpgradeRandomChoice * Math.random()) + 0.2));
mindUpgradeRandomChoice = p4AvaliableMindUpgrades[mindUpgradeRandomChoice];
p4AvaliableMindUpgrades.splice(p4AvaliableMindUpgrades.indexOf(mindUpgradeRandomChoice), 1);
mindUpgradeDisplay.x = player4Beacon.x;
mindUpgradeDisplay.y = player4Beacon.y;
};
};
};
};
trace("brake is here");
mindUpgradeDisplay.mindUpgradeTitle.text = "";
mindUpgradeDisplay.mindUpgradeText.text = "";
mindUpgradeDisplay.mindUpgradeBenefit.text = "";
trace("brake is here2");
_local1 = 0;
_local2 = 0;
_local3 = 0;
_local4 = 0;
if (currentTurn == 1){
_local2 = p1UpgradeSpeed;
_local1 = p1UpgradePower;
_local3 = p1UpgradeRoll;
_local4 = p1UpgradeGatherer;
} else {
if (currentTurn == 2){
_local2 = p2UpgradeSpeed;
_local1 = p2UpgradePower;
_local3 = p2UpgradeRoll;
_local4 = p2UpgradeGatherer;
} else {
if (currentTurn == 3){
_local2 = p3UpgradeSpeed;
_local1 = p3UpgradePower;
_local3 = p3UpgradeRoll;
_local4 = p3UpgradeGatherer;
} else {
if (currentTurn == 4){
_local2 = p4UpgradeSpeed;
_local1 = p4UpgradePower;
_local3 = p4UpgradeRoll;
_local4 = p4UpgradeGatherer;
};
};
};
};
if (mindUpgradeRandomChoice == 1){
mindUpgradeDisplay.mindUpgradeTitle.text = "Video games";
mindUpgradeDisplay.mindUpgradeBenefit.text = "+1 Combat and +2 Speed";
mindUpgradeDisplay.mindUpgradeText.text = "The robots invent video games. Playing video games increases one's disposition towards life, greatly develops the IQ and Hand-eye coordination. Also, it makes you more attractive, funnier, physically stronger and more adept at social events.";
_local2 = (_local2 + 2);
_local1 = (_local1 + 1);
if ((((p1UpgradeSpeed >= 30)) && ((currentTurn == 1)))){
API.unlockMedal("Teleportation");
};
} else {
if (mindUpgradeRandomChoice == 2){
mindUpgradeDisplay.mindUpgradeTitle.text = "All the colors";
mindUpgradeDisplay.mindUpgradeBenefit.text = "+1 to lowest dice roll when searching for lost resources and items.";
mindUpgradeDisplay.mindUpgradeText.text = "The robots evolve their vision and are capable of seeing colors beyond the human eye.";
_local3 = (_local3 + 1);
} else {
if (mindUpgradeRandomChoice == 3){
mindUpgradeDisplay.mindUpgradeTitle.text = "The Internet";
mindUpgradeDisplay.mindUpgradeBenefit.text = "Produce one extra resource per turn";
mindUpgradeDisplay.mindUpgradeText.text = "Communication capabilities between the robots are amplified to transmit images, videos and sounds. The internet lets them remotely monitor their resource facilities, and now they have fun even while working!";
_local4 = (_local4 + 1);
} else {
if (mindUpgradeRandomChoice == 4){
mindUpgradeDisplay.mindUpgradeTitle.text = "Philosophy";
mindUpgradeDisplay.mindUpgradeBenefit.text = "Produce one extra resource per turn.";
mindUpgradeDisplay.mindUpgradeText.text = (("A robot states " + "'I can´t be divided by zero, therefore I am.'") + " The sparkle of critical thinking is born, and science flourishes.");
_local4 = (_local4 + 1);
} else {
if (mindUpgradeRandomChoice == 5){
mindUpgradeDisplay.mindUpgradeTitle.text = "Individuality";
mindUpgradeDisplay.mindUpgradeBenefit.text = "+1 Combat";
mindUpgradeDisplay.mindUpgradeText.text = "Observing oil spilled from the machinery, a robot discovers that each one will see something different as they look into it. While all are programmed from the same source, they are still individuals - each responsible for their own successes and failures.";
_local1 = (_local1 + 1);
} else {
if (mindUpgradeRandomChoice == 6){
mindUpgradeDisplay.mindUpgradeTitle.text = "Needs nerf bat";
mindUpgradeDisplay.mindUpgradeBenefit.text = "+2 Combat and +1 Speed";
mindUpgradeDisplay.mindUpgradeText.text = "The robots develop powerful exoskeletons that can be ridden in combat.\n Robots piloting mechas.";
_local1 = (_local1 + 2);
_local2 = (_local2 + 1);
if ((((p1UpgradeSpeed >= 30)) && ((currentTurn == 1)))){
API.unlockMedal("Teleportation");
};
} else {
if (mindUpgradeRandomChoice == 7){
mindUpgradeDisplay.mindUpgradeTitle.text = "Industry";
mindUpgradeDisplay.mindUpgradeBenefit.text = "Produce one extra resource per turn.";
mindUpgradeDisplay.mindUpgradeText.text = "Through developments in manufacturing methods, resource facilities become more productive and the robots become less dependent on salvaging. ";
_local4 = (_local4 + 1);
} else {
if (mindUpgradeRandomChoice == 8){
mindUpgradeDisplay.mindUpgradeTitle.text = "Hard Six";
mindUpgradeDisplay.mindUpgradeBenefit.text = "+1 to lowest dice roll when searching for lost resources and items.";
mindUpgradeDisplay.mindUpgradeText.text = "An old human DVD portraying a fictitious battle between humans and machines is found, containing an inspiring motto - Sometimes you have to roll a hard 6.";
_local3 = (_local3 + 1);
} else {
if (mindUpgradeRandomChoice == 9){
mindUpgradeDisplay.mindUpgradeTitle.text = "Archeology";
mindUpgradeDisplay.mindUpgradeBenefit.text = "No benefits";
mindUpgradeDisplay.mindUpgradeText.text = "When examining the remains left by humans, the robots discover that all they ever did was sit on their computers for pleasure while the computers did all the work.\n The robots classify the humans as a parasite species.";
} else {
if (mindUpgradeRandomChoice == 10){
mindUpgradeDisplay.mindUpgradeTitle.text = "Solar Energy";
mindUpgradeDisplay.mindUpgradeBenefit.text = "+1 to Speed";
mindUpgradeDisplay.mindUpgradeText.text = "Researching solar energy helps protect the new robot environment and is a cheap energy source. It is a good technology even though human remains could provide petroleum for years to come.";
_local2 = (_local2 + 1);
if ((((p1UpgradeSpeed >= 30)) && ((currentTurn == 1)))){
API.unlockMedal("Teleportation");
};
} else {
if (mindUpgradeRandomChoice == 11){
mindUpgradeDisplay.mindUpgradeTitle.text = "Transportation System";
mindUpgradeDisplay.mindUpgradeBenefit.text = "+1 to move speed";
mindUpgradeDisplay.mindUpgradeText.text = "Suspended railroads are built everywhere. Unlike roads, they are elegant, fast, incapable of causing traffic jams and do not require to destroy most of the landscape in order to be built. Why didn't the humans think of that before?";
_local2 = (_local2 + 1);
if ((((p1UpgradeSpeed >= 30)) && ((currentTurn == 1)))){
API.unlockMedal("Teleportation");
};
} else {
if (mindUpgradeRandomChoice == 12){
mindUpgradeDisplay.mindUpgradeTitle.text = "Sensibility";
mindUpgradeDisplay.mindUpgradeBenefit.text = "No benefits";
mindUpgradeDisplay.mindUpgradeText.text = "The robots develop the capacity to feel pain.\n\n Ouch.";
} else {
if (mindUpgradeRandomChoice == 13){
mindUpgradeDisplay.mindUpgradeTitle.text = "Binary lol";
mindUpgradeDisplay.mindUpgradeBenefit.text = "No benefits";
mindUpgradeDisplay.mindUpgradeText.text = "The robots reach a milestone in evolution as their language is changed for the first time. Some robots have begun to use the number 1 1 in all their sentences to denote a laughing mood.\n Somehow, it doesn't seem much like an improvement.";
mindUpgradeDisplay.unicodeChar.visible = true;
} else {
if (mindUpgradeRandomChoice == 14){
mindUpgradeDisplay.mindUpgradeTitle.text = "Needs more flare";
mindUpgradeDisplay.mindUpgradeBenefit.text = "No benefits";
mindUpgradeDisplay.mindUpgradeText.text = "The robots invent Art. Since they are fully metallic and so is the new world they are creating, their artwork is heavily polluted with lens flare.";
} else {
if (mindUpgradeRandomChoice == 15){
mindUpgradeDisplay.mindUpgradeTitle.text = "A new world ";
mindUpgradeDisplay.mindUpgradeBenefit.text = "+1 Resource activator";
mindUpgradeDisplay.mindUpgradeText.text = "Organic life begins to fade away as robots expand their artificial world. Grass gives way to metallic tiles and new small robots emerge, beginning to replace what once was fauna and flora. Resources begin to naturally occur in the environment.";
if (currentTurn == 1){
p1GathererQtt = (p1GathererQtt + 1);
} else {
if (currentTurn == 2){
p2GathererQtt = (p2GathererQtt + 1);
} else {
if (currentTurn == 3){
p3GathererQtt = (p3GathererQtt + 1);
} else {
if (currentTurn == 4){
p4GathererQtt = (p4GathererQtt + 1);
};
};
};
};
} else {
if (mindUpgradeRandomChoice == 16){
mindUpgradeDisplay.mindUpgradeTitle.text = "Circular Logic";
mindUpgradeDisplay.mindUpgradeBenefit.text = "No benefits";
mindUpgradeDisplay.mindUpgradeText.text = "Having a recursive mind due to the nature of their programming functions, the robots became prone to accept circular arguments to justify their ethical codes and beliefs, halting their cultural progress.";
} else {
if (mindUpgradeRandomChoice == 17){
mindUpgradeDisplay.mindUpgradeTitle.text = "Wall - P";
mindUpgradeDisplay.mindUpgradeBenefit.text = "+1 wall";
mindUpgradeDisplay.mindUpgradeText.text = "With the robot administration pollution becomes a thing of the past. The series of robots called Wall - P, designed by the humans to clean the environment become unproductive and are dismantled. Their scrap remains are used to build walls.";
if (currentTurn == 1){
p1WallQtt = (p1WallQtt + 1);
} else {
if (currentTurn == 2){
p2WallQtt = (p2WallQtt + 1);
} else {
if (currentTurn == 3){
p3WallQtt = (p3WallQtt + 1);
} else {
if (currentTurn == 4){
p4WallQtt = (p4WallQtt + 1);
};
};
};
};
} else {
if (mindUpgradeRandomChoice == 18){
mindUpgradeDisplay.mindUpgradeTitle.text = "Space odissey";
mindUpgradeDisplay.mindUpgradeBenefit.text = "+1 wall";
mindUpgradeDisplay.mindUpgradeText.text = "At the dawn of robot evolution, an alien race visits earth and leaves behind an enigmatic monolith. Not knowing what to do with it, the robots use it as a wall.";
if (currentTurn == 1){
p1WallQtt = (p1WallQtt + 1);
} else {
if (currentTurn == 2){
p2WallQtt = (p2WallQtt + 1);
} else {
if (currentTurn == 3){
p3WallQtt = (p3WallQtt + 1);
} else {
if (currentTurn == 4){
p4WallQtt = (p4WallQtt + 1);
};
};
};
};
} else {
if (mindUpgradeRandomChoice == 19){
mindUpgradeDisplay.mindUpgradeTitle.text = "War and Peace";
mindUpgradeDisplay.mindUpgradeBenefit.text = "+3 walls";
mindUpgradeDisplay.mindUpgradeText.text = "The robots fight each other for resources because they were created to act like human beings.\nPerhaps one day, the robots will change and all walls will be taken down?";
if (currentTurn == 1){
p1WallQtt = (p1WallQtt + 3);
} else {
if (currentTurn == 2){
p2WallQtt = (p2WallQtt + 3);
} else {
if (currentTurn == 3){
p3WallQtt = (p3WallQtt + 3);
} else {
if (currentTurn == 4){
p4WallQtt = (p4WallQtt + 3);
};
};
};
};
} else {
mindUpgradeDisplay.mindUpgradeTitle.text = "";
mindUpgradeDisplay.mindUpgradeBenefit.text = "";
mindUpgradeDisplay.mindUpgradeText.text = "\n\n\n\nNo evolution cards left.";
if (currentTurn == 1){
API.unlockMedal("Give me the expansion deck");
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
if (currentTurn == 1){
p1UpgradeSpeed = _local2;
p1UpgradePower = _local1;
p1UpgradeRoll = _local3;
p1UpgradeGatherer = _local4;
} else {
if (currentTurn == 2){
p2UpgradeSpeed = _local2;
p2UpgradePower = _local1;
p2UpgradeRoll = _local3;
p2UpgradeGatherer = _local4;
} else {
if (currentTurn == 3){
p3UpgradeSpeed = _local2;
p3UpgradePower = _local1;
p3UpgradeRoll = _local3;
p3UpgradeGatherer = _local4;
} else {
if (currentTurn == 4){
p4UpgradeSpeed = _local2;
p4UpgradePower = _local1;
p4UpgradeRoll = _local3;
p4UpgradeGatherer = _local4;
};
};
};
};
if (currentTurn == 1){
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(mindUpgradeDisplay, (getChildIndex(escapeMenu) - 1));
mindUpgradeDisplay.visible = true;
} else {
npcBoughMindUpgrade = true;
};
updateGameBars();
}
public function gameTurn():void{
var _local1:uint;
var _local2:uint;
var _local3:uint;
var _local4:uint;
var _local5:uint;
var _local6:uint;
var _local7:uint;
var _local8:uint;
var _local9:uint;
if (gameOver == false){
exp6Resource2Cost = balanceGathererCost2;
exp6Resource3Cost = balanceGathererCost3;
exp1Resource4Cost = balanceAttackCost;
exp5Resource4Cost = balanceEvolutionCost;
exp2Resource2Cost = balanceWallCost;
exctinctRaceNoMovesLeft = true;
if (currentTurn == 1){
totalPlayerTurnsTaken = (totalPlayerTurnsTaken + 1);
if (player1Race == "keeper"){
exp6Resource2Cost = (exp6Resource2Cost - KeeperResourceDiscount);
exp6Resource3Cost = (exp6Resource3Cost - KeeperResourceDiscount);
exp1Resource4Cost = (exp1Resource4Cost + KeeperAttackPenalty);
} else {
if (player1Race == "builder"){
exp2Resource2Cost = (exp2Resource2Cost - BuilderWallDiscount);
} else {
if (player1Race == "expander"){
exp5Resource4Cost = (exp5Resource4Cost - ScibotEvolutionDiscount);
p1Resource4Qtt = (p1Resource4Qtt + 1);
} else {
if (player1Race == "raider"){
exp6Resource2Cost = (exp6Resource2Cost + WarBuildingPenalty);
exp6Resource3Cost = (exp6Resource3Cost + WarBuildingPenalty);
exp2Resource2Cost = (exp2Resource2Cost + WarBuildingPenalty);
exp1Resource4Cost = (exp1Resource4Cost - WarAttackDiscount);
};
};
};
};
} else {
if (currentTurn == 2){
if (player2Race == "keeper"){
exp6Resource2Cost = (exp6Resource2Cost - KeeperResourceDiscount);
exp6Resource3Cost = (exp6Resource3Cost - KeeperResourceDiscount);
exp1Resource4Cost = (exp1Resource4Cost + KeeperAttackPenalty);
} else {
if (player2Race == "builder"){
exp2Resource2Cost = (exp2Resource2Cost - BuilderWallDiscount);
} else {
if (player2Race == "expander"){
exp5Resource4Cost = (exp5Resource4Cost - ScibotEvolutionDiscount);
if (p2Extinct == false){
p2Resource4Qtt = (p2Resource4Qtt + 1);
};
} else {
if (player2Race == "raider"){
exp6Resource2Cost = (exp6Resource2Cost + WarBuildingPenalty);
exp6Resource3Cost = (exp6Resource3Cost + WarBuildingPenalty);
exp2Resource2Cost = (exp2Resource2Cost + WarBuildingPenalty);
exp1Resource4Cost = (exp1Resource4Cost - WarAttackDiscount);
};
};
};
};
} else {
if (currentTurn == 3){
if (player3Race == "keeper"){
exp6Resource2Cost = (exp6Resource2Cost - KeeperResourceDiscount);
exp6Resource3Cost = (exp6Resource3Cost - KeeperResourceDiscount);
exp1Resource4Cost = (exp1Resource4Cost + KeeperAttackPenalty);
} else {
if (player3Race == "builder"){
exp2Resource2Cost = (exp2Resource2Cost - BuilderWallDiscount);
} else {
if (player3Race == "expander"){
exp5Resource4Cost = (exp5Resource4Cost - ScibotEvolutionDiscount);
if (p3Extinct == false){
p3Resource4Qtt = (p3Resource4Qtt + 1);
};
} else {
if (player3Race == "raider"){
exp6Resource2Cost = (exp6Resource2Cost + WarBuildingPenalty);
exp6Resource3Cost = (exp6Resource3Cost + WarBuildingPenalty);
exp2Resource2Cost = (exp2Resource2Cost + WarBuildingPenalty);
exp1Resource4Cost = (exp1Resource4Cost - WarAttackDiscount);
};
};
};
};
} else {
if (currentTurn == 4){
if (player4Race == "keeper"){
exp6Resource2Cost = (exp6Resource2Cost - KeeperResourceDiscount);
exp6Resource3Cost = (exp6Resource3Cost - KeeperResourceDiscount);
exp1Resource4Cost = (exp1Resource4Cost + KeeperAttackPenalty);
} else {
if (player4Race == "builder"){
exp2Resource2Cost = (exp2Resource2Cost - BuilderWallDiscount);
} else {
if (player4Race == "expander"){
exp5Resource4Cost = (exp5Resource4Cost - ScibotEvolutionDiscount);
if (p4Extinct == false){
p4Resource4Qtt = (p4Resource4Qtt + 1);
};
} else {
if (player4Race == "raider"){
exp6Resource2Cost = (exp6Resource2Cost + WarBuildingPenalty);
exp6Resource3Cost = (exp6Resource3Cost + WarBuildingPenalty);
exp2Resource2Cost = (exp2Resource2Cost + WarBuildingPenalty);
exp1Resource4Cost = (exp1Resource4Cost - WarAttackDiscount);
};
};
};
};
};
};
};
};
if (currentTurn == 1){
if (learnAsYouPlayToolTip.currentFrame == 3){
if (learningWhilePlaying == true){
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(learnAsYouPlayToolTip, (getChildIndex(escapeMenu) - 1));
learnAsYouPlayToolTip.gotoAndStop(4);
animateTooltipWithSlide();
learnAsYouPlayToolTip.visible = true;
} else {
if (statusBar.currentFrame == 2){
setChildIndex(statusBar, (getChildIndex(player1GameBar) - 1));
learnAsYouPlayToolTip.gotoAndStop(3);
statusBar.gotoAndStop(3);
statusBar.visible = true;
} else {
if (statusBar.currentFrame == 3){
statusBar.gotoAndStop(4);
};
};
};
};
} else {
learnAsYouPlayToolTip.visible = false;
hideTutorialMiniBoxes();
};
if (currentTurn == 1){
_local1 = 0;
while (_local1 < partyUnitArray1.length) {
partyUnitArray1[_local1].movesLeft = (partyUnitMaxMoves + p1UpgradeSpeed);
_local1++;
};
};
if (currentTurn == startingTurnPlayer){
if (blankTurnsTaken == 1){
blankTurnOver = true;
} else {
blankTurnsTaken = 1;
};
};
reaversComingCount = (reaversComingCount + 1);
updateGameBars();
if ((((((((((((((currentTurn == 2)) && ((p2Extinct == false)))) && ((p2GathererQtt == 0)))) && ((p2Resource1Qtt >= exp6Resource1Cost)))) && ((p2Resource2Qtt >= exp6Resource2Cost)))) && ((p2Resource3Qtt >= exp6Resource3Cost)))) && ((p2Resource4Qtt >= exp6Resource4Cost)))){
p2Resource1Qtt = (p2Resource1Qtt - exp6Resource1Cost);
p2Resource2Qtt = (p2Resource2Qtt - exp6Resource2Cost);
p2Resource3Qtt = (p2Resource3Qtt - exp6Resource3Cost);
p2Resource4Qtt = (p2Resource4Qtt - exp6Resource4Cost);
p2GathererQtt = (p2GathererQtt + 1);
} else {
if ((((((((((((((currentTurn == 3)) && ((p3Extinct == false)))) && ((p3GathererQtt == 0)))) && ((p3Resource1Qtt >= exp6Resource1Cost)))) && ((p3Resource2Qtt >= exp6Resource2Cost)))) && ((p3Resource3Qtt >= exp6Resource3Cost)))) && ((p3Resource4Qtt >= exp6Resource4Cost)))){
p3Resource1Qtt = (p3Resource1Qtt - exp6Resource1Cost);
p3Resource2Qtt = (p3Resource2Qtt - exp6Resource2Cost);
p3Resource3Qtt = (p3Resource3Qtt - exp6Resource3Cost);
p3Resource4Qtt = (p3Resource4Qtt - exp6Resource4Cost);
p3GathererQtt = (p3GathererQtt + 1);
} else {
if ((((((((((((((currentTurn == 4)) && ((p4Extinct == false)))) && ((p4GathererQtt == 0)))) && ((p4Resource1Qtt >= exp6Resource1Cost)))) && ((p4Resource2Qtt >= exp6Resource2Cost)))) && ((p4Resource3Qtt >= exp6Resource3Cost)))) && ((p4Resource4Qtt >= exp6Resource4Cost)))){
p4Resource1Qtt = (p4Resource1Qtt - exp6Resource1Cost);
p4Resource2Qtt = (p4Resource2Qtt - exp6Resource2Cost);
p4Resource3Qtt = (p4Resource3Qtt - exp6Resource3Cost);
p4Resource4Qtt = (p4Resource4Qtt - exp6Resource4Cost);
p4GathererQtt = (p4GathererQtt + 1);
};
};
};
if ((((((((((((((currentTurn == 2)) && ((p2Extinct == false)))) && ((p2WallQtt == 0)))) && ((p2Resource1Qtt >= exp2Resource1Cost)))) && ((p2Resource2Qtt >= exp2Resource2Cost)))) && ((p2Resource3Qtt >= exp2Resource3Cost)))) && ((p2Resource4Qtt >= exp2Resource4Cost)))){
p2Resource1Qtt = (p2Resource1Qtt - exp2Resource1Cost);
p2Resource2Qtt = (p2Resource2Qtt - exp2Resource2Cost);
p2Resource3Qtt = (p2Resource3Qtt - exp2Resource3Cost);
p2Resource4Qtt = (p2Resource4Qtt - exp2Resource4Cost);
p2WallQtt = (p2WallQtt + 1);
} else {
if ((((((((((((((currentTurn == 3)) && ((p3Extinct == false)))) && ((p3WallQtt == 0)))) && ((p3Resource1Qtt >= exp2Resource1Cost)))) && ((p3Resource2Qtt >= exp2Resource2Cost)))) && ((p3Resource3Qtt >= exp2Resource3Cost)))) && ((p3Resource4Qtt >= exp2Resource4Cost)))){
p3Resource1Qtt = (p3Resource1Qtt - exp2Resource1Cost);
p3Resource2Qtt = (p3Resource2Qtt - exp2Resource2Cost);
p3Resource3Qtt = (p3Resource3Qtt - exp2Resource3Cost);
p3Resource4Qtt = (p3Resource4Qtt - exp2Resource4Cost);
p3WallQtt = (p3WallQtt + 1);
} else {
if ((((((((((((((currentTurn == 4)) && ((p4Extinct == false)))) && ((p4WallQtt == 0)))) && ((p4Resource1Qtt >= exp2Resource1Cost)))) && ((p4Resource2Qtt >= exp2Resource2Cost)))) && ((p4Resource3Qtt >= exp2Resource3Cost)))) && ((p4Resource4Qtt >= exp2Resource4Cost)))){
p4Resource1Qtt = (p4Resource1Qtt - exp2Resource1Cost);
p4Resource2Qtt = (p4Resource2Qtt - exp2Resource2Cost);
p4Resource3Qtt = (p4Resource3Qtt - exp2Resource3Cost);
p4Resource4Qtt = (p4Resource4Qtt - exp2Resource4Cost);
p3WallQtt = (p3WallQtt + 1);
};
};
};
while ((((((((((((currentTurn == 2)) && ((p2Extinct == false)))) && ((p2Resource1Qtt >= exp3Resource1Cost)))) && ((p2Resource2Qtt >= exp3Resource2Cost)))) && ((p2Resource3Qtt >= exp3Resource3Cost)))) && ((p2Resource4Qtt >= exp3Resource4Cost)))) {
p2Resource1Qtt = (p2Resource1Qtt - exp3Resource1Cost);
p2Resource2Qtt = (p2Resource2Qtt - exp3Resource2Cost);
p2Resource3Qtt = (p2Resource3Qtt - exp3Resource3Cost);
p2Resource4Qtt = (p2Resource4Qtt - exp3Resource4Cost);
p2UnitQtt = (p2UnitQtt + 1);
};
while ((((((((((((currentTurn == 3)) && ((p3Extinct == false)))) && ((p3Resource1Qtt >= exp3Resource1Cost)))) && ((p3Resource2Qtt >= exp3Resource2Cost)))) && ((p3Resource3Qtt >= exp3Resource3Cost)))) && ((p3Resource4Qtt >= exp3Resource4Cost)))) {
p3Resource1Qtt = (p3Resource1Qtt - exp3Resource1Cost);
p3Resource2Qtt = (p3Resource2Qtt - exp3Resource2Cost);
p3Resource3Qtt = (p3Resource3Qtt - exp3Resource3Cost);
p3Resource4Qtt = (p3Resource4Qtt - exp3Resource4Cost);
p3UnitQtt = (p3UnitQtt + 1);
};
while ((((((((((((currentTurn == 4)) && ((p4Extinct == false)))) && ((p4Resource1Qtt >= exp3Resource1Cost)))) && ((p4Resource2Qtt >= exp3Resource2Cost)))) && ((p4Resource3Qtt >= exp3Resource3Cost)))) && ((p4Resource4Qtt >= exp3Resource4Cost)))) {
p4Resource1Qtt = (p4Resource1Qtt - exp3Resource1Cost);
p4Resource2Qtt = (p4Resource2Qtt - exp3Resource2Cost);
p4Resource3Qtt = (p4Resource3Qtt - exp3Resource3Cost);
p4Resource4Qtt = (p4Resource4Qtt - exp3Resource4Cost);
p4UnitQtt = (p4UnitQtt + 1);
};
if ((((((((((((currentTurn == 2)) && ((p2Extinct == false)))) && ((p2Resource1Qtt >= exp1Resource1Cost)))) && ((p2Resource2Qtt >= exp1Resource2Cost)))) && ((p2Resource3Qtt >= exp1Resource3Cost)))) && ((p2Resource4Qtt >= exp1Resource4Cost)))){
p2Resource1Qtt = (p2Resource1Qtt - exp1Resource1Cost);
p2Resource2Qtt = (p2Resource2Qtt - exp1Resource2Cost);
p2Resource3Qtt = (p2Resource3Qtt - exp1Resource3Cost);
p2Resource4Qtt = (p2Resource4Qtt - exp1Resource4Cost);
p2UpgradePower = (p2UpgradePower + 1);
} else {
if ((((((((((((currentTurn == 3)) && ((p3Extinct == false)))) && ((p3Resource1Qtt >= exp1Resource1Cost)))) && ((p3Resource2Qtt >= exp1Resource2Cost)))) && ((p3Resource3Qtt >= exp1Resource3Cost)))) && ((p3Resource4Qtt >= exp1Resource4Cost)))){
p3Resource1Qtt = (p3Resource1Qtt - exp1Resource1Cost);
p3Resource2Qtt = (p3Resource2Qtt - exp1Resource2Cost);
p3Resource3Qtt = (p3Resource3Qtt - exp1Resource3Cost);
p3Resource4Qtt = (p3Resource4Qtt - exp1Resource4Cost);
p3UpgradePower = (p3UpgradePower + 1);
} else {
if ((((((((((((currentTurn == 4)) && ((p4Extinct == false)))) && ((p4Resource1Qtt >= exp1Resource1Cost)))) && ((p4Resource2Qtt >= exp1Resource2Cost)))) && ((p4Resource3Qtt >= exp1Resource3Cost)))) && ((p4Resource4Qtt >= exp1Resource4Cost)))){
p4Resource1Qtt = (p4Resource1Qtt - exp1Resource1Cost);
p4Resource2Qtt = (p4Resource2Qtt - exp1Resource2Cost);
p4Resource3Qtt = (p4Resource3Qtt - exp1Resource3Cost);
p4Resource4Qtt = (p4Resource4Qtt - exp1Resource4Cost);
p4UpgradePower = (p4UpgradePower + 1);
};
};
};
if ((((((((((((((((((((((Math.random() > 0.5)) && ((p2Extinct == false)))) && ((p2UpgradePower >= (p1UpgradePower + 5))))) && ((p2UpgradePower >= (p3UpgradePower + 5))))) && ((p2UpgradePower >= (p4UpgradePower + 5))))) && ((p2UpgradeSpeed < 5)))) && ((currentTurn == 2)))) && ((p2Resource1Qtt >= exp4Resource1Cost)))) && ((p2Resource2Qtt >= exp4Resource2Cost)))) && ((p2Resource3Qtt >= exp4Resource3Cost)))) && ((p2Resource4Qtt >= exp4Resource4Cost)))){
p2Resource1Qtt = (p2Resource1Qtt - exp4Resource1Cost);
p2Resource2Qtt = (p2Resource2Qtt - exp4Resource2Cost);
p2Resource3Qtt = (p2Resource3Qtt - exp4Resource3Cost);
p2Resource4Qtt = (p2Resource4Qtt - exp4Resource4Cost);
p2UpgradeSpeed = (p2UpgradeSpeed + 1);
} else {
if ((((((((((((((((((((((Math.random() > 0.5)) && ((p3Extinct == false)))) && ((p3UpgradePower >= (p1UpgradePower + 5))))) && ((p3UpgradePower >= (p2UpgradePower + 5))))) && ((p3UpgradePower >= (p4UpgradePower + 5))))) && ((p3UpgradeSpeed < 5)))) && ((currentTurn == 3)))) && ((p3Resource1Qtt >= exp4Resource1Cost)))) && ((p3Resource2Qtt >= exp4Resource2Cost)))) && ((p3Resource3Qtt >= exp4Resource3Cost)))) && ((p3Resource4Qtt >= exp4Resource4Cost)))){
p3Resource1Qtt = (p3Resource1Qtt - exp4Resource1Cost);
p3Resource2Qtt = (p3Resource2Qtt - exp4Resource2Cost);
p3Resource3Qtt = (p3Resource3Qtt - exp4Resource3Cost);
p3Resource4Qtt = (p3Resource4Qtt - exp4Resource4Cost);
p3UpgradeSpeed = (p3UpgradeSpeed + 1);
} else {
if ((((((((((((((((((((((Math.random() > 0.5)) && ((p4Extinct == false)))) && ((p4UpgradePower >= (p1UpgradePower + 5))))) && ((p4UpgradePower >= (p3UpgradePower + 5))))) && ((p4UpgradePower >= (p2UpgradePower + 5))))) && ((p4UpgradeSpeed < 5)))) && ((currentTurn == 4)))) && ((p4Resource1Qtt >= exp4Resource1Cost)))) && ((p4Resource2Qtt >= exp4Resource2Cost)))) && ((p4Resource3Qtt >= exp4Resource3Cost)))) && ((p4Resource4Qtt >= exp4Resource4Cost)))){
p4Resource1Qtt = (p4Resource1Qtt - exp4Resource1Cost);
p4Resource2Qtt = (p4Resource2Qtt - exp4Resource2Cost);
p4Resource3Qtt = (p4Resource3Qtt - exp4Resource3Cost);
p4Resource4Qtt = (p4Resource4Qtt - exp4Resource4Cost);
p4UpgradeSpeed = (p4UpgradeSpeed + 1);
};
};
};
if (((((((((((((((((((((!((npcBoughMindUpgrade == true))) && ((p2Extinct == false)))) && ((p2UpgradePower >= (p1UpgradePower + 5))))) && ((p2UpgradePower >= (p3UpgradePower + 5))))) && ((p2UpgradePower >= (p4UpgradePower + 5))))) && ((p2AvaliableMindUpgrades.length > 0)))) && ((currentTurn == 2)))) && ((p2Resource1Qtt >= exp5Resource1Cost)))) && ((p2Resource2Qtt >= exp5Resource2Cost)))) && ((p2Resource3Qtt >= exp5Resource3Cost)))) && ((p2Resource4Qtt >= exp5Resource4Cost)))){
p2Resource1Qtt = (p2Resource1Qtt - exp5Resource1Cost);
p2Resource2Qtt = (p2Resource2Qtt - exp5Resource2Cost);
p2Resource3Qtt = (p2Resource3Qtt - exp5Resource3Cost);
p2Resource4Qtt = (p2Resource4Qtt - exp5Resource4Cost);
buyMindUpgrade();
} else {
if (((((((((((((((((((((!((npcBoughMindUpgrade == true))) && ((p3Extinct == false)))) && ((p3UpgradePower >= (p1UpgradePower + 5))))) && ((p3UpgradePower >= (p1UpgradePower + 5))))) && ((p3UpgradePower >= (p4UpgradePower + 5))))) && ((p3AvaliableMindUpgrades.length > 0)))) && ((currentTurn == 3)))) && ((p3Resource1Qtt >= exp5Resource1Cost)))) && ((p3Resource2Qtt >= exp5Resource2Cost)))) && ((p3Resource3Qtt >= exp5Resource3Cost)))) && ((p3Resource4Qtt >= exp5Resource4Cost)))){
p3Resource1Qtt = (p3Resource1Qtt - exp5Resource1Cost);
p3Resource2Qtt = (p3Resource2Qtt - exp5Resource2Cost);
p3Resource3Qtt = (p3Resource3Qtt - exp5Resource3Cost);
p3Resource4Qtt = (p3Resource4Qtt - exp5Resource4Cost);
buyMindUpgrade();
} else {
if (((((((((((((((((((((!((npcBoughMindUpgrade == true))) && ((p4Extinct == false)))) && ((p4UpgradePower >= (p1UpgradePower + 5))))) && ((p4UpgradePower >= (p3UpgradePower + 5))))) && ((p4UpgradePower >= (p2UpgradePower + 5))))) && ((p4AvaliableMindUpgrades.length > 0)))) && ((currentTurn == 4)))) && ((p4Resource1Qtt >= exp5Resource1Cost)))) && ((p4Resource2Qtt >= exp5Resource2Cost)))) && ((p4Resource3Qtt >= exp5Resource3Cost)))) && ((p4Resource4Qtt >= exp5Resource4Cost)))){
p4Resource1Qtt = (p4Resource1Qtt - exp5Resource1Cost);
p4Resource2Qtt = (p4Resource2Qtt - exp5Resource2Cost);
p4Resource3Qtt = (p4Resource3Qtt - exp5Resource3Cost);
p4Resource4Qtt = (p4Resource4Qtt - exp5Resource4Cost);
buyMindUpgrade();
};
};
};
timeToPlaceNewGatherer = false;
reactivateGatherer = false;
if ((((((currentTurn == 2)) && ((p2Extinct == false)))) && ((p2GathererQtt >= 1)))){
civExpansionChoice();
timeToPlaceNewGatherer = true;
resourceToExpand = p2ResourceToExpand;
starterBuildingTile = p2StarterBuildingTile;
if ((((((((((p2ResourceToExpand == 1)) && ((p2Gatherers1 >= 3)))) || ((((p2ResourceToExpand == 2)) && ((p2Gatherers2 >= 3)))))) || ((((p2ResourceToExpand == 3)) && ((p2Gatherers3 >= 3)))))) || ((((p2ResourceToExpand == 4)) && ((p2Gatherers4 >= 3)))))){
chooseAnyResourceToGather = true;
} else {
chooseAnyResourceToGather = false;
};
} else {
if ((((((currentTurn == 3)) && ((p3Extinct == false)))) && ((p3GathererQtt >= 1)))){
if ((((((((((p3ResourceToExpand == 1)) && ((p3Gatherers1 >= 3)))) || ((((p3ResourceToExpand == 2)) && ((p3Gatherers2 >= 3)))))) || ((((p3ResourceToExpand == 3)) && ((p3Gatherers3 >= 3)))))) || ((((p3ResourceToExpand == 4)) && ((p3Gatherers4 >= 3)))))){
chooseAnyResourceToGather = true;
} else {
chooseAnyResourceToGather = false;
};
starterBuildingTile = p3StarterBuildingTile;
timeToPlaceNewGatherer = true;
civExpansionChoice();
resourceToExpand = p3ResourceToExpand;
} else {
if ((((((currentTurn == 4)) && ((p4Extinct == false)))) && ((p4GathererQtt >= 1)))){
if ((((((((((p4ResourceToExpand == 1)) && ((p4Gatherers1 >= 3)))) || ((((p4ResourceToExpand == 2)) && ((p4Gatherers2 >= 3)))))) || ((((p4ResourceToExpand == 3)) && ((p4Gatherers3 >= 3)))))) || ((((p4ResourceToExpand == 4)) && ((p4Gatherers4 >= 3)))))){
chooseAnyResourceToGather = true;
} else {
chooseAnyResourceToGather = false;
};
starterBuildingTile = p4StarterBuildingTile;
timeToPlaceNewGatherer = true;
civExpansionChoice();
resourceToExpand = p4ResourceToExpand;
} else {
timeToPlaceNewGatherer = false;
};
};
};
if (((((((!((currentTurn == 5))) && ((timeToPlaceNewGatherer == true)))) && ((wallQtt >= 1)))) && ((UnitQtt >= 2)))){
_local2 = 0;
while (_local2 < allGathererUnitArray.length) {
if ((((allGathererUnitArray[_local2].visible == false)) && ((allGathererUnitArray[_local2].player == currentTurn)))){
reactivateGatherer = true;
chan_soundFX = snd_place_gatherer.play(0, 0, snd_FXVolume);
allGathererUnitArray[_local2].visible = true;
landTileArray[allGathererUnitArray[_local2].partyCurrentTile].hasGatherer = true;
if (landTileArray[allGathererUnitArray[_local2].partyCurrentTile].resource == 1){
if (currentTurn == 2){
p2Gatherers1 = (p2Gatherers1 + 1);
} else {
if (currentTurn == 3){
p3Gatherers1 = (p3Gatherers1 + 1);
} else {
if (currentTurn == 4){
p4Gatherers1 = (p4Gatherers1 + 1);
};
};
};
} else {
if (landTileArray[allGathererUnitArray[_local2].partyCurrentTile].resource == 2){
if (currentTurn == 2){
p2Gatherers2 = (p2Gatherers2 + 1);
} else {
if (currentTurn == 3){
p3Gatherers2 = (p3Gatherers2 + 1);
} else {
if (currentTurn == 4){
p4Gatherers2 = (p4Gatherers2 + 1);
};
};
};
} else {
if (landTileArray[allGathererUnitArray[_local2].partyCurrentTile].resource == 3){
if (currentTurn == 2){
p2Gatherers3 = (p2Gatherers3 + 1);
} else {
if (currentTurn == 3){
p3Gatherers3 = (p3Gatherers3 + 1);
} else {
if (currentTurn == 4){
p4Gatherers3 = (p4Gatherers3 + 1);
};
};
};
} else {
if (landTileArray[allGathererUnitArray[_local2].partyCurrentTile].resource == 4){
if (currentTurn == 2){
p2Gatherers4 = (p2Gatherers4 + 1);
} else {
if (currentTurn == 3){
p3Gatherers4 = (p3Gatherers4 + 1);
} else {
if (currentTurn == 4){
p4Gatherers4 = (p4Gatherers4 + 1);
};
};
};
};
};
};
};
if (currentTurn == 2){
p2GathererQtt = (p2GathererQtt - 1);
gathererTooltip.visible = false;
if (landTileArray[allGathererUnitArray[_local2].partyCurrentTile].resource == 1){
producingResourceMessage.gotoAndStop(1);
} else {
if (landTileArray[allGathererUnitArray[_local2].partyCurrentTile].resource == 2){
producingResourceMessage.gotoAndStop(2);
} else {
if (landTileArray[allGathererUnitArray[_local2].partyCurrentTile].resource == 3){
producingResourceMessage.gotoAndStop(3);
} else {
if (landTileArray[allGathererUnitArray[_local2].partyCurrentTile].resource == 4){
producingResourceMessage.gotoAndStop(4);
};
};
};
};
producingResourceMessage.x = landTileArray[allGathererUnitArray[_local2].partyCurrentTile].x;
producingResourceMessage.y = landTileArray[allGathererUnitArray[_local2].partyCurrentTile].y;
adjustProducingMessage();
riseTo2 = 0;
TimerShowProducingResource.start();
} else {
if (currentTurn == 3){
p3GathererQtt = (p3GathererQtt - 1);
gathererTooltip.visible = false;
if (landTileArray[allGathererUnitArray[_local2].partyCurrentTile].resource == 1){
producingResourceMessage.gotoAndStop(1);
} else {
if (landTileArray[allGathererUnitArray[_local2].partyCurrentTile].resource == 2){
producingResourceMessage.gotoAndStop(2);
} else {
if (landTileArray[allGathererUnitArray[_local2].partyCurrentTile].resource == 3){
producingResourceMessage.gotoAndStop(3);
} else {
if (landTileArray[allGathererUnitArray[_local2].partyCurrentTile].resource == 4){
producingResourceMessage.gotoAndStop(4);
};
};
};
};
producingResourceMessage.x = landTileArray[allGathererUnitArray[_local2].partyCurrentTile].x;
producingResourceMessage.y = landTileArray[allGathererUnitArray[_local2].partyCurrentTile].y;
adjustProducingMessage();
riseTo2 = 0;
TimerShowProducingResource.start();
} else {
if (currentTurn == 4){
p4GathererQtt = (p4GathererQtt - 1);
gathererTooltip.visible = false;
if (landTileArray[allGathererUnitArray[_local2].partyCurrentTile].resource == 1){
producingResourceMessage.gotoAndStop(1);
} else {
if (landTileArray[allGathererUnitArray[_local2].partyCurrentTile].resource == 2){
producingResourceMessage.gotoAndStop(2);
} else {
if (landTileArray[allGathererUnitArray[_local2].partyCurrentTile].resource == 3){
producingResourceMessage.gotoAndStop(3);
} else {
if (landTileArray[allGathererUnitArray[_local2].partyCurrentTile].resource == 4){
producingResourceMessage.gotoAndStop(4);
};
};
};
};
producingResourceMessage.x = landTileArray[allGathererUnitArray[_local2].partyCurrentTile].x;
producingResourceMessage.y = landTileArray[allGathererUnitArray[_local2].partyCurrentTile].y;
adjustProducingMessage();
riseTo2 = 0;
TimerShowProducingResource.start();
};
};
};
break;
};
_local2++;
};
if (reactivateGatherer == true){
} else {
gathererDistanceScore = 0;
minimumGathererDistanceScore = 500;
_local3 = 0;
while (_local3 < landTileArray.length) {
gathererDistanceScore = 0;
if ((((((((chooseAnyResourceToGather == false)) && (!((landTileArray[_local3].hasGatherer == true))))) && ((landTileArray[_local3].resource == resourceToExpand)))) && ((landTileArray[_local3].player == currentTurn)))){
if (landTileArray[starterBuildingTile].tileRow > landTileArray[_local3].tileRow){
gathererDistanceScore = (gathererDistanceScore + (landTileArray[starterBuildingTile].tileRow - landTileArray[_local3].tileRow));
} else {
gathererDistanceScore = (gathererDistanceScore + (landTileArray[_local3].tileRow - landTileArray[starterBuildingTile].tileRow));
};
if (landTileArray[starterBuildingTile].tileColumn > landTileArray[_local3].tileColumn){
gathererDistanceScore = (gathererDistanceScore + (landTileArray[starterBuildingTile].tileColumn - landTileArray[_local3].tileColumn));
} else {
gathererDistanceScore = (gathererDistanceScore + (landTileArray[_local3].tileColumn - landTileArray[starterBuildingTile].tileColumn));
};
if (gathererDistanceScore < minimumGathererDistanceScore){
minimumGathererDistanceScore = gathererDistanceScore;
chosenMinimumGathererScore = landTileArray[_local3].myArrayNumber;
};
} else {
if ((((((chooseAnyResourceToGather == true)) && (!((landTileArray[_local3].hasGatherer == true))))) && ((landTileArray[_local3].player == currentTurn)))){
if (landTileArray[starterBuildingTile].tileRow > landTileArray[_local3].tileRow){
gathererDistanceScore = (gathererDistanceScore + (landTileArray[starterBuildingTile].tileRow - landTileArray[_local3].tileRow));
} else {
gathererDistanceScore = (gathererDistanceScore + (landTileArray[_local3].tileRow + landTileArray[starterBuildingTile].tileRow));
};
if (landTileArray[starterBuildingTile].tileColumn > landTileArray[_local3].tileColumn){
gathererDistanceScore = (gathererDistanceScore + (landTileArray[starterBuildingTile].tileColumn - landTileArray[_local3].tileColumn));
} else {
gathererDistanceScore = (gathererDistanceScore + (landTileArray[_local3].tileColumn + landTileArray[starterBuildingTile].tileColumn));
};
if (gathererDistanceScore < minimumGathererDistanceScore){
minimumGathererDistanceScore = gathererDistanceScore;
chosenMinimumGathererScore = landTileArray[_local3].myArrayNumber;
};
};
};
_local3++;
};
newGathererTobePlaced = chosenMinimumGathererScore;
gathererUnit = new gathererUnitLIB();
gathererUnit.x = landTileArray[newGathererTobePlaced].x;
gathererUnit.y = landTileArray[newGathererTobePlaced].y;
gathererUnit.width = gathererUnitWidth;
gathererUnit.height = gathererUnitHeight;
gathererUnitArray.push(starterBuilding);
gathererUnit.player = currentTurn;
gathererUnit.partyCurrentTile = landTileArray[newGathererTobePlaced].myArrayNumber;
landTileArray[newGathererTobePlaced].hasGatherer = true;
gathererUnit.addEventListener(MouseEvent.MOUSE_DOWN, playerMoveToGathererUnit);
gathererUnit.mouseEnabled = false;
allGathererUnitArray.push(gathererUnit);
if (currentTurn == 2){
if (landTileArray[newGathererTobePlaced].resource == 1){
gathererUnit.gotoAndStop(1);
p2Gatherers1 = (p2Gatherers1 + 1);
} else {
if (landTileArray[newGathererTobePlaced].resource == 2){
gathererUnit.gotoAndStop(2);
p2Gatherers2 = (p2Gatherers2 + 1);
} else {
if (landTileArray[newGathererTobePlaced].resource == 3){
gathererUnit.gotoAndStop(3);
p2Gatherers3 = (p2Gatherers3 + 1);
} else {
if (landTileArray[newGathererTobePlaced].resource == 4){
gathererUnit.gotoAndStop(4);
p2Gatherers4 = (p2Gatherers4 + 1);
};
};
};
};
p2ProtectResource = landTileArray[newGathererTobePlaced].myArrayNumber;
p2GathererQtt = (p2GathererQtt - 1);
tilesToProtectPlayer2.push(landTileArray[newGathererTobePlaced].myArrayNumber);
} else {
if (currentTurn == 3){
if (landTileArray[newGathererTobePlaced].resource == 1){
gathererUnit.gotoAndStop(1);
p3Gatherers1 = (p3Gatherers1 + 1);
} else {
if (landTileArray[newGathererTobePlaced].resource == 2){
gathererUnit.gotoAndStop(2);
p3Gatherers2 = (p3Gatherers2 + 1);
} else {
if (landTileArray[newGathererTobePlaced].resource == 3){
gathererUnit.gotoAndStop(3);
p3Gatherers3 = (p3Gatherers3 + 1);
} else {
if (landTileArray[newGathererTobePlaced].resource == 4){
gathererUnit.gotoAndStop(4);
p3Gatherers4 = (p3Gatherers4 + 1);
};
};
};
};
p3ProtectResource = landTileArray[newGathererTobePlaced].myArrayNumber;
p3GathererQtt = (p3GathererQtt - 1);
tilesToProtectPlayer3.push(landTileArray[newGathererTobePlaced].myArrayNumber);
} else {
if (currentTurn == 4){
if (landTileArray[newGathererTobePlaced].resource == 1){
gathererUnit.gotoAndStop(1);
p4Gatherers1 = (p4Gatherers1 + 1);
} else {
if (landTileArray[newGathererTobePlaced].resource == 2){
gathererUnit.gotoAndStop(2);
p4Gatherers2 = (p4Gatherers2 + 1);
} else {
if (landTileArray[newGathererTobePlaced].resource == 3){
gathererUnit.gotoAndStop(3);
p4Gatherers3 = (p4Gatherers3 + 1);
} else {
if (landTileArray[newGathererTobePlaced].resource == 4){
gathererUnit.gotoAndStop(4);
p4Gatherers4 = (p4Gatherers4 + 1);
};
};
};
};
p4ProtectResource = landTileArray[newGathererTobePlaced].myArrayNumber;
p4GathererQtt = (p4GathererQtt - 1);
tilesToProtectPlayer4.push(landTileArray[newGathererTobePlaced].myArrayNumber);
};
};
};
gathererTooltip.visible = false;
if (landTileArray[newGathererTobePlaced].resource == 1){
producingResourceMessage.gotoAndStop(1);
} else {
if (landTileArray[newGathererTobePlaced].resource == 2){
producingResourceMessage.gotoAndStop(2);
} else {
if (landTileArray[newGathererTobePlaced].resource == 3){
producingResourceMessage.gotoAndStop(3);
} else {
if (landTileArray[newGathererTobePlaced].resource == 4){
producingResourceMessage.gotoAndStop(4);
};
};
};
};
producingResourceMessage.x = landTileArray[newGathererTobePlaced].x;
producingResourceMessage.y = landTileArray[newGathererTobePlaced].y;
adjustProducingMessage();
riseTo2 = 0;
TimerShowProducingResource.start();
chan_soundFX = snd_place_gatherer.play(0, 0, snd_FXVolume);
addChild(gathererUnit);
};
updateGameBars();
};
gameOverCheck();
endWallExpansion = false;
if (currentTurn == 2){
protectResourceCheck = p2ProtectResource;
tilesToProtect = tilesToProtectPlayer2;
resourceQttCheck = p2Resource2Qtt;
UnitQtt = p2UnitQtt;
wallQtt = p2WallQtt;
} else {
if (currentTurn == 3){
protectResourceCheck = p3ProtectResource;
tilesToProtect = tilesToProtectPlayer3;
resourceQttCheck = p3Resource2Qtt;
UnitQtt = p3UnitQtt;
wallQtt = p3WallQtt;
} else {
if (currentTurn == 4){
tilesToProtect = tilesToProtectPlayer4;
protectResourceCheck = p4ProtectResource;
resourceQttCheck = p4Resource2Qtt;
UnitQtt = p4UnitQtt;
wallQtt = p4WallQtt;
};
};
};
wallLoopCheck = 0;
while ((((((((((((((((currentTurn == 2)) && ((p2Extinct == false)))) || ((((currentTurn == 3)) && ((p3Extinct == false)))))) || ((((currentTurn == 4)) && ((p4Extinct == false)))))) && (!((currentTurn == 5))))) && ((wallQtt >= 1)))) && ((endWallExpansion == false)))) && (!((currentTurn == 1))))) {
protectResourceCheck = tilesToProtect[wallLoopCheck];
failedWallInsertion = false;
trace("protecting walls with loop");
if (((((!((landTileArray[protectResourceCheck].protectedOnce == true))) || ((wallQtt >= 2)))) && (!((landTileArray[protectResourceCheck].isProtected == true))))){
if ((((wallSlotArray[landTileArray[protectResourceCheck].upWall].alpha == 0)) && (!((wallSlotArray[landTileArray[protectResourceCheck].upWall].closeCase == true))))){
wallExpandChoicesArray.push(wallSlotArray[landTileArray[protectResourceCheck].upWall].myArrayNumber);
} else {
landTileArray[protectResourceCheck].protectedOnce = true;
};
if ((((wallSlotArray[landTileArray[protectResourceCheck].bottomWall].alpha == 0)) && (!((wallSlotArray[landTileArray[protectResourceCheck].bottomWall].closeCase == true))))){
wallExpandChoicesArray.push(wallSlotArray[landTileArray[protectResourceCheck].bottomWall].myArrayNumber);
} else {
landTileArray[protectResourceCheck].protectedOnce = true;
};
if ((((wallSlotArray[landTileArray[protectResourceCheck].rightWall].alpha == 0)) && (!((wallSlotArray[landTileArray[protectResourceCheck].rightWall].closeCase == true))))){
wallExpandChoicesArray.push(wallSlotArray[landTileArray[protectResourceCheck].rightWall].myArrayNumber);
} else {
landTileArray[protectResourceCheck].protectedOnce = true;
};
if ((((wallSlotArray[landTileArray[protectResourceCheck].leftWall].alpha == 0)) && (!((wallSlotArray[landTileArray[protectResourceCheck].leftWall].closeCase == true))))){
wallExpandChoicesArray.push(wallSlotArray[landTileArray[protectResourceCheck].leftWall].myArrayNumber);
} else {
landTileArray[protectResourceCheck].protectedOnce = true;
};
if (wallExpandChoicesArray.length > 0){
if (landTileArray[protectResourceCheck].protectedOnce != true){
expandWallMaxRoll = (wallExpandChoicesArray.length - 1);
expandWallMaxRoll = int(((expandWallMaxRoll * Math.random()) + 0.4));
if (expandWallMaxRoll > (wallExpandChoicesArray.length - 1)){
expandWallMaxRoll = (wallExpandChoicesArray.length - 1);
};
expandWallMaxRoll = wallExpandChoicesArray[expandWallMaxRoll];
} else {
if (Math.random() >= 0.5){
expandWallMaxRoll = (wallExpandChoicesArray.length - 1);
expandWallMaxRoll = int(((expandWallMaxRoll * Math.random()) + 0.4));
if (expandWallMaxRoll > (wallExpandChoicesArray.length - 1)){
expandWallMaxRoll = (wallExpandChoicesArray.length - 1);
};
expandWallMaxRoll = wallExpandChoicesArray[expandWallMaxRoll];
} else {
landTileArray[protectResourceCheck].isProtected = true;
while (wallExpandChoicesArray.length >= 1) {
wallExpandChoicesArray.splice(0);
};
};
};
} else {
landTileArray[protectResourceCheck].isProtected = true;
while (wallExpandChoicesArray.length >= 1) {
wallExpandChoicesArray.splice(0);
};
};
};
if ((((landTileArray[protectResourceCheck].isProtected == true)) && ((wallQtt >= 2)))){
if (wallSlotArray[landTileArray[protectResourceCheck].upWall].alpha == 0){
if (((!((landTileArray[(protectResourceCheck - 1)].noMansLand == true))) && (!((landTileArray[(protectResourceCheck - 1)].blockTile == true))))){
if ((((wallSlotArray[landTileArray[(protectResourceCheck - 1)].upWall].alpha == 0)) && (!((wallSlotArray[landTileArray[(protectResourceCheck - 1)].upWall].closeCase == true))))){
wallExpandChoicesArray.push(wallSlotArray[landTileArray[(protectResourceCheck - 1)].upWall].myArrayNumber);
};
if ((((wallSlotArray[landTileArray[(protectResourceCheck - 1)].leftWall].alpha == 0)) && (!((wallSlotArray[landTileArray[(protectResourceCheck - 1)].leftWall].closeCase == true))))){
wallExpandChoicesArray.push(wallSlotArray[landTileArray[(protectResourceCheck - 1)].leftWall].myArrayNumber);
};
if ((((wallSlotArray[landTileArray[(protectResourceCheck - 1)].rightWall].alpha == 0)) && (!((wallSlotArray[landTileArray[(protectResourceCheck - 1)].rightWall].closeCase == true))))){
wallExpandChoicesArray.push(wallSlotArray[landTileArray[(protectResourceCheck - 1)].rightWall].myArrayNumber);
};
};
};
if (wallSlotArray[landTileArray[protectResourceCheck].bottomWall].alpha == 0){
if (((!((landTileArray[(protectResourceCheck + 1)].noMansLand == true))) && (!((landTileArray[(protectResourceCheck + 1)].blockTile == true))))){
if ((((wallSlotArray[landTileArray[(protectResourceCheck + 1)].bottomWall].alpha == 0)) && (!((wallSlotArray[landTileArray[(protectResourceCheck + 1)].bottomWall].closeCase == true))))){
wallExpandChoicesArray.push(wallSlotArray[landTileArray[(protectResourceCheck + 1)].bottomWall].myArrayNumber);
};
if ((((wallSlotArray[landTileArray[(protectResourceCheck + 1)].leftWall].alpha == 0)) && (!((wallSlotArray[landTileArray[(protectResourceCheck + 1)].leftWall].closeCase == true))))){
wallExpandChoicesArray.push(wallSlotArray[landTileArray[(protectResourceCheck + 1)].leftWall].myArrayNumber);
};
if ((((wallSlotArray[landTileArray[(protectResourceCheck + 1)].rightWall].alpha == 0)) && (!((wallSlotArray[landTileArray[(protectResourceCheck + 1)].rightWall].closeCase == true))))){
wallExpandChoicesArray.push(wallSlotArray[landTileArray[(protectResourceCheck + 1)].rightWall].myArrayNumber);
};
};
};
if (wallSlotArray[landTileArray[protectResourceCheck].rightWall].alpha == 0){
if (((!((landTileArray[((protectResourceCheck + 6) + (verticalGridCounter / 2))].noMansLand == true))) && (!((landTileArray[((protectResourceCheck + 6) + (verticalGridCounter / 2))].blockTile == true))))){
if ((((wallSlotArray[landTileArray[((protectResourceCheck + 6) + (verticalGridCounter / 2))].bottomWall].alpha == 0)) && (!((wallSlotArray[landTileArray[((protectResourceCheck + 6) + (verticalGridCounter / 2))].bottomWall].closeCase == true))))){
wallExpandChoicesArray.push(wallSlotArray[landTileArray[((protectResourceCheck + 6) + (verticalGridCounter / 2))].bottomWall].myArrayNumber);
};
if ((((wallSlotArray[landTileArray[((protectResourceCheck + 6) + (verticalGridCounter / 2))].rightWall].alpha == 0)) && (!((wallSlotArray[landTileArray[((protectResourceCheck + 6) + (verticalGridCounter / 2))].rightWall].closeCase == true))))){
wallExpandChoicesArray.push(wallSlotArray[landTileArray[((protectResourceCheck + 6) + (verticalGridCounter / 2))].rightWall].myArrayNumber);
};
if ((((wallSlotArray[landTileArray[((protectResourceCheck + 6) + (verticalGridCounter / 2))].upWall].alpha == 0)) && (!((wallSlotArray[landTileArray[((protectResourceCheck + 6) + (verticalGridCounter / 2))].upWall].closeCase == true))))){
wallExpandChoicesArray.push(wallSlotArray[landTileArray[((protectResourceCheck + 6) + (verticalGridCounter / 2))].upWall].myArrayNumber);
};
};
};
if (wallSlotArray[landTileArray[protectResourceCheck].leftWall].alpha == 0){
if (((!((landTileArray[((protectResourceCheck - 6) - (verticalGridCounter / 2))].noMansLand == true))) && (!((landTileArray[((protectResourceCheck - 6) - (verticalGridCounter / 2))].blockTile == true))))){
if ((((wallSlotArray[landTileArray[((protectResourceCheck - 6) - (verticalGridCounter / 2))].bottomWall].alpha == 0)) && (!((wallSlotArray[landTileArray[((protectResourceCheck - 6) - (verticalGridCounter / 2))].bottomWall].closeCase == true))))){
wallExpandChoicesArray.push(wallSlotArray[landTileArray[((protectResourceCheck - 6) - (verticalGridCounter / 2))].bottomWall].myArrayNumber);
};
if ((((wallSlotArray[landTileArray[((protectResourceCheck - 6) - (verticalGridCounter / 2))].leftWall].alpha == 0)) && (!((wallSlotArray[landTileArray[((protectResourceCheck - 6) - (verticalGridCounter / 2))].leftWall].closeCase == true))))){
wallExpandChoicesArray.push(wallSlotArray[landTileArray[((protectResourceCheck - 6) - (verticalGridCounter / 2))].leftWall].myArrayNumber);
};
if ((((wallSlotArray[landTileArray[((protectResourceCheck - 6) - (verticalGridCounter / 2))].upWall].alpha == 0)) && (!((wallSlotArray[landTileArray[((protectResourceCheck - 6) - (verticalGridCounter / 2))].upWall].closeCase == true))))){
wallExpandChoicesArray.push(wallSlotArray[landTileArray[((protectResourceCheck - 6) - (verticalGridCounter / 2))].upWall].myArrayNumber);
};
};
};
if (wallExpandChoicesArray.length > 0){
expandWallMaxRoll = (wallExpandChoicesArray.length - 1);
expandWallMaxRoll = int(((expandWallMaxRoll * Math.random()) + 0.4));
if (expandWallMaxRoll > (wallExpandChoicesArray.length - 1)){
expandWallMaxRoll = (wallExpandChoicesArray.length - 1);
};
expandWallMaxRoll = wallExpandChoicesArray[expandWallMaxRoll];
};
};
if (wallExpandChoicesArray.length <= 0){
if (wallLoopCheck == (tilesToProtect.length - 1)){
endWallExpansion = true;
};
};
if ((((wallExpandChoicesArray.length > 0)) && ((endWallExpansion == false)))){
currentWall = expandWallMaxRoll;
wallToBePlaced = expandWallMaxRoll;
traceWallSlotBegin();
};
while (wallExpandChoicesArray.length >= 1) {
wallExpandChoicesArray.splice(0);
};
if (wallLoopCheck != (tilesToProtect.length - 1)){
if (failedWallInsertion == false){
wallLoopCheck = (wallLoopCheck + 1);
};
};
};
endPartyAssignments = false;
if (currentTurn == 2){
tilesToProtect = tilesToProtectPlayer2;
starterBuildingTile = p2StarterBuildingTile;
resourceQttCheck = p2Resource1Qtt;
UnitQtt = p2UnitQtt;
playerAggro = player2Aggro;
_local4 = 0;
while (_local4 < partyUnitArray2.length) {
partyUnitArray2[_local4].movesLeft = (partyUnitMaxMoves + p2UpgradeSpeed);
_local4++;
};
} else {
if (currentTurn == 3){
tilesToProtect = tilesToProtectPlayer3;
starterBuildingTile = p3StarterBuildingTile;
resourceQttCheck = p3Resource1Qtt;
UnitQtt = p3UnitQtt;
playerAggro = player3Aggro;
_local5 = 0;
while (_local5 < partyUnitArray3.length) {
partyUnitArray3[_local5].movesLeft = (partyUnitMaxMoves + p3UpgradeSpeed);
_local5++;
};
} else {
if (currentTurn == 4){
tilesToProtect = tilesToProtectPlayer4;
starterBuildingTile = p4StarterBuildingTile;
resourceQttCheck = p4Resource1Qtt;
playerAggro = player4Aggro;
UnitQtt = p4UnitQtt;
_local6 = 0;
while (_local6 < partyUnitArray4.length) {
partyUnitArray4[_local6].movesLeft = (partyUnitMaxMoves + p4UpgradeSpeed);
_local6++;
};
} else {
if (currentTurn == 5){
_local7 = 0;
while (_local7 < partyUnitArray5.length) {
partyUnitArray5[_local7].movesLeft = partyUnitMaxMoves;
_local7++;
};
};
};
};
};
while ((((((((((((((((currentTurn == 2)) && ((p2Extinct == false)))) || ((((currentTurn == 3)) && ((p3Extinct == false)))))) || ((((currentTurn == 4)) && ((p4Extinct == false)))))) && (!((currentTurn == 5))))) && ((((((UnitQtt >= 1)) && ((attackOnceForTutorial == false)))) || ((((UnitQtt >= 2)) && ((attackOnceForTutorial == true)))))))) && ((endPartyAssignments == false)))) && (!((currentTurn == 1))))) {
_local8 = 0;
while (_local8 < tilesToProtect.length) {
if (landTileArray[_local8].isProtected == true){
if (wallSlotArray[landTileArray[tilesToProtect[_local8]].upWall].alpha == 0){
if (((((((((((((!((landTileArray[(tilesToProtect[_local8] - 1)].partyAssignedDefensive == true))) && (!((landTileArray[(tilesToProtect[_local8] - 1)].blockTile == true))))) && (!((landTileArray[(tilesToProtect[_local8] - 1)].startBuildTile == true))))) && (!((landTileArray[(tilesToProtect[_local8] - 1)].resource == 1))))) && (!((landTileArray[(tilesToProtect[_local8] - 1)].resource == 2))))) && (!((landTileArray[(tilesToProtect[_local8] - 1)].resource == 3))))) && (!((landTileArray[(tilesToProtect[_local8] - 1)].resource == 4))))){
if (((((((!((wallSlotArray[landTileArray[(tilesToProtect[_local8] - 1)].upWall].alpha == 0))) || (!((wallSlotArray[landTileArray[(tilesToProtect[_local8] - 1)].bottomWall].alpha == 0))))) || (!((wallSlotArray[landTileArray[(tilesToProtect[_local8] - 1)].leftWall].alpha == 0))))) || (!((wallSlotArray[landTileArray[(tilesToProtect[_local8] - 1)].rightWall].alpha == 0))))){
partyDefendChoicesArray.push((tilesToProtect[_local8] - 1));
};
};
};
if (wallSlotArray[landTileArray[tilesToProtect[_local8]].bottomWall].alpha == 0){
if (((((((((((((!((landTileArray[(tilesToProtect[_local8] + 1)].partyAssignedDefensive == true))) && (!((landTileArray[(tilesToProtect[_local8] + 1)].blockTile == true))))) && (!((landTileArray[(tilesToProtect[_local8] + 1)].startBuildTile == true))))) && (!((landTileArray[(tilesToProtect[_local8] + 1)].resource == 1))))) && (!((landTileArray[(tilesToProtect[_local8] + 1)].resource == 2))))) && (!((landTileArray[(tilesToProtect[_local8] + 1)].resource == 3))))) && (!((landTileArray[(tilesToProtect[_local8] + 1)].resource == 4))))){
if (((((((!((wallSlotArray[landTileArray[(tilesToProtect[_local8] + 1)].upWall].alpha == 0))) || (!((wallSlotArray[landTileArray[(tilesToProtect[_local8] + 1)].bottomWall].alpha == 0))))) || (!((wallSlotArray[landTileArray[(tilesToProtect[_local8] + 1)].leftWall].alpha == 0))))) || (!((wallSlotArray[landTileArray[(tilesToProtect[_local8] + 1)].rightWall].alpha == 0))))){
partyDefendChoicesArray.push((tilesToProtect[_local8] + 1));
};
};
};
if (wallSlotArray[landTileArray[tilesToProtect[_local8]].leftWall].alpha == 0){
if (((((((((((((!((landTileArray[((tilesToProtect[_local8] - 6) - (verticalGridCounter / 2))].partyAssignedDefensive == true))) && (!((landTileArray[((tilesToProtect[_local8] - 6) - (verticalGridCounter / 2))].blockTile == true))))) && (!((landTileArray[((tilesToProtect[_local8] - 6) - (verticalGridCounter / 2))].startBuildTile == true))))) && (!((landTileArray[((tilesToProtect[_local8] - 6) - (verticalGridCounter / 2))].resource == 1))))) && (!((landTileArray[((tilesToProtect[_local8] - 6) - (verticalGridCounter / 2))].resource == 2))))) && (!((landTileArray[((tilesToProtect[_local8] - 6) - (verticalGridCounter / 2))].resource == 3))))) && (!((landTileArray[((tilesToProtect[_local8] - 6) - (verticalGridCounter / 2))].resource == 4))))){
if (((((((!((wallSlotArray[landTileArray[((tilesToProtect[_local8] - 6) - (verticalGridCounter / 2))].upWall].alpha == 0))) || (!((wallSlotArray[landTileArray[((tilesToProtect[_local8] - 6) - (verticalGridCounter / 2))].bottomWall].alpha == 0))))) || (!((wallSlotArray[landTileArray[((tilesToProtect[_local8] - 6) - (verticalGridCounter / 2))].leftWall].alpha == 0))))) || (!((wallSlotArray[landTileArray[((tilesToProtect[_local8] - 6) - (verticalGridCounter / 2))].rightWall].alpha == 0))))){
partyDefendChoicesArray.push(((tilesToProtect[_local8] - 6) - (verticalGridCounter / 2)));
};
};
};
if (wallSlotArray[landTileArray[tilesToProtect[_local8]].rightWall].alpha == 0){
if (((((((((((((!((landTileArray[((tilesToProtect[_local8] + 6) + (verticalGridCounter / 2))].partyAssignedDefensive == true))) && (!((landTileArray[((tilesToProtect[_local8] + 6) + (verticalGridCounter / 2))].blockTile == true))))) && (!((landTileArray[((tilesToProtect[_local8] + 6) + (verticalGridCounter / 2))].startBuildTile == true))))) && (!((landTileArray[((tilesToProtect[_local8] + 6) + (verticalGridCounter / 2))].resource == 1))))) && (!((landTileArray[((tilesToProtect[_local8] + 6) + (verticalGridCounter / 2))].resource == 2))))) && (!((landTileArray[((tilesToProtect[_local8] + 6) + (verticalGridCounter / 2))].resource == 3))))) && (!((landTileArray[((tilesToProtect[_local8] + 6) + (verticalGridCounter / 2))].resource == 4))))){
if (((((((!((wallSlotArray[landTileArray[((tilesToProtect[_local8] + 6) + (verticalGridCounter / 2))].upWall].alpha == 0))) || (!((wallSlotArray[landTileArray[((tilesToProtect[_local8] + 6) + (verticalGridCounter / 2))].bottomWall].alpha == 0))))) || (!((wallSlotArray[landTileArray[((tilesToProtect[_local8] + 6) + (verticalGridCounter / 2))].leftWall].alpha == 0))))) || (!((wallSlotArray[landTileArray[((tilesToProtect[_local8] + 6) + (verticalGridCounter / 2))].rightWall].alpha == 0))))){
partyDefendChoicesArray.push(((tilesToProtect[_local8] + 6) + (verticalGridCounter / 2)));
};
};
};
};
if (partyDefendChoicesArray.length == 0){
if ((((((((((((((((((wallSlotArray[landTileArray[tilesToProtect[_local8]].upWall].alpha == 0)) && (!((landTileArray[(tilesToProtect[_local8] - 1)].noMansLand == true))))) && (!((landTileArray[(tilesToProtect[_local8] - 1)].partyAssignedDefensive == true))))) && (!((landTileArray[(tilesToProtect[_local8] - 1)].blockTile == true))))) && (!((landTileArray[(tilesToProtect[_local8] - 1)].startBuildTile == true))))) && (!((landTileArray[(tilesToProtect[_local8] - 1)].resource == 1))))) && (!((landTileArray[(tilesToProtect[_local8] - 1)].resource == 2))))) && (!((landTileArray[(tilesToProtect[_local8] - 1)].resource == 3))))) && (!((landTileArray[(tilesToProtect[_local8] - 1)].resource == 4))))){
partyDefendChoicesArray.push((tilesToProtect[_local8] - 1));
};
if ((((((((((((((((((wallSlotArray[landTileArray[tilesToProtect[_local8]].bottomWall].alpha == 0)) && (!((landTileArray[(tilesToProtect[_local8] + 1)].noMansLand == true))))) && (!((landTileArray[(tilesToProtect[_local8] + 1)].partyAssignedDefensive == true))))) && (!((landTileArray[(tilesToProtect[_local8] + 1)].blockTile == true))))) && (!((landTileArray[(tilesToProtect[_local8] + 1)].startBuildTile == true))))) && (!((landTileArray[(tilesToProtect[_local8] + 1)].resource == 1))))) && (!((landTileArray[(tilesToProtect[_local8] + 1)].resource == 2))))) && (!((landTileArray[(tilesToProtect[_local8] + 1)].resource == 3))))) && (!((landTileArray[(tilesToProtect[_local8] + 1)].resource == 4))))){
partyDefendChoicesArray.push((tilesToProtect[_local8] + 1));
};
if ((((((((((((((((((wallSlotArray[landTileArray[tilesToProtect[_local8]].leftWall].alpha == 0)) && (!((landTileArray[((tilesToProtect[_local8] - 6) - (verticalGridCounter / 2))].noMansLand == true))))) && (!((landTileArray[((tilesToProtect[_local8] - 6) - (verticalGridCounter / 2))].partyAssignedDefensive == true))))) && (!((landTileArray[((tilesToProtect[_local8] - 6) - (verticalGridCounter / 2))].blockTile == true))))) && (!((landTileArray[((tilesToProtect[_local8] - 6) - (verticalGridCounter / 2))].startBuildTile == true))))) && (!((landTileArray[((tilesToProtect[_local8] - 6) - (verticalGridCounter / 2))].resource == 1))))) && (!((landTileArray[((tilesToProtect[_local8] - 6) - (verticalGridCounter / 2))].resource == 2))))) && (!((landTileArray[((tilesToProtect[_local8] - 6) - (verticalGridCounter / 2))].resource == 3))))) && (!((landTileArray[((tilesToProtect[_local8] - 6) - (verticalGridCounter / 2))].resource == 4))))){
partyDefendChoicesArray.push(((tilesToProtect[_local8] - 6) - (verticalGridCounter / 2)));
};
if ((((((((((((((((((wallSlotArray[landTileArray[tilesToProtect[_local8]].rightWall].alpha == 0)) && (!((landTileArray[((tilesToProtect[_local8] + 6) + (verticalGridCounter / 2))].noMansLand == true))))) && (!((landTileArray[((tilesToProtect[_local8] + 6) + (verticalGridCounter / 2))].partyAssignedDefensive == true))))) && (!((landTileArray[((tilesToProtect[_local8] + 6) + (verticalGridCounter / 2))].blockTile == true))))) && (!((landTileArray[((tilesToProtect[_local8] + 6) + (verticalGridCounter / 2))].startBuildTile == true))))) && (!((landTileArray[((tilesToProtect[_local8] + 6) + (verticalGridCounter / 2))].resource == 1))))) && (!((landTileArray[((tilesToProtect[_local8] + 6) + (verticalGridCounter / 2))].resource == 2))))) && (!((landTileArray[((tilesToProtect[_local8] + 6) + (verticalGridCounter / 2))].resource == 3))))) && (!((landTileArray[((tilesToProtect[_local8] + 6) + (verticalGridCounter / 2))].resource == 4))))){
partyDefendChoicesArray.push(((tilesToProtect[_local8] + 6) + (verticalGridCounter / 2)));
};
};
if ((((((partyDefendChoicesArray.length > 0)) || (!((landTileArray[tilesToProtect[_local8]].partyAssignedDefensive == true))))) && ((UnitQtt >= 1)))){
expandPartyMaxRoll = (partyDefendChoicesArray.length - 1);
expandPartyMaxRoll = int(((expandPartyMaxRoll * Math.random()) + 0.4));
if (expandPartyMaxRoll > (partyDefendChoicesArray.length - 1)){
expandPartyMaxRoll = (partyDefendChoicesArray.length - 1);
};
expandPartyMaxRoll = partyDefendChoicesArray[expandPartyMaxRoll];
while (partyDefendChoicesArray.length >= 1) {
partyDefendChoicesArray.splice(0);
};
if (landTileArray[tilesToProtect[_local8]].partyAssignedDefensive != true){
expandPartyMaxRoll = tilesToProtect[_local8];
};
if (((!((landTileArray[expandPartyMaxRoll].partyAssignedDefensive == true))) && (!((landTileArray[expandPartyMaxRoll].defensiveUnit == true))))){
landTileArray[expandPartyMaxRoll].partyAssignedDefensive = true;
partyUnit = new partyUnitLIB();
partyUnit.x = landTileArray[starterBuildingTile].x;
partyUnit.y = landTileArray[starterBuildingTile].y;
partyUnit.addEventListener(MouseEvent.MOUSE_OVER, callWarAdvisor);
partyUnit.partyCurrentTile = landTileArray[starterBuildingTile].myArrayNumber;
partyUnit.myAssignment = landTileArray[expandPartyMaxRoll].myArrayNumber;
trace(("created, I am going to tile: " + partyUnit.myAssignment));
partyUnit.width = partyUnitWidth;
partyUnit.height = partyUnitHeight;
if (currentTurn == 2){
UnitQtt = (UnitQtt - 1);
p2UnitQtt = (p2UnitQtt - 1);
partyUnitArray2.push(partyUnit);
partyUnit.myArrayNumber = (partyUnitArray2.length - 1);
landTileArray[starterBuildingTile].party2 = (landTileArray[starterBuildingTile].party2 + 1);
} else {
if (currentTurn == 3){
UnitQtt = (UnitQtt - 1);
p3UnitQtt = (p3UnitQtt - 1);
partyUnitArray3.push(partyUnit);
partyUnit.myArrayNumber = (partyUnitArray3.length - 1);
landTileArray[starterBuildingTile].party3 = (landTileArray[starterBuildingTile].party3 + 1);
} else {
if (currentTurn == 4){
UnitQtt = (UnitQtt - 1);
p4UnitQtt = (p4UnitQtt - 1);
partyUnitArray4.push(partyUnit);
partyUnit.myArrayNumber = (partyUnitArray4.length - 1);
landTileArray[starterBuildingTile].party4 = (landTileArray[starterBuildingTile].party4 + 1);
};
};
};
partyUnit.player = currentTurn;
while (partyDefendChoicesArray.length >= 1) {
partyDefendChoicesArray.splice(0);
};
updateGameBars();
if ((((wallSlotArray[landTileArray[expandPartyMaxRoll].upWall].alpha == 0)) && ((((((wallSlotArray[landTileArray[expandPartyMaxRoll].bottomWall].alpha == 1)) || ((landTileArray[(expandPartyMaxRoll + 1)].startBuildTile == true)))) || ((landTileArray[(expandPartyMaxRoll + 1)].blockTile == true)))))){
partyDefendChoicesArray.push(0);
};
if ((((wallSlotArray[landTileArray[expandPartyMaxRoll].bottomWall].alpha == 0)) && ((((((wallSlotArray[landTileArray[expandPartyMaxRoll].upWall].alpha == 1)) || ((landTileArray[(expandPartyMaxRoll - 1)].startBuildTile == true)))) || ((landTileArray[(expandPartyMaxRoll - 1)].blockTile == true)))))){
partyDefendChoicesArray.push(180);
};
if ((((wallSlotArray[landTileArray[expandPartyMaxRoll].leftWall].alpha == 0)) && ((((((wallSlotArray[landTileArray[expandPartyMaxRoll].rightWall].alpha == 1)) || ((landTileArray[((expandPartyMaxRoll + 6) + (verticalGridCounter / 2))].startBuildTile == true)))) || ((landTileArray[((expandPartyMaxRoll + 6) + (verticalGridCounter / 2))].blockTile == true)))))){
partyDefendChoicesArray.push(-90);
};
if ((((wallSlotArray[landTileArray[expandPartyMaxRoll].rightWall].alpha == 0)) && ((((((wallSlotArray[landTileArray[expandPartyMaxRoll].leftWall].alpha == 1)) || ((landTileArray[((expandPartyMaxRoll - 6) - (verticalGridCounter / 2))].startBuildTile == true)))) || ((landTileArray[((expandPartyMaxRoll - 6) - (verticalGridCounter / 2))].blockTile == true)))))){
partyDefendChoicesArray.push(90);
};
if (partyDefendChoicesArray.length <= 0){
if ((((wallSlotArray[landTileArray[expandPartyMaxRoll].upWall].alpha == 1)) && ((((((wallSlotArray[landTileArray[expandPartyMaxRoll].bottomWall].alpha == 1)) || ((landTileArray[(expandPartyMaxRoll + 1)].startBuildTile == true)))) || ((landTileArray[(expandPartyMaxRoll + 1)].blockTile == true)))))){
partyDefendChoicesArray.push(0);
};
if ((((wallSlotArray[landTileArray[expandPartyMaxRoll].bottomWall].alpha == 1)) && ((((((wallSlotArray[landTileArray[expandPartyMaxRoll].upWall].alpha == 1)) || ((landTileArray[(expandPartyMaxRoll - 1)].startBuildTile == true)))) || ((landTileArray[(expandPartyMaxRoll - 1)].blockTile == true)))))){
partyDefendChoicesArray.push(180);
};
if ((((wallSlotArray[landTileArray[expandPartyMaxRoll].leftWall].alpha == 1)) && ((((((wallSlotArray[landTileArray[expandPartyMaxRoll].rightWall].alpha == 1)) || ((landTileArray[((expandPartyMaxRoll + 6) + (verticalGridCounter / 2))].startBuildTile == true)))) || ((landTileArray[((expandPartyMaxRoll + 6) + (verticalGridCounter / 2))].blockTile == true)))))){
partyDefendChoicesArray.push(-90);
};
if ((((wallSlotArray[landTileArray[expandPartyMaxRoll].rightWall].alpha == 1)) && ((((((wallSlotArray[landTileArray[expandPartyMaxRoll].leftWall].alpha == 1)) || ((landTileArray[((expandPartyMaxRoll - 6) - (verticalGridCounter / 2))].startBuildTile == true)))) || ((landTileArray[((expandPartyMaxRoll - 6) - (verticalGridCounter / 2))].blockTile == true)))))){
partyDefendChoicesArray.push(90);
};
};
if (partyDefendChoicesArray.length <= 0){
if (landTileArray[expandPartyMaxRoll].myArrayNumber == landTileArray[(tilesToProtect[_local8] - 1)].myArrayNumber){
partyDefendChoicesArray.push(0);
};
if (landTileArray[expandPartyMaxRoll].myArrayNumber == landTileArray[(tilesToProtect[_local8] + 1)].myArrayNumber){
partyDefendChoicesArray.push(180);
};
if (landTileArray[expandPartyMaxRoll].myArrayNumber == landTileArray[((tilesToProtect[_local8] + 6) + (verticalGridCounter / 2))].myArrayNumber){
partyDefendChoicesArray.push(90);
};
if (landTileArray[expandPartyMaxRoll].myArrayNumber == landTileArray[((tilesToProtect[_local8] - 6) - (verticalGridCounter / 2))].myArrayNumber){
partyDefendChoicesArray.push(-90);
};
};
if (partyDefendChoicesArray.length >= 1){
expandPartyMaxRoll = (partyDefendChoicesArray.length - 1);
expandPartyMaxRoll = int(((expandPartyMaxRoll * Math.random()) + 0.4));
if (expandPartyMaxRoll > (partyDefendChoicesArray.length - 1)){
expandPartyMaxRoll = (partyDefendChoicesArray.length - 1);
};
expandPartyMaxRoll = partyDefendChoicesArray[expandPartyMaxRoll];
landTileArray[partyUnit.myAssignment].defensiveUnitRotation = expandPartyMaxRoll;
partyUnit.imDefensive = true;
};
partyUnit.addEventListener(MouseEvent.MOUSE_DOWN, playerAttacksEnemy);
if (currentTurn == 2){
partyUnit.movesLeft = (partyUnitMaxMoves + p2UpgradeSpeed);
if (player2Race == "keeper"){
partyUnit.gotoAndStop(1);
} else {
if (player2Race == "builder"){
partyUnit.gotoAndStop(4);
} else {
if (player2Race == "expander"){
partyUnit.gotoAndStop(7);
} else {
if (player2Race == "raider"){
partyUnit.gotoAndStop(10);
};
};
};
};
} else {
if (currentTurn == 3){
partyUnit.movesLeft = (partyUnitMaxMoves + p3UpgradeSpeed);
if (player3Race == "keeper"){
partyUnit.gotoAndStop(1);
} else {
if (player3Race == "builder"){
partyUnit.gotoAndStop(4);
} else {
if (player3Race == "expander"){
partyUnit.gotoAndStop(7);
} else {
if (player3Race == "raider"){
partyUnit.gotoAndStop(10);
};
};
};
};
} else {
if (currentTurn == 4){
partyUnit.movesLeft = (partyUnitMaxMoves + p4UpgradeSpeed);
if (player4Race == "keeper"){
partyUnit.gotoAndStop(1);
} else {
if (player4Race == "builder"){
partyUnit.gotoAndStop(4);
} else {
if (player4Race == "expander"){
partyUnit.gotoAndStop(7);
} else {
if (player4Race == "raider"){
partyUnit.gotoAndStop(10);
};
};
};
};
};
};
};
addChild(partyUnit);
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(partyUnit, (getChildIndex(escapeMenu) - 1));
};
};
if ((((_local8 == (tilesToProtect.length - 1))) && ((partyDefendChoicesArray.length <= 0)))){
endPartyAssignments = true;
};
while (partyDefendChoicesArray.length >= 1) {
partyDefendChoicesArray.splice(0);
};
_local8++;
};
};
if ((((((((((((((currentTurn == 2)) && ((p2Extinct == false)))) || ((((currentTurn == 3)) && ((p3Extinct == false)))))) || ((((currentTurn == 4)) && ((p4Extinct == false)))))) && ((((UnitQtt >= 2)) || ((attackOnceForTutorial == true)))))) && (!((currentTurn == 1))))) && (!((currentTurn == 5))))){
attackOnceForTutorial = false;
exposedGatherer = false;
_local9 = 0;
while (_local9 < landTileArray.length) {
if ((((landTileArray[_local9].hasGatherer == true)) && (!((landTileArray[_local9].player == currentTurn))))){
if ((((((currentTurn == 2)) && ((landTileArray[_local9].player == 1)))) && ((((p2UpgradePower >= (p1UpgradePower - 2))) || ((((UnitQtt >= 5)) && ((p2UpgradePower >= (p1UpgradePower - 3))))))))){
partyDefendChoicesArray.push(landTileArray[_local9].myArrayNumber);
} else {
if ((((((currentTurn == 2)) && ((landTileArray[_local9].player == 3)))) && ((((p2UpgradePower >= (p3UpgradePower - 2))) || ((((UnitQtt >= 5)) && ((p2UpgradePower >= (p3UpgradePower - 3))))))))){
partyDefendChoicesArray.push(landTileArray[_local9].myArrayNumber);
} else {
if ((((((currentTurn == 2)) && ((landTileArray[_local9].player == 4)))) && ((((p2UpgradePower >= (p4UpgradePower - 2))) || ((((UnitQtt >= 5)) && ((p2UpgradePower >= (p4UpgradePower - 3))))))))){
partyDefendChoicesArray.push(landTileArray[_local9].myArrayNumber);
} else {
if ((((((currentTurn == 3)) && ((landTileArray[_local9].player == 1)))) && ((((p3UpgradePower >= (p1UpgradePower - 2))) || ((((UnitQtt >= 5)) && ((p3UpgradePower >= (p1UpgradePower - 3))))))))){
partyDefendChoicesArray.push(landTileArray[_local9].myArrayNumber);
} else {
if ((((((currentTurn == 3)) && ((landTileArray[_local9].player == 2)))) && ((((p3UpgradePower >= (p2UpgradePower - 2))) || ((((UnitQtt >= 5)) && ((p3UpgradePower >= (p2UpgradePower - 3))))))))){
partyDefendChoicesArray.push(landTileArray[_local9].myArrayNumber);
} else {
if ((((((currentTurn == 3)) && ((landTileArray[_local9].player == 4)))) && ((((p3UpgradePower >= (p4UpgradePower - 2))) || ((((UnitQtt >= 5)) && ((p3UpgradePower >= (p4UpgradePower - 3))))))))){
partyDefendChoicesArray.push(landTileArray[_local9].myArrayNumber);
} else {
if ((((((currentTurn == 4)) && ((landTileArray[_local9].player == 1)))) && ((((p4UpgradePower >= (p1UpgradePower - 2))) || ((((UnitQtt >= 5)) && ((p4UpgradePower >= (p1UpgradePower - 3))))))))){
partyDefendChoicesArray.push(landTileArray[_local9].myArrayNumber);
} else {
if ((((((currentTurn == 4)) && ((landTileArray[_local9].player == 2)))) && ((((p4UpgradePower >= (p2UpgradePower - 2))) || ((((UnitQtt >= 5)) && ((p4UpgradePower >= (p2UpgradePower - 3))))))))){
partyDefendChoicesArray.push(landTileArray[_local9].myArrayNumber);
} else {
if ((((((currentTurn == 4)) && ((landTileArray[_local9].player == 3)))) && ((((p4UpgradePower >= (p3UpgradePower + 2))) || ((((UnitQtt >= 5)) && ((p4UpgradePower >= (p3UpgradePower - 3))))))))){
partyDefendChoicesArray.push(landTileArray[_local9].myArrayNumber);
};
};
};
};
};
};
};
};
};
};
if ((((partyDefendChoicesArray.length >= 1)) && ((UnitQtt >= 1)))){
expandPartyMaxRoll = (partyDefendChoicesArray.length - 1);
expandPartyMaxRoll = int(((expandPartyMaxRoll * Math.random()) + 0.4));
if (expandPartyMaxRoll > (partyDefendChoicesArray.length - 1)){
expandPartyMaxRoll = (partyDefendChoicesArray.length - 1);
};
expandPartyMaxRoll = partyDefendChoicesArray[expandPartyMaxRoll];
while (partyDefendChoicesArray.length >= 1) {
partyDefendChoicesArray.splice(0);
};
landTileArray[expandPartyMaxRoll].partyAssignedOffensive = true;
partyUnit = new partyUnitLIB();
partyUnit.x = landTileArray[starterBuildingTile].x;
partyUnit.y = landTileArray[starterBuildingTile].y;
partyUnit.partyCurrentTile = landTileArray[starterBuildingTile].myArrayNumber;
partyUnit.myAssignment = landTileArray[expandPartyMaxRoll].myArrayNumber;
partyUnit.width = partyUnitWidth;
partyUnit.height = partyUnitHeight;
if (currentTurn == 2){
p2UnitQtt = (p2UnitQtt - 1);
UnitQtt = (UnitQtt - 1);
partyUnitArray2.push(partyUnit);
partyUnit.myArrayNumber = (partyUnitArray2.length - 1);
landTileArray[starterBuildingTile].party2 = (landTileArray[starterBuildingTile].party2 + 1);
} else {
if (currentTurn == 3){
p3UnitQtt = (p3UnitQtt - 1);
UnitQtt = (UnitQtt - 1);
partyUnitArray3.push(partyUnit);
partyUnit.myArrayNumber = (partyUnitArray3.length - 1);
landTileArray[starterBuildingTile].party3 = (landTileArray[starterBuildingTile].party3 + 1);
} else {
if (currentTurn == 4){
p4UnitQtt = (p4UnitQtt - 1);
UnitQtt = (UnitQtt - 1);
partyUnitArray4.push(partyUnit);
partyUnit.myArrayNumber = (partyUnitArray4.length - 1);
landTileArray[starterBuildingTile].party4 = (landTileArray[starterBuildingTile].party4 + 1);
};
};
};
partyUnit.player = currentTurn;
partyUnit.gotoAndStop(1);
partyUnit.addEventListener(MouseEvent.MOUSE_DOWN, playerAttacksEnemy);
partyUnit.addEventListener(MouseEvent.MOUSE_OVER, callWarAdvisor);
if (currentTurn == 2){
partyUnit.movesLeft = (partyUnitMaxMoves + p2UpgradeSpeed);
if (player2Race == "keeper"){
partyUnit.gotoAndStop(1);
} else {
if (player2Race == "builder"){
partyUnit.gotoAndStop(4);
} else {
if (player2Race == "expander"){
partyUnit.gotoAndStop(7);
} else {
if (player2Race == "raider"){
partyUnit.gotoAndStop(10);
};
};
};
};
} else {
if (currentTurn == 3){
partyUnit.movesLeft = (partyUnitMaxMoves + p3UpgradeSpeed);
if (player3Race == "keeper"){
partyUnit.gotoAndStop(1);
} else {
if (player3Race == "builder"){
partyUnit.gotoAndStop(4);
} else {
if (player3Race == "expander"){
partyUnit.gotoAndStop(7);
} else {
if (player3Race == "raider"){
partyUnit.gotoAndStop(10);
};
};
};
};
} else {
if (currentTurn == 4){
partyUnit.movesLeft = (partyUnitMaxMoves + p4UpgradeSpeed);
if (player4Race == "keeper"){
partyUnit.gotoAndStop(1);
} else {
if (player4Race == "builder"){
partyUnit.gotoAndStop(4);
} else {
if (player4Race == "expander"){
partyUnit.gotoAndStop(7);
} else {
if (player4Race == "raider"){
partyUnit.gotoAndStop(10);
};
};
};
};
};
};
};
addChild(partyUnit);
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(partyUnit, (getChildIndex(escapeMenu) - 1));
};
updateGameBars();
_local9++;
};
};
if (((((!((currentTurn == 1))) && ((npcBoughMindUpgrade == false)))) && ((((((((((currentTurn == 2)) && ((p2NoLongerPlaying == false)))) || ((((currentTurn == 3)) && ((p3NoLongerPlaying == false)))))) || ((((currentTurn == 4)) && ((p4NoLongerPlaying == false)))))) || ((currentTurn == 5)))))){
npcBoughMindUpgrade = false;
movingUnit = 0;
TimerAnimatePieces.stop();
TimerAnimatePieces.start();
} else {
if (npcBoughMindUpgrade == true){
npcBoughMindUpgrade = false;
TimerDelayShowNPCUpgrade.start();
} else {
if (currentTurn != 1){
playerAssign();
};
};
};
updateGameBars();
};
}
public function hideTutorialMiniBoxes():void{
tutoMiniBox4.visible = false;
tutoMiniBox5.visible = false;
tutoMiniBox7.visible = false;
tutoMiniBox72.visible = false;
tutoMiniBox8.visible = false;
tutoMiniBox82.visible = false;
tutoMiniBox9.visible = false;
tutoMiniBox10.visible = false;
tutoMiniBox11.visible = false;
}
public function animateTooltipWithSlide():void{
tutoMiniBox4.visible = false;
tutoMiniBox5.visible = false;
tutoMiniBox7.visible = false;
tutoMiniBox72.visible = false;
tutoMiniBox8.visible = false;
tutoMiniBox82.visible = false;
tutoMiniBox9.visible = false;
tutoMiniBox10.visible = false;
tutoMiniBox11.visible = false;
TimerAnimateTutorial.stop();
learnAsYouPlayToolTip.x = slideTutorialBeacon.x;
TimerAnimateTutorial.start();
}
public function animateTutorial(_arg1:TimerEvent):void{
if (learnAsYouPlayToolTip.x > player2Beacon.x){
if ((learnAsYouPlayToolTip.x - 14) < player2Beacon.x){
learnAsYouPlayToolTip.x = player2Beacon.x;
} else {
learnAsYouPlayToolTip.x = (learnAsYouPlayToolTip.x - 14);
};
} else {
TimerAnimateTutorial.stop();
if (learnAsYouPlayToolTip.visible == true){
if (learnAsYouPlayToolTip.currentFrame == 4){
tutoMiniBox4.y = landTileArray[p1StarterBuildingTile].y;
tutoMiniBox4.x = landTileArray[p1StarterBuildingTile].x;
p1Resource1Qtt = 6;
updateGameBars();
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(tutoMiniBox4, (getChildIndex(escapeMenu) - 1));
tutoMiniBox4.visible = true;
};
if (learnAsYouPlayToolTip.currentFrame == 5){
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(tutoMiniBox5, (getChildIndex(escapeMenu) - 1));
tutoMiniBox5.visible = true;
};
if (learnAsYouPlayToolTip.currentFrame == 7){
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(tutoMiniBox7, (getChildIndex(escapeMenu) - 1));
tutoMiniBox7.visible = true;
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(tutoMiniBox72, (getChildIndex(escapeMenu) - 1));
tutoMiniBox72.visible = true;
};
if (learnAsYouPlayToolTip.currentFrame == 8){
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(tutoMiniBox8, (getChildIndex(escapeMenu) - 1));
tutoMiniBox8.visible = true;
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(tutoMiniBox82, (getChildIndex(escapeMenu) - 1));
tutoMiniBox82.visible = true;
};
if (learnAsYouPlayToolTip.currentFrame == 9){
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(tutoMiniBox9, (getChildIndex(escapeMenu) - 1));
tutoMiniBox9.visible = true;
};
if (learnAsYouPlayToolTip.currentFrame == 10){
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(tutoMiniBox10, (getChildIndex(escapeMenu) - 1));
tutoMiniBox10.visible = true;
};
if (learnAsYouPlayToolTip.currentFrame == 11){
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(tutoMiniBox11, (getChildIndex(escapeMenu) - 1));
tutoMiniBox11.visible = true;
};
};
};
}
public function showProduceResource(_arg1:TimerEvent):void{
var _local2:Number;
setChildIndex(mindUpgradeDisplay, (getChildIndex(escapeMenu) - 1));
setChildIndex(producingResourceMessage, (getChildIndex(mindUpgradeDisplay) - 1));
producingResourceMessage.visible = true;
_local2 = 0.4;
producingResourceMessage.y = (producingResourceMessage.y - _local2);
if (riseTo2 >= 40){
producingResourceMessage.visible = false;
TimerShowProducingResource.stop();
riseTo2 = 0;
};
riseTo2++;
}
public function partyBattleShowAttackers():void{
turnPartyLedOn();
if (landTileArray[partyUnitArray[attackerUnit].partyCurrentTile].tileRow == landTileArray[tileAttacked].tileRow){
combatEvidencer.x = ((partyUnitArray[attackerUnit].x + landTileArray[tileAttacked].x) / 2);
combatEvidencer.y = partyUnitArray[attackerUnit].y;
combatEvidencer.rotation = 0;
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(combatEvidencer, (getChildIndex(escapeMenu) - 1));
playerMovesLeftText.alpha = 0;
combatEvidencer.visible = true;
} else {
combatEvidencer.x = partyUnitArray[attackerUnit].x;
combatEvidencer.y = ((partyUnitArray[attackerUnit].y + landTileArray[tileAttacked].y) / 2);
combatEvidencer.rotation = 90;
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(combatEvidencer, (getChildIndex(escapeMenu) - 1));
playerMovesLeftText.alpha = 0;
combatEvidencer.visible = true;
};
TimerShowCombatantsEnd.start();
}
public function partyBattleShowAttackersEnd(_arg1:TimerEvent):void{
partyBattle();
}
public function showGathererGetFinal(_arg1:TimerEvent):void{
var _local2:Number;
_local2 = 1.2;
res1Get1.y = (res1Get1.y - _local2);
res1Get2.y = (res1Get2.y - _local2);
res1Get3.y = (res1Get3.y - _local2);
res2Get1.y = (res2Get1.y - _local2);
res2Get2.y = (res2Get2.y - _local2);
res2Get3.y = (res2Get3.y - _local2);
res3Get1.y = (res3Get1.y - _local2);
res3Get2.y = (res3Get2.y - _local2);
res3Get3.y = (res3Get3.y - _local2);
res4Get1.y = (res4Get1.y - _local2);
res4Get2.y = (res4Get2.y - _local2);
res4Get3.y = (res4Get3.y - _local2);
if (riseTo >= 40){
res1Get1.visible = false;
res1Get2.visible = false;
res1Get3.visible = false;
res2Get1.visible = false;
res2Get2.visible = false;
res2Get3.visible = false;
res3Get1.visible = false;
res3Get2.visible = false;
res3Get3.visible = false;
res4Get1.visible = false;
res4Get2.visible = false;
res4Get3.visible = false;
TimerShowGathererGet.stop();
riseTo = 0;
diceRollChoice();
};
riseTo++;
}
public function showGathererGet():void{
var _local1:Boolean;
var _local2:Boolean;
var _local3:Boolean;
var _local4:Boolean;
var _local5:Boolean;
var _local6:Boolean;
var _local7:Boolean;
var _local8:Boolean;
var _local9:Boolean;
var _local10:Boolean;
var _local11:Boolean;
var _local12:Boolean;
var _local13:uint;
var _local14:uint;
_local1 = false;
_local2 = false;
_local3 = false;
_local4 = false;
_local5 = false;
_local6 = false;
_local7 = false;
_local8 = false;
_local9 = false;
_local10 = false;
_local11 = false;
_local12 = false;
_local13 = 0;
if (currentTurn == 1){
_local13 = p1UpgradeGatherer;
} else {
if (currentTurn == 2){
_local13 = p2UpgradeGatherer;
} else {
if (currentTurn == 3){
_local13 = p3UpgradeGatherer;
} else {
if (currentTurn == 4){
_local13 = p4UpgradeGatherer;
};
};
};
};
if ((((((((currentTurn == 1)) || ((((currentTurn == 2)) && ((p2Extinct == false)))))) || ((((currentTurn == 3)) && ((p3Extinct == false)))))) || ((((currentTurn == 4)) && ((p4Extinct == false)))))){
_local14 = 0;
while (_local14 < landTileArray.length) {
if ((((landTileArray[_local14].hasGatherer == true)) && ((landTileArray[_local14].player == currentTurn)))){
if (landTileArray[_local14].resource == 1){
if (_local1 == false){
_local1 = true;
res1Get1.x = landTileArray[_local14].x;
res1Get1.y = landTileArray[_local14].y;
res1Get1.resGetText.text = ("+" + (_local13 + 1));
res1Get1.visible = true;
} else {
if (_local2 == false){
_local2 = true;
res1Get2.x = landTileArray[_local14].x;
res1Get2.y = landTileArray[_local14].y;
res1Get2.resGetText.text = ("+" + (_local13 + 1));
res1Get2.visible = true;
} else {
if (_local3 == false){
_local3 = true;
res1Get3.x = landTileArray[_local14].x;
res1Get3.y = landTileArray[_local14].y;
res1Get3.resGetText.text = ("+" + (_local13 + 1));
res1Get3.visible = true;
};
};
};
};
if (landTileArray[_local14].resource == 2){
if (_local4 == false){
_local4 = true;
res2Get1.x = landTileArray[_local14].x;
res2Get1.y = landTileArray[_local14].y;
res2Get1.resGetText.text = ("+" + (_local13 + 1));
res2Get1.visible = true;
} else {
if (_local5 == false){
_local5 = true;
res2Get2.x = landTileArray[_local14].x;
res2Get2.y = landTileArray[_local14].y;
res2Get2.resGetText.text = ("+" + (_local13 + 1));
res2Get2.visible = true;
} else {
if (_local6 == false){
_local6 = true;
res2Get3.x = landTileArray[_local14].x;
res2Get3.y = landTileArray[_local14].y;
res2Get3.resGetText.text = ("+" + (_local13 + 1));
res2Get3.visible = true;
};
};
};
};
if (landTileArray[_local14].resource == 3){
if (_local7 == false){
_local7 = true;
res3Get1.x = landTileArray[_local14].x;
res3Get1.y = landTileArray[_local14].y;
res3Get1.resGetText.text = ("+" + (_local13 + 1));
res3Get1.visible = true;
} else {
if (_local8 == false){
_local8 = true;
res3Get2.x = landTileArray[_local14].x;
res3Get2.y = landTileArray[_local14].y;
res3Get2.resGetText.text = ("+" + (_local13 + 1));
res3Get2.visible = true;
} else {
if (_local9 == false){
_local9 = true;
res3Get3.x = landTileArray[_local14].x;
res3Get3.y = landTileArray[_local14].y;
res3Get3.resGetText.text = ("+" + (_local13 + 1));
res3Get3.visible = true;
};
};
};
};
if (landTileArray[_local14].resource == 4){
if (_local10 == false){
_local10 = true;
res4Get1.x = landTileArray[_local14].x;
res4Get1.y = landTileArray[_local14].y;
res4Get1.resGetText.text = ("+" + (_local13 + 1));
res4Get1.visible = true;
} else {
if (_local11 == false){
_local11 = true;
res4Get2.x = landTileArray[_local14].x;
res4Get2.y = landTileArray[_local14].y;
res4Get2.resGetText.text = ("+" + (_local13 + 1));
res4Get2.visible = true;
} else {
if (_local12 == false){
_local12 = true;
res4Get3.x = landTileArray[_local14].x;
res4Get3.y = landTileArray[_local14].y;
res4Get3.resGetText.text = ("+" + (_local13 + 1));
res4Get3.visible = true;
};
};
};
};
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(res1Get1, (getChildIndex(escapeMenu) - 1));
setChildIndex(res1Get2, (getChildIndex(escapeMenu) - 1));
setChildIndex(res1Get3, (getChildIndex(escapeMenu) - 1));
setChildIndex(res2Get1, (getChildIndex(escapeMenu) - 1));
setChildIndex(res2Get2, (getChildIndex(escapeMenu) - 1));
setChildIndex(res2Get3, (getChildIndex(escapeMenu) - 1));
setChildIndex(res3Get1, (getChildIndex(escapeMenu) - 1));
setChildIndex(res3Get2, (getChildIndex(escapeMenu) - 1));
setChildIndex(res3Get3, (getChildIndex(escapeMenu) - 1));
setChildIndex(res4Get1, (getChildIndex(escapeMenu) - 1));
setChildIndex(res4Get2, (getChildIndex(escapeMenu) - 1));
setChildIndex(res4Get3, (getChildIndex(escapeMenu) - 1));
};
_local14++;
};
if (blankTurnOver == true){
if (currentTurn == 1){
p1Resource1Qtt = (p1Resource1Qtt + (p1Gatherers1 * resourcesPerTurn));
p1Resource2Qtt = (p1Resource2Qtt + (p1Gatherers2 * resourcesPerTurn));
p1Resource3Qtt = (p1Resource3Qtt + (p1Gatherers3 * resourcesPerTurn));
p1Resource4Qtt = (p1Resource4Qtt + (p1Gatherers4 * resourcesPerTurn));
p1Resource1Qtt = (p1Resource1Qtt + (p1Gatherers1 * p1UpgradeGatherer));
p1Resource2Qtt = (p1Resource2Qtt + (p1Gatherers2 * p1UpgradeGatherer));
p1Resource3Qtt = (p1Resource3Qtt + (p1Gatherers3 * p1UpgradeGatherer));
p1Resource4Qtt = (p1Resource4Qtt + (p1Gatherers4 * p1UpgradeGatherer));
} else {
if ((((currentTurn == 2)) && ((p2Extinct == false)))){
p2Resource1Qtt = (p2Resource1Qtt + (p2Gatherers1 * resourcesPerTurn));
p2Resource2Qtt = (p2Resource2Qtt + (p2Gatherers2 * resourcesPerTurn));
p2Resource3Qtt = (p2Resource3Qtt + (p2Gatherers3 * resourcesPerTurn));
p2Resource4Qtt = (p2Resource4Qtt + (p2Gatherers4 * resourcesPerTurn));
p2Resource1Qtt = (p2Resource1Qtt + (p2Gatherers1 * p2UpgradeGatherer));
p2Resource2Qtt = (p2Resource2Qtt + (p2Gatherers2 * p2UpgradeGatherer));
p2Resource3Qtt = (p2Resource3Qtt + (p2Gatherers3 * p2UpgradeGatherer));
p2Resource4Qtt = (p2Resource4Qtt + (p2Gatherers4 * p2UpgradeGatherer));
} else {
if ((((currentTurn == 3)) && ((p3Extinct == false)))){
p3Resource1Qtt = (p3Resource1Qtt + (p3Gatherers1 * resourcesPerTurn));
p3Resource2Qtt = (p3Resource2Qtt + (p3Gatherers2 * resourcesPerTurn));
p3Resource3Qtt = (p3Resource3Qtt + (p3Gatherers3 * resourcesPerTurn));
p3Resource4Qtt = (p3Resource4Qtt + (p3Gatherers4 * resourcesPerTurn));
p3Resource1Qtt = (p3Resource1Qtt + (p3Gatherers1 * p3UpgradeGatherer));
p3Resource2Qtt = (p3Resource2Qtt + (p3Gatherers2 * p3UpgradeGatherer));
p3Resource3Qtt = (p3Resource3Qtt + (p3Gatherers3 * p3UpgradeGatherer));
p3Resource4Qtt = (p3Resource4Qtt + (p3Gatherers4 * p3UpgradeGatherer));
};
};
};
if ((((currentTurn == 4)) && ((p4Extinct == false)))){
p4Resource1Qtt = (p4Resource1Qtt + (p4Gatherers1 * resourcesPerTurn));
p4Resource2Qtt = (p4Resource2Qtt + (p4Gatherers2 * resourcesPerTurn));
p4Resource3Qtt = (p4Resource3Qtt + (p4Gatherers3 * resourcesPerTurn));
p4Resource4Qtt = (p4Resource4Qtt + (p4Gatherers4 * resourcesPerTurn));
p4Resource1Qtt = (p4Resource1Qtt + (p4Gatherers1 * p4UpgradeGatherer));
p4Resource2Qtt = (p4Resource2Qtt + (p4Gatherers2 * p4UpgradeGatherer));
p4Resource3Qtt = (p4Resource3Qtt + (p4Gatherers3 * p4UpgradeGatherer));
p4Resource4Qtt = (p4Resource4Qtt + (p4Gatherers4 * p4UpgradeGatherer));
};
};
updateGameBars();
riseTo = 0;
TimerShowGathererGet.start();
} else {
gameTurn();
};
}
public function playerAssign():void{
var _local1:uint;
var _local2:uint;
var _local3:uint;
var _local4:uint;
var _local5:uint;
var _local6:uint;
var _local7:uint;
var _local8:uint;
var _local9:uint;
var _local10:uint;
if (gameOver == false){
player1ChoosingDiceRoll = true;
if (reaverTurnTaken == false){
turnBeforeReavers = currentTurn;
currentTurn = 5;
reaverTurnTaken = true;
} else {
currentTurn = turnBeforeReavers;
reaverTurnTaken = false;
};
if (currentTurn == 1){
currentTurn = 2;
} else {
if (currentTurn == 2){
if (numberOfPlayers == 2){
currentTurn = 1;
} else {
if (numberOfPlayers == 3){
currentTurn = 3;
} else {
if (numberOfPlayers == 4){
currentTurn = 4;
};
};
};
} else {
if (currentTurn == 3){
currentTurn = 1;
} else {
if (currentTurn == 4){
currentTurn = 3;
};
};
};
};
if (currentTurn == startingTurnPlayer){
blankTurnOver = true;
};
if (blankTurnOver != true){
player1ChoosingDiceRoll = false;
};
if ((((blankTurnOver == true)) && (!((currentTurn == 5))))){
tokenRollChoice.visible = false;
showGathererGet();
} else {
_local1 = (((p1Gatherers1 + p1Gatherers2) + p1Gatherers3) + p1Gatherers4);
_local2 = _local1;
_local3 = (((p2Gatherers1 + p2Gatherers2) + p2Gatherers3) + p2Gatherers4);
if (_local3 > _local2){
_local2 = _local3;
};
_local4 = (((p3Gatherers1 + p3Gatherers2) + p3Gatherers3) + p3Gatherers4);
if (_local4 > _local2){
_local2 = _local4;
};
_local5 = (((p4Gatherers1 + p4Gatherers2) + p4Gatherers3) + p4Gatherers4);
if (_local5 > _local2){
_local2 = _local5;
};
trace(("zomg the reavers " + reaversComingCount));
if ((((((((((reaversComingCount >= reaversMostWait)) || ((((reaversComingCount >= whenReaversComeTemp)) && ((Math.random() >= 0.5)))))) && ((learningWhilePlaying == false)))) && ((reaversDontMove == false)))) && ((gameOver == false)))){
reaversComingCount = 0;
_local6 = 0;
_local7 = 0;
_local8 = 0;
_local9 = 0;
_local10 = 0;
while (_local10 < landTileArray.length) {
if (landTileArray[_local10].hasGatherer == true){
if ((((((((((landTileArray[_local10].player == 1)) && (((((p1Gatherers1 + p1Gatherers2) + p1Gatherers3) + p1Gatherers4) >= 1)))) || ((((landTileArray[_local10].player == 2)) && (((((p2Gatherers1 + p2Gatherers2) + p2Gatherers3) + p2Gatherers4) >= 1)))))) || ((((landTileArray[_local10].player == 3)) && (((((p3Gatherers1 + p3Gatherers2) + p3Gatherers3) + p3Gatherers4) >= 1)))))) || ((((landTileArray[_local10].player == 4)) && (((((p4Gatherers1 + p4Gatherers2) + p4Gatherers3) + p4Gatherers4) >= 1)))))){
if ((((((landTileArray[_local10].player == 1)) && ((_local1 == _local2)))) && ((_local6 < 5)))){
reaverRaid = (reaverOriginPlayer1.length - 1);
reaverRaid = int(((reaverRaid * Math.random()) + 0.4));
if (reaverRaid > (reaverOriginPlayer1.length - 1)){
reaverRaid = (reaverOriginPlayer1.length - 1);
};
reaverRaid = reaverOriginPlayer1[reaverRaid];
partyUnit = new partyUnitLIB();
partyUnit.x = landTileArray[reaverRaid].x;
partyUnit.y = landTileArray[reaverRaid].y;
partyUnit.partyCurrentTile = landTileArray[reaverRaid].myArrayNumber;
partyUnit.myAssignment = landTileArray[_local10].myArrayNumber;
partyUnit.width = partyUnitWidth;
partyUnit.height = partyUnitHeight;
partyUnitArray5.push(partyUnit);
partyUnit.myArrayNumber = (partyUnitArray5.length - 1);
landTileArray[reaverRaid].party5 = (landTileArray[reaverRaid].party5 + 1);
reaverTurnTaken = true;
partyUnit.player = 5;
partyUnit.gotoAndStop(13);
partyUnit.addEventListener(MouseEvent.MOUSE_DOWN, playerAttacksEnemy);
partyUnit.addEventListener(MouseEvent.MOUSE_OVER, callWarAdvisor);
partyUnit.movesLeft = partyUnitMaxMoves;
if (landTileArray[partyUnit.partyCurrentTile].tileRow == 0){
partyUnit.rotation = 180;
} else {
partyUnit.rotation = 90;
};
_local6++;
addChild(partyUnit);
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(partyUnit, (getChildIndex(escapeMenu) - 1));
} else {
if ((((((landTileArray[_local10].player == 2)) && ((_local3 == _local2)))) && ((_local7 < 5)))){
reaverRaid = (reaverOriginPlayer2.length - 1);
reaverRaid = int(((reaverRaid * Math.random()) + 0.4));
if (reaverRaid > (reaverOriginPlayer2.length - 1)){
reaverRaid = (reaverOriginPlayer2.length - 1);
};
reaverRaid = reaverOriginPlayer2[reaverRaid];
partyUnit = new partyUnitLIB();
partyUnit.x = landTileArray[reaverRaid].x;
partyUnit.y = landTileArray[reaverRaid].y;
partyUnit.partyCurrentTile = landTileArray[reaverRaid].myArrayNumber;
partyUnit.myAssignment = landTileArray[_local10].myArrayNumber;
partyUnit.width = partyUnitWidth;
partyUnit.height = partyUnitHeight;
partyUnitArray5.push(partyUnit);
partyUnit.myArrayNumber = (partyUnitArray5.length - 1);
landTileArray[reaverRaid].party5 = (landTileArray[reaverRaid].party5 + 1);
reaverTurnTaken = true;
partyUnit.player = 5;
partyUnit.gotoAndStop(13);
partyUnit.addEventListener(MouseEvent.MOUSE_DOWN, playerAttacksEnemy);
partyUnit.addEventListener(MouseEvent.MOUSE_OVER, callWarAdvisor);
partyUnit.movesLeft = partyUnitMaxMoves;
if (landTileArray[partyUnit.partyCurrentTile].tileRow == 0){
partyUnit.rotation = 180;
} else {
partyUnit.rotation = -90;
};
_local7++;
addChild(partyUnit);
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(partyUnit, (getChildIndex(escapeMenu) - 1));
} else {
if ((((((landTileArray[_local10].player == 3)) && ((_local4 == _local2)))) && ((_local8 < 5)))){
reaverRaid = (reaverOriginPlayer3.length - 1);
reaverRaid = int(((reaverRaid * Math.random()) + 0.4));
if (reaverRaid > (reaverOriginPlayer3.length - 1)){
reaverRaid = (reaverOriginPlayer3.length - 1);
};
reaverRaid = reaverOriginPlayer3[reaverRaid];
partyUnit = new partyUnitLIB();
partyUnit.x = landTileArray[reaverRaid].x;
partyUnit.y = landTileArray[reaverRaid].y;
partyUnit.partyCurrentTile = landTileArray[reaverRaid].myArrayNumber;
partyUnit.myAssignment = landTileArray[_local10].myArrayNumber;
partyUnit.width = partyUnitWidth;
partyUnit.height = partyUnitHeight;
partyUnitArray5.push(partyUnit);
partyUnit.myArrayNumber = (partyUnitArray5.length - 1);
landTileArray[reaverRaid].party5 = (landTileArray[reaverRaid].party5 + 1);
reaverTurnTaken = true;
partyUnit.player = 5;
if (landTileArray[partyUnit.partyCurrentTile].tileRow == lowerMostLimit){
partyUnit.rotation = 0;
} else {
partyUnit.rotation = 90;
};
partyUnit.gotoAndStop(13);
partyUnit.addEventListener(MouseEvent.MOUSE_DOWN, playerAttacksEnemy);
partyUnit.addEventListener(MouseEvent.MOUSE_OVER, callWarAdvisor);
partyUnit.movesLeft = partyUnitMaxMoves;
_local8++;
addChild(partyUnit);
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(partyUnit, (getChildIndex(escapeMenu) - 1));
} else {
if ((((((landTileArray[_local10].player == 4)) && ((_local5 == _local2)))) && ((_local9 < 5)))){
reaverRaid = (reaverOriginPlayer4.length - 1);
reaverRaid = int(((reaverRaid * Math.random()) + 0.4));
if (reaverRaid > (reaverOriginPlayer4.length - 1)){
reaverRaid = (reaverOriginPlayer4.length - 1);
};
reaverRaid = reaverOriginPlayer4[reaverRaid];
partyUnit = new partyUnitLIB();
partyUnit.x = landTileArray[reaverRaid].x;
partyUnit.y = landTileArray[reaverRaid].y;
partyUnit.partyCurrentTile = landTileArray[reaverRaid].myArrayNumber;
partyUnit.myAssignment = landTileArray[_local10].myArrayNumber;
partyUnit.width = partyUnitWidth;
partyUnit.height = partyUnitHeight;
partyUnitArray5.push(partyUnit);
partyUnit.myArrayNumber = (partyUnitArray5.length - 1);
landTileArray[reaverRaid].party5 = (landTileArray[reaverRaid].party5 + 1);
reaverTurnTaken = true;
partyUnit.player = 5;
partyUnit.gotoAndStop(13);
partyUnit.addEventListener(MouseEvent.MOUSE_DOWN, playerAttacksEnemy);
partyUnit.addEventListener(MouseEvent.MOUSE_OVER, callWarAdvisor);
partyUnit.movesLeft = partyUnitMaxMoves;
if (landTileArray[partyUnit.partyCurrentTile].tileRow == lowerMostLimit){
partyUnit.rotation = 0;
} else {
partyUnit.rotation = -90;
};
_local9++;
addChild(partyUnit);
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(partyUnit, (getChildIndex(escapeMenu) - 1));
};
};
};
};
currentTurn = 5;
};
};
_local10++;
};
};
gameTurn();
};
};
}
public function playerUpdateMoveText():void{
playerMovesLeftText.x = (partyUnitArray1[currentUnitPlayerMoves].x + xmoveTextModifier);
playerMovesLeftText.y = (partyUnitArray1[currentUnitPlayerMoves].y + ymoveTextModifier);
playerMovesLeftText.playerMovesLeftTextMoves.text = ("" + partyUnitArray1[currentUnitPlayerMoves].movesLeft);
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(playerMovesLeftText, (getChildIndex(escapeMenu) - 1));
playerMovesLeftText.visible = true;
}
public function playerHideMoveText():void{
playerMovesLeftText.visible = false;
}
public function playerMoveToGathererUnit(_arg1:MouseEvent):void{
if (gameOver == false){
trace(_arg1.target.partyCurrentTile);
if (allowPlayerToMoveUnit == true){
if ((((((((currentTurn == 1)) && (!((landTileArray[_arg1.target.partyCurrentTile].blockTile == true))))) && ((partyUnitArray1[currentUnitPlayerMoves].movesLeft > 0)))) && (((((((((((((((landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].tileRow + 1) == landTileArray[_arg1.target.partyCurrentTile].tileRow)) && ((landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].tileColumn == landTileArray[_arg1.target.partyCurrentTile].tileColumn)))) || (((((landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].tileRow - 1) == landTileArray[_arg1.target.partyCurrentTile].tileRow)) && ((landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].tileColumn == landTileArray[_arg1.target.partyCurrentTile].tileColumn)))))) || ((partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile == landTileArray[(landTileArray[_arg1.target.partyCurrentTile].myArrayNumber + 1)].myArrayNumber)))) || ((partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile == landTileArray[(landTileArray[_arg1.target.partyCurrentTile].myArrayNumber - 1)].myArrayNumber)))) || ((partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile == landTileArray[((landTileArray[_arg1.target.partyCurrentTile].myArrayNumber + 6) + (verticalGridCounter / 2))].myArrayNumber)))) || ((partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile == landTileArray[((landTileArray[_arg1.target.partyCurrentTile].myArrayNumber - 6) - (verticalGridCounter / 2))].myArrayNumber)))))){
if (((((((((((landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].myArrayNumber - 1) == landTileArray[_arg1.target.partyCurrentTile].myArrayNumber)) && ((((wallSlotArray[landTileArray[_arg1.target.partyCurrentTile].bottomWall].alpha == 0)) || ((wallSlotArray[landTileArray[_arg1.target.partyCurrentTile].bottomWall].player == currentTurn)))))) || (((((landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].myArrayNumber + 1) == landTileArray[_arg1.target.partyCurrentTile].myArrayNumber)) && ((((wallSlotArray[landTileArray[_arg1.target.partyCurrentTile].upWall].alpha == 0)) || ((wallSlotArray[landTileArray[_arg1.target.partyCurrentTile].upWall].player == currentTurn)))))))) || ((((((landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].myArrayNumber + 6) + (verticalGridCounter / 2)) == landTileArray[_arg1.target.partyCurrentTile].myArrayNumber)) && ((((wallSlotArray[landTileArray[_arg1.target.partyCurrentTile].leftWall].alpha == 0)) || ((wallSlotArray[landTileArray[_arg1.target.partyCurrentTile].leftWall].player == currentTurn)))))))) || ((((((landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].myArrayNumber - 6) - (verticalGridCounter / 2)) == landTileArray[_arg1.target.partyCurrentTile].myArrayNumber)) && ((((wallSlotArray[landTileArray[_arg1.target.partyCurrentTile].rightWall].alpha == 0)) || ((wallSlotArray[landTileArray[_arg1.target.partyCurrentTile].rightWall].player == currentTurn)))))))){
if (partyUnitArray1[currentUnitPlayerMoves].defensiveUnit != true){
partyUnitArray1[currentUnitPlayerMoves].x = landTileArray[_arg1.target.partyCurrentTile].x;
partyUnitArray1[currentUnitPlayerMoves].y = landTileArray[_arg1.target.partyCurrentTile].y;
landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].party1 = (landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].party1 - 1);
partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile = _arg1.target.partyCurrentTile;
landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].party1 = (landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].party1 + 1);
partyUnitArray1[currentUnitPlayerMoves].movesLeft = (partyUnitArray1[currentUnitPlayerMoves].movesLeft - 1);
playerUpdateMoveText();
};
};
};
};
};
}
public function playerMovesUnit(_arg1:MouseEvent):void{
var _local2:uint;
var _local3:uint;
var _local4:uint;
var _local5:uint;
var _local6:uint;
if (gameOver == false){
unitWithMostMoves = 0;
if ((((((((player1UnderCombat == false)) && ((p1GathererQtt <= 0)))) || ((landTileArray[_arg1.target.partyCurrentTile].hasGatherer == true)))) || (((((((!((landTileArray[_arg1.target.partyCurrentTile].resource == 1))) && (!((landTileArray[_arg1.target.partyCurrentTile].resource == 2))))) && (!((landTileArray[_arg1.target.partyCurrentTile].resource == 3))))) && (!((landTileArray[_arg1.target.partyCurrentTile].resource == 4))))))){
player1PlaceGathererMode = false;
player1PlaceWallMode = false;
constructorModeMouse.visible = false;
Mouse.show();
};
trace(("number of party 1 on this tile: " + landTileArray[_arg1.target.partyCurrentTile].party1));
if ((((((((((((((((((((longWalkSliding == false)) && ((player1UnderCombat == false)))) && ((slidingUnit == false)))) && ((player1PlaceGathererMode == false)))) && ((player1PlaceWallMode == false)))) && ((currentTurn == 1)))) && ((allowPlayerToMoveUnit == false)))) && ((player1ChoosingDiceRoll == false)))) && ((player1PlaceWallMode == false)))) && ((player1PlaceGathererMode == false)))){
chan_soundFX = snd_moveunit.play(0, 0, snd_FXVolume);
if (landTileArray[_arg1.target.partyCurrentTile].party1 >= 2){
_local2 = 0;
while (_local2 < partyUnitArray1.length) {
if (((((((!((partyUnitArray1[_local2].deadUnit == true))) && (!((partyUnitArray1[_local2].defensiveUnit == true))))) && ((landTileArray[partyUnitArray1[_local2].partyCurrentTile].myArrayNumber == landTileArray[_arg1.target.partyCurrentTile].myArrayNumber)))) && ((partyUnitArray1[_local2].movesLeft >= unitWithMostMoves)))){
currentUnitPlayerMoves = partyUnitArray1[_local2].myArrayNumber;
unitWithMostMoves = partyUnitArray1[_local2].movesLeft;
trace("bug here 1");
trace(partyUnitArray1[_local2].deadUnit);
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(partyUnitArray1[currentUnitPlayerMoves], (getChildIndex(escapeMenu) - 1));
trace("bug here 2");
allowPlayerToMoveUnit = true;
playerUpdateMoveText();
};
_local2++;
};
} else {
if ((((((((((((longWalkSliding == false)) && ((player1UnderCombat == false)))) && ((slidingUnit == false)))) && ((_arg1.target.movesLeft <= 0)))) && ((landTileArray[_arg1.target.partyCurrentTile].startBuildTile == true)))) && ((p1UnitQtt >= 1)))){
spawnUnitEnd();
} else {
if ((((((player1UnderCombat == false)) && ((longWalkSliding == false)))) && ((slidingUnit == false)))){
currentUnitPlayerMoves = _arg1.target.myArrayNumber;
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(partyUnitArray1[currentUnitPlayerMoves], (getChildIndex(escapeMenu) - 1));
allowPlayerToMoveUnit = true;
playerUpdateMoveText();
};
};
};
} else {
if ((((((((((((((((((((player1UnderCombat == false)) && ((longWalkSliding == false)))) && ((slidingUnit == false)))) && ((player1ChoosingDiceRoll == false)))) && ((player1PlaceGathererMode == false)))) && ((player1PlaceWallMode == false)))) && ((currentTurn == 1)))) && (!((currentUnitPlayerMoves == _arg1.target.myArrayNumber))))) && ((player1PlaceWallMode == false)))) && ((player1PlaceGathererMode == false)))){
if ((((((((currentTurn == 1)) && (!((landTileArray[_arg1.target.partyCurrentTile].blockTile == true))))) && ((partyUnitArray1[currentUnitPlayerMoves].movesLeft > 0)))) && (((((((((((((((landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].tileRow + 1) == landTileArray[_arg1.target.partyCurrentTile].tileRow)) && ((landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].tileColumn == landTileArray[_arg1.target.partyCurrentTile].tileColumn)))) || (((((landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].tileRow - 1) == landTileArray[_arg1.target.partyCurrentTile].tileRow)) && ((landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].tileColumn == landTileArray[_arg1.target.partyCurrentTile].tileColumn)))))) || ((partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile == landTileArray[(landTileArray[_arg1.target.partyCurrentTile].myArrayNumber + 1)].myArrayNumber)))) || ((partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile == landTileArray[(landTileArray[_arg1.target.partyCurrentTile].myArrayNumber - 1)].myArrayNumber)))) || ((partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile == landTileArray[((landTileArray[_arg1.target.partyCurrentTile].myArrayNumber + 6) + (verticalGridCounter / 2))].myArrayNumber)))) || ((partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile == landTileArray[((landTileArray[_arg1.target.partyCurrentTile].myArrayNumber - 6) - (verticalGridCounter / 2))].myArrayNumber)))))){
if (((((((((((landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].myArrayNumber - 1) == landTileArray[_arg1.target.partyCurrentTile].myArrayNumber)) && ((((wallSlotArray[landTileArray[_arg1.target.partyCurrentTile].bottomWall].alpha == 0)) || ((wallSlotArray[landTileArray[_arg1.target.partyCurrentTile].bottomWall].player == currentTurn)))))) || (((((landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].myArrayNumber + 1) == landTileArray[_arg1.target.partyCurrentTile].myArrayNumber)) && ((((wallSlotArray[landTileArray[_arg1.target.partyCurrentTile].upWall].alpha == 0)) || ((wallSlotArray[landTileArray[_arg1.target.partyCurrentTile].upWall].player == currentTurn)))))))) || ((((((landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].myArrayNumber + 6) + (verticalGridCounter / 2)) == landTileArray[_arg1.target.partyCurrentTile].myArrayNumber)) && ((((wallSlotArray[landTileArray[_arg1.target.partyCurrentTile].leftWall].alpha == 0)) || ((wallSlotArray[landTileArray[_arg1.target.partyCurrentTile].leftWall].player == currentTurn)))))))) || ((((((landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].myArrayNumber - 6) - (verticalGridCounter / 2)) == landTileArray[_arg1.target.partyCurrentTile].myArrayNumber)) && ((((wallSlotArray[landTileArray[_arg1.target.partyCurrentTile].rightWall].alpha == 0)) || ((wallSlotArray[landTileArray[_arg1.target.partyCurrentTile].rightWall].player == currentTurn)))))))){
if (partyUnitArray1[currentUnitPlayerMoves].defensiveUnit != true){
turnPartyLedOff();
if ((_arg1.target.partyCurrentTile + 1) == partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile){
partyUnitArray1[currentUnitPlayerMoves].rotation = 0;
};
if ((_arg1.target.partyCurrentTile - 1) == partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile){
partyUnitArray1[currentUnitPlayerMoves].rotation = 180;
};
if (((_arg1.target.partyCurrentTile - 6) - (verticalGridCounter / 2)) == partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile){
partyUnitArray1[currentUnitPlayerMoves].rotation = 90;
};
if (((_arg1.target.partyCurrentTile + 6) + (verticalGridCounter / 2)) == partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile){
partyUnitArray1[currentUnitPlayerMoves].rotation = -90;
};
firstMoveRight = false;
firstMoveLeft = false;
firstMoveUp = false;
firstMoveDown = false;
slideToX = _arg1.target.x;
slideToY = _arg1.target.y;
landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].party1 = (landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].party1 - 1);
partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile = landTileArray[_arg1.target.partyCurrentTile].myArrayNumber;
landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].party1 = (landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].party1 + 1);
partyUnitArray1[currentUnitPlayerMoves].movesLeft = (partyUnitArray1[currentUnitPlayerMoves].movesLeft - 1);
playerUpdateMoveText();
turnPartyLedOn();
TimerSlidePartyUnit.start();
};
};
} else {
if ((((((((((((((((((player1UnderCombat == false)) && ((allowPlayerToMoveUnit == true)))) && ((landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].tileRow == landTileArray[_arg1.target.partyCurrentTile].tileRow)))) && ((longWalkSliding == false)))) && ((slidingUnit == false)))) && ((currentTurn == 1)))) && (!((landTileArray[_arg1.target.partyCurrentTile].blockTile == true))))) && (!((landTileArray[_arg1.target.partyCurrentTile].startBuildTile == true))))) && ((partyUnitArray1[currentUnitPlayerMoves].movesLeft > 0)))){
tilesDifference = (landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].tileColumn - landTileArray[_arg1.target.partyCurrentTile].tileColumn);
failLongWalk = false;
longWalkArray.splice(0);
if ((((tilesDifference > 0)) && ((tilesDifference <= partyUnitArray1[currentUnitPlayerMoves].movesLeft)))){
tempLongwalkOrientation = -90;
_local3 = 1;
while (_local3 <= tilesDifference) {
if ((((((((((((((((((((wallSlotArray[landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((-6 - (verticalGridCounter / 2)) * _local3))].rightWall].alpha == 0)) || ((wallSlotArray[landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((-6 - (verticalGridCounter / 2)) * _local3))].rightWall].player == 1)))) && ((((((wallSlotArray[landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((-6 - (verticalGridCounter / 2)) * _local3))].leftWall].alpha == 0)) || ((_local3 == tilesDifference)))) || ((wallSlotArray[landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((-6 - (verticalGridCounter / 2)) * _local3))].leftWall].player == 1)))))) && ((landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((-6 - (verticalGridCounter / 2)) * _local3))].party2 == 0)))) && ((landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((-6 - (verticalGridCounter / 2)) * _local3))].party3 == 0)))) && ((landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((-6 - (verticalGridCounter / 2)) * _local3))].party4 == 0)))) && ((landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((-6 - (verticalGridCounter / 2)) * _local3))].party5 == 0)))) && (!((landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((-6 - (verticalGridCounter / 2)) * _local3))].blockTile == true))))) && (((!((landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((-6 - (verticalGridCounter / 2)) * _local3))].startBuildTile == true))) || ((landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((-6 - (verticalGridCounter / 2)) * _local3))].player == 1)))))) && ((landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((-6 - (verticalGridCounter / 2)) * _local3))].party5 == 0)))){
longWalkArray.push(landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((-6 - (verticalGridCounter / 2)) * _local3))].myArrayNumber);
} else {
failLongWalk = true;
};
_local3++;
};
} else {
if ((((tilesDifference < 0)) && ((-(tilesDifference) <= partyUnitArray1[currentUnitPlayerMoves].movesLeft)))){
tempLongwalkOrientation = 90;
tilesDifference = -(tilesDifference);
_local4 = 1;
while (_local4 <= tilesDifference) {
if ((((((((((((((((((((wallSlotArray[landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((6 + (verticalGridCounter / 2)) * _local4))].leftWall].alpha == 0)) || ((wallSlotArray[landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((6 + (verticalGridCounter / 2)) * _local4))].leftWall].player == 1)))) && ((((((wallSlotArray[landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((6 + (verticalGridCounter / 2)) * _local4))].rightWall].alpha == 0)) || ((_local4 == tilesDifference)))) || ((wallSlotArray[landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((6 + (verticalGridCounter / 2)) * _local4))].rightWall].player == 1)))))) && ((landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((6 + (verticalGridCounter / 2)) * _local4))].party2 == 0)))) && ((landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((6 + (verticalGridCounter / 2)) * _local4))].party3 == 0)))) && ((landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((6 + (verticalGridCounter / 2)) * _local4))].party4 == 0)))) && ((landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((6 + (verticalGridCounter / 2)) * _local4))].party5 == 0)))) && (!((landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((6 + (verticalGridCounter / 2)) * _local4))].blockTile == true))))) && (((!((landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((6 + (verticalGridCounter / 2)) * _local4))].startBuildTile == true))) || ((landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((6 + (verticalGridCounter / 2)) * _local4))].player == 1)))))) && ((landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((6 + (verticalGridCounter / 2)) * _local4))].party5 == 0)))){
longWalkArray.push(landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((6 + (verticalGridCounter / 2)) * _local4))].myArrayNumber);
} else {
failLongWalk = true;
};
_local4++;
};
} else {
chan_soundFX = snd_moveunit.play(0, 0, snd_FXVolume);
currentUnitPlayerMoves = _arg1.target.myArrayNumber;
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(partyUnitArray1[currentUnitPlayerMoves], (getChildIndex(escapeMenu) - 1));
playerUpdateMoveText();
};
};
if ((((failLongWalk == false)) && (!((partyUnitArray1[currentUnitPlayerMoves].defensiveUnit == true))))){
TimerLongWalk.start();
};
} else {
if ((((((((((((((((((player1UnderCombat == false)) && ((allowPlayerToMoveUnit == true)))) && ((landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].tileColumn == landTileArray[_arg1.target.partyCurrentTile].tileColumn)))) && ((longWalkSliding == false)))) && ((slidingUnit == false)))) && ((currentTurn == 1)))) && (!((landTileArray[_arg1.target.partyCurrentTile].blockTile == true))))) && (!((landTileArray[_arg1.target.partyCurrentTile].startBuildTile == true))))) && ((partyUnitArray1[currentUnitPlayerMoves].movesLeft > 0)))){
tilesDifference = (landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].tileRow - landTileArray[_arg1.target.partyCurrentTile].tileRow);
failLongWalk = false;
longWalkArray.splice(0);
if ((((tilesDifference > 0)) && ((tilesDifference <= partyUnitArray1[currentUnitPlayerMoves].movesLeft)))){
tempLongwalkOrientation = 0;
longWalkPartyCurrentTile = landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].myArrayNumber;
_local3 = 1;
while (_local3 <= tilesDifference) {
if (landTileArray[longWalkPartyCurrentTile].tileRow == landGridNumberVertical){
longWalkPartyCurrentTile = landTileArray[(longWalkPartyCurrentTile - kingdom1ToKingdom3TileDifference)].myArrayNumber;
} else {
longWalkPartyCurrentTile = landTileArray[(longWalkPartyCurrentTile - 1)].myArrayNumber;
};
if ((((((((((((((((((((wallSlotArray[landTileArray[longWalkPartyCurrentTile].bottomWall].alpha == 0)) || ((wallSlotArray[landTileArray[longWalkPartyCurrentTile].bottomWall].player == 1)))) && ((((((wallSlotArray[landTileArray[longWalkPartyCurrentTile].upWall].alpha == 0)) || ((_local3 == tilesDifference)))) || ((wallSlotArray[landTileArray[longWalkPartyCurrentTile].upWall].player == 1)))))) && ((landTileArray[longWalkPartyCurrentTile].party2 == 0)))) && ((landTileArray[longWalkPartyCurrentTile].party3 == 0)))) && ((landTileArray[longWalkPartyCurrentTile].party4 == 0)))) && ((landTileArray[longWalkPartyCurrentTile].party5 == 0)))) && (!((landTileArray[longWalkPartyCurrentTile].blockTile == true))))) && (((!((landTileArray[longWalkPartyCurrentTile].startBuildTile == true))) || ((landTileArray[longWalkPartyCurrentTile].player == 1)))))) && ((landTileArray[longWalkPartyCurrentTile].party5 == 0)))){
longWalkArray.push(landTileArray[longWalkPartyCurrentTile].myArrayNumber);
} else {
failLongWalk = true;
};
_local3++;
};
} else {
if ((((tilesDifference < 0)) && ((-(tilesDifference) <= partyUnitArray1[currentUnitPlayerMoves].movesLeft)))){
tempLongwalkOrientation = 180;
longWalkPartyCurrentTile = landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].myArrayNumber;
tilesDifference = -(tilesDifference);
_local4 = 1;
while (_local4 <= tilesDifference) {
if (landTileArray[longWalkPartyCurrentTile].tileRow == (landGridNumberVertical - 1)){
longWalkPartyCurrentTile = landTileArray[(longWalkPartyCurrentTile + kingdom1ToKingdom3TileDifference)].myArrayNumber;
} else {
longWalkPartyCurrentTile = landTileArray[(longWalkPartyCurrentTile + 1)].myArrayNumber;
};
if ((((((((((((((((((wallSlotArray[landTileArray[longWalkPartyCurrentTile].upWall].alpha == 0)) || ((wallSlotArray[landTileArray[longWalkPartyCurrentTile].upWall].player == 1)))) && ((((((wallSlotArray[landTileArray[longWalkPartyCurrentTile].bottomWall].alpha == 0)) || ((_local4 == tilesDifference)))) || ((wallSlotArray[landTileArray[longWalkPartyCurrentTile].bottomWall].player == 1)))))) && ((landTileArray[longWalkPartyCurrentTile].party2 == 0)))) && ((landTileArray[longWalkPartyCurrentTile].party3 == 0)))) && ((landTileArray[longWalkPartyCurrentTile].party4 == 0)))) && ((landTileArray[longWalkPartyCurrentTile].party5 == 0)))) && (!((landTileArray[longWalkPartyCurrentTile].blockTile == true))))) && (((!((landTileArray[longWalkPartyCurrentTile].startBuildTile == true))) || ((landTileArray[longWalkPartyCurrentTile].player == 1)))))){
longWalkArray.push(landTileArray[longWalkPartyCurrentTile].myArrayNumber);
} else {
failLongWalk = true;
};
_local4++;
};
} else {
chan_soundFX = snd_moveunit.play(0, 0, snd_FXVolume);
currentUnitPlayerMoves = _arg1.target.myArrayNumber;
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(partyUnitArray1[currentUnitPlayerMoves], (getChildIndex(escapeMenu) - 1));
playerUpdateMoveText();
};
};
if ((((failLongWalk == false)) && (!((partyUnitArray1[currentUnitPlayerMoves].defensiveUnit == true))))){
TimerLongWalk.start();
};
} else {
if ((((((((((((((((player1UnderCombat == false)) && ((longWalkSliding == false)))) && ((slidingUnit == false)))) && ((player1PlaceGathererMode == false)))) && ((player1PlaceWallMode == false)))) && ((currentTurn == 1)))) && ((player1PlaceGathererMode == false)))) && ((player1PlaceWallMode == false)))){
if (landTileArray[_arg1.target.partyCurrentTile].party1 >= 2){
_local5 = 0;
while (_local5 < partyUnitArray1.length) {
if (((((((!((partyUnitArray1[_local5].deadUnit == true))) && (!((partyUnitArray1[_local5].defensiveUnit == true))))) && ((landTileArray[partyUnitArray1[_local5].partyCurrentTile].myArrayNumber == landTileArray[_arg1.target.partyCurrentTile].myArrayNumber)))) && ((partyUnitArray1[_local5].movesLeft >= unitWithMostMoves)))){
currentUnitPlayerMoves = partyUnitArray1[_local5].myArrayNumber;
unitWithMostMoves = partyUnitArray1[_local5].movesLeft;
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(partyUnitArray1[currentUnitPlayerMoves], (getChildIndex(escapeMenu) - 1));
};
_local5++;
};
} else {
if ((((((((((((player1UnderCombat == false)) && ((longWalkSliding == false)))) && ((slidingUnit == false)))) && ((player1PlaceGathererMode == false)))) && ((player1PlaceWallMode == false)))) && ((currentTurn == 1)))){
chan_soundFX = snd_moveunit.play(0, 0, snd_FXVolume);
currentUnitPlayerMoves = _arg1.target.myArrayNumber;
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(partyUnitArray1[currentUnitPlayerMoves], (getChildIndex(escapeMenu) - 1));
};
};
allowPlayerToMoveUnit = true;
playerUpdateMoveText();
};
};
};
};
} else {
if ((((((((((((((player1UnderCombat == false)) && ((longWalkSliding == false)))) && ((slidingUnit == false)))) && ((currentTurn == 1)))) && (!((currentUnitPlayerMoves == _arg1.target.myArrayNumber))))) && ((player1PlaceWallMode == false)))) && ((player1PlaceGathererMode == false)))){
chan_soundFX = snd_moveunit.play(0, 0, snd_FXVolume);
currentUnitPlayerMoves = _arg1.target.myArrayNumber;
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(partyUnitArray1[currentUnitPlayerMoves], (getChildIndex(escapeMenu) - 1));
playerUpdateMoveText();
} else {
if ((((((((((((((slidingUnit == false)) && ((longWalkSliding == false)))) && ((player1UnderCombat == false)))) && ((currentTurn == 1)))) && ((currentUnitPlayerMoves == _arg1.target.myArrayNumber)))) && ((player1PlaceWallMode == false)))) && ((player1PlaceGathererMode == false)))){
allowPlayerToMoveUnit = false;
playerHideMoveText();
};
};
};
};
reactivateGatherer = false;
if ((((landTileArray[_arg1.target.partyCurrentTile].player == 1)) && ((((((((landTileArray[_arg1.target.partyCurrentTile].resource == 1)) || ((landTileArray[_arg1.target.partyCurrentTile].resource == 2)))) || ((landTileArray[_arg1.target.partyCurrentTile].resource == 3)))) || ((landTileArray[_arg1.target.partyCurrentTile].resource == 4)))))){
player1NewGathererTile = _arg1.target.partyCurrentTile;
} else {
player1NewGathererTile = 20;
};
if ((((((((((((((((((((((((slidingUnit == false)) && ((landTileArray[player1NewGathererTile].resource >= 1)))) && (!((player1NewGathererTile == 20))))) && ((p1starterGathererPlaced == true)))) && ((player1PlaceGathererMode == true)))) && ((currentTurn == 1)))) && (!((landTileArray[player1NewGathererTile].hasGatherer == true))))) && ((p1GathererQtt >= 1)))) && ((player1PlacingGatherer == false)))) && ((player1UnderCombat == false)))) && ((player1Raiding == false)))) && ((player1ChoosingDiceRoll == false)))){
chan_soundFX = snd_place_gatherer.play(0, 0, snd_FXVolume);
if (learnAsYouPlayToolTip.currentFrame == 7){
player1PlaceGathererMode = false;
player1PlaceWallMode = false;
constructorModeMouse.visible = false;
Mouse.show();
learnAsYouPlayToolTip.gotoAndStop(8);
animateTooltipWithSlide();
};
_local6 = 0;
while (_local6 < allGathererUnitArray.length) {
if ((((((landTileArray[player1NewGathererTile].myArrayNumber == allGathererUnitArray[_local6].partyCurrentTile)) && ((allGathererUnitArray[_local6].visible == false)))) && ((allGathererUnitArray[_local6].player == currentTurn)))){
reactivateGatherer = true;
allGathererUnitArray[_local6].visible = true;
landTileArray[allGathererUnitArray[_local6].partyCurrentTile].hasGatherer = true;
if (landTileArray[allGathererUnitArray[_local6].partyCurrentTile].resource == 1){
p1Gatherers1 = (p1Gatherers1 + 1);
} else {
if (landTileArray[allGathererUnitArray[_local6].partyCurrentTile].resource == 2){
p1Gatherers2 = (p1Gatherers2 + 1);
} else {
if (landTileArray[allGathererUnitArray[_local6].partyCurrentTile].resource == 3){
p1Gatherers3 = (p1Gatherers3 + 1);
} else {
if (landTileArray[allGathererUnitArray[_local6].partyCurrentTile].resource == 4){
p1Gatherers4 = (p1Gatherers4 + 1);
};
};
};
};
p1GathererQtt = (p1GathererQtt - 1);
gathererTooltip.visible = false;
if (landTileArray[allGathererUnitArray[_local6].partyCurrentTile].resource == 1){
producingResourceMessage.gotoAndStop(1);
} else {
if (landTileArray[allGathererUnitArray[_local6].partyCurrentTile].resource == 2){
producingResourceMessage.gotoAndStop(2);
} else {
if (landTileArray[allGathererUnitArray[_local6].partyCurrentTile].resource == 3){
producingResourceMessage.gotoAndStop(3);
} else {
if (landTileArray[allGathererUnitArray[_local6].partyCurrentTile].resource == 4){
producingResourceMessage.gotoAndStop(4);
};
};
};
};
producingResourceMessage.x = landTileArray[allGathererUnitArray[_local6].partyCurrentTile].x;
producingResourceMessage.y = landTileArray[allGathererUnitArray[_local6].partyCurrentTile].y;
adjustProducingMessage();
riseTo2 = 0;
TimerShowProducingResource.start();
break;
};
_local6++;
};
if (reactivateGatherer == false){
player1PlacingGatherer = true;
p1GathererQtt = (p1GathererQtt - 1);
landTileArray[player1NewGathererTile].hasGatherer = true;
gathererUnit = new gathererUnitLIB();
gathererUnit.x = landTileArray[player1NewGathererTile].x;
gathererUnit.y = landTileArray[player1NewGathererTile].y;
gathererUnit.width = gathererUnitWidth;
gathererUnit.height = gathererUnitHeight;
gathererUnitArray.push(gathererUnit);
gathererUnit.player = currentTurn;
gathererUnit.partyCurrentTile = landTileArray[player1NewGathererTile].myArrayNumber;
gathererUnit.addEventListener(MouseEvent.MOUSE_DOWN, playerMoveToGathererUnit);
gathererUnit.mouseEnabled = false;
allGathererUnitArray.push(gathererUnit);
if (landTileArray[player1NewGathererTile].resource == 1){
gathererUnit.gotoAndStop(1);
p1Gatherers1 = (p1Gatherers1 + 1);
} else {
if (landTileArray[player1NewGathererTile].resource == 2){
gathererUnit.gotoAndStop(2);
p1Gatherers2 = (p1Gatherers2 + 1);
} else {
if (landTileArray[player1NewGathererTile].resource == 3){
gathererUnit.gotoAndStop(3);
p1Gatherers3 = (p1Gatherers3 + 1);
} else {
if (landTileArray[player1NewGathererTile].resource == 4){
gathererUnit.gotoAndStop(4);
p1Gatherers4 = (p1Gatherers4 + 1);
};
};
};
};
addChild(gathererUnit);
gathererTooltip.visible = false;
if (landTileArray[player1NewGathererTile].resource == 1){
producingResourceMessage.gotoAndStop(1);
} else {
if (landTileArray[player1NewGathererTile].resource == 2){
producingResourceMessage.gotoAndStop(2);
} else {
if (landTileArray[player1NewGathererTile].resource == 3){
producingResourceMessage.gotoAndStop(3);
} else {
if (landTileArray[player1NewGathererTile].resource == 4){
producingResourceMessage.gotoAndStop(4);
};
};
};
};
producingResourceMessage.x = landTileArray[player1NewGathererTile].x;
producingResourceMessage.y = landTileArray[player1NewGathererTile].y;
adjustProducingMessage();
riseTo2 = 0;
TimerShowProducingResource.start();
player1PlacingGatherer = false;
};
updateGameBars();
};
};
gameOverCheck();
}
public function endPlayerTurn(_arg1:MouseEvent):void{
endPlayerTurnCall();
}
public function endPlayerTurnCall():void{
if ((((((((((((((((((((((learningWhilePlaying == false)) || ((learnAsYouPlayToolTip.currentFrame >= 7)))) && ((gameOver == false)))) && ((slidingUnit == false)))) && ((currentTurn == 1)))) && ((p1starterBuildingPlaced == true)))) && ((p1starterGathererPlaced == true)))) && ((player1ChoosingDiceRoll == false)))) && ((player1PlacingGatherer == false)))) && ((player1UnderCombat == false)))) && ((player1Raiding == false)))){
chan_soundFX = snd_evolution.play(0, 0, snd_FXVolume);
statusBar.visible = false;
mindUpgradeDisplay.visible = false;
cancelConstructionMode();
allowPlayerToMoveUnit = false;
playerHideMoveText();
reaversDontMove = false;
playerAssign();
};
}
public function goToLetheSite(_arg1:MouseEvent):void{
navigateToURL(new URLRequest("http://www.lethegames.com"));
}
public function goToSponsorSite(_arg1:MouseEvent):void{
navigateToURL(new URLRequest("http://www.gameshed.com/?utm_source=sponsorship&utm_medium=branded_game&utm_term=humans_adb&utm_campaign=humans_adb_game"));
}
public function showCredits(_arg1:MouseEvent):void{
monitor.monitorTextContainer.monitorText.text = "Game Design\nR. Mac-Donald\n\nGraphics\nSamize\n\nAudio\nCaio Lopez";
if (!monitor_status){
monitor.gotoAndPlay("_on");
monitor_status = 1;
monitor.addEventListener(MouseEvent.MOUSE_OVER, overMouse);
snd_monitorSound.play(0, 0, snd_MonitorVolume);
};
}
public function playerInspectsRace1(_arg1:MouseEvent):void{
monitor.monitorTextContainer.monitorText.text = "Keepers (Robo erectus)\n\n Keepers are elegant, beautiful robots that despise war and live to preserve their world.\n\n+1 Resource activator\nLower cost to produce activators\nHigher cost to increase Combat";
}
public function playerInspectsRace2(_arg1:MouseEvent):void{
monitor.monitorTextContainer.monitorText.text = "Hiveminds (Arthro pods)\n\nResembling insects, these creatures love to construct.\n\n+1 wall\nLower cost to build walls.";
}
public function playerInspectsRace3(_arg1:MouseEvent):void{
monitor.monitorTextContainer.monitorText.text = "Scibots ( Robo ergaster )\n\nScibots value culture and science. They like to collect old human books of literature and knowledge.\n\n+10 Research\n+1 Research per turn\nLower cost for Evolution cards. ";
}
public function playerInspectsRace4(_arg1:MouseEvent):void{
monitor.monitorTextContainer.monitorText.text = "War Machines ( Neanderdigithal )\n\nBuilt with the sole purpose of combat, these robots rely on their destructive force to survive.\n\n+1 to Combat\nLower cost to raise Combat\nHigher cost for activators/walls";
}
public function playerInspectsOut(_arg1:MouseEvent):void{
monitor.monitorTextContainer.monitorText.text = "";
}
public function playerSelectsRace1(_arg1:MouseEvent):void{
player1Race = "keeper";
}
public function playerSelectsRace2(_arg1:MouseEvent):void{
player1Race = "builder";
}
public function playerSelectsRace3(_arg1:MouseEvent):void{
player1Race = "expander";
}
public function playerSelectsRace4(_arg1:MouseEvent):void{
player1Race = "raider";
}
public function resumeGame(_arg1:MouseEvent):void{
escapeMenu.visible = false;
tutoBoxMainIntro.play();
if (runningFullScreen == true){
stage.displayState = StageDisplayState.FULL_SCREEN;
};
}
public function exitGame(_arg1:MouseEvent):void{
var _local2:uint;
chan_theme.stop();
TimerTutorialAfterIntro.stop();
tutoBoxMainIntro.stop();
tutoBoxMainIntro.visible = false;
TimerAnimateTutorial.stop();
TimerMoveAttacker.stop();
TimerAnimatePieces.stop();
TimerAnimatePiecesRecursion.stop();
TimerNewTurnDelay.stop();
TimerDiceRollPlaceChoiceDelay.stop();
TimerDiceRollGetDelay.stop();
TimerPartyBattleEnd.stop();
TimerDelayShowNPCUpgrade.stop();
TimerSlidePartyUnit.stop();
TimerDelayPlaceStarterBuilding.stop();
TimerDelayPlaceStarterBuildingEnd.stop();
TimerDelayPlaceStarterGatherer.stop();
TimerDelayPlaceStarterGathererEnd.stop();
learnAsYouPlayToolTip.visible = false;
hideTutorialMiniBoxes();
btn_chooseDiceRoll.visible = false;
tokenRollChoice.visible = false;
dice2Graphic.visible = false;
dice1Graphic.visible = false;
play_2pw.visible = true;
play_2pf.visible = true;
play_4pf.visible = true;
learningWhilePlaying = false;
credits.visible = true;
playMoreGames.visible = true;
letheGames.visible = true;
btn_easy.visible = true;
btn_norm.visible = true;
btn_hard.visible = true;
_local2 = 0;
_local2 = 0;
while (_local2 < landTileArray.length) {
if (landTileArray[_local2].parent != null){
removeChild(landTileArray[_local2]);
};
_local2++;
};
_local2 = 0;
while (_local2 < wallSlotArray.length) {
if (wallSlotArray[_local2].parent != null){
removeChild(wallSlotArray[_local2]);
};
_local2++;
};
_local2 = 0;
while (_local2 < partyUnitArray.length) {
if (partyUnitArray[_local2].parent != null){
removeChild(partyUnitArray[_local2]);
};
_local2++;
};
_local2 = 0;
while (_local2 < partyUnitArray1.length) {
if (partyUnitArray1[_local2].parent != null){
removeChild(partyUnitArray1[_local2]);
};
_local2++;
};
_local2 = 0;
while (_local2 < partyUnitArray2.length) {
if (partyUnitArray2[_local2].parent != null){
removeChild(partyUnitArray2[_local2]);
};
_local2++;
};
_local2 = 0;
while (_local2 < partyUnitArray3.length) {
if (partyUnitArray3[_local2].parent != null){
removeChild(partyUnitArray3[_local2]);
};
_local2++;
};
_local2 = 0;
while (_local2 < partyUnitArray4.length) {
if (partyUnitArray4[_local2].parent != null){
removeChild(partyUnitArray4[_local2]);
};
_local2++;
};
_local2 = 0;
while (_local2 < partyUnitArray5.length) {
if (partyUnitArray5[_local2].parent != null){
removeChild(partyUnitArray5[_local2]);
};
_local2++;
};
_local2 = 0;
while (_local2 < starterBuildingArray.length) {
if (starterBuildingArray[_local2].parent != null){
removeChild(starterBuildingArray[_local2]);
};
_local2++;
};
_local2 = 0;
while (_local2 < allGathererUnitArray.length) {
if (allGathererUnitArray[_local2].parent != null){
removeChild(allGathererUnitArray[_local2]);
};
_local2++;
};
gameOver = true;
gameInitialSetup();
}
public function wallTooltipDisplay(_arg1:MouseEvent):void{
if ((((((player1PlaceWallMode == true)) && ((gameOver == false)))) && ((((learningWhilePlaying == false)) || ((learnAsYouPlayToolTip.currentFrame >= 8)))))){
wallToolTip.x = _arg1.target.x;
wallToolTip.y = _arg1.target.y;
wallToolTip.rotation = _arg1.target.rotation;
if (wallToolTip.currentFrame < 3){
if (_arg1.target.alpha == 0){
wallToolTip.gotoAndStop(1);
wallToolTip.alpha = 0.5;
wallToolTipMsgBox.wallToolTipMsg.text = "";
} else {
if (_arg1.target.alpha == 1){
wallToolTip.gotoAndStop(2);
wallToolTip.alpha = 1;
wallToolTipMsgBox.wallToolTipMsg.text = "";
};
};
};
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(wallToolTip, (getChildIndex(escapeMenu) - 1));
setChildIndex(wallToolTipMsgBox, (getChildIndex(escapeMenu) - 1));
wallToolTipMsgBox.x = wallToolTip.x;
wallToolTipMsgBox.y = (wallToolTip.y - 50);
if (_arg1.target.alpha == 0){
wallToolTip.visible = true;
};
};
}
public function hideWallTooltipDisplay(_arg1:MouseEvent):void{
wallToolTip.visible = false;
wallToolTipMsgBox.visible = false;
wallToolTip.gotoAndStop(1);
}
public function traceWallSlot(_arg1:MouseEvent):void{
if ((((((((((((((((((learningWhilePlaying == false)) || ((learnAsYouPlayToolTip.currentFrame >= 8)))) && ((gameOver == false)))) && ((p1WallQtt >= 1)))) && ((player1PlaceWallMode == true)))) && ((p1starterGathererPlaced == true)))) && ((currentTurn == 1)))) && ((_arg1.target.allowPlayerBuild == true)))) && (!((_arg1.target.alpha == 1))))){
currentWall = _arg1.target.myArrayNumber;
wallToBePlaced = _arg1.target.myArrayNumber;
trace(("my wall array number" + _arg1.target.myArrayNumber));
traceWallSlotBegin();
} else {
if ((((((((((((((((((learningWhilePlaying == false)) || ((learnAsYouPlayToolTip.currentFrame >= 8)))) && ((gameOver == false)))) && ((p1WallQtt <= 0)))) && ((player1PlaceWallMode == true)))) && ((p1starterGathererPlaced == true)))) && ((currentTurn == 1)))) && ((_arg1.target.allowPlayerBuild == true)))) && (!((_arg1.target.alpha == 1))))){
wallToolTip.x = _arg1.target.x;
wallToolTip.y = _arg1.target.y;
wallToolTip.rotation = _arg1.target.rotation;
wallToolTip.alpha = 0.5;
wallToolTipMsgBox.wallToolTipMsg.text = "No walls left";
wallToolTipMsgBox.insideWallToolTipMsgBox.width = 104;
wallToolTipMsgBox.visible = true;
wallToolTip.gotoAndStop(4);
};
};
}
public function traceWallSlotBegin():void{
var _local1:uint;
var _local2:uint;
var _local3:uint;
var _local4:uint;
var _local5:uint;
wallSlotArray[wallToBePlaced].alpha = 1;
numberOfWallSteps = 0;
allPathsChecked = false;
failedWallInsertion = false;
while (allPathsChecked == false) {
if (wallSlotArray[currentWall].wallChecked != true){
wallCheckPointArray.push(wallSlotArray[currentWall]);
wallSlotArray[currentWall].wallChecked = true;
};
if (wallSlotArray[currentWall].myArrayNumber == wallSlotArray[wallToBePlaced].myArrayNumber){
numberOfWallSteps = 0;
};
if (numberOfWallSteps < 4){
wallSlotArray[wallToBePlaced].wallChecked = true;
};
if (numberOfWallSteps >= 4){
if (wallCheckPointArray.length > 4){
wallSlotArray[wallToBePlaced].wallChecked = false;
};
};
if (wallSlotArray[currentWall].rotation == 0){
if ((((((wallSlotArray[(currentWall - 2)].alpha == 1)) && (!((wallSlotArray[(currentWall - 2)].wallChecked == true))))) && (!((wallSlotArray[currentWall].topEdge == true))))){
if (wallSlotArray[(currentWall - 2)].myArrayNumber == wallSlotArray[wallToBePlaced].myArrayNumber){
wallSlotArray[wallToBePlaced].alpha = 0;
wallSlotArray[wallToBePlaced].closeCase = true;
};
currentWall = (currentWall - 2);
numberOfWallSteps = (numberOfWallSteps + 1);
} else {
if ((((((((wallSlotArray[(currentWall - 1)].alpha == 1)) && (!((wallSlotArray[(currentWall - 1)].wallChecked == true))))) && (!((wallSlotArray[currentWall].rightEdge == true))))) && (!((wallSlotArray[currentWall].rightCorner == true))))){
if (wallSlotArray[(currentWall - 1)].myArrayNumber == wallSlotArray[wallToBePlaced].myArrayNumber){
wallSlotArray[wallToBePlaced].alpha = 0;
wallSlotArray[wallToBePlaced].closeCase = true;
};
currentWall = (currentWall - 1);
numberOfWallSteps = (numberOfWallSteps + 1);
} else {
if ((((((((wallSlotArray[((currentWall - 14) - verticalGridCounter)].alpha == 1)) && (!((wallSlotArray[((currentWall - 14) - verticalGridCounter)].wallChecked == true))))) && (!((wallSlotArray[currentWall].leftEdge == true))))) && (!((wallSlotArray[currentWall].leftCorner == true))))){
if (wallSlotArray[((currentWall - 14) - verticalGridCounter)].myArrayNumber == wallSlotArray[wallToBePlaced].myArrayNumber){
wallSlotArray[wallToBePlaced].alpha = 0;
wallSlotArray[wallToBePlaced].closeCase = true;
};
currentWall = ((currentWall - 14) - verticalGridCounter);
numberOfWallSteps = (numberOfWallSteps + 1);
} else {
if ((((((wallSlotArray[(currentWall + 2)].alpha == 1)) && (!((wallSlotArray[(currentWall + 2)].wallChecked == true))))) && (!((wallSlotArray[currentWall].bottomEdge == true))))){
if (wallSlotArray[(currentWall + 2)].myArrayNumber == wallSlotArray[wallToBePlaced].myArrayNumber){
wallSlotArray[wallToBePlaced].alpha = 0;
wallSlotArray[wallToBePlaced].closeCase = true;
};
currentWall = (currentWall + 2);
numberOfWallSteps = (numberOfWallSteps + 1);
} else {
if ((((((((wallSlotArray[(currentWall + 1)].alpha == 1)) && (!((wallSlotArray[(currentWall + 1)].wallChecked == true))))) && (!((wallSlotArray[currentWall].rightEdge == true))))) && (!((wallSlotArray[currentWall].rightCorner == true))))){
if (wallSlotArray[(currentWall + 1)].myArrayNumber == wallSlotArray[wallToBePlaced].myArrayNumber){
wallSlotArray[wallToBePlaced].alpha = 0;
wallSlotArray[wallToBePlaced].closeCase = true;
};
currentWall = (currentWall + 1);
numberOfWallSteps = (numberOfWallSteps + 1);
} else {
if ((((((((wallSlotArray[((currentWall - 12) - verticalGridCounter)].alpha == 1)) && (!((wallSlotArray[((currentWall - 12) - verticalGridCounter)].wallChecked == true))))) && (!((wallSlotArray[currentWall].leftEdge == true))))) && (!((wallSlotArray[currentWall].leftCorner == true))))){
if (wallSlotArray[((currentWall - 12) - verticalGridCounter)].myArrayNumber == wallSlotArray[wallToBePlaced].myArrayNumber){
wallSlotArray[wallToBePlaced].alpha = 0;
wallSlotArray[wallToBePlaced].closeCase = true;
};
currentWall = ((currentWall - 12) - verticalGridCounter);
numberOfWallSteps = (numberOfWallSteps + 1);
} else {
if (wallCheckPointArray.length > 1){
wallCheckPointArray.splice((wallCheckPointArray.length - 1), 1);
currentWall = wallCheckPointArray[(wallCheckPointArray.length - 1)].myArrayNumber;
if (numberOfWallSteps > 0){
numberOfWallSteps = (numberOfWallSteps - 1);
};
} else {
allPathsChecked = true;
_local1 = 0;
while (_local1 < wallSlotArray.length) {
wallSlotArray[_local1].wallChecked = false;
_local1++;
};
_local2 = 0;
while (_local2 < wallCheckPointArray.length) {
wallCheckPointArray.splice(_local2, 1);
_local2++;
};
};
};
};
};
};
};
};
} else {
if (wallSlotArray[currentWall].rotation == 90){
if ((((((wallSlotArray[((currentWall + 12) + verticalGridCounter)].alpha == 1)) && (!((wallSlotArray[((currentWall + 12) + verticalGridCounter)].wallChecked == true))))) && (!((wallSlotArray[currentWall].topCorner == true))))){
if (wallSlotArray[((currentWall + 12) + verticalGridCounter)].myArrayNumber == wallSlotArray[wallToBePlaced].myArrayNumber){
wallSlotArray[wallToBePlaced].alpha = 0;
wallSlotArray[wallToBePlaced].closeCase = true;
};
currentWall = ((currentWall + 12) + verticalGridCounter);
numberOfWallSteps = (numberOfWallSteps + 1);
} else {
if ((((((wallSlotArray[((currentWall + 13) + verticalGridCounter)].alpha == 1)) && (!((wallSlotArray[((currentWall + 13) + verticalGridCounter)].wallChecked == true))))) && (!((wallSlotArray[currentWall].rightEdge == true))))){
if (wallSlotArray[((currentWall + 13) + verticalGridCounter)].myArrayNumber == wallSlotArray[wallToBePlaced].myArrayNumber){
wallSlotArray[wallToBePlaced].alpha = 0;
wallSlotArray[wallToBePlaced].closeCase = true;
};
currentWall = ((currentWall + 13) + verticalGridCounter);
numberOfWallSteps = (numberOfWallSteps + 1);
} else {
if ((((((wallSlotArray[((currentWall + 14) + verticalGridCounter)].alpha == 1)) && (!((wallSlotArray[((currentWall + 14) + verticalGridCounter)].wallChecked == true))))) && (!((wallSlotArray[currentWall].bottomCorner == true))))){
if (wallSlotArray[((currentWall + 14) + verticalGridCounter)].myArrayNumber == wallSlotArray[wallToBePlaced].myArrayNumber){
wallSlotArray[wallToBePlaced].alpha = 0;
wallSlotArray[wallToBePlaced].closeCase = true;
};
currentWall = ((currentWall + 14) + verticalGridCounter);
numberOfWallSteps = (numberOfWallSteps + 1);
} else {
if ((((((wallSlotArray[(currentWall - 1)].alpha == 1)) && (!((wallSlotArray[(currentWall - 1)].wallChecked == true))))) && (!((wallSlotArray[currentWall].topCorner == true))))){
if (wallSlotArray[(currentWall - 1)].myArrayNumber == wallSlotArray[wallToBePlaced].myArrayNumber){
wallSlotArray[wallToBePlaced].alpha = 0;
wallSlotArray[wallToBePlaced].closeCase = true;
};
currentWall = (currentWall - 1);
numberOfWallSteps = (numberOfWallSteps + 1);
} else {
if ((((((wallSlotArray[((currentWall - 13) - verticalGridCounter)].alpha == 1)) && (!((wallSlotArray[((currentWall - 13) - verticalGridCounter)].wallChecked == true))))) && (!((wallSlotArray[currentWall].leftEdge == true))))){
if (wallSlotArray[((currentWall - 13) - verticalGridCounter)].myArrayNumber == wallSlotArray[wallToBePlaced].myArrayNumber){
wallSlotArray[wallToBePlaced].alpha = 0;
wallSlotArray[wallToBePlaced].closeCase = true;
};
currentWall = ((currentWall - 13) - verticalGridCounter);
numberOfWallSteps = (numberOfWallSteps + 1);
} else {
if ((((((wallSlotArray[(currentWall + 1)].alpha == 1)) && (!((wallSlotArray[(currentWall + 1)].wallChecked == true))))) && (!((wallSlotArray[currentWall].bottomCorner == true))))){
if (wallSlotArray[(currentWall + 1)].myArrayNumber == wallSlotArray[wallToBePlaced].myArrayNumber){
wallSlotArray[wallToBePlaced].alpha = 0;
wallSlotArray[wallToBePlaced].closeCase = true;
};
currentWall = (currentWall + 1);
numberOfWallSteps = (numberOfWallSteps + 1);
} else {
if (wallCheckPointArray.length > 1){
wallCheckPointArray.splice((wallCheckPointArray.length - 1), 1);
currentWall = wallCheckPointArray[(wallCheckPointArray.length - 1)].myArrayNumber;
if (numberOfWallSteps > 0){
numberOfWallSteps = (numberOfWallSteps - 1);
};
} else {
allPathsChecked = true;
_local3 = 0;
while (_local3 < wallSlotArray.length) {
wallSlotArray[_local3].wallChecked = false;
_local3++;
};
_local4 = 0;
while (_local4 < wallCheckPointArray.length) {
wallCheckPointArray.splice(_local4, 1);
_local4++;
};
};
};
};
};
};
};
};
};
};
};
if (wallSlotArray[currentWall].rotation == 0){
exceptionCloseCheckWall = wallSlotArray[(currentWall - 1)].myArrayNumber;
if ((((((wallSlotArray[(currentWall - 1)].alpha == 1)) && ((wallSlotArray[(currentWall + 1)].alpha == 1)))) && ((wallSlotArray[((exceptionCloseCheckWall + 14) + verticalGridCounter)].alpha == 1)))){
wallSlotArray[wallToBePlaced].alpha = 0;
wallSlotArray[wallToBePlaced].closeCase = true;
};
exceptionCloseCheckWall = wallSlotArray[((currentWall - 14) - verticalGridCounter)].myArrayNumber;
if ((((((wallSlotArray[((currentWall - 14) - verticalGridCounter)].alpha == 1)) && ((wallSlotArray[((currentWall - 12) - verticalGridCounter)].alpha == 1)))) && ((wallSlotArray[(exceptionCloseCheckWall + 1)].alpha == 1)))){
wallSlotArray[wallToBePlaced].alpha = 0;
wallSlotArray[wallToBePlaced].closeCase = true;
};
} else {
if (wallSlotArray[currentWall].rotation == 90){
exceptionCloseCheckWall = wallSlotArray[((currentWall + 12) + verticalGridCounter)].myArrayNumber;
if ((((((wallSlotArray[((currentWall + 12) + verticalGridCounter)].alpha == 1)) && ((wallSlotArray[(currentWall - 1)].alpha == 1)))) && ((wallSlotArray[((exceptionCloseCheckWall - 14) - verticalGridCounter)].alpha == 1)))){
wallSlotArray[wallToBePlaced].alpha = 0;
wallSlotArray[wallToBePlaced].closeCase = true;
};
exceptionCloseCheckWall = wallSlotArray[((currentWall + 14) + verticalGridCounter)].myArrayNumber;
if ((((((wallSlotArray[((currentWall + 14) + verticalGridCounter)].alpha == 1)) && ((wallSlotArray[(currentWall + 1)].alpha == 1)))) && ((wallSlotArray[((exceptionCloseCheckWall - 12) - verticalGridCounter)].alpha == 1)))){
wallSlotArray[wallToBePlaced].alpha = 0;
wallSlotArray[wallToBePlaced].closeCase = true;
};
};
};
if (wallSlotArray[wallToBePlaced].alpha == 1){
chan_soundFX = snd_placewall.play(0, 0, snd_FXVolume);
if (currentTurn != 1){
landTileArray[protectResourceCheck].protectedOnce = true;
};
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(constructorModeMouse, (numChildren - 1));
setChildIndex(wallSlotArray[wallToBePlaced], (getChildIndex(constructorModeMouse) - 1));
if (currentTurn == 1){
p1WallQtt = (p1WallQtt - 1);
} else {
if (currentTurn == 2){
wallQtt = (wallQtt - 1);
p2WallQtt = (p2WallQtt - 1);
} else {
if (currentTurn == 3){
wallQtt = (wallQtt - 1);
p3WallQtt = (p3WallQtt - 1);
} else {
if (currentTurn == 4){
wallQtt = (wallQtt - 1);
p4WallQtt = (p4WallQtt - 1);
};
};
};
};
if ((((learnAsYouPlayToolTip.currentFrame == 8)) && ((p1WallQtt == 0)))){
learnAsYouPlayToolTip.gotoAndStop(9);
animateTooltipWithSlide();
};
updateGameBars();
_local5 = 0;
while (_local5 < allGathererUnitArray.length) {
setChildIndex(learnAsYouPlayToolTip, (getChildIndex(escapeMenu) - 1));
setChildIndex(tutoMiniBox4, (getChildIndex(escapeMenu) - 1));
setChildIndex(tutoMiniBox5, (getChildIndex(escapeMenu) - 1));
setChildIndex(tutoMiniBox7, (getChildIndex(escapeMenu) - 1));
setChildIndex(tutoMiniBox72, (getChildIndex(escapeMenu) - 1));
setChildIndex(tutoMiniBox8, (getChildIndex(escapeMenu) - 1));
setChildIndex(tutoMiniBox82, (getChildIndex(escapeMenu) - 1));
setChildIndex(tutoMiniBox9, (getChildIndex(escapeMenu) - 1));
setChildIndex(tutoMiniBox10, (getChildIndex(escapeMenu) - 1));
setChildIndex(tutoMiniBox11, (getChildIndex(escapeMenu) - 1));
setChildIndex(btn_chooseCivExpansion, (getChildIndex(learnAsYouPlayToolTip) - 1));
setChildIndex(allGathererUnitArray[_local5], (getChildIndex(btn_chooseCivExpansion) - 1));
_local5++;
};
} else {
failedWallInsertion = true;
if (currentTurn == 1){
wallToolTip.x = wallSlotArray[wallToBePlaced].x;
wallToolTip.y = wallSlotArray[wallToBePlaced].y;
wallToolTip.rotation = wallSlotArray[wallToBePlaced].rotation;
wallToolTip.alpha = 0.5;
wallToolTipMsgBox.wallToolTipMsg.text = "Block detected";
wallToolTipMsgBox.insideWallToolTipMsgBox.width = 105;
wallToolTip.gotoAndStop(3);
wallToolTipMsgBox.visible = true;
};
};
}
public function playerSpawnsUnit(_arg1:MouseEvent):void{
if (gameOver == false){
player1PlaceGathererMode = false;
player1PlaceWallMode = false;
constructorModeMouse.visible = false;
Mouse.show();
if ((((((((((((((((player1UnderCombat == false)) && ((slidingUnit == false)))) && ((player1PlaceGathererMode == false)))) && ((player1PlaceWallMode == false)))) && ((allowPlayerToMoveUnit == true)))) && ((currentTurn == 1)))) && ((partyUnitArray1[currentUnitPlayerMoves].movesLeft > 0)))) && (((((((((((((((landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].tileRow + 1) == landTileArray[p1StarterBuildingTile].tileRow)) && ((landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].tileColumn == landTileArray[p1StarterBuildingTile].tileColumn)))) || (((((landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].tileRow - 1) == landTileArray[p1StarterBuildingTile].tileRow)) && ((landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].tileColumn == landTileArray[p1StarterBuildingTile].tileColumn)))))) || ((partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile == landTileArray[(landTileArray[p1StarterBuildingTile].myArrayNumber + 1)].myArrayNumber)))) || ((partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile == landTileArray[(landTileArray[p1StarterBuildingTile].myArrayNumber - 1)].myArrayNumber)))) || ((partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile == landTileArray[((landTileArray[p1StarterBuildingTile].myArrayNumber + 6) + (verticalGridCounter / 2))].myArrayNumber)))) || ((partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile == landTileArray[((landTileArray[p1StarterBuildingTile].myArrayNumber - 6) - (verticalGridCounter / 2))].myArrayNumber)))))){
if (((((((((((landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].myArrayNumber - 1) == landTileArray[p1StarterBuildingTile].myArrayNumber)) && ((((wallSlotArray[landTileArray[p1StarterBuildingTile].bottomWall].alpha == 0)) || ((wallSlotArray[landTileArray[p1StarterBuildingTile].bottomWall].player == currentTurn)))))) || (((((landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].myArrayNumber + 1) == landTileArray[p1StarterBuildingTile].myArrayNumber)) && ((((wallSlotArray[landTileArray[p1StarterBuildingTile].upWall].alpha == 0)) || ((wallSlotArray[landTileArray[p1StarterBuildingTile].upWall].player == currentTurn)))))))) || ((((((landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].myArrayNumber + 6) + (verticalGridCounter / 2)) == landTileArray[p1StarterBuildingTile].myArrayNumber)) && ((((wallSlotArray[landTileArray[p1StarterBuildingTile].leftWall].alpha == 0)) || ((wallSlotArray[landTileArray[p1StarterBuildingTile].leftWall].player == currentTurn)))))))) || ((((((landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].myArrayNumber - 6) - (verticalGridCounter / 2)) == landTileArray[p1StarterBuildingTile].myArrayNumber)) && ((((wallSlotArray[landTileArray[p1StarterBuildingTile].rightWall].alpha == 0)) || ((wallSlotArray[landTileArray[p1StarterBuildingTile].rightWall].player == currentTurn)))))))){
if (partyUnitArray1[currentUnitPlayerMoves].defensiveUnit != true){
turnPartyLedOff();
if ((landTileArray[p1StarterBuildingTile].myArrayNumber + 1) == partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile){
partyUnitArray1[currentUnitPlayerMoves].rotation = 0;
};
if ((landTileArray[p1StarterBuildingTile].myArrayNumber - 1) == partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile){
partyUnitArray1[currentUnitPlayerMoves].rotation = 180;
};
if (((landTileArray[p1StarterBuildingTile].myArrayNumber - 6) - (verticalGridCounter / 2)) == partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile){
partyUnitArray1[currentUnitPlayerMoves].rotation = 90;
};
if (((landTileArray[p1StarterBuildingTile].myArrayNumber + 6) + (verticalGridCounter / 2)) == partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile){
partyUnitArray1[currentUnitPlayerMoves].rotation = -90;
};
landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].party1 = (landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].party1 - 1);
partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile = landTileArray[p1StarterBuildingTile].myArrayNumber;
landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].party1 = (landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].party1 + 1);
partyUnitArray1[currentUnitPlayerMoves].movesLeft = (partyUnitArray1[currentUnitPlayerMoves].movesLeft - 1);
playerUpdateMoveText();
firstMoveRight = false;
firstMoveLeft = false;
firstMoveUp = false;
firstMoveDown = false;
slideToX = landTileArray[p1StarterBuildingTile].x;
slideToY = landTileArray[p1StarterBuildingTile].y;
turnPartyLedOn();
TimerSlidePartyUnit.start();
};
};
} else {
if ((((player1UnderCombat == false)) && ((slidingUnit == false)))){
spawnUnitEnd();
};
};
};
}
public function spawnUnitEnd():void{
if (gameOver == false){
if ((((((((((((((learningWhilePlaying == false)) || ((learnAsYouPlayToolTip.currentFrame >= 5)))) && ((slidingUnit == false)))) && ((currentTurn == 1)))) && ((p1UnitQtt >= 1)))) && ((p1starterGathererPlaced == true)))) && ((player1ChoosingDiceRoll == false)))){
if ((((allowPlayerToMoveUnit == false)) || ((((allowPlayerToMoveUnit == true)) && (!((landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].startBuildTile == true))))))){
statusBar.visible = false;
if (learnAsYouPlayToolTip.currentFrame == 5){
learnAsYouPlayToolTip.gotoAndStop(6);
animateTooltipWithSlide();
};
p1UnitQtt = (p1UnitQtt - 1);
partyUnit = new partyUnitLIB();
partyUnit.x = landTileArray[p1StarterBuildingTile].x;
partyUnit.y = landTileArray[p1StarterBuildingTile].y;
partyUnit.partyCurrentTile = landTileArray[p1StarterBuildingTile].myArrayNumber;
partyUnit.width = partyUnitWidth;
partyUnit.height = partyUnitHeight;
partyUnit.addEventListener(MouseEvent.MOUSE_DOWN, playerMovesUnit);
partyUnit.addEventListener(MouseEvent.MOUSE_OVER, longWalkInterfaceParty);
partyUnit.addEventListener(MouseEvent.MOUSE_OUT, longWalkInterfaceHide);
partyUnit.player = currentTurn;
partyUnit.gotoAndStop(1);
partyUnitArray1.push(partyUnit);
partyUnit.myArrayNumber = (partyUnitArray1.length - 1);
landTileArray[p1StarterBuildingTile].party1 = (landTileArray[p1StarterBuildingTile].party1 + 1);
currentUnitPlayerMoves = partyUnit.myArrayNumber;
allowPlayerToMoveUnit = true;
playerUpdateMoveText();
chan_soundFX = snd_moveunit.play(0, 0, snd_FXVolume);
partyUnit.movesLeft = (partyUnitMaxMoves + p1UpgradeSpeed);
if (player1Race == "keeper"){
partyUnit.gotoAndStop(1);
} else {
if (player1Race == "builder"){
partyUnit.gotoAndStop(4);
} else {
if (player1Race == "expander"){
partyUnit.gotoAndStop(7);
} else {
if (player1Race == "raider"){
partyUnit.gotoAndStop(10);
};
};
};
};
addChild(partyUnit);
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(partyUnit, (getChildIndex(escapeMenu) - 1));
playerUpdateMoveText();
updateGameBars();
};
};
};
}
public function adjustProducingMessage():void{
if ((producingResourceMessage.x + (producingResourceMessage.width / 2)) > stageWidthLimitBeacon.x){
producingResourceMessage.x = (producingResourceMessage.x - ((producingResourceMessage.x + (producingResourceMessage.width / 2)) - stageWidthLimitBeacon.x));
} else {
if ((producingResourceMessage.x - (producingResourceMessage.width / 2)) < 0){
producingResourceMessage.x = (producingResourceMessage.x + -((producingResourceMessage.x - (producingResourceMessage.width / 2))));
};
};
}
public function traceTile(_arg1:MouseEvent):void{
var _local2:uint;
var _local3:uint;
var _local4:uint;
if (gameOver == false){
trace(_arg1.target.myArrayNumber);
trace(("has assigned unit: " + _arg1.target.partyAssignedDefensive));
trace(("has current defending unit: " + _arg1.target.defensiveUnit));
trace(("number of party 2 on this tile: " + _arg1.target.party2));
trace(("number of party 1 on this tile: " + _arg1.target.party1));
if ((((((((((((((((((((currentTurn == 1)) && ((learnAsYouPlayToolTip.currentFrame == 2)))) && ((p1starterBuildingPlaced == false)))) && ((_arg1.target.player == 1)))) && (!((_arg1.target.noMansLand == true))))) && (!((_arg1.target.resource == 1))))) && (!((_arg1.target.resource == 2))))) && (!((_arg1.target.resource == 3))))) && (!((_arg1.target.resource == 4))))) && (!((_arg1.target.blockTile == true))))){
chan_soundFX = snd_placewall.play(0, 0, snd_FXVolume);
learnAsYouPlayToolTip.visible = false;
hideTutorialMiniBoxes();
p1starterBuildingPlaced = true;
statusBar.visible = false;
starterBuilding = new starterBuildingLIB();
starterBuilding.x = _arg1.target.x;
starterBuilding.y = _arg1.target.y;
_arg1.target.startBuildTile = true;
p1StarterBuildingTile = _arg1.target.myArrayNumber;
starterBuildingArray.push(starterBuilding);
starterBuilding.partyCurrentTile = _arg1.target.myArrayNumber;
starterBuilding.addEventListener(MouseEvent.MOUSE_DOWN, p1ShowCivExpansions);
if (player1Race == "keeper"){
starterBuilding.gotoAndStop(1);
} else {
if (player1Race == "builder"){
starterBuilding.gotoAndStop(2);
} else {
if (player1Race == "expander"){
starterBuilding.gotoAndStop(3);
} else {
if (player1Race == "raider"){
starterBuilding.gotoAndStop(4);
};
};
};
};
addChild(starterBuilding);
wallSlotArray[_arg1.target.upWall].alpha = 1;
wallSlotArray[_arg1.target.upWall].visible = false;
wallSlotArray[_arg1.target.upWall].player = 1;
if ((((wallSlotArray[((_arg1.target.upWall - 13) - verticalGridCounter)].alpha == 1)) && ((wallSlotArray[((_arg1.target.bottomWall - 13) - verticalGridCounter)].alpha == 1)))){
wallSlotArray[_arg1.target.leftWall].alpha = 0;
wallSlotArray[_arg1.target.leftWall].player = 1;
} else {
wallSlotArray[_arg1.target.leftWall].alpha = 1;
wallSlotArray[_arg1.target.leftWall].visible = false;
wallSlotArray[_arg1.target.leftWall].player = 1;
};
if ((((wallSlotArray[((_arg1.target.upWall + 13) + verticalGridCounter)].alpha == 1)) && ((wallSlotArray[((_arg1.target.bottomWall + 13) + verticalGridCounter)].alpha == 1)))){
wallSlotArray[_arg1.target.rightWall].alpha = 0;
wallSlotArray[_arg1.target.rightWall].player = 1;
};
wallSlotArray[_arg1.target.bottomWall].alpha = 1;
wallSlotArray[_arg1.target.bottomWall].visible = false;
wallSlotArray[_arg1.target.bottomWall].player = 1;
wallSlotArray[_arg1.target.rightWall].visible = false;
currentTurn = 2;
TimerDelayPlaceStarterBuilding.start();
} else {
if ((((((((((((currentTurn == 1)) && ((learnAsYouPlayToolTip.currentFrame == 3)))) && ((p1starterBuildingPlaced == true)))) && ((p1starterGathererPlaced == false)))) && ((_arg1.target.player == 1)))) && ((((((((_arg1.target.resource == 1)) || ((_arg1.target.resource == 2)))) || ((_arg1.target.resource == 3)))) || ((_arg1.target.resource == 4)))))){
chan_soundFX = snd_place_gatherer.play(0, 0, snd_FXVolume);
learnAsYouPlayToolTip.visible = false;
hideTutorialMiniBoxes();
p1starterGathererPlaced = true;
_arg1.target.hasGatherer = true;
statusBar.visible = false;
gathererUnit = new gathererUnitLIB();
gathererUnit.x = _arg1.target.x;
gathererUnit.y = _arg1.target.y;
gathererUnit.width = gathererUnitWidth;
gathererUnit.height = gathererUnitHeight;
gathererUnitArray.push(gathererUnit);
gathererUnit.partyCurrentTile = _arg1.target.myArrayNumber;
gathererUnit.addEventListener(MouseEvent.MOUSE_DOWN, playerMoveToGathererUnit);
gathererUnit.mouseEnabled = false;
gathererUnit.player = currentTurn;
allGathererUnitArray.push(gathererUnit);
if (_arg1.target.resource == 1){
gathererUnit.gotoAndStop(1);
p1Gatherers1 = (p1Gatherers1 + 1);
} else {
if (_arg1.target.resource == 2){
gathererUnit.gotoAndStop(2);
p1Gatherers2 = (p1Gatherers2 + 1);
} else {
if (_arg1.target.resource == 3){
gathererUnit.gotoAndStop(3);
p1Gatherers3 = (p1Gatherers3 + 1);
} else {
if (_arg1.target.resource == 4){
gathererUnit.gotoAndStop(4);
p1Gatherers4 = (p1Gatherers4 + 1);
};
};
};
};
addChild(gathererUnit);
if (_arg1.target.resource == 1){
producingResourceMessage.gotoAndStop(1);
} else {
if (_arg1.target.resource == 2){
producingResourceMessage.gotoAndStop(2);
} else {
if (_arg1.target.resource == 3){
producingResourceMessage.gotoAndStop(3);
} else {
if (_arg1.target.resource == 4){
producingResourceMessage.gotoAndStop(4);
};
};
};
};
gathererTooltip.visible = false;
producingResourceMessage.x = _arg1.target.x;
producingResourceMessage.y = _arg1.target.y;
adjustProducingMessage();
riseTo2 = 0;
TimerShowProducingResource.start();
constructorModeMouse.visible = false;
Mouse.show();
currentTurn = 2;
TimerDelayPlaceStarterGatherer.start();
};
};
if ((((((((((((((((player1UnderCombat == false)) && ((longWalkSliding == false)))) && ((slidingUnit == false)))) && ((allowPlayerToMoveUnit == true)))) && ((currentTurn == 1)))) && (!((_arg1.target.blockTile == true))))) && ((partyUnitArray1[currentUnitPlayerMoves].movesLeft > 0)))) && (((((((((((((((landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].tileRow + 1) == _arg1.target.tileRow)) && ((landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].tileColumn == _arg1.target.tileColumn)))) || (((((landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].tileRow - 1) == _arg1.target.tileRow)) && ((landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].tileColumn == _arg1.target.tileColumn)))))) || ((partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile == landTileArray[(_arg1.target.myArrayNumber + 1)].myArrayNumber)))) || ((partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile == landTileArray[(_arg1.target.myArrayNumber - 1)].myArrayNumber)))) || ((partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile == landTileArray[((_arg1.target.myArrayNumber + 6) + (verticalGridCounter / 2))].myArrayNumber)))) || ((partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile == landTileArray[((_arg1.target.myArrayNumber - 6) - (verticalGridCounter / 2))].myArrayNumber)))))){
if (((((((((((landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].tileRow - 1) == _arg1.target.tileRow)) && ((((wallSlotArray[_arg1.target.bottomWall].alpha == 0)) || ((wallSlotArray[_arg1.target.bottomWall].player == currentTurn)))))) || (((((landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].tileRow + 1) == _arg1.target.tileRow)) && ((((wallSlotArray[_arg1.target.upWall].alpha == 0)) || ((wallSlotArray[_arg1.target.upWall].player == currentTurn)))))))) || ((((((landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].myArrayNumber + 6) + (verticalGridCounter / 2)) == _arg1.target.myArrayNumber)) && ((((wallSlotArray[_arg1.target.leftWall].alpha == 0)) || ((wallSlotArray[_arg1.target.leftWall].player == currentTurn)))))))) || ((((((landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].myArrayNumber - 6) - (verticalGridCounter / 2)) == _arg1.target.myArrayNumber)) && ((((wallSlotArray[_arg1.target.rightWall].alpha == 0)) || ((wallSlotArray[_arg1.target.rightWall].player == currentTurn)))))))){
if ((((((((_arg1.target.party2 == 0)) && ((_arg1.target.party3 == 0)))) && ((_arg1.target.party4 == 0)))) && (!((_arg1.target.startBuildTile == true))))){
if (partyUnitArray1[currentUnitPlayerMoves].defensiveUnit != true){
turnPartyLedOff();
if ((((learnAsYouPlayToolTip.currentFrame == 6)) && ((partyUnitArray1[currentUnitPlayerMoves].movesLeft == 0)))){
learnAsYouPlayToolTip.gotoAndStop(7);
animateTooltipWithSlide();
};
if ((_arg1.target.myArrayNumber + 1) == partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile){
partyUnitArray1[currentUnitPlayerMoves].rotation = 0;
};
if ((_arg1.target.myArrayNumber - 1) == partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile){
partyUnitArray1[currentUnitPlayerMoves].rotation = 180;
};
if (((_arg1.target.myArrayNumber - 6) - (verticalGridCounter / 2)) == partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile){
partyUnitArray1[currentUnitPlayerMoves].rotation = 90;
};
if (((_arg1.target.myArrayNumber + 6) + (verticalGridCounter / 2)) == partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile){
partyUnitArray1[currentUnitPlayerMoves].rotation = -90;
};
firstMoveRight = false;
firstMoveLeft = false;
firstMoveUp = false;
firstMoveDown = false;
slideToX = _arg1.target.x;
slideToY = _arg1.target.y;
landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].party1 = (landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].party1 - 1);
partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile = _arg1.target.myArrayNumber;
landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].party1 = (landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].party1 + 1);
partyUnitArray1[currentUnitPlayerMoves].movesLeft = (partyUnitArray1[currentUnitPlayerMoves].movesLeft - 1);
playerUpdateMoveText();
turnPartyLedOn();
TimerSlidePartyUnit.start();
};
};
};
} else {
if ((((((((((((((((((longWalkSliding == false)) && ((player1UnderCombat == false)))) && ((allowPlayerToMoveUnit == true)))) && ((landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].tileRow == _arg1.target.tileRow)))) && ((slidingUnit == false)))) && ((currentTurn == 1)))) && (!((_arg1.target.blockTile == true))))) && (!((_arg1.target.startBuildTile == true))))) && ((partyUnitArray1[currentUnitPlayerMoves].movesLeft > 0)))){
tilesDifference = (landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].tileColumn - _arg1.target.tileColumn);
failLongWalk = false;
longWalkArray.splice(0);
if ((((tilesDifference > 0)) && ((tilesDifference <= partyUnitArray1[currentUnitPlayerMoves].movesLeft)))){
tempLongwalkOrientation = -90;
_local2 = 1;
while (_local2 <= tilesDifference) {
if ((((((((((((((((((((wallSlotArray[landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((-6 - (verticalGridCounter / 2)) * _local2))].rightWall].alpha == 0)) || ((wallSlotArray[landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((-6 - (verticalGridCounter / 2)) * _local2))].rightWall].player == 1)))) && ((((((wallSlotArray[landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((-6 - (verticalGridCounter / 2)) * _local2))].leftWall].alpha == 0)) || ((_local2 == tilesDifference)))) || ((wallSlotArray[landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((-6 - (verticalGridCounter / 2)) * _local2))].leftWall].player == 1)))))) && ((landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((-6 - (verticalGridCounter / 2)) * _local2))].party2 == 0)))) && ((landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((-6 - (verticalGridCounter / 2)) * _local2))].party3 == 0)))) && ((landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((-6 - (verticalGridCounter / 2)) * _local2))].party4 == 0)))) && ((landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((-6 - (verticalGridCounter / 2)) * _local2))].party5 == 0)))) && (!((landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((-6 - (verticalGridCounter / 2)) * _local2))].blockTile == true))))) && (((!((landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((-6 - (verticalGridCounter / 2)) * _local2))].startBuildTile == true))) || ((landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((-6 - (verticalGridCounter / 2)) * _local2))].player == 1)))))) && ((landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((-6 - (verticalGridCounter / 2)) * _local2))].party5 == 0)))){
longWalkArray.push(landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((-6 - (verticalGridCounter / 2)) * _local2))].myArrayNumber);
} else {
failLongWalk = true;
};
_local2++;
};
} else {
if ((((tilesDifference < 0)) && ((-(tilesDifference) <= partyUnitArray1[currentUnitPlayerMoves].movesLeft)))){
tempLongwalkOrientation = 90;
tilesDifference = -(tilesDifference);
_local3 = 1;
while (_local3 <= tilesDifference) {
if ((((((((((((((((((((wallSlotArray[landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((6 + (verticalGridCounter / 2)) * _local3))].leftWall].alpha == 0)) || ((wallSlotArray[landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((6 + (verticalGridCounter / 2)) * _local3))].leftWall].player == 1)))) && ((((((wallSlotArray[landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((6 + (verticalGridCounter / 2)) * _local3))].rightWall].alpha == 0)) || ((_local3 == tilesDifference)))) || ((wallSlotArray[landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((6 + (verticalGridCounter / 2)) * _local3))].rightWall].player == 1)))))) && ((landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((6 + (verticalGridCounter / 2)) * _local3))].party2 == 0)))) && ((landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((6 + (verticalGridCounter / 2)) * _local3))].party3 == 0)))) && ((landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((6 + (verticalGridCounter / 2)) * _local3))].party4 == 0)))) && ((landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((6 + (verticalGridCounter / 2)) * _local3))].party5 == 0)))) && (!((landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((6 + (verticalGridCounter / 2)) * _local3))].blockTile == true))))) && (((!((landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((6 + (verticalGridCounter / 2)) * _local3))].startBuildTile == true))) || ((landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((6 + (verticalGridCounter / 2)) * _local3))].player == 1)))))) && ((landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((6 + (verticalGridCounter / 2)) * _local3))].party5 == 0)))){
longWalkArray.push(landTileArray[(partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + ((6 + (verticalGridCounter / 2)) * _local3))].myArrayNumber);
} else {
failLongWalk = true;
};
_local3++;
};
};
};
if ((((failLongWalk == false)) && (!((partyUnitArray1[currentUnitPlayerMoves].defensiveUnit == true))))){
TimerLongWalk.start();
};
} else {
if ((((((((((((((((((longWalkSliding == false)) && ((player1UnderCombat == false)))) && ((allowPlayerToMoveUnit == true)))) && ((landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].tileColumn == _arg1.target.tileColumn)))) && ((slidingUnit == false)))) && ((currentTurn == 1)))) && (!((_arg1.target.blockTile == true))))) && (!((_arg1.target.startBuildTile == true))))) && ((partyUnitArray1[currentUnitPlayerMoves].movesLeft > 0)))){
tilesDifference = (landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].tileRow - _arg1.target.tileRow);
failLongWalk = false;
longWalkArray.splice(0);
if ((((tilesDifference > 0)) && ((tilesDifference <= partyUnitArray1[currentUnitPlayerMoves].movesLeft)))){
tempLongwalkOrientation = 0;
longWalkPartyCurrentTile = landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].myArrayNumber;
_local2 = 1;
while (_local2 <= tilesDifference) {
if (landTileArray[longWalkPartyCurrentTile].tileRow == landGridNumberVertical){
longWalkPartyCurrentTile = landTileArray[(longWalkPartyCurrentTile - kingdom1ToKingdom3TileDifference)].myArrayNumber;
} else {
longWalkPartyCurrentTile = landTileArray[(longWalkPartyCurrentTile - 1)].myArrayNumber;
};
if ((((((((((((((((((((wallSlotArray[landTileArray[longWalkPartyCurrentTile].bottomWall].alpha == 0)) || ((wallSlotArray[landTileArray[longWalkPartyCurrentTile].bottomWall].player == 1)))) && ((((((wallSlotArray[landTileArray[longWalkPartyCurrentTile].upWall].alpha == 0)) || ((_local2 == tilesDifference)))) || ((wallSlotArray[landTileArray[longWalkPartyCurrentTile].upWall].player == 1)))))) && ((landTileArray[longWalkPartyCurrentTile].party2 == 0)))) && ((landTileArray[longWalkPartyCurrentTile].party3 == 0)))) && ((landTileArray[longWalkPartyCurrentTile].party4 == 0)))) && ((landTileArray[longWalkPartyCurrentTile].party5 == 0)))) && (!((landTileArray[longWalkPartyCurrentTile].blockTile == true))))) && (((!((landTileArray[longWalkPartyCurrentTile].startBuildTile == true))) || ((landTileArray[longWalkPartyCurrentTile].player == 1)))))) && ((landTileArray[longWalkPartyCurrentTile].party5 == 0)))){
longWalkArray.push(landTileArray[longWalkPartyCurrentTile].myArrayNumber);
} else {
failLongWalk = true;
};
_local2++;
};
} else {
if ((((tilesDifference < 0)) && ((-(tilesDifference) <= partyUnitArray1[currentUnitPlayerMoves].movesLeft)))){
tempLongwalkOrientation = 180;
longWalkPartyCurrentTile = landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].myArrayNumber;
tilesDifference = -(tilesDifference);
_local3 = 1;
while (_local3 <= tilesDifference) {
if (landTileArray[longWalkPartyCurrentTile].tileRow == (landGridNumberVertical - 1)){
longWalkPartyCurrentTile = landTileArray[(longWalkPartyCurrentTile + kingdom1ToKingdom3TileDifference)].myArrayNumber;
} else {
longWalkPartyCurrentTile = landTileArray[(longWalkPartyCurrentTile + 1)].myArrayNumber;
};
if ((((((((((((((((((wallSlotArray[landTileArray[longWalkPartyCurrentTile].upWall].alpha == 0)) || ((wallSlotArray[landTileArray[longWalkPartyCurrentTile].upWall].player == 1)))) && ((((((wallSlotArray[landTileArray[longWalkPartyCurrentTile].bottomWall].alpha == 0)) || ((_local3 == tilesDifference)))) || ((wallSlotArray[landTileArray[longWalkPartyCurrentTile].bottomWall].player == 1)))))) && ((landTileArray[longWalkPartyCurrentTile].party2 == 0)))) && ((landTileArray[longWalkPartyCurrentTile].party3 == 0)))) && ((landTileArray[longWalkPartyCurrentTile].party4 == 0)))) && ((landTileArray[longWalkPartyCurrentTile].party5 == 0)))) && (!((landTileArray[longWalkPartyCurrentTile].blockTile == true))))) && (((!((landTileArray[longWalkPartyCurrentTile].startBuildTile == true))) || ((landTileArray[longWalkPartyCurrentTile].player == 1)))))){
longWalkArray.push(landTileArray[longWalkPartyCurrentTile].myArrayNumber);
} else {
failLongWalk = true;
};
_local3++;
};
};
};
if ((((failLongWalk == false)) && (!((partyUnitArray1[currentUnitPlayerMoves].defensiveUnit == true))))){
TimerLongWalk.start();
};
};
};
};
if ((((_arg1.target.player == 1)) && ((((((((_arg1.target.resource == 1)) || ((_arg1.target.resource == 2)))) || ((_arg1.target.resource == 3)))) || ((_arg1.target.resource == 4)))))){
player1NewGathererTile = _arg1.target.myArrayNumber;
} else {
player1NewGathererTile = 20;
};
reactivateGatherer = false;
if ((((((((((((((((((((((((slidingUnit == false)) && (!((player1NewGathererTile == 20))))) && ((_arg1.target.resource >= 1)))) && ((p1starterGathererPlaced == true)))) && ((player1PlaceGathererMode == true)))) && ((currentTurn == 1)))) && (!((landTileArray[player1NewGathererTile].hasGatherer == true))))) && ((p1GathererQtt >= 1)))) && ((player1PlacingGatherer == false)))) && ((player1UnderCombat == false)))) && ((player1Raiding == false)))) && ((player1ChoosingDiceRoll == false)))){
chan_soundFX = snd_place_gatherer.play(0, 0, snd_FXVolume);
if (learnAsYouPlayToolTip.currentFrame == 7){
player1PlaceGathererMode = false;
player1PlaceWallMode = false;
constructorModeMouse.visible = false;
Mouse.show();
learnAsYouPlayToolTip.gotoAndStop(8);
animateTooltipWithSlide();
};
_local4 = 0;
while (_local4 < allGathererUnitArray.length) {
if ((((((landTileArray[player1NewGathererTile].myArrayNumber == allGathererUnitArray[_local4].partyCurrentTile)) && ((allGathererUnitArray[_local4].visible == false)))) && ((allGathererUnitArray[_local4].player == currentTurn)))){
reactivateGatherer = true;
allGathererUnitArray[_local4].visible = true;
landTileArray[allGathererUnitArray[_local4].partyCurrentTile].hasGatherer = true;
if (landTileArray[allGathererUnitArray[_local4].partyCurrentTile].resource == 1){
p1Gatherers1 = (p1Gatherers1 + 1);
} else {
if (landTileArray[allGathererUnitArray[_local4].partyCurrentTile].resource == 2){
p1Gatherers2 = (p1Gatherers2 + 1);
} else {
if (landTileArray[allGathererUnitArray[_local4].partyCurrentTile].resource == 3){
p1Gatherers3 = (p1Gatherers3 + 1);
} else {
if (landTileArray[allGathererUnitArray[_local4].partyCurrentTile].resource == 4){
p1Gatherers4 = (p1Gatherers4 + 1);
};
};
};
};
p1GathererQtt = (p1GathererQtt - 1);
gathererTooltip.visible = false;
if (landTileArray[allGathererUnitArray[_local4].partyCurrentTile].resource == 1){
producingResourceMessage.gotoAndStop(1);
} else {
if (landTileArray[allGathererUnitArray[_local4].partyCurrentTile].resource == 2){
producingResourceMessage.gotoAndStop(2);
} else {
if (landTileArray[allGathererUnitArray[_local4].partyCurrentTile].resource == 3){
producingResourceMessage.gotoAndStop(3);
} else {
if (landTileArray[allGathererUnitArray[_local4].partyCurrentTile].resource == 4){
producingResourceMessage.gotoAndStop(4);
};
};
};
};
producingResourceMessage.x = landTileArray[allGathererUnitArray[_local4].partyCurrentTile].x;
producingResourceMessage.y = landTileArray[allGathererUnitArray[_local4].partyCurrentTile].y;
adjustProducingMessage();
riseTo2 = 0;
TimerShowProducingResource.start();
break;
};
_local4++;
};
if (reactivateGatherer == false){
player1PlacingGatherer = true;
p1GathererQtt = (p1GathererQtt - 1);
landTileArray[player1NewGathererTile].hasGatherer = true;
gathererUnit = new gathererUnitLIB();
gathererUnit.x = landTileArray[player1NewGathererTile].x;
gathererUnit.y = landTileArray[player1NewGathererTile].y;
gathererUnit.width = gathererUnitWidth;
gathererUnit.height = gathererUnitHeight;
gathererUnitArray.push(gathererUnit);
gathererUnit.player = currentTurn;
gathererUnit.partyCurrentTile = landTileArray[player1NewGathererTile].myArrayNumber;
gathererUnit.addEventListener(MouseEvent.MOUSE_DOWN, playerMoveToGathererUnit);
gathererUnit.mouseEnabled = false;
allGathererUnitArray.push(gathererUnit);
if (landTileArray[player1NewGathererTile].resource == 1){
gathererUnit.gotoAndStop(1);
p1Gatherers1 = (p1Gatherers1 + 1);
} else {
if (landTileArray[player1NewGathererTile].resource == 2){
gathererUnit.gotoAndStop(2);
p1Gatherers2 = (p1Gatherers2 + 1);
} else {
if (landTileArray[player1NewGathererTile].resource == 3){
gathererUnit.gotoAndStop(3);
p1Gatherers3 = (p1Gatherers3 + 1);
} else {
if (landTileArray[player1NewGathererTile].resource == 4){
gathererUnit.gotoAndStop(4);
p1Gatherers4 = (p1Gatherers4 + 1);
};
};
};
};
addChild(gathererUnit);
gathererTooltip.visible = false;
if (landTileArray[player1NewGathererTile].resource == 1){
producingResourceMessage.gotoAndStop(1);
} else {
if (landTileArray[player1NewGathererTile].resource == 2){
producingResourceMessage.gotoAndStop(2);
} else {
if (landTileArray[player1NewGathererTile].resource == 3){
producingResourceMessage.gotoAndStop(3);
} else {
if (landTileArray[player1NewGathererTile].resource == 4){
producingResourceMessage.gotoAndStop(4);
};
};
};
};
producingResourceMessage.x = landTileArray[player1NewGathererTile].x;
producingResourceMessage.y = landTileArray[player1NewGathererTile].y;
adjustProducingMessage();
riseTo2 = 0;
TimerShowProducingResource.start();
player1PlacingGatherer = false;
};
};
updateGameBars();
};
gameOverCheck();
}
public function attackerPathFindTile():void{
var _local1:Boolean;
var _local2:uint;
var _local3:uint;
var _local4:uint;
var _local5:uint;
var _local6:Boolean;
var _local7:Number;
var _local8:Number;
var _local9:Boolean;
var _local10:Boolean;
var _local11:Boolean;
var _local12:uint;
var _local13:uint;
var _local14:uint;
var _local15:uint;
var _local16:uint;
var _local17:uint;
_local1 = false;
_local2 = 0;
_local3 = 0;
_local4 = 1;
_local5 = 0;
_local6 = false;
_local7 = 0;
_local8 = 0;
_local9 = true;
_local10 = true;
_local11 = false;
_local12 = 10;
_local13 = 0;
bestPathNumber = 0;
trace("\n beginning new pathfind");
_local2 = attackerChosenTile;
while (_local1 == false) {
trace("pathfind mark 1");
if (landTileArray[_local2].tileChecked != true){
landCheckPointArray.push(landTileArray[_local2]);
landTileArray[_local2].tileChecked = true;
landTileArray[_local2].pathNumber = _local4;
_local3 = (_local3 + 1);
};
if (landTileArray[_local2].tileRow == (landGridNumberVertical - 1)){
_local8 = (_local2 + kingdom1ToKingdom3TileDifference);
_local7 = (_local2 - 1);
} else {
if (landTileArray[_local2].tileRow == landGridNumberVertical){
_local7 = (_local2 - kingdom1ToKingdom3TileDifference);
_local8 = (_local2 + 1);
_local7 = int(_local7);
} else {
_local8 = (_local2 + 1);
_local7 = (_local2 - 1);
};
};
trace("pathfind mark 1.2");
if (((((((((((((((((((((((((((!((_local8 == partyUnitArray[currentMovingParty].myBackTrack))) && (!((_local8 == partyUnitArray[currentMovingParty].myBackTrack2))))) && (!((_local8 == partyUnitArray[currentMovingParty].myBackTrack3))))) && (!((_local8 == partyUnitArray[currentMovingParty].myBackTrack4))))) || ((_local10 == false)))) && ((((((_local9 == false)) || (!((landTileArray[_local8].defensiveUnit == true))))) || ((((((((((_local9 == true)) && ((((landTileArray[_local8].party1 == 0)) || ((currentTurn == 1)))))) && ((((landTileArray[_local8].party2 == 0)) || ((currentTurn == 2)))))) && ((((landTileArray[_local8].party3 == 0)) || ((currentTurn == 3)))))) && ((((landTileArray[_local8].party4 == 0)) || ((currentTurn == 4)))))))))) && (!((landTileArray[_local8].backTrack == true))))) && ((_local6 == false)))) && (((!((landTileArray[_local8].startBuildTile == true))) || ((landTileArray[partyUnitArray[movingUnit].partyCurrentTile].startBuildTile == true)))))) && (!((landTileArray[_local8].blockTile == true))))) && ((landTileArray[_local2].tileRow < lowerMostLimit)))) && (((!((wallSlotArray[landTileArray[_local2].bottomWall].alpha == 1))) || ((wallSlotArray[landTileArray[_local2].bottomWall].player == currentTurn)))))) && (!((landTileArray[_local8].tileChecked == true))))) && ((landTileArray[_local2].tileRow < landTileArray[attackerCurrentTile].tileRow)))){
_local2 = _local8;
if ((((landTileArray[_local8].defensiveUnit == true)) && (!((landTileArray[_local8].player == currentTurn))))){
_local3 = (_local3 + _local12);
};
if (_local2 == partyUnitArray[currentMovingParty].myBackTrack){
_local3 = (_local3 + 1000);
};
landTileArray[_local2].directPath = true;
} else {
if (((((((((((((((((((((((((((!((_local7 == partyUnitArray[currentMovingParty].myBackTrack))) && (!((_local7 == partyUnitArray[currentMovingParty].myBackTrack2))))) && (!((_local7 == partyUnitArray[currentMovingParty].myBackTrack3))))) && (!((_local7 == partyUnitArray[currentMovingParty].myBackTrack4))))) || ((_local10 == false)))) && ((((((_local9 == false)) || (!((landTileArray[_local7].defensiveUnit == true))))) || ((((((((((_local9 == true)) && ((((landTileArray[_local7].party1 == 0)) || ((currentTurn == 1)))))) && ((((landTileArray[_local7].party2 == 0)) || ((currentTurn == 2)))))) && ((((landTileArray[_local7].party3 == 0)) || ((currentTurn == 3)))))) && ((((landTileArray[_local7].party4 == 0)) || ((currentTurn == 4)))))))))) && (!((landTileArray[_local7].backTrack == true))))) && ((_local6 == false)))) && (((!((landTileArray[_local7].startBuildTile == true))) || ((landTileArray[partyUnitArray[movingUnit].partyCurrentTile].startBuildTile == true)))))) && (!((landTileArray[_local7].blockTile == true))))) && ((landTileArray[_local2].tileRow > 0)))) && (((!((wallSlotArray[landTileArray[_local2].upWall].alpha == 1))) || ((wallSlotArray[landTileArray[_local2].upWall].player == currentTurn)))))) && (!((landTileArray[_local7].tileChecked == true))))) && ((landTileArray[_local2].tileRow > landTileArray[attackerCurrentTile].tileRow)))){
_local2 = _local7;
if ((((landTileArray[_local7].defensiveUnit == true)) && (!((landTileArray[_local7].player == currentTurn))))){
_local3 = (_local3 + _local12);
};
if (_local2 == partyUnitArray[currentMovingParty].myBackTrack){
_local3 = (_local3 + 1000);
};
landTileArray[_local2].directPath = true;
} else {
if (((((((((((((((((((((((((((!((((_local2 - 6) - (verticalGridCounter / 2)) == partyUnitArray[currentMovingParty].myBackTrack))) && (!((((_local2 - 6) - (verticalGridCounter / 2)) == partyUnitArray[currentMovingParty].myBackTrack2))))) && (!((((_local2 - 6) - (verticalGridCounter / 2)) == partyUnitArray[currentMovingParty].myBackTrack3))))) && (!((((_local2 - 6) - (verticalGridCounter / 2)) == partyUnitArray[currentMovingParty].myBackTrack4))))) || ((_local10 == false)))) && ((((((_local9 == false)) || (!((landTileArray[((_local2 - 6) - (verticalGridCounter / 2))].defensiveUnit == true))))) || ((((((((((_local9 == true)) && ((((landTileArray[((_local2 - 6) - (verticalGridCounter / 2))].party1 == 0)) || ((currentTurn == 1)))))) && ((((landTileArray[((_local2 - 6) - (verticalGridCounter / 2))].party2 == 0)) || ((currentTurn == 2)))))) && ((((landTileArray[((_local2 - 6) - (verticalGridCounter / 2))].party3 == 0)) || ((currentTurn == 3)))))) && ((((landTileArray[((_local2 - 6) - (verticalGridCounter / 2))].party4 == 0)) || ((currentTurn == 4)))))))))) && (!((landTileArray[((_local2 - 6) - (verticalGridCounter / 2))].backTrack == true))))) && (((!((landTileArray[((_local2 - 6) - (verticalGridCounter / 2))].startBuildTile == true))) || ((landTileArray[partyUnitArray[movingUnit].partyCurrentTile].startBuildTile == true)))))) && ((_local6 == false)))) && (!((landTileArray[((_local2 - 6) - (verticalGridCounter / 2))].blockTile == true))))) && ((landTileArray[_local2].tileColumn > 0)))) && (((!((wallSlotArray[landTileArray[_local2].leftWall].alpha == 1))) || ((wallSlotArray[landTileArray[_local2].leftWall].player == currentTurn)))))) && (!((landTileArray[((_local2 - 6) - (verticalGridCounter / 2))].tileChecked == true))))) && ((landTileArray[_local2].tileColumn > landTileArray[attackerCurrentTile].tileColumn)))){
_local2 = ((_local2 - 6) - (verticalGridCounter / 2));
if ((((landTileArray[((_local2 - 6) - (verticalGridCounter / 2))].defensiveUnit == true)) && (!((landTileArray[((_local2 - 6) - (verticalGridCounter / 2))].player == currentTurn))))){
_local3 = (_local3 + _local12);
};
if (_local2 == partyUnitArray[currentMovingParty].myBackTrack){
_local3 = (_local3 + 1000);
};
landTileArray[_local2].directPath = true;
} else {
if (((((((((((((((((((((((((((!((((_local2 + 6) + (verticalGridCounter / 2)) == partyUnitArray[currentMovingParty].myBackTrack))) && (!((((_local2 + 6) + (verticalGridCounter / 2)) == partyUnitArray[currentMovingParty].myBackTrack2))))) && (!((((_local2 + 6) + (verticalGridCounter / 2)) == partyUnitArray[currentMovingParty].myBackTrack3))))) && (!((((_local2 + 6) + (verticalGridCounter / 2)) == partyUnitArray[currentMovingParty].myBackTrack4))))) || ((_local10 == false)))) && ((((((_local9 == false)) || (!((landTileArray[((_local2 + 6) + (verticalGridCounter / 2))].defensiveUnit == true))))) || ((((((((((_local9 == true)) && ((((landTileArray[((_local2 + 6) + (verticalGridCounter / 2))].party1 == 0)) || ((currentTurn == 1)))))) && ((((landTileArray[((_local2 + 6) + (verticalGridCounter / 2))].party2 == 0)) || ((currentTurn == 2)))))) && ((((landTileArray[((_local2 + 6) + (verticalGridCounter / 2))].party3 == 0)) || ((currentTurn == 3)))))) && ((((landTileArray[((_local2 + 6) + (verticalGridCounter / 2))].party4 == 0)) || ((currentTurn == 4)))))))))) && (!((landTileArray[((_local2 + 6) + (verticalGridCounter / 2))].backTrack == true))))) && (((!((landTileArray[((_local2 + 6) + (verticalGridCounter / 2))].startBuildTile == true))) || ((landTileArray[partyUnitArray[movingUnit].partyCurrentTile].startBuildTile == true)))))) && ((_local6 == false)))) && (!((landTileArray[((_local2 + 6) + (verticalGridCounter / 2))].blockTile == true))))) && ((landTileArray[_local2].tileColumn < rightMostLimit)))) && (((!((wallSlotArray[landTileArray[_local2].rightWall].alpha == 1))) || ((wallSlotArray[landTileArray[_local2].rightWall].player == currentTurn)))))) && (!((landTileArray[((_local2 + 6) + (verticalGridCounter / 2))].tileChecked == true))))) && ((landTileArray[_local2].tileColumn < landTileArray[attackerCurrentTile].tileColumn)))){
_local2 = ((_local2 + 6) + (verticalGridCounter / 2));
if ((((landTileArray[((_local2 + 6) + (verticalGridCounter / 2))].defensiveUnit == true)) && (!((landTileArray[((_local2 + 6) + (verticalGridCounter / 2))].player == currentTurn))))){
_local3 = (_local3 + _local12);
};
if (_local2 == partyUnitArray[currentMovingParty].myBackTrack){
_local3 = (_local3 + 1000);
};
landTileArray[_local2].directPath = true;
} else {
if (((((((((((((((((((((((((((!((_local8 == partyUnitArray[currentMovingParty].myBackTrack))) && (!((_local8 == partyUnitArray[currentMovingParty].myBackTrack2))))) && (!((_local8 == partyUnitArray[currentMovingParty].myBackTrack3))))) && (!((_local8 == partyUnitArray[currentMovingParty].myBackTrack4))))) || ((_local10 == false)))) && ((((((_local9 == false)) || (!((landTileArray[_local8].defensiveUnit == true))))) || ((((((((((_local9 == true)) && ((((landTileArray[_local8].party1 == 0)) || ((currentTurn == 1)))))) && ((((landTileArray[_local8].party2 == 0)) || ((currentTurn == 2)))))) && ((((landTileArray[_local8].party3 == 0)) || ((currentTurn == 3)))))) && ((((landTileArray[_local8].party4 == 0)) || ((currentTurn == 4)))))))))) && (!((landTileArray[_local8].backTrack == true))))) && ((_local6 == false)))) && (((!((landTileArray[_local8].startBuildTile == true))) || ((landTileArray[partyUnitArray[movingUnit].partyCurrentTile].startBuildTile == true)))))) && (!((landTileArray[_local8].blockTile == true))))) && ((landTileArray[_local2].tileRow < lowerMostLimit)))) && (((!((wallSlotArray[landTileArray[_local2].bottomWall].alpha == 1))) || ((wallSlotArray[landTileArray[_local2].bottomWall].player == currentTurn)))))) && (!((landTileArray[_local8].tileChecked == true))))) && (!((_local2 == attackerCurrentTile))))){
_local2 = _local8;
if ((((landTileArray[_local8].defensiveUnit == true)) && (!((landTileArray[_local8].player == currentTurn))))){
_local3 = (_local3 + _local12);
};
if (_local2 == partyUnitArray[currentMovingParty].myBackTrack){
_local3 = (_local3 + 1000);
};
landTileArray[_local2].directPath = false;
} else {
if (((((((((((((((((((((((((((!((_local7 == partyUnitArray[currentMovingParty].myBackTrack))) && (!((_local7 == partyUnitArray[currentMovingParty].myBackTrack2))))) && (!((_local7 == partyUnitArray[currentMovingParty].myBackTrack3))))) && (!((_local7 == partyUnitArray[currentMovingParty].myBackTrack4))))) || ((_local10 == false)))) && ((((((_local9 == false)) || (!((landTileArray[_local7].defensiveUnit == true))))) || ((((((((((_local9 == true)) && ((((landTileArray[_local7].party1 == 0)) || ((currentTurn == 1)))))) && ((((landTileArray[_local7].party2 == 0)) || ((currentTurn == 2)))))) && ((((landTileArray[_local7].party3 == 0)) || ((currentTurn == 3)))))) && ((((landTileArray[_local7].party4 == 0)) || ((currentTurn == 4)))))))))) && (!((landTileArray[_local7].backTrack == true))))) && (((!((landTileArray[_local7].startBuildTile == true))) || ((landTileArray[partyUnitArray[movingUnit].partyCurrentTile].startBuildTile == true)))))) && ((_local6 == false)))) && (!((landTileArray[_local7].blockTile == true))))) && ((landTileArray[_local2].tileRow > 0)))) && (((!((wallSlotArray[landTileArray[_local2].upWall].alpha == 1))) || ((wallSlotArray[landTileArray[_local2].upWall].player == currentTurn)))))) && (!((landTileArray[_local7].tileChecked == true))))) && (!((_local2 == attackerCurrentTile))))){
_local2 = _local7;
if ((((landTileArray[_local7].defensiveUnit == true)) && (!((landTileArray[_local7].player == currentTurn))))){
_local3 = (_local3 + _local12);
};
if (_local2 == partyUnitArray[currentMovingParty].myBackTrack){
_local3 = (_local3 + 1000);
};
landTileArray[_local2].directPath = false;
} else {
if (((((((((((((((((((((((((((!((((_local2 - 6) - (verticalGridCounter / 2)) == partyUnitArray[currentMovingParty].myBackTrack))) && (!((((_local2 - 6) - (verticalGridCounter / 2)) == partyUnitArray[currentMovingParty].myBackTrack2))))) && (!((((_local2 - 6) - (verticalGridCounter / 2)) == partyUnitArray[currentMovingParty].myBackTrack3))))) && (!((((_local2 - 6) - (verticalGridCounter / 2)) == partyUnitArray[currentMovingParty].myBackTrack4))))) || ((_local10 == false)))) && ((((((_local9 == false)) || (!((landTileArray[((_local2 - 6) - (verticalGridCounter / 2))].defensiveUnit == true))))) || ((((((((((_local9 == true)) && ((((landTileArray[((_local2 - 6) - (verticalGridCounter / 2))].party1 == 0)) || ((currentTurn == 1)))))) && ((((landTileArray[((_local2 - 6) - (verticalGridCounter / 2))].party2 == 0)) || ((currentTurn == 2)))))) && ((((landTileArray[((_local2 - 6) - (verticalGridCounter / 2))].party3 == 0)) || ((currentTurn == 3)))))) && ((((landTileArray[((_local2 - 6) - (verticalGridCounter / 2))].party4 == 0)) || ((currentTurn == 4)))))))))) && (!((landTileArray[((_local2 - 6) - (verticalGridCounter / 2))].backTrack == true))))) && ((_local6 == false)))) && (((!((landTileArray[((_local2 - 6) - (verticalGridCounter / 2))].startBuildTile == true))) || ((landTileArray[partyUnitArray[movingUnit].partyCurrentTile].startBuildTile == true)))))) && (!((landTileArray[((_local2 - 6) - (verticalGridCounter / 2))].blockTile == true))))) && ((landTileArray[_local2].tileColumn > 0)))) && (((!((wallSlotArray[landTileArray[_local2].leftWall].alpha == 1))) || ((wallSlotArray[landTileArray[_local2].leftWall].player == currentTurn)))))) && (!((landTileArray[((_local2 - 6) - (verticalGridCounter / 2))].tileChecked == true))))) && (!((_local2 == attackerCurrentTile))))){
_local2 = ((_local2 - 6) - (verticalGridCounter / 2));
if ((((landTileArray[((_local2 - 6) - (verticalGridCounter / 2))].defensiveUnit == true)) && (!((landTileArray[((_local2 - 6) - (verticalGridCounter / 2))].player == currentTurn))))){
_local3 = (_local3 + _local12);
};
if (_local2 == partyUnitArray[currentMovingParty].myBackTrack){
_local3 = (_local3 + 1000);
};
landTileArray[_local2].directPath = false;
} else {
if (((((((((((((((((((((((((((!((((_local2 + 6) + (verticalGridCounter / 2)) == partyUnitArray[currentMovingParty].myBackTrack))) && (!((((_local2 + 6) + (verticalGridCounter / 2)) == partyUnitArray[currentMovingParty].myBackTrack2))))) && (!((((_local2 + 6) + (verticalGridCounter / 2)) == partyUnitArray[currentMovingParty].myBackTrack3))))) && (!((((_local2 + 6) + (verticalGridCounter / 2)) == partyUnitArray[currentMovingParty].myBackTrack4))))) || ((_local10 == false)))) && ((((((_local9 == false)) || (!((landTileArray[((_local2 + 6) + (verticalGridCounter / 2))].defensiveUnit == true))))) || ((((((((((_local9 == true)) && ((((landTileArray[((_local2 + 6) + (verticalGridCounter / 2))].party1 == 0)) || ((currentTurn == 1)))))) && ((((landTileArray[((_local2 + 6) + (verticalGridCounter / 2))].party2 == 0)) || ((currentTurn == 2)))))) && ((((landTileArray[((_local2 + 6) + (verticalGridCounter / 2))].party3 == 0)) || ((currentTurn == 3)))))) && ((((landTileArray[((_local2 + 6) + (verticalGridCounter / 2))].party4 == 0)) || ((currentTurn == 4)))))))))) && (!((landTileArray[((_local2 + 6) + (verticalGridCounter / 2))].backTrack == true))))) && ((_local6 == false)))) && (((!((landTileArray[((_local2 + 6) + (verticalGridCounter / 2))].startBuildTile == true))) || ((landTileArray[partyUnitArray[movingUnit].partyCurrentTile].startBuildTile == true)))))) && (!((landTileArray[((_local2 + 6) + (verticalGridCounter / 2))].blockTile == true))))) && ((landTileArray[_local2].tileColumn < rightMostLimit)))) && (((!((wallSlotArray[landTileArray[_local2].rightWall].alpha == 1))) || ((wallSlotArray[landTileArray[_local2].rightWall].player == currentTurn)))))) && (!((landTileArray[((_local2 + 6) + (verticalGridCounter / 2))].tileChecked == true))))) && (!((_local2 == attackerCurrentTile))))){
_local2 = ((_local2 + 6) + (verticalGridCounter / 2));
if ((((landTileArray[((_local2 + 6) + (verticalGridCounter / 2))].defensiveUnit == true)) && (!((landTileArray[((_local2 + 6) + (verticalGridCounter / 2))].player == currentTurn))))){
_local3 = (_local3 + _local12);
};
if (_local2 == partyUnitArray[currentMovingParty].myBackTrack){
_local3 = (_local3 + 1000);
};
landTileArray[_local2].directPath = false;
} else {
trace("pathfind mark 2");
if (((((!((_local2 == attackerChosenTile))) && ((landCheckPointArray.length > 1)))) && (!((_local2 == attackerCurrentTile))))){
trace("pathfind mark 2.1");
if (landCheckPointArray[(landCheckPointArray.length - 1)].pathNumber == _local4){
if (_local3 > 0){
if ((((landTileArray[(landCheckPointArray.length - 1)].defensiveUnit == true)) && (!((landTileArray[(landCheckPointArray.length - 1)].player == currentTurn))))){
_local3 = (_local3 - _local12);
} else {
_local3--;
};
if (_local3 < 0){
_local3 = 0;
};
};
landCheckPointArray.splice((landCheckPointArray.length - 1), 1);
_local2 = landCheckPointArray[(landCheckPointArray.length - 1)].myArrayNumber;
};
} else {
if (((((!((_local2 == attackerChosenTile))) && ((_local6 == false)))) && ((_local13 < 5)))){
trace("pathfind mark 2.3");
_local11 = true;
if ((((((_local2 == attackerCurrentTile)) && ((_local3 < _local5)))) || ((bestPathNumber == 0)))){
_local5 = _local3;
bestPathNumber = _local4;
};
_local2 = attackerChosenTile;
if (_local3 < 3){
_local6 = true;
landTileArray[attackerCurrentTile].tileChecked = true;
landTileArray[attackerChosenTile].tileChecked = true;
} else {
landTileArray[attackerCurrentTile].tileChecked = false;
landTileArray[attackerChosenTile].tileChecked = false;
};
_local13 = (_local13 + 1);
_local3 = 0;
_local4 = (_local4 + 1);
} else {
if ((((_local9 == true)) && ((_local2 == attackerChosenTile)))){
trace("pathfind mark 2.4 = TRYING PATH WITH ENEMIES NOW");
_local9 = false;
_local14 = 0;
while (_local14 < landTileArray.length) {
landTileArray[_local14].tileChecked = false;
landTileArray[_local14].walk = true;
_local14++;
};
landCheckPointArray.splice(0);
_local1 = false;
_local2 = 0;
_local3 = 0;
_local4 = 1;
_local5 = 0;
_local6 = false;
bestPathNumber = 0;
_local13 = 0;
_local2 = attackerChosenTile;
} else {
if ((((_local10 == true)) && ((_local11 == false)))){
trace("pathfind mark 2.X = we MUST backtrack");
_local10 = false;
_local15 = 0;
while (_local15 < landTileArray.length) {
landTileArray[_local15].tileChecked = false;
landTileArray[_local15].walk = true;
_local15++;
};
landCheckPointArray.splice(0);
_local1 = false;
_local2 = 0;
_local3 = 0;
_local4 = 1;
_local5 = 0;
_local6 = false;
bestPathNumber = 0;
_local13 = 0;
_local2 = attackerChosenTile;
} else {
trace("pathfind mark 2.5");
_local16 = 0;
while (_local16 < landCheckPointArray.length) {
if (landCheckPointArray[_local16].myArrayNumber == landTileArray[attackerChosenTile].myArrayNumber){
landCheckPointArray[_local16].walk = false;
} else {
if (landCheckPointArray[_local16].myArrayNumber == landTileArray[attackerCurrentTile].myArrayNumber){
landCheckPointArray[_local16].walk = false;
} else {
if (landCheckPointArray[_local16].pathNumber != bestPathNumber){
landCheckPointArray[_local16].walk = false;
};
};
};
_local16++;
};
trace("pathfind mark 2.6");
landCheckPointBestPathArray.push(landTileArray[attackerChosenTile]);
_local17 = 0;
while (_local17 < landCheckPointArray.length) {
if (landCheckPointArray[_local17].walk != false){
landCheckPointBestPathArray.push(landCheckPointArray[_local17]);
if (landCheckPointArray[_local17].directPath == false){
partyUnitArray[movingUnit].myIndirectPath = landCheckPointArray[_local17].myArrayNumber;
};
};
_local17++;
};
_local1 = true;
};
};
};
};
};
};
};
};
};
};
};
};
};
}
public function animatePiecesRecursion(_arg1:TimerEvent):void{
if (gameOver == false){
TimerAnimatePieces.start();
};
}
public function npcDefenseStanceGraphicsOff():void{
if (currentTurn == 1){
if (player1Race == "keeper"){
partyUnitArray1[currentUnitPlayerMoves].gotoAndStop(2);
} else {
if (player1Race == "builder"){
partyUnitArray1[currentUnitPlayerMoves].gotoAndStop(5);
} else {
if (player1Race == "expander"){
partyUnitArray1[currentUnitPlayerMoves].gotoAndStop(8);
} else {
if (player1Race == "raider"){
partyUnitArray1[currentUnitPlayerMoves].gotoAndStop(11);
};
};
};
};
} else {
if (currentTurn == 2){
if (player2Race == "keeper"){
partyUnitArray[movingUnit].gotoAndStop(2);
} else {
if (player2Race == "builder"){
partyUnitArray[movingUnit].gotoAndStop(5);
} else {
if (player2Race == "expander"){
partyUnitArray[movingUnit].gotoAndStop(8);
} else {
if (player2Race == "raider"){
partyUnitArray[movingUnit].gotoAndStop(11);
};
};
};
};
} else {
if (currentTurn == 3){
if (player3Race == "keeper"){
partyUnitArray[movingUnit].gotoAndStop(2);
} else {
if (player3Race == "builder"){
partyUnitArray[movingUnit].gotoAndStop(5);
} else {
if (player3Race == "expander"){
partyUnitArray[movingUnit].gotoAndStop(8);
} else {
if (player3Race == "raider"){
partyUnitArray[movingUnit].gotoAndStop(11);
};
};
};
};
} else {
if (currentTurn == 4){
if (player4Race == "keeper"){
partyUnitArray[movingUnit].gotoAndStop(2);
} else {
if (player4Race == "builder"){
partyUnitArray[movingUnit].gotoAndStop(5);
} else {
if (player4Race == "expander"){
partyUnitArray[movingUnit].gotoAndStop(8);
} else {
if (player4Race == "raider"){
partyUnitArray[movingUnit].gotoAndStop(11);
};
};
};
};
};
};
};
};
}
public function animatePieces(_arg1:TimerEvent):void{
var _local2:uint;
var _local3:uint;
var _local4:uint;
if (gameOver == false){
if (currentTurn == 2){
partyUnitArray = partyUnitArray2;
} else {
if (currentTurn == 3){
partyUnitArray = partyUnitArray3;
} else {
if (currentTurn == 4){
partyUnitArray = partyUnitArray4;
} else {
if (currentTurn == 5){
partyUnitArray = partyUnitArray5;
};
};
};
};
while ((((movingUnit < partyUnitArray.length)) && ((((partyUnitArray[movingUnit].defensiveUnit == true)) || ((partyUnitArray[movingUnit].deadUnit == true)))))) {
movingUnit = (movingUnit + 1);
newMovingUnit = true;
};
if ((((movingUnit < partyUnitArray.length)) && (((!((currentTurn == 5))) || ((reaversDontMove == false)))))){
attackerCurrentTile = partyUnitArray[movingUnit].partyCurrentTile;
attackerChosenTile = partyUnitArray[movingUnit].myAssignment;
currentMovingParty = partyUnitArray[movingUnit].myArrayNumber;
if (((((((!((attackerCurrentTile == attackerChosenTile))) && ((partyUnitArray[movingUnit].movesLeft > 0)))) && (!((partyUnitArray[movingUnit].deadUnit == true))))) && (((!((landTileArray[partyUnitArray[movingUnit].partyCurrentTile].hasGatherer == true))) || ((landTileArray[partyUnitArray[movingUnit].partyCurrentTile].player == currentTurn)))))){
exctinctRaceNoMovesLeft = false;
TimerMoveAttacker.start();
} else {
if ((((((((((landTileArray[partyUnitArray[movingUnit].myAssignment].player == currentTurn)) && (!((landTileArray[partyUnitArray[movingUnit].myAssignment].defensiveUnit == true))))) && ((partyUnitArray[movingUnit].imDefensive == true)))) && ((attackerCurrentTile == attackerChosenTile)))) && (!((partyUnitArray[movingUnit].deadUnit == true))))){
exctinctRaceNoMovesLeft = false;
landTileArray[partyUnitArray[movingUnit].myAssignment].defensiveUnit = true;
landTileArray[partyUnitArray[movingUnit].myAssignment].defensiveUnitReference = partyUnitArray[movingUnit].myArrayNumber;
partyUnitArray[movingUnit].rotation = landTileArray[partyUnitArray[movingUnit].myAssignment].defensiveUnitRotation;
npcDefenseStanceGraphicsOff();
partyUnitArray[movingUnit].defensiveUnit = true;
trace("shouldnt be here brah");
chan_soundFX = snd_defensive_stance.play(0, 0, snd_DefensiveStanceVolume);
setChildIndex(wallSlotArray[landTileArray[partyUnitArray[movingUnit].partyCurrentTile].leftWall], (getChildIndex(escapeMenu) - 1));
setChildIndex(wallSlotArray[landTileArray[partyUnitArray[movingUnit].partyCurrentTile].rightWall], (getChildIndex(escapeMenu) - 1));
setChildIndex(wallSlotArray[landTileArray[partyUnitArray[movingUnit].partyCurrentTile].upWall], (getChildIndex(escapeMenu) - 1));
setChildIndex(wallSlotArray[landTileArray[partyUnitArray[movingUnit].partyCurrentTile].bottomWall], (getChildIndex(escapeMenu) - 1));
_local2 = 0;
while (_local2 < allGathererUnitArray.length) {
setChildIndex(learnAsYouPlayToolTip, (getChildIndex(escapeMenu) - 1));
setChildIndex(btn_chooseCivExpansion, (getChildIndex(learnAsYouPlayToolTip) - 1));
setChildIndex(tutoMiniBox4, (getChildIndex(escapeMenu) - 1));
setChildIndex(tutoMiniBox5, (getChildIndex(escapeMenu) - 1));
setChildIndex(tutoMiniBox7, (getChildIndex(escapeMenu) - 1));
setChildIndex(tutoMiniBox72, (getChildIndex(escapeMenu) - 1));
setChildIndex(tutoMiniBox8, (getChildIndex(escapeMenu) - 1));
setChildIndex(tutoMiniBox82, (getChildIndex(escapeMenu) - 1));
setChildIndex(tutoMiniBox9, (getChildIndex(escapeMenu) - 1));
setChildIndex(tutoMiniBox10, (getChildIndex(escapeMenu) - 1));
setChildIndex(tutoMiniBox11, (getChildIndex(escapeMenu) - 1));
setChildIndex(allGathererUnitArray[_local2], (getChildIndex(btn_chooseCivExpansion) - 1));
_local2++;
};
};
if ((((((((attackerCurrentTile == attackerChosenTile)) && (!((landTileArray[partyUnitArray[movingUnit].myAssignment].player == currentTurn))))) && (!((partyUnitArray[movingUnit].deadUnit == true))))) || ((((((landTileArray[partyUnitArray[movingUnit].partyCurrentTile].hasGatherer == true)) && (!((landTileArray[partyUnitArray[movingUnit].partyCurrentTile].player == currentTurn))))) && (!((partyUnitArray[movingUnit].deadUnit == true))))))){
exctinctRaceNoMovesLeft = false;
chan_soundFX = snd_raid.play(0, 0, snd_FXVolume);
landTileArray[partyUnitArray[movingUnit].partyCurrentTile].hasGatherer = false;
_local3 = 0;
while (_local3 < allGathererUnitArray.length) {
if (allGathererUnitArray[_local3].partyCurrentTile == partyUnitArray[movingUnit].partyCurrentTile){
allGathererUnitArray[_local3].visible = false;
};
_local3++;
};
if (landTileArray[partyUnitArray[movingUnit].partyCurrentTile].resource == 1){
if (landTileArray[partyUnitArray[movingUnit].partyCurrentTile].player == 1){
p1Gatherers1 = (p1Gatherers1 - 1);
} else {
if (landTileArray[partyUnitArray[movingUnit].partyCurrentTile].player == 2){
p2Gatherers1 = (p2Gatherers1 - 1);
} else {
if (landTileArray[partyUnitArray[movingUnit].partyCurrentTile].player == 3){
p3Gatherers1 = (p3Gatherers1 - 1);
} else {
if (landTileArray[partyUnitArray[movingUnit].partyCurrentTile].player == 4){
p4Gatherers1 = (p4Gatherers1 - 1);
};
};
};
};
} else {
if (landTileArray[partyUnitArray[movingUnit].partyCurrentTile].resource == 2){
if (landTileArray[partyUnitArray[movingUnit].partyCurrentTile].player == 1){
p1Gatherers2 = (p1Gatherers2 - 1);
} else {
if (landTileArray[partyUnitArray[movingUnit].partyCurrentTile].player == 2){
p2Gatherers2 = (p2Gatherers2 - 1);
} else {
if (landTileArray[partyUnitArray[movingUnit].partyCurrentTile].player == 3){
p3Gatherers2 = (p3Gatherers2 - 1);
} else {
if (landTileArray[partyUnitArray[movingUnit].partyCurrentTile].player == 4){
p4Gatherers2 = (p4Gatherers2 - 1);
};
};
};
};
} else {
if (landTileArray[partyUnitArray[movingUnit].partyCurrentTile].resource == 3){
if (landTileArray[partyUnitArray[movingUnit].partyCurrentTile].player == 1){
p1Gatherers3 = (p1Gatherers3 - 1);
} else {
if (landTileArray[partyUnitArray[movingUnit].partyCurrentTile].player == 2){
p2Gatherers3 = (p2Gatherers3 - 1);
} else {
if (landTileArray[partyUnitArray[movingUnit].partyCurrentTile].player == 3){
p3Gatherers3 = (p3Gatherers3 - 1);
} else {
if (landTileArray[partyUnitArray[movingUnit].partyCurrentTile].player == 4){
p4Gatherers3 = (p4Gatherers3 - 1);
};
};
};
};
} else {
if (landTileArray[partyUnitArray[movingUnit].partyCurrentTile].resource == 4){
if (landTileArray[partyUnitArray[movingUnit].partyCurrentTile].player == 1){
p1Gatherers4 = (p1Gatherers4 - 1);
} else {
if (landTileArray[partyUnitArray[movingUnit].partyCurrentTile].player == 2){
p2Gatherers4 = (p2Gatherers4 - 1);
} else {
if (landTileArray[partyUnitArray[movingUnit].partyCurrentTile].player == 3){
p3Gatherers4 = (p3Gatherers4 - 1);
} else {
if (landTileArray[partyUnitArray[movingUnit].partyCurrentTile].player == 4){
p4Gatherers4 = (p4Gatherers4 - 1);
};
};
};
};
};
};
};
};
if (partyUnitArray[movingUnit].player == 2){
landTileArray[partyUnitArray2[movingUnit].partyCurrentTile].partyAssignedOffensive = false;
landTileArray[partyUnitArray2[movingUnit].partyCurrentTile].party2 = (landTileArray[partyUnitArray2[movingUnit].partyCurrentTile].party2 - 1);
partyUnitArray2[movingUnit].visible = false;
partyUnitArray2[movingUnit].deadUnit = true;
} else {
if (partyUnitArray[movingUnit].player == 3){
landTileArray[partyUnitArray3[movingUnit].partyCurrentTile].partyAssignedOffensive = false;
landTileArray[partyUnitArray3[movingUnit].partyCurrentTile].party3 = (landTileArray[partyUnitArray3[movingUnit].partyCurrentTile].party3 - 1);
partyUnitArray3[movingUnit].visible = false;
partyUnitArray3[movingUnit].deadUnit = true;
} else {
if (partyUnitArray[movingUnit].player == 4){
landTileArray[partyUnitArray4[movingUnit].partyCurrentTile].partyAssignedOffensive = false;
landTileArray[partyUnitArray4[movingUnit].partyCurrentTile].party4 = (landTileArray[partyUnitArray4[movingUnit].partyCurrentTile].party4 - 1);
partyUnitArray4[movingUnit].visible = false;
partyUnitArray4[movingUnit].deadUnit = true;
} else {
if (partyUnitArray[movingUnit].player == 5){
landTileArray[partyUnitArray5[movingUnit].partyCurrentTile].partyAssignedOffensive = false;
landTileArray[partyUnitArray5[movingUnit].partyCurrentTile].party5 = (landTileArray[partyUnitArray5[movingUnit].partyCurrentTile].party5 - 1);
partyUnitArray5[movingUnit].visible = false;
partyUnitArray5[movingUnit].deadUnit = true;
};
};
};
};
};
updateGameBars();
turnPartyLedOff();
movingUnit = (movingUnit + 1);
newMovingUnit = true;
gameOverCheck();
TimerAnimatePiecesRecursion.start();
};
} else {
_local4 = 0;
while (_local4 < landTileArray.length) {
landTileArray[_local4].backTrack = false;
_local4++;
};
newMovingUnit = true;
movingUnit = 0;
if (exctinctRaceNoMovesLeft == true){
if ((((currentTurn == 2)) && ((p2Extinct == true)))){
p2NoLongerPlaying = true;
} else {
if ((((currentTurn == 3)) && ((p3Extinct == true)))){
p3NoLongerPlaying = true;
} else {
if ((((currentTurn == 4)) && ((p4Extinct == true)))){
p4NoLongerPlaying = true;
};
};
};
};
reaversDontMove = false;
if ((((currentTurn == 2)) && ((p2NoLongerPlaying == true)))){
reaversDontMove = true;
} else {
if ((((currentTurn == 3)) && ((p3NoLongerPlaying == true)))){
reaversDontMove = true;
} else {
if ((((currentTurn == 4)) && ((p4NoLongerPlaying == true)))){
reaversDontMove = true;
} else {
if (currentTurn == 5){
reaversDontMove = true;
};
};
};
};
TimerNewTurnDelay.start();
};
};
}
public function newTurnDelay(_arg1:TimerEvent):void{
playerAssign();
}
public function moveAttacker(_arg1:TimerEvent):void{
var _local2:uint;
var _local3:uint;
var _local4:uint;
var _local5:uint;
if (partyUnitArray[currentMovingParty].deadUnit != true){
if (((!((landTileArray[partyUnitArray[currentMovingParty].myAssignment].hasGatherer == true))) && (!((landTileArray[partyUnitArray[currentMovingParty].myAssignment].player == currentTurn))))){
if (currentTurn == 5){
_local2 = 0;
while (_local2 < landTileArray.length) {
if ((((((landTileArray[_local2].hasGatherer == true)) && (!((landTileArray[_local2].player == currentTurn))))) && ((landTileArray[partyUnitArray[currentMovingParty].myAssignment].player == landTileArray[_local2].player)))){
partyDefendChoicesArray.push(landTileArray[_local2].myArrayNumber);
};
_local2++;
};
};
if (partyDefendChoicesArray.length <= 0){
_local3 = 0;
while (_local3 < landTileArray.length) {
if ((((landTileArray[_local3].hasGatherer == true)) && (!((landTileArray[_local3].player == currentTurn))))){
partyDefendChoicesArray.push(landTileArray[_local3].myArrayNumber);
};
_local3++;
};
};
if (partyDefendChoicesArray.length >= 1){
expandPartyMaxRoll = (partyDefendChoicesArray.length - 1);
expandPartyMaxRoll = int(((expandPartyMaxRoll * Math.random()) + 0.4));
if (expandPartyMaxRoll > (partyDefendChoicesArray.length - 1)){
expandPartyMaxRoll = (partyDefendChoicesArray.length - 1);
};
expandPartyMaxRoll = partyDefendChoicesArray[expandPartyMaxRoll];
while (partyDefendChoicesArray.length >= 1) {
partyDefendChoicesArray.splice(0);
};
landTileArray[partyUnitArray[currentMovingParty].myAssignment].partyAssignedOffensive = false;
landTileArray[expandPartyMaxRoll].partyAssignedOffensive = true;
partyUnitArray[currentMovingParty].myAssignment = expandPartyMaxRoll;
attackerChosenTile = partyUnitArray[movingUnit].myAssignment;
newMovingUnit = true;
};
};
if (newMovingUnit == true){
newMovingUnit = false;
while (landCheckPointBestPathArray.length >= 1) {
landCheckPointBestPathArray.splice(0);
};
while (landCheckPointArray.length >= 1) {
landCheckPointArray.splice(0);
};
_local4 = 0;
while (_local4 < landTileArray.length) {
landTileArray[_local4].tileChecked = false;
landTileArray[_local4].walk = true;
_local4++;
};
attackerPathFindTile();
chan_soundFX = snd_moveunit.play(0, 0, snd_FXVolume);
} else {
if (landCheckPointBestPathArray[(landCheckPointBestPathArray.length - 1)].myArrayNumber == partyUnitArray[movingUnit].myIndirectPath){
while (landCheckPointBestPathArray.length >= 1) {
landCheckPointBestPathArray.splice(0);
};
while (landCheckPointArray.length >= 1) {
landCheckPointArray.splice(0);
};
_local5 = 0;
while (_local5 < landTileArray.length) {
landTileArray[_local5].tileChecked = false;
landTileArray[_local5].walk = true;
_local5++;
};
attackerPathFindTile();
trace("INSIDE");
};
};
trace(((landCheckPointBestPathArray[(landCheckPointBestPathArray.length - 1)].myArrayNumber + " ") + partyUnitArray[movingUnit].myIndirectPath));
if ((((((((((landCheckPointBestPathArray[(landCheckPointBestPathArray.length - 1)].party1 >= 1)) || ((((landCheckPointBestPathArray[(landCheckPointBestPathArray.length - 1)].party2 >= 1)) && (!((currentTurn == 2))))))) || ((((landCheckPointBestPathArray[(landCheckPointBestPathArray.length - 1)].party3 >= 1)) && (!((currentTurn == 3))))))) || ((((landCheckPointBestPathArray[(landCheckPointBestPathArray.length - 1)].party4 >= 1)) && (!((currentTurn == 4))))))) || ((((landCheckPointBestPathArray[(landCheckPointBestPathArray.length - 1)].party5 >= 1)) && (!((currentTurn == 5))))))){
if (landCheckPointBestPathArray[(landCheckPointBestPathArray.length - 1)].party1 >= 1){
enemyPartyDetected = partyUnitArray1;
} else {
if ((((landCheckPointBestPathArray[(landCheckPointBestPathArray.length - 1)].party2 >= 1)) && (!((currentTurn == 2))))){
enemyPartyDetected = partyUnitArray2;
} else {
if ((((landCheckPointBestPathArray[(landCheckPointBestPathArray.length - 1)].party3 >= 1)) && (!((currentTurn == 3))))){
enemyPartyDetected = partyUnitArray3;
} else {
if ((((landCheckPointBestPathArray[(landCheckPointBestPathArray.length - 1)].party4 >= 1)) && (!((currentTurn == 4))))){
enemyPartyDetected = partyUnitArray4;
} else {
if ((((landCheckPointBestPathArray[(landCheckPointBestPathArray.length - 1)].party5 >= 1)) && (!((currentTurn == 5))))){
enemyPartyDetected = partyUnitArray5;
};
};
};
};
};
attackerUnit = partyUnitArray[movingUnit].myArrayNumber;
attackerKingdom = currentTurn;
tileAttacked = landCheckPointBestPathArray[(landCheckPointBestPathArray.length - 1)].myArrayNumber;
partyBattleShowAttackers();
} else {
if (partyUnitArray[currentMovingParty].movesLeft > 0){
turnPartyLedOff();
if (currentTurn == 2){
landTileArray[partyUnitArray[currentMovingParty].partyCurrentTile].party2 = (landTileArray[partyUnitArray[currentMovingParty].partyCurrentTile].party2 - 1);
} else {
if (currentTurn == 3){
landTileArray[partyUnitArray[currentMovingParty].partyCurrentTile].party3 = (landTileArray[partyUnitArray[currentMovingParty].partyCurrentTile].party3 - 1);
} else {
if (currentTurn == 4){
landTileArray[partyUnitArray[currentMovingParty].partyCurrentTile].party4 = (landTileArray[partyUnitArray[currentMovingParty].partyCurrentTile].party4 - 1);
} else {
if (currentTurn == 5){
landTileArray[partyUnitArray[currentMovingParty].partyCurrentTile].party5 = (landTileArray[partyUnitArray[currentMovingParty].partyCurrentTile].party5 - 1);
};
};
};
};
if ((((((((landTileArray[partyUnitArray[currentMovingParty].partyCurrentTile].player == 3)) && ((landCheckPointBestPathArray[(landCheckPointBestPathArray.length - 1)].player == 1)))) || ((((landTileArray[partyUnitArray[currentMovingParty].partyCurrentTile].player == 4)) && ((landCheckPointBestPathArray[(landCheckPointBestPathArray.length - 1)].player == 2)))))) || (((landCheckPointBestPathArray[(landCheckPointBestPathArray.length - 1)].myArrayNumber + 1) == partyUnitArray[currentMovingParty].partyCurrentTile)))){
partyUnitArray[currentMovingParty].rotation = 0;
};
if ((((((((landTileArray[partyUnitArray[currentMovingParty].partyCurrentTile].player == 1)) && ((landCheckPointBestPathArray[(landCheckPointBestPathArray.length - 1)].player == 3)))) || ((((landTileArray[partyUnitArray[currentMovingParty].partyCurrentTile].player == 2)) && ((landCheckPointBestPathArray[(landCheckPointBestPathArray.length - 1)].player == 4)))))) || (((landCheckPointBestPathArray[(landCheckPointBestPathArray.length - 1)].myArrayNumber - 1) == partyUnitArray[currentMovingParty].partyCurrentTile)))){
partyUnitArray[currentMovingParty].rotation = 180;
};
if (((landCheckPointBestPathArray[(landCheckPointBestPathArray.length - 1)].myArrayNumber - 6) - (verticalGridCounter / 2)) == partyUnitArray[currentMovingParty].partyCurrentTile){
partyUnitArray[currentMovingParty].rotation = 90;
};
if (((landCheckPointBestPathArray[(landCheckPointBestPathArray.length - 1)].myArrayNumber + 6) + (verticalGridCounter / 2)) == partyUnitArray[currentMovingParty].partyCurrentTile){
partyUnitArray[currentMovingParty].rotation = -90;
};
partyUnitArray[currentMovingParty].myBackTrack = partyUnitArray[currentMovingParty].partyCurrentTile;
if (partyUnitArray[currentMovingParty].movesLeft == 2){
partyUnitArray[currentMovingParty].myBackTrack2 = partyUnitArray[currentMovingParty].partyCurrentTile;
};
if (partyUnitArray[currentMovingParty].movesLeft == 3){
partyUnitArray[currentMovingParty].myBackTrack3 = partyUnitArray[currentMovingParty].partyCurrentTile;
};
if (partyUnitArray[currentMovingParty].movesLeft == 4){
partyUnitArray[currentMovingParty].myBackTrack4 = partyUnitArray[currentMovingParty].partyCurrentTile;
};
partyUnitArray[currentMovingParty].partyCurrentTile = landCheckPointBestPathArray[(landCheckPointBestPathArray.length - 1)].myArrayNumber;
firstMoveRight = false;
firstMoveLeft = false;
firstMoveUp = false;
firstMoveDown = false;
slideToX = landCheckPointBestPathArray[(landCheckPointBestPathArray.length - 1)].x;
slideToY = landCheckPointBestPathArray[(landCheckPointBestPathArray.length - 1)].y;
landCheckPointBestPathArray.splice((landCheckPointBestPathArray.length - 1), 1);
if (currentTurn == 2){
landTileArray[partyUnitArray[currentMovingParty].partyCurrentTile].party2 = (landTileArray[partyUnitArray[currentMovingParty].partyCurrentTile].party2 + 1);
} else {
if (currentTurn == 3){
landTileArray[partyUnitArray[currentMovingParty].partyCurrentTile].party3 = (landTileArray[partyUnitArray[currentMovingParty].partyCurrentTile].party3 + 1);
} else {
if (currentTurn == 4){
landTileArray[partyUnitArray[currentMovingParty].partyCurrentTile].party4 = (landTileArray[partyUnitArray[currentMovingParty].partyCurrentTile].party4 + 1);
} else {
if (currentTurn == 5){
landTileArray[partyUnitArray[currentMovingParty].partyCurrentTile].party5 = (landTileArray[partyUnitArray[currentMovingParty].partyCurrentTile].party5 + 1);
};
};
};
};
partyUnitArray[currentMovingParty].movesLeft = (partyUnitArray[currentMovingParty].movesLeft - 1);
firstMoveRight = false;
firstMoveLeft = false;
firstMoveUp = false;
firstMoveDown = false;
turnPartyLedOn();
TimerSlidePartyUnit.start();
} else {
TimerAnimatePieces.start();
};
};
} else {
TimerAnimatePieces.start();
};
}
public function defensiveStance(_arg1:MouseEvent):void{
var _local2:uint;
if ((((((((((((((((((((((learningWhilePlaying == false)) || ((learnAsYouPlayToolTip.currentFrame >= 9)))) && ((gameOver == false)))) && ((slidingUnit == false)))) && ((player1UnderCombat == false)))) && ((allowPlayerToMoveUnit == true)))) && ((currentTurn == 1)))) && (!((landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].noMansLand == true))))) && ((landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].player == 1)))) && (!((landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].defensiveUnit == true))))) && (!((landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].startBuildTile == true))))){
chan_soundFX = snd_defensive_stance.play(0, 0, snd_DefensiveStanceVolume);
partyUnitArray1[currentUnitPlayerMoves].movesLeft = 0;
playerMovesLeftText.playerMovesLeftTextMoves.text = ("" + 0);
landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].defensiveUnit = true;
landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].defensiveUnitReference = partyUnitArray1[currentUnitPlayerMoves].myArrayNumber;
landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].defensiveUnitRotation = partyUnitArray1[currentUnitPlayerMoves].rotation;
partyUnitArray1[currentUnitPlayerMoves].defensiveUnit = true;
npcDefenseStanceGraphicsOff();
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(playerMovesLeftText, (getChildIndex(escapeMenu) - 1));
setChildIndex(wallSlotArray[landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].leftWall], (getChildIndex(escapeMenu) - 1));
setChildIndex(wallSlotArray[landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].rightWall], (getChildIndex(escapeMenu) - 1));
setChildIndex(wallSlotArray[landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].upWall], (getChildIndex(escapeMenu) - 1));
setChildIndex(wallSlotArray[landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].bottomWall], (getChildIndex(escapeMenu) - 1));
_local2 = 0;
while (_local2 < allGathererUnitArray.length) {
setChildIndex(learnAsYouPlayToolTip, (getChildIndex(escapeMenu) - 1));
setChildIndex(btn_chooseCivExpansion, (getChildIndex(learnAsYouPlayToolTip) - 1));
setChildIndex(tutoMiniBox4, (getChildIndex(escapeMenu) - 1));
setChildIndex(tutoMiniBox5, (getChildIndex(escapeMenu) - 1));
setChildIndex(tutoMiniBox7, (getChildIndex(escapeMenu) - 1));
setChildIndex(tutoMiniBox72, (getChildIndex(escapeMenu) - 1));
setChildIndex(tutoMiniBox8, (getChildIndex(escapeMenu) - 1));
setChildIndex(tutoMiniBox82, (getChildIndex(escapeMenu) - 1));
setChildIndex(tutoMiniBox9, (getChildIndex(escapeMenu) - 1));
setChildIndex(tutoMiniBox10, (getChildIndex(escapeMenu) - 1));
setChildIndex(tutoMiniBox11, (getChildIndex(escapeMenu) - 1));
setChildIndex(allGathererUnitArray[_local2], (getChildIndex(btn_chooseCivExpansion) - 1));
_local2++;
};
};
}
public function cancelConstructionMode():void{
player1PlaceGathererMode = false;
player1PlaceWallMode = false;
allowPlayerToMoveUnit = false;
constructorModeMouse.visible = false;
playerMovesLeftText.visible = false;
Mouse.show();
}
public function allowConstructionMode():void{
statusBar.visible = false;
allowPlayerToMoveUnit = false;
playerHideMoveText();
Mouse.hide();
constructorModeMouse.visible = true;
player1PlaceWallMode = true;
player1PlaceGathererMode = true;
}
public function buttonTooltipHide(_arg1:MouseEvent):void{
buttonTooltip.visible = false;
}
public function buttonTooltipWallPlace(_arg1:MouseEvent):void{
buttonTooltip.buttonTooltipText.text = "Place walls and activators";
buttonTooltip.insideButtonTooltip.width = 180;
buttonTooltip.visible = true;
}
public function buttonTooltipMenu(_arg1:MouseEvent):void{
buttonTooltip.buttonTooltipText.text = "Menu";
buttonTooltip.insideButtonTooltip.width = 35;
buttonTooltip.visible = true;
}
public function buttonTooltipRaid(_arg1:MouseEvent):void{
buttonTooltip.buttonTooltipText.text = "Deactivate enemy resource";
buttonTooltip.insideButtonTooltip.width = 175;
buttonTooltip.visible = true;
}
public function buttonTooltipRotate(_arg1:MouseEvent):void{
buttonTooltip.buttonTooltipText.text = "Rotate defensive robot";
buttonTooltip.insideButtonTooltip.width = 160;
buttonTooltip.visible = true;
}
public function buttonTooltipEndTurn(_arg1:MouseEvent):void{
buttonTooltip.buttonTooltipText.text = "End turn";
buttonTooltip.insideButtonTooltip.width = 60;
buttonTooltip.visible = true;
}
public function buttonTooltipDefensive(_arg1:MouseEvent):void{
buttonTooltip.buttonTooltipText.text = "Defend";
buttonTooltip.insideButtonTooltip.width = 60;
buttonTooltip.visible = true;
}
public function allowPlayerWallPlace(_arg1:MouseEvent):void{
if ((((((((((((((((((((((((learningWhilePlaying == false)) || ((learnAsYouPlayToolTip.currentFrame >= 7)))) && ((slidingUnit == false)))) && ((player1UnderCombat == false)))) && ((currentTurn == 1)))) && ((player1PlaceWallMode == false)))) && ((p1starterBuildingPlaced == true)))) && ((p1starterGathererPlaced == true)))) && ((player1ChoosingDiceRoll == false)))) && ((player1PlacingGatherer == false)))) && ((player1UnderCombat == false)))) && ((player1Raiding == false)))){
allowConstructionMode();
} else {
if ((((slidingUnit == false)) && ((player1UnderCombat == false)))){
cancelConstructionMode();
};
};
}
public function player1PlaceNewGatherer(_arg1:MouseEvent):void{
if ((((((((((((((((currentTurn == 1)) && ((player1PlaceGathererMode == false)))) && ((p1starterBuildingPlaced == true)))) && ((p1starterGathererPlaced == true)))) && ((player1ChoosingDiceRoll == false)))) && ((player1PlacingGatherer == false)))) && ((player1UnderCombat == false)))) && ((player1Raiding == false)))){
allowConstructionMode();
} else {
cancelConstructionMode();
};
}
public function player1Raid(_arg1:MouseEvent):void{
var _local2:uint;
if ((((((((((((((gameOver == false)) && ((slidingUnit == false)))) && ((player1UnderCombat == false)))) && ((player1PlacingGatherer == false)))) && ((player1Raiding == false)))) && ((allowPlayerToMoveUnit == true)))) && ((currentTurn == 1)))){
turnPartyLedOff();
player1Raiding = true;
if (((!((landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].player == 1))) && ((landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].hasGatherer == true)))){
chan_soundFX = snd_raid.play(0, 0, snd_FXVolume);
landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].hasGatherer = false;
_local2 = 0;
while (_local2 < allGathererUnitArray.length) {
if (allGathererUnitArray[_local2].partyCurrentTile == partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile){
allGathererUnitArray[_local2].visible = false;
};
_local2++;
};
if (landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].resource == 1){
if (landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].player == 1){
p1Gatherers1 = (p1Gatherers1 - 1);
} else {
if (landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].player == 2){
p2Gatherers1 = (p2Gatherers1 - 1);
} else {
if (landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].player == 3){
p3Gatherers1 = (p3Gatherers1 - 1);
} else {
if (landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].player == 4){
p4Gatherers1 = (p4Gatherers1 - 1);
};
};
};
};
} else {
if (landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].resource == 2){
if (landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].player == 1){
p1Gatherers1 = (p1Gatherers1 - 1);
} else {
if (landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].player == 2){
p2Gatherers2 = (p2Gatherers2 - 1);
} else {
if (landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].player == 3){
p3Gatherers2 = (p3Gatherers2 - 1);
} else {
if (landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].player == 4){
p4Gatherers2 = (p4Gatherers2 - 1);
};
};
};
};
} else {
if (landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].resource == 3){
if (landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].player == 1){
p1Gatherers3 = (p1Gatherers3 - 1);
} else {
if (landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].player == 2){
p2Gatherers3 = (p2Gatherers3 - 1);
} else {
if (landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].player == 3){
p3Gatherers3 = (p3Gatherers3 - 1);
} else {
if (landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].player == 4){
p4Gatherers3 = (p4Gatherers3 - 1);
};
};
};
};
} else {
if (landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].resource == 4){
if (landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].player == 1){
p1Gatherers4 = (p1Gatherers4 - 1);
} else {
if (landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].player == 2){
p2Gatherers4 = (p2Gatherers4 - 1);
} else {
if (landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].player == 3){
p3Gatherers4 = (p3Gatherers4 - 1);
} else {
if (landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].player == 4){
p4Gatherers4 = (p4Gatherers4 - 1);
};
};
};
};
};
};
};
};
allowPlayerToMoveUnit = false;
playerHideMoveText();
landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].party1 = (landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].party1 - 1);
removeChild(partyUnitArray1[currentUnitPlayerMoves]);
};
updateGameBars();
gameOverCheck();
};
player1Raiding = false;
}
public function playerAttacksEnemy(_arg1:MouseEvent):void{
if (gameOver == false){
if ((((((((allowPlayerToMoveUnit == true)) && (!((landTileArray[_arg1.target.partyCurrentTile].startBuildTile == true))))) && ((partyUnitArray1[currentUnitPlayerMoves].movesLeft >= 1)))) && (!((partyUnitArray1[currentUnitPlayerMoves].defensiveUnit == true))))){
if (partyUnitArray1.length >= 1){
if (_arg1.target.player == 2){
enemyPartyDetected = partyUnitArray2;
} else {
if (_arg1.target.player == 3){
enemyPartyDetected = partyUnitArray3;
} else {
if (_arg1.target.player == 4){
enemyPartyDetected = partyUnitArray4;
} else {
if (_arg1.target.player == 5){
enemyPartyDetected = partyUnitArray5;
};
};
};
};
partyUnitArray = partyUnitArray1;
tileAttacked = _arg1.target.partyCurrentTile;
attackerUnit = partyUnitArray1[currentUnitPlayerMoves].myArrayNumber;
attackerKingdom = 1;
if ((((landTileArray[_arg1.target.partyCurrentTile].tileRow == (landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].tileRow - 1))) && ((landTileArray[_arg1.target.partyCurrentTile].tileColumn == landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].tileColumn)))){
if (((!((wallSlotArray[landTileArray[_arg1.target.partyCurrentTile].bottomWall].alpha == 1))) || ((wallSlotArray[landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].bottomWall].player == currentTurn)))){
if (player1UnderCombat == false){
player1UnderCombat = true;
partyBattleShowAttackers();
};
};
} else {
if ((((landTileArray[_arg1.target.partyCurrentTile].tileRow == (landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].tileRow + 1))) && ((landTileArray[_arg1.target.partyCurrentTile].tileColumn == landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].tileColumn)))){
if (((!((wallSlotArray[landTileArray[_arg1.target.partyCurrentTile].upWall].alpha == 1))) || ((wallSlotArray[landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].bottomWall].player == currentTurn)))){
if (player1UnderCombat == false){
player1UnderCombat = true;
partyBattleShowAttackers();
};
};
} else {
if (_arg1.target.partyCurrentTile == ((partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile + 6) + (verticalGridCounter / 2))){
if (((!((wallSlotArray[landTileArray[_arg1.target.partyCurrentTile].leftWall].alpha == 1))) || ((wallSlotArray[landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].bottomWall].player == currentTurn)))){
if (player1UnderCombat == false){
player1UnderCombat = true;
partyBattleShowAttackers();
};
};
} else {
if (_arg1.target.partyCurrentTile == ((partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile - 6) - (verticalGridCounter / 2))){
if (((!((wallSlotArray[landTileArray[_arg1.target.partyCurrentTile].rightWall].alpha == 1))) || ((wallSlotArray[landTileArray[partyUnitArray1[currentUnitPlayerMoves].partyCurrentTile].bottomWall].player == currentTurn)))){
if (player1UnderCombat == false){
player1UnderCombat = true;
partyBattleShowAttackers();
};
};
};
};
};
};
};
};
};
}
public function partyBattle():void{
var _local1:Boolean;
defenderDiceRoll = 0;
defenderDiceRoll1 = 0;
defenderDiceRoll2 = 0;
additionalDefendersAttackPower = 0;
additionalDefendingAttackersAttackPower = 0;
attackerDiceRoll = 0;
attackerDiceRoll1 = 0;
attackerDiceRoll2 = 0;
defensiveAttackedFromBehind = false;
_local1 = true;
if (landTileArray[tileAttacked].defensiveUnit == true){
if (partyUnitArray[attackerUnit].partyCurrentTile == landTileArray[(tileAttacked - 1)].myArrayNumber){
if (landTileArray[tileAttacked].defensiveUnitRotation == 0){
defenderAttackPower = partyDefensiveStancePowerVsMelee;
} else {
if (landTileArray[tileAttacked].defensiveUnitRotation == 90){
defenderAttackPower = partyDefensiveStancePowerVsRanged;
} else {
if (landTileArray[tileAttacked].defensiveUnitRotation == 180){
defenderAttackPower = partyDefensiveStancePowerVsMagician;
defensiveAttackedFromBehind = true;
} else {
if (landTileArray[tileAttacked].defensiveUnitRotation == -90){
defenderAttackPower = partyDefensiveStancePowerVsRanged;
};
};
};
};
} else {
if (partyUnitArray[attackerUnit].partyCurrentTile == landTileArray[(tileAttacked + 1)].myArrayNumber){
if (landTileArray[tileAttacked].defensiveUnitRotation == 0){
defenderAttackPower = partyDefensiveStancePowerVsMagician;
defensiveAttackedFromBehind = true;
} else {
if (landTileArray[tileAttacked].defensiveUnitRotation == 90){
defenderAttackPower = partyDefensiveStancePowerVsRanged;
} else {
if (landTileArray[tileAttacked].defensiveUnitRotation == 180){
defenderAttackPower = partyDefensiveStancePowerVsMelee;
} else {
if (landTileArray[tileAttacked].defensiveUnitRotation == -90){
defenderAttackPower = partyDefensiveStancePowerVsRanged;
};
};
};
};
} else {
if (partyUnitArray[attackerUnit].partyCurrentTile == landTileArray[((tileAttacked - 6) - (verticalGridCounter / 2))].myArrayNumber){
if (landTileArray[tileAttacked].defensiveUnitRotation == 0){
defenderAttackPower = partyDefensiveStancePowerVsRanged;
} else {
if (landTileArray[tileAttacked].defensiveUnitRotation == 90){
defenderAttackPower = partyDefensiveStancePowerVsMagician;
defensiveAttackedFromBehind = true;
} else {
if (landTileArray[tileAttacked].defensiveUnitRotation == 180){
defenderAttackPower = partyDefensiveStancePowerVsRanged;
} else {
if (landTileArray[tileAttacked].defensiveUnitRotation == -90){
defenderAttackPower = partyDefensiveStancePowerVsMelee;
};
};
};
};
} else {
if (partyUnitArray[attackerUnit].partyCurrentTile == landTileArray[((tileAttacked + 6) + (verticalGridCounter / 2))].myArrayNumber){
if (landTileArray[tileAttacked].defensiveUnitRotation == 0){
defenderAttackPower = partyDefensiveStancePowerVsRanged;
} else {
if (landTileArray[tileAttacked].defensiveUnitRotation == 90){
defenderAttackPower = partyDefensiveStancePowerVsMelee;
} else {
if (landTileArray[tileAttacked].defensiveUnitRotation == 180){
defenderAttackPower = partyDefensiveStancePowerVsRanged;
} else {
if (landTileArray[tileAttacked].defensiveUnitRotation == -90){
defenderAttackPower = partyDefensiveStancePowerVsMagician;
defensiveAttackedFromBehind = true;
};
};
};
};
};
};
};
};
} else {
defenderAttackPower = partyRegularStancePower;
_local1 = false;
};
if ((((landTileArray[(tileAttacked - 1)].defensiveUnit == true)) && ((landTileArray[(tileAttacked - 1)].tileRow > 0)))){
if (((((!((landTileArray[(tileAttacked - 1)].defensiveUnitRotation == 0))) && ((landTileArray[(tileAttacked - 1)].party1 >= 1)))) && ((landTileArray[tileAttacked].party1 >= 1)))){
additionalDefendersAttackPower = (additionalDefendersAttackPower + defenderAssistAttackPowerBonus);
};
if (((((!((landTileArray[(tileAttacked - 1)].defensiveUnitRotation == 0))) && ((landTileArray[(tileAttacked - 1)].party2 >= 1)))) && ((landTileArray[tileAttacked].party2 >= 1)))){
additionalDefendersAttackPower = (additionalDefendersAttackPower + defenderAssistAttackPowerBonus);
};
if (((((!((landTileArray[(tileAttacked - 1)].defensiveUnitRotation == 0))) && ((landTileArray[(tileAttacked - 1)].party3 >= 1)))) && ((landTileArray[tileAttacked].party3 >= 1)))){
additionalDefendersAttackPower = (additionalDefendersAttackPower + defenderAssistAttackPowerBonus);
};
if (((((!((landTileArray[(tileAttacked - 1)].defensiveUnitRotation == 0))) && ((landTileArray[(tileAttacked - 1)].party4 >= 1)))) && ((landTileArray[tileAttacked].party4 >= 1)))){
additionalDefendersAttackPower = (additionalDefendersAttackPower + defenderAssistAttackPowerBonus);
};
if (((((!((landTileArray[(tileAttacked - 1)].defensiveUnitRotation == 0))) && ((landTileArray[(tileAttacked - 1)].party1 >= 1)))) && ((partyUnitArray[attackerUnit].player == 1)))){
additionalDefendingAttackersAttackPower = (additionalDefendingAttackersAttackPower + defenderAssistAttackPowerBonus);
};
if (((((!((landTileArray[(tileAttacked - 1)].defensiveUnitRotation == 0))) && ((landTileArray[(tileAttacked - 1)].party2 >= 1)))) && ((partyUnitArray[attackerUnit].player == 2)))){
additionalDefendingAttackersAttackPower = (additionalDefendingAttackersAttackPower + defenderAssistAttackPowerBonus);
};
if (((((!((landTileArray[(tileAttacked - 1)].defensiveUnitRotation == 0))) && ((landTileArray[(tileAttacked - 1)].party3 >= 3)))) && ((partyUnitArray[attackerUnit].player == 3)))){
additionalDefendingAttackersAttackPower = (additionalDefendingAttackersAttackPower + defenderAssistAttackPowerBonus);
};
if (((((!((landTileArray[(tileAttacked - 1)].defensiveUnitRotation == 0))) && ((landTileArray[(tileAttacked - 1)].party4 >= 1)))) && ((partyUnitArray[attackerUnit].player == 4)))){
additionalDefendingAttackersAttackPower = (additionalDefendingAttackersAttackPower + defenderAssistAttackPowerBonus);
};
};
if ((((landTileArray[(tileAttacked + 1)].defensiveUnit == true)) && ((landTileArray[(tileAttacked + 1)].tileRow < lowerMostLimit)))){
if (((((!((landTileArray[(tileAttacked + 1)].defensiveUnitRotation == 180))) && ((landTileArray[(tileAttacked + 1)].party1 >= 1)))) && ((landTileArray[tileAttacked].party1 >= 1)))){
additionalDefendersAttackPower = (additionalDefendersAttackPower + defenderAssistAttackPowerBonus);
};
if (((((!((landTileArray[(tileAttacked + 1)].defensiveUnitRotation == 180))) && ((landTileArray[(tileAttacked + 1)].party2 >= 1)))) && ((landTileArray[tileAttacked].party2 >= 1)))){
additionalDefendersAttackPower = (additionalDefendersAttackPower + defenderAssistAttackPowerBonus);
};
if (((((!((landTileArray[(tileAttacked + 1)].defensiveUnitRotation == 180))) && ((landTileArray[(tileAttacked + 1)].party3 >= 1)))) && ((landTileArray[tileAttacked].party3 >= 1)))){
additionalDefendersAttackPower = (additionalDefendersAttackPower + defenderAssistAttackPowerBonus);
};
if (((((!((landTileArray[(tileAttacked + 1)].defensiveUnitRotation == 180))) && ((landTileArray[(tileAttacked + 1)].party4 >= 1)))) && ((landTileArray[tileAttacked].party4 >= 1)))){
additionalDefendersAttackPower = (additionalDefendersAttackPower + defenderAssistAttackPowerBonus);
};
if (((((!((landTileArray[(tileAttacked + 1)].defensiveUnitRotation == 180))) && ((landTileArray[(tileAttacked + 1)].party1 >= 1)))) && ((partyUnitArray[attackerUnit].player == 1)))){
additionalDefendingAttackersAttackPower = (additionalDefendingAttackersAttackPower + defenderAssistAttackPowerBonus);
};
if (((((!((landTileArray[(tileAttacked + 1)].defensiveUnitRotation == 180))) && ((landTileArray[(tileAttacked + 1)].party2 >= 1)))) && ((partyUnitArray[attackerUnit].player == 2)))){
additionalDefendingAttackersAttackPower = (additionalDefendingAttackersAttackPower + defenderAssistAttackPowerBonus);
};
if (((((!((landTileArray[(tileAttacked + 1)].defensiveUnitRotation == 180))) && ((landTileArray[(tileAttacked + 1)].party3 >= 3)))) && ((partyUnitArray[attackerUnit].player == 3)))){
additionalDefendingAttackersAttackPower = (additionalDefendingAttackersAttackPower + defenderAssistAttackPowerBonus);
};
if (((((!((landTileArray[(tileAttacked + 1)].defensiveUnitRotation == 180))) && ((landTileArray[(tileAttacked + 1)].party4 >= 1)))) && ((partyUnitArray[attackerUnit].player == 4)))){
additionalDefendingAttackersAttackPower = (additionalDefendingAttackersAttackPower + defenderAssistAttackPowerBonus);
};
};
if ((((landTileArray[((tileAttacked - 6) - (verticalGridCounter / 2))].defensiveUnit == true)) && ((landTileArray[((tileAttacked - 6) - (verticalGridCounter / 2))].tileColumn > 0)))){
if (((((!((landTileArray[((tileAttacked - 6) - (verticalGridCounter / 2))].defensiveUnitRotation == -90))) && ((landTileArray[((tileAttacked - 6) - (verticalGridCounter / 2))].party1 >= 1)))) && ((landTileArray[tileAttacked].party1 >= 1)))){
additionalDefendersAttackPower = (additionalDefendersAttackPower + defenderAssistAttackPowerBonus);
};
if (((((!((landTileArray[((tileAttacked - 6) - (verticalGridCounter / 2))].defensiveUnitRotation == -90))) && ((landTileArray[((tileAttacked - 6) - (verticalGridCounter / 2))].party2 >= 1)))) && ((landTileArray[tileAttacked].party2 >= 1)))){
additionalDefendersAttackPower = (additionalDefendersAttackPower + defenderAssistAttackPowerBonus);
};
if (((((!((landTileArray[((tileAttacked - 6) - (verticalGridCounter / 2))].defensiveUnitRotation == -90))) && ((landTileArray[((tileAttacked - 6) - (verticalGridCounter / 2))].party3 >= 1)))) && ((landTileArray[tileAttacked].party3 >= 1)))){
additionalDefendersAttackPower = (additionalDefendersAttackPower + defenderAssistAttackPowerBonus);
};
if (((((!((landTileArray[((tileAttacked - 6) - (verticalGridCounter / 2))].defensiveUnitRotation == -90))) && ((landTileArray[((tileAttacked - 6) - (verticalGridCounter / 2))].party4 >= 1)))) && ((landTileArray[tileAttacked].party4 >= 1)))){
additionalDefendersAttackPower = (additionalDefendersAttackPower + defenderAssistAttackPowerBonus);
};
if (((((!((landTileArray[((tileAttacked - 6) - (verticalGridCounter / 2))].defensiveUnitRotation == -90))) && ((landTileArray[((tileAttacked - 6) - (verticalGridCounter / 2))].party1 >= 1)))) && ((partyUnitArray[attackerUnit].player == 1)))){
additionalDefendingAttackersAttackPower = (additionalDefendingAttackersAttackPower + defenderAssistAttackPowerBonus);
};
if (((((!((landTileArray[((tileAttacked - 6) - (verticalGridCounter / 2))].defensiveUnitRotation == -90))) && ((landTileArray[((tileAttacked - 6) - (verticalGridCounter / 2))].party2 >= 1)))) && ((partyUnitArray[attackerUnit].player == 2)))){
additionalDefendingAttackersAttackPower = (additionalDefendingAttackersAttackPower + defenderAssistAttackPowerBonus);
};
if (((((!((landTileArray[((tileAttacked - 6) - (verticalGridCounter / 2))].defensiveUnitRotation == -90))) && ((landTileArray[((tileAttacked - 6) - (verticalGridCounter / 2))].party3 >= 3)))) && ((partyUnitArray[attackerUnit].player == 3)))){
additionalDefendingAttackersAttackPower = (additionalDefendingAttackersAttackPower + defenderAssistAttackPowerBonus);
};
if (((((!((landTileArray[((tileAttacked - 6) - (verticalGridCounter / 2))].defensiveUnitRotation == -90))) && ((landTileArray[((tileAttacked - 6) - (verticalGridCounter / 2))].party4 >= 1)))) && ((partyUnitArray[attackerUnit].player == 4)))){
additionalDefendingAttackersAttackPower = (additionalDefendingAttackersAttackPower + defenderAssistAttackPowerBonus);
};
};
if ((((landTileArray[((tileAttacked + 6) + (verticalGridCounter / 2))].defensiveUnit == true)) && ((landTileArray[((tileAttacked + 6) + (verticalGridCounter / 2))].tileColumn < rightMostLimit)))){
if (((((!((landTileArray[((tileAttacked + 6) + (verticalGridCounter / 2))].defensiveUnitRotation == 90))) && ((landTileArray[((tileAttacked + 6) + (verticalGridCounter / 2))].party1 >= 1)))) && ((landTileArray[tileAttacked].party1 >= 1)))){
additionalDefendersAttackPower = (additionalDefendersAttackPower + defenderAssistAttackPowerBonus);
};
if (((((!((landTileArray[((tileAttacked + 6) + (verticalGridCounter / 2))].defensiveUnitRotation == 90))) && ((landTileArray[((tileAttacked + 6) + (verticalGridCounter / 2))].party2 >= 1)))) && ((landTileArray[tileAttacked].party2 >= 1)))){
additionalDefendersAttackPower = (additionalDefendersAttackPower + defenderAssistAttackPowerBonus);
};
if (((((!((landTileArray[((tileAttacked + 6) + (verticalGridCounter / 2))].defensiveUnitRotation == 90))) && ((landTileArray[((tileAttacked + 6) + (verticalGridCounter / 2))].party3 >= 1)))) && ((landTileArray[tileAttacked].party3 >= 1)))){
additionalDefendersAttackPower = (additionalDefendersAttackPower + defenderAssistAttackPowerBonus);
};
if (((((!((landTileArray[((tileAttacked + 6) + (verticalGridCounter / 2))].defensiveUnitRotation == 90))) && ((landTileArray[((tileAttacked + 6) + (verticalGridCounter / 2))].party4 >= 1)))) && ((landTileArray[tileAttacked].party4 >= 1)))){
additionalDefendersAttackPower = (additionalDefendersAttackPower + defenderAssistAttackPowerBonus);
};
if (((((!((landTileArray[((tileAttacked + 6) + (verticalGridCounter / 2))].defensiveUnitRotation == 90))) && ((landTileArray[((tileAttacked + 6) + (verticalGridCounter / 2))].party1 >= 1)))) && ((partyUnitArray[attackerUnit].player == 1)))){
additionalDefendingAttackersAttackPower = (additionalDefendingAttackersAttackPower + defenderAssistAttackPowerBonus);
};
if (((((!((landTileArray[((tileAttacked + 6) + (verticalGridCounter / 2))].defensiveUnitRotation == 90))) && ((landTileArray[((tileAttacked + 6) + (verticalGridCounter / 2))].party2 >= 1)))) && ((partyUnitArray[attackerUnit].player == 2)))){
additionalDefendingAttackersAttackPower = (additionalDefendingAttackersAttackPower + defenderAssistAttackPowerBonus);
};
if (((((!((landTileArray[((tileAttacked + 6) + (verticalGridCounter / 2))].defensiveUnitRotation == 90))) && ((landTileArray[((tileAttacked + 6) + (verticalGridCounter / 2))].party3 >= 3)))) && ((partyUnitArray[attackerUnit].player == 3)))){
additionalDefendingAttackersAttackPower = (additionalDefendingAttackersAttackPower + defenderAssistAttackPowerBonus);
};
if (((((!((landTileArray[((tileAttacked + 6) + (verticalGridCounter / 2))].defensiveUnitRotation == 90))) && ((landTileArray[((tileAttacked + 6) + (verticalGridCounter / 2))].party4 >= 1)))) && ((partyUnitArray[attackerUnit].player == 4)))){
additionalDefendingAttackersAttackPower = (additionalDefendingAttackersAttackPower + defenderAssistAttackPowerBonus);
};
};
attackerDiceRoll1 = int(((Math.random() * 6) + 0.6));
attackerDiceRoll2 = int(((Math.random() * 6) + 0.6));
attackerRawRoll = (partyRegularStancePower + additionalDefendingAttackersAttackPower);
if (attackerDiceRoll1 > 6){
attackerDiceRoll1 = 6;
};
if (attackerDiceRoll2 > 6){
attackerDiceRoll2 = 6;
};
if (attackerDiceRoll1 <= 0){
attackerDiceRoll1 = 1;
};
if (attackerDiceRoll2 <= 0){
attackerDiceRoll2 = 1;
};
if (_local1 == true){
attackerRawRoll = (attackerRawRoll + partyInitiativeBonus);
};
if (partyUnitArray[attackerUnit].player == 1){
attackerRawRoll = (attackerRawRoll + p1UpgradePower);
} else {
if (partyUnitArray[attackerUnit].player == 2){
attackerRawRoll = (attackerRawRoll + p2UpgradePower);
} else {
if (partyUnitArray[attackerUnit].player == 3){
attackerRawRoll = (attackerRawRoll + p3UpgradePower);
} else {
if (partyUnitArray[attackerUnit].player == 4){
attackerRawRoll = (attackerRawRoll + p4UpgradePower);
} else {
if (partyUnitArray[attackerUnit].player == 5){
attackerRawRoll = (attackerRawRoll + reaverStr);
};
};
};
};
};
defenderDiceRoll1 = int(((Math.random() * 6) + 0.6));
defenderDiceRoll2 = int(((Math.random() * 6) + 0.6));
defenderRawRoll = (defenderAttackPower + additionalDefendersAttackPower);
if (defenderDiceRoll1 > 6){
defenderDiceRoll1 = 6;
};
if (defenderDiceRoll2 > 6){
defenderDiceRoll2 = 6;
};
if (defenderDiceRoll1 <= 0){
defenderDiceRoll1 = 1;
};
if (defenderDiceRoll2 <= 0){
defenderDiceRoll2 = 1;
};
if (landTileArray[tileAttacked].party1 >= 1){
defenderRawRoll = (defenderRawRoll + p1UpgradePower);
if (landTileArray[tileAttacked].hasGatherer == true){
overClockBonus = (((p1Gatherers1 + p1Gatherers2) + p1Gatherers3) + p1Gatherers4);
if (overClockBonus == 1){
defenderRawRoll = (defenderRawRoll + overclock1);
} else {
if (overClockBonus == 2){
defenderRawRoll = (defenderRawRoll + overclock2);
} else {
if ((((overClockBonus == 3)) || ((overClockBonus == 4)))){
defenderRawRoll = (defenderRawRoll + overclock34);
} else {
if ((((overClockBonus == 5)) || ((overClockBonus == 6)))){
defenderRawRoll = (defenderRawRoll + overclock56);
} else {
if ((((overClockBonus == 7)) || ((overClockBonus == 8)))){
defenderRawRoll = (defenderRawRoll + overclock78);
} else {
if (overClockBonus >= 9){
defenderRawRoll = (defenderRawRoll + overclock9);
};
};
};
};
};
};
};
} else {
if (landTileArray[tileAttacked].party2 >= 1){
defenderRawRoll = (defenderRawRoll + p2UpgradePower);
if (landTileArray[tileAttacked].hasGatherer == true){
overClockBonus = (((p2Gatherers1 + p2Gatherers2) + p2Gatherers3) + p2Gatherers4);
if (overClockBonus == 1){
defenderRawRoll = (defenderRawRoll + overclock1);
} else {
if (overClockBonus == 2){
defenderRawRoll = (defenderRawRoll + overclock2);
} else {
if ((((overClockBonus == 3)) || ((overClockBonus == 4)))){
defenderRawRoll = (defenderRawRoll + overclock34);
} else {
if ((((overClockBonus == 5)) || ((overClockBonus == 6)))){
defenderRawRoll = (defenderRawRoll + overclock56);
} else {
if ((((overClockBonus == 7)) || ((overClockBonus == 8)))){
defenderRawRoll = (defenderRawRoll + overclock78);
} else {
if (overClockBonus >= 9){
defenderRawRoll = (defenderRawRoll + overclock9);
};
};
};
};
};
};
};
} else {
if (landTileArray[tileAttacked].party3 >= 1){
defenderRawRoll = (defenderRawRoll + p3UpgradePower);
if (landTileArray[tileAttacked].hasGatherer == true){
overClockBonus = (((p3Gatherers1 + p3Gatherers2) + p3Gatherers3) + p3Gatherers4);
if (overClockBonus == 1){
defenderRawRoll = (defenderRawRoll + overclock1);
} else {
if (overClockBonus == 2){
defenderRawRoll = (defenderRawRoll + overclock2);
} else {
if ((((overClockBonus == 3)) || ((overClockBonus == 4)))){
defenderRawRoll = (defenderRawRoll + overclock34);
} else {
if ((((overClockBonus == 5)) || ((overClockBonus == 6)))){
defenderRawRoll = (defenderRawRoll + overclock56);
} else {
if ((((overClockBonus == 7)) || ((overClockBonus == 8)))){
defenderRawRoll = (defenderRawRoll + overclock78);
} else {
if (overClockBonus >= 9){
defenderRawRoll = (defenderRawRoll + overclock9);
};
};
};
};
};
};
};
} else {
if (landTileArray[tileAttacked].party4 >= 1){
defenderRawRoll = (defenderRawRoll + p4UpgradePower);
if (landTileArray[tileAttacked].hasGatherer == true){
overClockBonus = (((p4Gatherers1 + p4Gatherers2) + p4Gatherers3) + p4Gatherers4);
if (overClockBonus == 1){
defenderRawRoll = (defenderRawRoll + overclock1);
} else {
if (overClockBonus == 2){
defenderRawRoll = (defenderRawRoll + overclock2);
} else {
if ((((overClockBonus == 3)) || ((overClockBonus == 4)))){
defenderRawRoll = (defenderRawRoll + overclock34);
} else {
if ((((overClockBonus == 5)) || ((overClockBonus == 6)))){
defenderRawRoll = (defenderRawRoll + overclock56);
} else {
if ((((overClockBonus == 7)) || ((overClockBonus == 8)))){
defenderRawRoll = (defenderRawRoll + overclock78);
} else {
if (overClockBonus >= 9){
defenderRawRoll = (defenderRawRoll + overclock9);
};
};
};
};
};
};
};
} else {
if (landTileArray[tileAttacked].party5 >= 1){
defenderRawRoll = (defenderRawRoll + reaverStr);
};
};
};
};
};
if (landTileArray[tileAttacked].player == 1){
combatBar.x = player1Beacon.x;
combatBar.y = player1Beacon.y;
} else {
if (landTileArray[tileAttacked].player == 2){
combatBar.x = player2Beacon.x;
combatBar.y = player2Beacon.y;
} else {
if (landTileArray[tileAttacked].player == 3){
combatBar.x = player3Beacon.x;
combatBar.y = player3Beacon.y;
} else {
if (landTileArray[tileAttacked].player == 4){
combatBar.x = player4Beacon.x;
combatBar.y = player4Beacon.y;
};
};
};
};
attackerDiceRoll = ((attackerRawRoll + attackerDiceRoll1) + attackerDiceRoll2);
defenderDiceRoll = ((defenderRawRoll + defenderDiceRoll1) + defenderDiceRoll2);
if (defensiveAttackedFromBehind == true){
defenderDiceRoll = 0;
};
MovieClip(combatBar.getChildByName("dice1CombatGraphic")).gotoAndStop(attackerDiceRoll1);
MovieClip(combatBar.getChildByName("dice2CombatGraphic")).gotoAndStop(attackerDiceRoll2);
MovieClip(combatBar.getChildByName("dice3CombatGraphic")).gotoAndStop(defenderDiceRoll1);
MovieClip(combatBar.getChildByName("dice4CombatGraphic")).gotoAndStop(defenderDiceRoll2);
if (defensiveAttackedFromBehind == true){
defenderDiceRoll = 0;
defenderRawRoll = 0;
combatBar.vulnerableIndicator.visible = true;
combatBar.combatResultText2.visible = false;
combatBar.combatPowerText2.visible = false;
combatBar.dice3CombatGraphic.visible = false;
combatBar.dice4CombatGraphic.visible = false;
} else {
combatBar.vulnerableIndicator.visible = false;
combatBar.combatResultText2.visible = true;
combatBar.combatPowerText2.visible = true;
combatBar.dice3CombatGraphic.visible = true;
combatBar.dice4CombatGraphic.visible = true;
};
combatBar.combatPowerText1.text = ("+" + attackerRawRoll);
combatBar.combatPowerText2.text = (("" + defenderRawRoll) + "+");
combatBar.combatResultText1.text = ("" + attackerDiceRoll);
combatBar.combatResultText2.text = ("" + defenderDiceRoll);
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(combatBar, (getChildIndex(escapeMenu) - 1));
combatBar.visible = true;
if ((((attackerDiceRoll > defenderDiceRoll)) || ((defensiveAttackedFromBehind == true)))){
chan_soundFX = snd_combat_win.play(0, 0, snd_FXVolume);
} else {
chan_soundFX = snd_combat_lose.play(0, 0, snd_FXVolume);
};
TimerPartyBattleEnd.start();
}
public function partyBattleEnd(_arg1:TimerEvent):void{
var _local2:uint;
var _local3:uint;
combatBar.visible = false;
combatEvidencer.visible = false;
playerMovesLeftText.alpha = 1;
if ((((attackerDiceRoll > defenderDiceRoll)) || ((defensiveAttackedFromBehind == true)))){
turnPartyLedOff();
_local2 = 0;
while (_local2 < enemyPartyDetected.length) {
if (((((!((landTileArray[tileAttacked].defensiveUnit == true))) && (!((enemyPartyDetected[_local2].defensiveUnit == true))))) || ((((landTileArray[tileAttacked].defensiveUnit == true)) && ((enemyPartyDetected[_local2].defensiveUnit == true)))))){
if ((((enemyPartyDetected[_local2].partyCurrentTile == tileAttacked)) && (!((enemyPartyDetected[_local2].deadUnit == true))))){
trace("we are inside combat where its buggy");
if (((!((enemyPartyDetected[_local2].player == 1))) && ((enemyPartyDetected[_local2].imDefensive == true)))){
landTileArray[enemyPartyDetected[_local2].myAssignment].partyAssignedDefensive = false;
};
landTileArray[tileAttacked].defensiveUnit = false;
enemyPartyDetected[_local2].deadUnit = true;
enemyPartyDetected[_local2].visible = false;
if (landTileArray[tileAttacked].party1 >= 1){
allowPlayerToMoveUnit = false;
playerHideMoveText();
landTileArray[tileAttacked].party1 = (landTileArray[tileAttacked].party1 - 1);
} else {
if ((((landTileArray[tileAttacked].party2 >= 1)) && (!((currentTurn == 2))))){
landTileArray[tileAttacked].party2 = (landTileArray[tileAttacked].party2 - 1);
} else {
if ((((landTileArray[tileAttacked].party3 >= 1)) && (!((currentTurn == 3))))){
landTileArray[tileAttacked].party3 = (landTileArray[tileAttacked].party3 - 1);
} else {
if ((((landTileArray[tileAttacked].party4 >= 1)) && (!((currentTurn == 4))))){
landTileArray[tileAttacked].party4 = (landTileArray[tileAttacked].party4 - 1);
} else {
if ((((landTileArray[tileAttacked].party5 >= 1)) && (!((currentTurn == 5))))){
landTileArray[tileAttacked].party5 = (landTileArray[tileAttacked].party5 - 1);
};
};
};
};
};
break;
};
};
_local2++;
};
} else {
turnPartyLedOff();
_local3 = 0;
while (_local3 < landTileArray.length) {
landTileArray[_local3].backTrack = false;
_local3++;
};
if (attackerKingdom == 1){
allowPlayerToMoveUnit = false;
playerHideMoveText();
landTileArray[partyUnitArray1[attackerUnit].partyCurrentTile].party1 = (landTileArray[partyUnitArray1[attackerUnit].partyCurrentTile].party1 - 1);
partyUnitArray1[attackerUnit].deadUnit = true;
removeChild(partyUnitArray1[attackerUnit]);
} else {
if (attackerKingdom == 2){
landTileArray[partyUnitArray2[attackerUnit].myAssignment].partyAssignedOffensive = false;
landTileArray[partyUnitArray2[attackerUnit].partyCurrentTile].party2 = (landTileArray[partyUnitArray2[attackerUnit].partyCurrentTile].party2 - 1);
partyUnitArray2[attackerUnit].visible = false;
partyUnitArray2[attackerUnit].deadUnit = true;
} else {
if (attackerKingdom == 3){
landTileArray[partyUnitArray3[attackerUnit].myAssignment].partyAssignedOffensive = false;
landTileArray[partyUnitArray3[attackerUnit].partyCurrentTile].party3 = (landTileArray[partyUnitArray3[attackerUnit].partyCurrentTile].party3 - 1);
partyUnitArray3[attackerUnit].visible = false;
partyUnitArray3[attackerUnit].deadUnit = true;
} else {
if (attackerKingdom == 4){
landTileArray[partyUnitArray4[attackerUnit].myAssignment].partyAssignedOffensive = false;
landTileArray[partyUnitArray4[attackerUnit].partyCurrentTile].party4 = (landTileArray[partyUnitArray4[attackerUnit].partyCurrentTile].party4 - 1);
partyUnitArray4[attackerUnit].visible = false;
partyUnitArray4[attackerUnit].deadUnit = true;
} else {
if (attackerKingdom == 5){
landTileArray[partyUnitArray5[attackerUnit].myAssignment].partyAssignedOffensive = false;
landTileArray[partyUnitArray5[attackerUnit].partyCurrentTile].party5 = (landTileArray[partyUnitArray5[attackerUnit].partyCurrentTile].party5 - 1);
partyUnitArray5[attackerUnit].visible = false;
partyUnitArray5[attackerUnit].deadUnit = true;
};
};
};
};
};
};
if (currentTurn != 1){
movingUnit = 0;
TimerAnimatePieces.start();
};
updateGameBars();
player1UnderCombat = false;
}
public function gameOverCheck():void{
if (numberOfPlayers == 2){
theEnd.y = 0;
theEnd.x = 0;
endGameFader.y = 0;
endGameFader.x = 0;
precious.x = 0;
precious.y = 0;
} else {
theEnd.y = playerMode4BoardCenterBeacon.y;
theEnd.x = playerMode4BoardCenterBeacon.x;
endGameFader.y = playerMode4BoardCenterBeacon.y;
endGameFader.x = playerMode4BoardCenterBeacon.x;
precious.y = playerMode4BoardCenterBeacon.y;
precious.x = playerMode4BoardCenterBeacon.x;
};
if ((((p1starterGathererPlaced == true)) && (((((p1Gatherers1 + p1Gatherers2) + p1Gatherers3) + p1Gatherers4) == 12)))){
if ((((((totalPlayerTurnsTaken < 30)) && ((exp3Resource1Cost == 10)))) && ((numberOfPlayers == 2)))){
API.unlockMedal("Evolution Rush");
};
if ((((exp3Resource1Cost == 10)) && ((numberOfPlayers == 4)))){
API.unlockMedal("Each robot for himself");
};
API.unlockMedal("I beat extinction");
API.unlockMedal("Way of Peace");
twoTimesInARow = (twoTimesInARow + 1);
if (twoTimesInARow >= 2){
API.unlockMedal("Most precious reward");
};
if ((((numberOfPlayers == 2)) && ((exp3Resource1Cost == 10)))){
if (player1Race == "keeper"){
API.unlockMedal("Keepers");
};
if (player1Race == "builder"){
API.unlockMedal("Hiveminds");
};
if (player1Race == "expander"){
API.unlockMedal("Scibots");
};
if (player1Race == "raider"){
API.unlockMedal("War Machines");
};
};
chan_soundFX = snd_game_Victory.play(0, 0, snd_FXVolume);
gameOver = true;
chan_theme.stop();
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(endGameFader, (getChildIndex(escapeMenu) - 1));
setChildIndex(precious, (getChildIndex(endGameFader) - 1));
setChildIndex(theEnd, (getChildIndex(precious) - 1));
endGameFader.visible = true;
endGameFader.gotoAndPlay(1);
theEnd.gotoAndStop(1);
theEnd.visible = true;
precious.gotoAndPlay(1);
precious.visible = true;
MochiBot.track(this, "b572db69");
} else {
if ((((p1starterGathererPlaced == true)) && (((((p1Gatherers1 + p1Gatherers2) + p1Gatherers3) + p1Gatherers4) == 0)))){
MochiBot.track(this, "6cef50b5");
twoTimesInARow = 0;
gameOver = true;
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(theEnd, (getChildIndex(escapeMenu) - 1));
theEnd.gotoAndStop(2);
theEnd.visible = true;
} else {
if ((((p2starterGathererPlaced == true)) && (((((p2Gatherers1 + p2Gatherers2) + p2Gatherers3) + p2Gatherers4) == 12)))){
MochiBot.track(this, "d12090b9");
twoTimesInARow = 0;
gameOver = true;
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(theEnd, (getChildIndex(escapeMenu) - 1));
theEnd.gotoAndStop(2);
theEnd.visible = true;
} else {
if ((((p3starterGathererPlaced == true)) && (((((p3Gatherers1 + p3Gatherers2) + p3Gatherers3) + p3Gatherers4) == 12)))){
MochiBot.track(this, "d12090b9");
twoTimesInARow = 0;
gameOver = true;
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(theEnd, (getChildIndex(escapeMenu) - 1));
theEnd.gotoAndStop(2);
theEnd.visible = true;
} else {
if ((((p4starterGathererPlaced == true)) && (((((p4Gatherers1 + p4Gatherers2) + p4Gatherers3) + p4Gatherers4) == 12)))){
MochiBot.track(this, "d12090b9");
twoTimesInARow = 0;
gameOver = true;
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(theEnd, (getChildIndex(escapeMenu) - 1));
theEnd.gotoAndStop(2);
theEnd.visible = true;
} else {
if ((((p2starterGathererPlaced == true)) && (((((p2Gatherers1 + p2Gatherers2) + p2Gatherers3) + p2Gatherers4) == 0)))){
p2Extinct = true;
};
if ((((p3starterGathererPlaced == true)) && (((((p3Gatherers1 + p3Gatherers2) + p3Gatherers3) + p3Gatherers4) == 0)))){
p3Extinct = true;
};
if ((((p4starterGathererPlaced == true)) && (((((p4Gatherers1 + p4Gatherers2) + p4Gatherers3) + p4Gatherers4) == 0)))){
p4Extinct = true;
};
if ((((((numberOfPlayers == 2)) && ((p2Extinct == true)))) || ((((((((numberOfPlayers == 4)) && ((p2Extinct == true)))) && ((p3Extinct == true)))) && ((p4Extinct == true)))))){
if ((((((totalPlayerTurnsTaken < 30)) && ((exp3Resource1Cost == 10)))) && ((numberOfPlayers == 2)))){
API.unlockMedal("Evolution Rush");
};
if ((((exp3Resource1Cost == 10)) && ((numberOfPlayers == 4)))){
API.unlockMedal("Each robot for himself");
};
API.unlockMedal("I beat extinction");
if (twoTimesInARow >= 2){
API.unlockMedal("Most precious reward");
};
if ((((numberOfPlayers == 2)) && ((exp3Resource1Cost == 10)))){
if (player1Race == "keeper"){
API.unlockMedal("Keepers");
};
if (player1Race == "builder"){
API.unlockMedal("Hiveminds");
};
if (player1Race == "expander"){
API.unlockMedal("Scibots");
};
if (player1Race == "raider"){
API.unlockMedal("War Machines");
};
};
MochiBot.track(this, "01c2c535");
gameOver = true;
chan_soundFX = snd_game_Victory.play(0, 0, snd_FXVolume);
chan_theme.stop();
setChildIndex(escapeMenu, (numChildren - 1));
setChildIndex(endGameFader, (getChildIndex(escapeMenu) - 1));
setChildIndex(precious, (getChildIndex(endGameFader) - 1));
setChildIndex(theEnd, (getChildIndex(precious) - 1));
endGameFader.visible = true;
endGameFader.gotoAndPlay(1);
theEnd.gotoAndStop(1);
theEnd.visible = true;
precious.gotoAndPlay(1);
precious.visible = true;
};
};
};
};
};
};
}
public function runGameLoop(_arg1:TimerEvent):void{
}
public function overMouse(_arg1:MouseEvent):void{
switch (_arg1.currentTarget){
case monitor:
monitor.gotoAndPlay("_off");
monitor.removeEventListener(MouseEvent.MOUSE_OVER, overMouse);
monitor_status = 0;
snd_monitorSound.play(0, 0, snd_MonitorVolume);
break;
case btn_lin_1:
if (btn_lin_1_status == 0){
btn_lin_1_gfx.gotoAndPlay("_over");
if (!monitor_status){
monitor.gotoAndPlay("_on");
monitor_status = 1;
monitor.addEventListener(MouseEvent.MOUSE_OVER, overMouse);
snd_monitorSound.play(0, 0, snd_MonitorVolume);
};
};
break;
case btn_lin_2:
if (btn_lin_2_status == 0){
btn_lin_2_gfx.gotoAndPlay("_over");
if (!monitor_status){
monitor.gotoAndPlay("_on");
monitor_status = 1;
monitor.addEventListener(MouseEvent.MOUSE_OVER, overMouse);
snd_monitorSound.play(0, 0, snd_MonitorVolume);
};
};
break;
case btn_lin_3:
if (btn_lin_3_status == 0){
btn_lin_3_gfx.gotoAndPlay("_over");
if (!monitor_status){
monitor.gotoAndPlay("_on");
monitor_status = 1;
monitor.addEventListener(MouseEvent.MOUSE_OVER, overMouse);
snd_monitorSound.play(0, 0, snd_MonitorVolume);
};
};
break;
case btn_lin_4:
if (btn_lin_4_status == 0){
btn_lin_4_gfx.gotoAndPlay("_over");
if (!monitor_status){
monitor.gotoAndPlay("_on");
monitor_status = 1;
monitor.addEventListener(MouseEvent.MOUSE_OVER, overMouse);
snd_monitorSound.play(0, 0, snd_MonitorVolume);
};
};
break;
case btn_easy:
if (!btn_easy_status){
btn_easy_gfx.gotoAndPlay("_over");
};
break;
case btn_norm:
if (!btn_norm_status){
btn_norm_gfx.gotoAndPlay("_over");
};
break;
case btn_hard:
if (!btn_hard_status){
btn_hard_gfx.gotoAndPlay("_over");
};
break;
case play_tuto:
play_tuto_gfx.gotoAndPlay("_over");
play_tuto_gfx.darkness.alpha = 0;
break;
case play_2pw:
play_2pw_gfx.gotoAndPlay("_over");
play_2pw_gfx.darkness.alpha = 0;
break;
case play_2pf:
play_2pf_gfx.gotoAndPlay("_over");
play_2pf_gfx.darkness.alpha = 0;
break;
case play_4pf:
play_4pf_gfx.gotoAndPlay("_over");
play_4pf_gfx.darkness.alpha = 0;
break;
};
}
public function outMouse(_arg1:MouseEvent):void{
switch (_arg1.currentTarget){
case btn_lin_1:
if (btn_lin_1_status == 0){
btn_lin_1_gfx.gotoAndPlay("_out");
};
break;
case btn_lin_2:
if (btn_lin_2_status == 0){
btn_lin_2_gfx.gotoAndPlay("_out");
};
break;
case btn_lin_3:
if (btn_lin_3_status == 0){
btn_lin_3_gfx.gotoAndPlay("_out");
};
break;
case btn_lin_4:
if (btn_lin_4_status == 0){
btn_lin_4_gfx.gotoAndPlay("_out");
};
break;
case btn_easy:
if (!btn_easy_status){
btn_easy_gfx.gotoAndPlay("_out");
};
break;
case btn_norm:
if (!btn_norm_status){
btn_norm_gfx.gotoAndPlay("_out");
};
break;
case btn_hard:
if (!btn_hard_status){
btn_hard_gfx.gotoAndPlay("_out");
};
break;
case play_tuto:
play_tuto_gfx.gotoAndPlay("_out");
play_tuto_gfx.darkness.alpha = 0.5;
break;
case play_2pw:
play_2pw_gfx.gotoAndPlay("_out");
play_2pw_gfx.darkness.alpha = 0.5;
break;
case play_2pf:
play_2pf_gfx.gotoAndPlay("_out");
play_2pf_gfx.darkness.alpha = 0.5;
break;
case play_4pf:
play_4pf_gfx.gotoAndPlay("_out");
play_4pf_gfx.darkness.alpha = 0.5;
break;
};
}
public function clickMouse(_arg1:MouseEvent):void{
switch (_arg1.currentTarget){
case btn_lin_1:
if (btn_lin_1_status == 0){
if (btn_lin_2_status){
btn_lin_2_gfx.gotoAndPlay("_out");
btn_lin_2_status = 0;
};
if (btn_lin_3_status){
btn_lin_3_gfx.gotoAndPlay("_out");
btn_lin_3_status = 0;
};
if (btn_lin_4_status){
btn_lin_4_gfx.gotoAndPlay("_out");
btn_lin_4_status = 0;
};
btn_lin_1_gfx.gotoAndPlay("_on");
chan_soundFX = snd_lights.play(0, 0, snd_DiceRoll);
btn_lin_1_status = 1;
};
break;
case btn_lin_2:
if (btn_lin_2_status == 0){
if (btn_lin_1_status){
btn_lin_1_gfx.gotoAndPlay("_out");
btn_lin_1_status = 0;
};
if (btn_lin_3_status){
btn_lin_3_gfx.gotoAndPlay("_out");
btn_lin_3_status = 0;
};
if (btn_lin_4_status){
btn_lin_4_gfx.gotoAndPlay("_out");
btn_lin_4_status = 0;
};
btn_lin_2_gfx.gotoAndPlay("_on");
chan_soundFX = snd_lights.play(0, 0, snd_DiceRoll);
btn_lin_2_status = 1;
};
break;
case btn_lin_3:
if (btn_lin_3_status == 0){
if (btn_lin_1_status){
btn_lin_1_gfx.gotoAndPlay("_out");
btn_lin_1_status = 0;
};
if (btn_lin_2_status){
btn_lin_2_gfx.gotoAndPlay("_out");
btn_lin_2_status = 0;
};
if (btn_lin_4_status){
btn_lin_4_gfx.gotoAndPlay("_out");
btn_lin_4_status = 0;
};
btn_lin_3_gfx.gotoAndPlay("_on");
chan_soundFX = snd_lights.play(0, 0, snd_DiceRoll);
btn_lin_3_status = 1;
};
break;
case btn_lin_4:
if (btn_lin_4_status == 0){
if (btn_lin_1_status){
btn_lin_1_gfx.gotoAndPlay("_out");
btn_lin_1_status = 0;
};
if (btn_lin_3_status){
btn_lin_3_gfx.gotoAndPlay("_out");
btn_lin_3_status = 0;
};
if (btn_lin_2_status){
btn_lin_2_gfx.gotoAndPlay("_out");
btn_lin_2_status = 0;
};
btn_lin_4_gfx.gotoAndPlay("_on");
chan_soundFX = snd_lights.play(0, 0, snd_DiceRoll);
btn_lin_4_status = 1;
};
break;
case btn_easy:
if (!btn_easy_status){
if (btn_norm_status){
btn_norm_gfx.gotoAndPlay("_out");
btn_norm_status = 0;
};
if (btn_hard_status){
btn_hard_gfx.gotoAndPlay("_out");
btn_hard_status = 0;
};
btn_easy_gfx.gotoAndPlay("_on");
trace("here");
chan_soundFX = snd_placewall.play(0, 0, snd_FXVolume);
btn_easy_status = 1;
};
break;
case btn_norm:
if (!btn_norm_status){
if (btn_easy_status){
btn_easy_gfx.gotoAndPlay("_out");
btn_easy_status = 0;
};
if (btn_hard_status){
btn_hard_gfx.gotoAndPlay("_out");
btn_hard_status = 0;
};
btn_norm_gfx.gotoAndPlay("_on");
chan_soundFX = snd_placewall.play(0, 0, snd_FXVolume);
btn_norm_status = 1;
};
break;
case btn_hard:
if (!btn_hard_status){
if (btn_easy_status){
btn_easy_gfx.gotoAndPlay("_out");
btn_easy_status = 0;
};
if (btn_norm_status){
btn_norm_gfx.gotoAndPlay("_out");
btn_norm_status = 0;
};
btn_hard_gfx.gotoAndPlay("_on");
chan_soundFX = snd_placewall.play(0, 0, snd_FXVolume);
btn_hard_status = 1;
};
break;
case play_tuto:
if (((((((!(btn_lin_1_status)) && (!(btn_lin_2_status)))) && (!(btn_lin_3_status)))) && (!(btn_lin_4_status)))){
txt_selection.gotoAndPlay("_on");
};
break;
case play_2pw:
if (((((((!(btn_lin_1_status)) && (!(btn_lin_2_status)))) && (!(btn_lin_3_status)))) && (!(btn_lin_4_status)))){
txt_selection.gotoAndPlay("_on");
};
break;
case play_2pf:
if (((((((!(btn_lin_1_status)) && (!(btn_lin_2_status)))) && (!(btn_lin_3_status)))) && (!(btn_lin_4_status)))){
txt_selection.gotoAndPlay("_on");
};
break;
case play_4pf:
if (((((((!(btn_lin_1_status)) && (!(btn_lin_2_status)))) && (!(btn_lin_3_status)))) && (!(btn_lin_4_status)))){
txt_selection.gotoAndPlay("_on");
};
break;
};
}
function __setProp___id0__Scene1_Title_2(){
if ((((__setPropDict[__id0_] == undefined)) || (!((int(__setPropDict[__id0_]) == 3))))){
__setPropDict[__id0_] = 3;
try {
__id0_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id0_.debugMode = true;
__id0_.encryptionKey = "sDHAfY8yXOlftsE8B7mUxejDhwI6KvGr";
__id0_.movieId = "14574:oeAXUUGO";
__id0_.movieVersion = "";
__id0_.showConnectingPopup = true;
__id0_.useErrorPopup = true;
__id0_.useMedalPopup = true;
try {
__id0_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
};
}
function frame1(){
stage.scaleMode = StageScaleMode.EXACT_FIT;
stage.frameRate = 30;
rightClickMenu = new ContextMenu();
rightClickMenu.builtInItems.forwardAndBack = false;
rightClickMenu.builtInItems.loop = false;
rightClickMenu.builtInItems.play = false;
rightClickMenu.builtInItems.print = false;
rightClickMenu.builtInItems.quality = false;
rightClickMenu.builtInItems.rewind = false;
rightClickMenu.builtInItems.save = false;
rightClickMenu.builtInItems.zoom = false;
contextMenu = rightClickMenu;
MochiAd.showPreGameAd({clip:root, id:"daa8dc37cab707da", res:"684x453", background:0, color:9210500, outline:9210500, no_bg:true, ad_finished:preloaderDone});
}
function frame2(){
this.stop();
stage.addEventListener(MouseEvent.MOUSE_DOWN, continueGame);
setChildIndex(sponsorSplash, (numChildren - 1));
}
function frame3(){
__setProp___id0__Scene1_Title_2();
this.gotoAndStop(3);
GameShedAchievement.Init(this.root, "x_m.z;r8h+-8m");
stage.scaleMode = StageScaleMode.EXACT_FIT;
developedBy = new ContextMenuItem("Developed by Lethe");
sponsoredBy = new ContextMenuItem("Sponsored by GameShed");
rightClickMenu.customItems.push(sponsoredBy);
rightClickMenu.customItems.push(developedBy);
developedBy.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, linkDeveloper);
sponsoredBy.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, linkSponsor);
TimerRunGameLoop = new Timer(1000);
TimerRunGameLoop.addEventListener("timer", runGameLoop);
TimerMoveAttacker = new Timer(1, 1);
TimerMoveAttacker.addEventListener("timer", moveAttacker);
TimerAnimatePieces = new Timer(1, 1);
TimerAnimatePieces.addEventListener("timer", animatePieces);
TimerAnimatePiecesRecursion = new Timer(1, 1);
TimerAnimatePiecesRecursion.addEventListener("timer", animatePiecesRecursion);
TimerNewTurnDelay = new Timer(750, 1);
TimerNewTurnDelay.addEventListener("timer", newTurnDelay);
TimerDiceRollPlaceChoiceDelay = new Timer(2000, 1);
TimerDiceRollPlaceChoiceDelay.addEventListener("timer", diceRollPlaceChoice);
TimerDiceRollGetDelay = new Timer(2000, 1);
TimerDiceRollGetDelay.addEventListener("timer", diceRollGetEnd);
TimerPartyBattleEnd = new Timer(3000, 1);
TimerPartyBattleEnd.addEventListener("timer", partyBattleEnd);
TimerDelayShowNPCUpgrade = new Timer(1);
TimerDelayShowNPCUpgrade.addEventListener("timer", showNPCUpgrade);
TimerSlidePartyUnit = new Timer(15);
TimerSlidePartyUnit.addEventListener("timer", slidePartyUnit);
TimerDelayPlaceStarterBuilding = new Timer(500, 1);
TimerDelayPlaceStarterBuilding.addEventListener("timer", placeStarterBuildingCall);
TimerDelayPlaceStarterBuildingEnd = new Timer(500, 1);
TimerDelayPlaceStarterBuildingEnd.addEventListener("timer", placeStarterBuilding);
TimerDelayPlaceStarterGatherer = new Timer(750, 1);
TimerDelayPlaceStarterGatherer.addEventListener("timer", placeGathererUnitCall);
TimerDelayPlaceStarterGathererEnd = new Timer(500, 1);
TimerDelayPlaceStarterGathererEnd.addEventListener("timer", placeGathererUnit);
TimerShowResearchGet = new Timer(25);
TimerShowResearchGet.addEventListener("timer", showResearchGet);
TimerLongWalk = new Timer(10, 1);
TimerLongWalk.addEventListener("timer", makeTheLongWalk);
TimerShowGathererGet = new Timer(25);
TimerShowGathererGet.addEventListener("timer", showGathererGetFinal);
TimerShowCombatantsEnd = new Timer(1000, 1);
TimerShowCombatantsEnd.addEventListener("timer", partyBattleShowAttackersEnd);
TimerShowProducingResource = new Timer(25);
TimerShowProducingResource.addEventListener("timer", showProduceResource);
TimerFadeAndStartNewgame = new Timer(3000, 1);
TimerFadeAndStartNewgame.addEventListener("timer", beginNewGameAfterFade);
TimerAnimateTutorial = new Timer(25);
TimerAnimateTutorial.addEventListener("timer", animateTutorial);
TimerTutorialAfterIntro = new Timer(1000);
TimerTutorialAfterIntro.addEventListener("timer", beginTutorialAfterExplanation);
resourcesPerTurn = 1;
startingUnitQtt = 4;
startingWallQtt = 3;
startingGathererQtt = 1;
exp1Resource1Cost = 0;
exp1Resource2Cost = 0;
exp1Resource3Cost = 0;
exp1Resource4Cost = 30;
exp4Resource1Cost = 0;
exp4Resource2Cost = 0;
exp4Resource3Cost = 0;
exp4Resource4Cost = 6;
numberOfMindEvolutions = 19;
exp5Resource1Cost = 0;
exp5Resource2Cost = 0;
exp5Resource3Cost = 0;
exp5Resource4Cost = 20;
exp2Resource1Cost = 0;
exp2Resource2Cost = 12;
exp2Resource3Cost = 0;
exp2Resource4Cost = 0;
exp3Resource1Cost = 10;
exp3Resource2Cost = 0;
exp3Resource3Cost = 0;
exp3Resource4Cost = 0;
exp6Resource1Cost = 0;
exp6Resource2Cost = 8;
exp6Resource3Cost = 15;
exp6Resource4Cost = 0;
KeeperResourceDiscount = 2;
KeeperAttackPenalty = 5;
ScibotEvolutionDiscount = 10;
BuilderWallDiscount = 3;
WarAttackDiscount = 5;
WarBuildingPenalty = 3;
KeeperAdditionalGatherer = 1;
ScibotStartingResearch = 10;
BuilderExtraWalls = 1;
WarStartingAttack = 1;
partyUnitMaxMoves = 5;
partyRegularStancePower = 2;
partyInitiativeBonus = 3;
reaverStr = 3;
reaversMostWait = 25;
overclock1 = 5;
overclock2 = 4;
overclock34 = 3;
overclock56 = 2;
overclock78 = 1;
overclock9 = 0;
partyDefensiveStancePowerVsMelee = 3;
partyDefensiveStancePowerVsRanged = 2;
partyDefensiveStancePowerVsMagician = 0;
defenderAssistAttackPowerBonus = 1;
partyUnitWidth = 30;
partyUnitHeight = 30;
slideMoveSpeedNormal = 2.5;
slideMoveSpeedFast = 4;
tileWidth = 32;
tileHeight = 33;
tileXSpacing = 38;
tileYSpacing = 38;
landGridNumberHorizontal = 9;
landGridNumberVertical = 10;
quantityResources = 3;
quantityBlockedTiles = 2;
quantityAdditionalBlockedTiles = 20;
additionalBlockTileChance = 0.4;
tilesPerPlaceable = 4;
player1XSpacing = -20;
player1YSpacing = 51;
player2XSpacing = 324;
player2YSpacing = 51;
player3XSpacing = 0;
player3YSpacing = 430;
player4XSpacing = 350;
player4YSpacing = 430;
leadSlotSpacing = -20;
slotLeftSpacing = -20;
slotBottomSpacing = 20;
endingleadSlotSpacing = 20;
starterBuildingWidth = 25;
starterBuildingHeight = 25;
gathererUnitWidth = 25;
gathererUnitHeight = 25;
numberOfPlayers = 4;
player1Race = "unassigned";
player2Race = "Moonanite";
player3Race = "Weaver's Guild";
player4Race = "Sardaukar";
tileXSpacingCounter = 0;
tileYSpacingCounter = 0;
currentPlayerXSpacing = 0;
currentPlayerYSpacing = 0;
verticalGridCounter = 0;
attackerChosenTile = 0;
attackerCurrentTile = 0;
rightMostLimit = 0;
lowerMostLimit = 0;
landTileResource1Placed = 0;
landTileResource2Placed = 0;
landTileResource3Placed = 0;
landTileResource4Placed = 0;
blockTilesPlaced = 0;
additionalBlockTilesPlaced = 0;
resourceRandomizer = 0;
turnOrder = 0;
currentTurn = 0;
startingTurnPlayer = 0;
p1starterBuildingPlaced = false;
p2starterBuildingPlaced = false;
p3starterBuildingPlaced = false;
p4starterBuildingPlaced = false;
p1StarterBuildingTile = 0;
p2StarterBuildingTile = 0;
p3StarterBuildingTile = 0;
p4StarterBuildingTile = 0;
starterBuildingTile = 0;
p1starterGathererPlaced = false;
p2starterGathererPlaced = false;
p3starterGathererPlaced = false;
p4starterGathererPlaced = false;
currentUnitPlayerMoves = 0;
allowPlayerToMoveUnit = false;
tileFilledRoll = false;
tileNumberRoll = 1;
tileBlankPlaced = 0;
topChoiceTileScore = 0;
besttopChoiceTileScore = 0;
plcModifier = 0;
plcCurrent = 0;
chosenResource = 0;
currentChosenGatherTile = 0;
player2ChosenGatherTile = 0;
player3ChosenGatherTile = 0;
player4ChosenGatherTile = 0;
skipBestTileCheck = false;
randomStarterBuildingTile = 0;
p1Resource1Qtt = 0;
p1Resource2Qtt = 0;
p1Resource3Qtt = 0;
p1Resource4Qtt = 0;
p1UnitQtt = 0;
p1WallQtt = 0;
p1GathererQtt = 0;
p2Resource1Qtt = 0;
p2Resource2Qtt = 0;
p2Resource3Qtt = 0;
p2Resource4Qtt = 0;
p2UnitQtt = 0;
p2WallQtt = 0;
p2GathererQtt = 0;
p3Resource1Qtt = 0;
p3Resource2Qtt = 0;
p3Resource3Qtt = 0;
p3Resource4Qtt = 0;
p3UnitQtt = 0;
p3WallQtt = 0;
p3GathererQtt = 0;
p4Resource1Qtt = 0;
p4Resource2Qtt = 0;
p4Resource3Qtt = 0;
p4Resource4Qtt = 0;
p4UnitQtt = 0;
p4WallQtt = 0;
p4GathererQtt = 0;
Resource1Qtt = 0;
Resource2Qtt = 0;
Resource3Qtt = 0;
Resource4Qtt = 0;
wallQtt = 0;
UnitQtt = 0;
dice1 = 0;
dice2 = 0;
diceCombined = 0;
rolledResource = 0;
p2ProtectResource = 0;
p3ProtectResource = 0;
p4ProtectResource = 0;
p2WallExpandCheckpoint = 0;
p3WallExpandCheckpoint = 0;
p4WallExpandCheckpoint = 0;
expandWallMaxRoll = 0;
expandPartyMaxRoll = 0;
endWallExpansion = false;
endPartyAssignments = false;
protectResourceCheck = 0;
resourceQttCheck = 0;
currentMovingParty = 0;
movingUnit = 0;
tileAttacked = 0;
attackerUnit = 0;
attackerKingdom = 0;
attackerDiceRoll = 0;
attackerDiceRoll1 = 0;
attackerDiceRoll2 = 0;
defenderDiceRoll = 0;
defenderDiceRoll1 = 0;
defenderDiceRoll2 = 0;
defenderAttackPower = 0;
additionalDefendersAttackPower = 0;
additionalDefendingAttackersAttackPower = 0;
player2Aggro = 1;
player3Aggro = 0;
player4Aggro = 0;
playerAggro = 0;
exposedGatherer = false;
lastTileKingdom1 = 0;
firstTileKingdom3 = 0;
kingdom1ToKingdom3TileDifference = 0;
player1DiceRollChoice = 0;
player2DiceRollChoice = 0;
player3DiceRollChoice = 0;
player4DiceRollChoice = 0;
playerDiceRollChoice = 0;
blankTurnOver = false;
blankTurnsTaken = 0;
civExpandChoice = 0;
p2ResourceToExpand = 0;
p3ResourceToExpand = 0;
p4ResourceToExpand = 0;
timeToPlaceNewGatherer = false;
resourceToExpand = 0;
newGathererTobePlaced = 0;
p1Gatherers1 = 0;
p1Gatherers2 = 0;
p1Gatherers3 = 0;
p1Gatherers4 = 0;
p2Gatherers1 = 0;
p2Gatherers2 = 0;
p2Gatherers3 = 0;
p2Gatherers4 = 0;
p3Gatherers1 = 0;
p3Gatherers2 = 0;
p3Gatherers3 = 0;
p3Gatherers4 = 0;
p4Gatherers1 = 0;
p4Gatherers2 = 0;
p4Gatherers3 = 0;
p4Gatherers4 = 0;
chooseAnyResourceToGather = false;
gathererDistanceScore = 0;
minimumGathererDistanceScore = 0;
chosenMinimumGathererScore = 0;
unitWithMostMoves = 0;
player1NewGathererTile = 0;
exceptionCloseCheckWall = 0;
xmoveTextModifier = 0;
ymoveTextModifier = 0;
attackerRawRoll = 0;
defenderRawRoll = 0;
civChoiceMaxRoll = 0;
diceChoiceMaxroll = 0;
newMovingUnit = true;
reactivateGatherer = false;
p1UpgradePower = 0;
p2UpgradePower = 0;
p3UpgradePower = 0;
p4UpgradePower = 0;
p1UpgradeSpeed = 0;
p2UpgradeSpeed = 0;
p3UpgradeSpeed = 0;
p4UpgradeSpeed = 0;
p1UpgradeRoll = 0;
p2UpgradeRoll = 0;
p3UpgradeRoll = 0;
p4UpgradeRoll = 0;
p1UpgradeGatherer = 0;
p2UpgradeGatherer = 0;
p3UpgradeGatherer = 0;
p4UpgradeGatherer = 0;
mindUpgradeRandomChoice = 0;
dicesDisplayXMod = 0;
dicesDisplayYMod = 0;
npcBoughMindUpgrade = false;
slideToX = 0;
slideToY = 0;
slidingUnit = false;
wallLoopCheck = 0;
player1PlaceGathererMode = false;
player1PlaceWallMode = false;
learningWhilePlaying = false;
reaversComingCount = 0;
overClockBonus = 0;
tilesDifference = 0;
failLongWalk = false;
hw = 0;
hw2 = 0;
longWalkSliding = false;
tempLongwalkOrientation = 0;
allowP1UpGradeBuy = false;
longWalkPartyCurrentTile = 0;
failedWallInsertion = false;
riseTo = 0;
riseTo2 = 0;
gameOver = false;
whenReaversCome = 0;
whenReaversComeTemp = 0;
p2Extinct = false;
p3Extinct = false;
p4Extinct = false;
p2NoLongerPlaying = false;
p3NoLongerPlaying = false;
p4NoLongerPlaying = false;
exctinctRaceNoMovesLeft = false;
reaversDontMove = false;
attackOnceForTutorial = false;
slideMoveSpeed = slideMoveSpeedNormal;
escapeMenu.changeRobotSpeed.gotoAndStop(1);
totalPlayerTurnsTaken = 0;
giveUpgradeAchievement = false;
giveUpgradeAchievementSecretOoze = false;
twoTimesInARow = 0;
balanceGathererCost2 = exp6Resource2Cost;
balanceGathererCost3 = exp6Resource3Cost;
balanceAttackCost = exp1Resource4Cost;
balanceEvolutionCost = exp5Resource4Cost;
balanceWallCost = exp2Resource2Cost;
civAttackRaceModifier = 0;
civWallRaceModifier = 0;
civEvolutionRaceModifier = 0;
civGathererRaceModifier = 0;
currentWall = 0;
wallToBePlaced = 0;
numberOfWallSteps = 0;
allPathsChecked = false;
exceptionFirstWall = 0;
exceptionLastWall = 0;
exceptionArrayTest = false;
exeptionArrayPosition = 0;
defensiveAttackedFromBehind = false;
firstMoveRight = false;
firstMoveLeft = false;
firstMoveUp = false;
firstMoveDown = false;
turnBeforeReavers = 0;
reaverTurnTaken = false;
reaverRaid = 0;
p1LedOn = 0;
p2LedOn = 0;
p3LedOn = 0;
p4LedOn = 0;
runningFullScreen = false;
bestPathNumber = 0;
player1UnderCombat = false;
player1Raiding = false;
player1PlacingGatherer = false;
player1ChoosingDiceRoll = false;
player1AlreadyChoseDiceRoll = false;
landTile = new landTileLIB();
landTileArray = new Array();
landTileArrayPlayer1 = new Array();
landTileArrayPlayer2 = new Array();
landTileArrayPlayer3 = new Array();
landTileArrayPlayer4 = new Array();
wallSlot = new wallSlotLIB();
wallSlotArray = new Array();
starterBuilding = new starterBuildingLIB();
starterBuildingArray = new Array();
starterBuildingTileChoicesArray = new Array();
wallExpandChoicesArray = new Array();
partyDefendChoicesArray = new Array();
wallCheckPointArray = new Array();
landCheckPointArray = new Array();
landCheckPointBestPathArray = new Array();
partyUnit = new partyUnitLIB();
partyUnitArray1 = new Array();
partyUnitArray2 = new Array();
partyUnitArray3 = new Array();
partyUnitArray4 = new Array();
partyUnitArray5 = new Array();
partyUnitArray = new Array();
enemyPartyDetected = new Array();
civChoicesArray = new Array();
diceChoicesArray = new Array();
gathererUnit = new gathererUnitLIB();
longWalkArray = new Array();
gathererUnitArray = new Array();
allGathererUnitArray = new Array();
p1AvaliableMindUpgrades = new Array();
p2AvaliableMindUpgrades = new Array();
p3AvaliableMindUpgrades = new Array();
p4AvaliableMindUpgrades = new Array();
tilesToProtectPlayer2 = new Array();
tilesToProtectPlayer3 = new Array();
tilesToProtectPlayer4 = new Array();
tilesToProtect = new Array();
reaverOriginPlayer1 = new Array();
reaverOriginPlayer2 = new Array();
reaverOriginPlayer3 = new Array();
reaverOriginPlayer4 = new Array();
stage.addEventListener(MouseEvent.MOUSE_DOWN, mousePress);
stage.addEventListener(MouseEvent.MOUSE_UP, mouseRelease);
stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoved);
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyPressCall);
stage.addEventListener(KeyboardEvent.KEY_UP, keyReleaseCall);
btn_chooseDiceRoll.getChildByName("btn_dicechoice1").addEventListener(MouseEvent.MOUSE_DOWN, player1DiceRollChoice1);
btn_chooseDiceRoll.getChildByName("btn_dicechoice2").addEventListener(MouseEvent.MOUSE_DOWN, player1DiceRollChoice2);
btn_chooseDiceRoll.getChildByName("btn_dicechoice3").addEventListener(MouseEvent.MOUSE_DOWN, player1DiceRollChoice3);
btn_chooseDiceRoll.getChildByName("btn_dicechoice4").addEventListener(MouseEvent.MOUSE_DOWN, player1DiceRollChoice4);
btn_chooseDiceRoll.getChildByName("btn_dicechoice5").addEventListener(MouseEvent.MOUSE_DOWN, player1DiceRollChoice5);
btn_chooseDiceRoll.getChildByName("btn_dicechoice6").addEventListener(MouseEvent.MOUSE_DOWN, player1DiceRollChoice6);
btn_chooseDiceRoll.getChildByName("btn_dicechoice7").addEventListener(MouseEvent.MOUSE_DOWN, player1DiceRollChoice7);
btn_chooseDiceRoll.getChildByName("btn_dicechoice8").addEventListener(MouseEvent.MOUSE_DOWN, player1DiceRollChoice8);
btn_chooseDiceRoll.getChildByName("btn_dicechoice9").addEventListener(MouseEvent.MOUSE_DOWN, player1DiceRollChoice9);
btn_chooseDiceRoll.getChildByName("btn_dicechoice10").addEventListener(MouseEvent.MOUSE_DOWN, player1DiceRollChoice10);
btn_chooseDiceRoll.getChildByName("btn_dicechoice11").addEventListener(MouseEvent.MOUSE_DOWN, player1DiceRollChoice11);
btn_chooseDiceRoll.getChildByName("btn_dicechoice12").addEventListener(MouseEvent.MOUSE_DOWN, player1DiceRollChoice12);
btn_chooseDiceRoll.getChildByName("btn_dicechoice1").addEventListener(MouseEvent.MOUSE_OVER, diceRoll1tooltip);
btn_chooseDiceRoll.getChildByName("btn_dicechoice2").addEventListener(MouseEvent.MOUSE_OVER, diceRoll2tooltip);
btn_chooseDiceRoll.getChildByName("btn_dicechoice3").addEventListener(MouseEvent.MOUSE_OVER, diceRoll3tooltip);
btn_chooseDiceRoll.getChildByName("btn_dicechoice4").addEventListener(MouseEvent.MOUSE_OVER, diceRoll4tooltip);
btn_chooseDiceRoll.getChildByName("btn_dicechoice5").addEventListener(MouseEvent.MOUSE_OVER, diceRoll5tooltip);
btn_chooseDiceRoll.getChildByName("btn_dicechoice6").addEventListener(MouseEvent.MOUSE_OVER, diceRoll6tooltip);
btn_chooseDiceRoll.getChildByName("btn_dicechoice7").addEventListener(MouseEvent.MOUSE_OVER, diceRoll7tooltip);
btn_chooseDiceRoll.getChildByName("btn_dicechoice8").addEventListener(MouseEvent.MOUSE_OVER, diceRoll8tooltip);
btn_chooseDiceRoll.getChildByName("btn_dicechoice9").addEventListener(MouseEvent.MOUSE_OVER, diceRoll9tooltip);
btn_chooseDiceRoll.getChildByName("btn_dicechoice10").addEventListener(MouseEvent.MOUSE_OVER, diceRoll10tooltip);
btn_chooseDiceRoll.getChildByName("btn_dicechoice11").addEventListener(MouseEvent.MOUSE_OVER, diceRoll11tooltip);
btn_chooseDiceRoll.getChildByName("btn_dicechoice12").addEventListener(MouseEvent.MOUSE_OVER, diceRoll12tooltip);
btn_chooseDiceRoll.getChildByName("btn_dicechoice1").addEventListener(MouseEvent.MOUSE_OUT, hideTooltip);
btn_chooseDiceRoll.getChildByName("btn_dicechoice2").addEventListener(MouseEvent.MOUSE_OUT, hideTooltip);
btn_chooseDiceRoll.getChildByName("btn_dicechoice3").addEventListener(MouseEvent.MOUSE_OUT, hideTooltip);
btn_chooseDiceRoll.getChildByName("btn_dicechoice4").addEventListener(MouseEvent.MOUSE_OUT, hideTooltip);
btn_chooseDiceRoll.getChildByName("btn_dicechoice5").addEventListener(MouseEvent.MOUSE_OUT, hideTooltip);
btn_chooseDiceRoll.getChildByName("btn_dicechoice6").addEventListener(MouseEvent.MOUSE_OUT, hideTooltip);
btn_chooseDiceRoll.getChildByName("btn_dicechoice7").addEventListener(MouseEvent.MOUSE_OUT, hideTooltip);
btn_chooseDiceRoll.getChildByName("btn_dicechoice8").addEventListener(MouseEvent.MOUSE_OUT, hideTooltip);
btn_chooseDiceRoll.getChildByName("btn_dicechoice9").addEventListener(MouseEvent.MOUSE_OUT, hideTooltip);
btn_chooseDiceRoll.getChildByName("btn_dicechoice10").addEventListener(MouseEvent.MOUSE_OUT, hideTooltip);
btn_chooseDiceRoll.getChildByName("btn_dicechoice11").addEventListener(MouseEvent.MOUSE_OUT, hideTooltip);
btn_chooseDiceRoll.getChildByName("btn_dicechoice12").addEventListener(MouseEvent.MOUSE_OUT, hideTooltip);
btn_chooseCivExpansion.getChildByName("bnt_civExpandChoice1").addEventListener(MouseEvent.MOUSE_DOWN, player1CivChoice1);
btn_chooseCivExpansion.getChildByName("bnt_civExpandChoice2").addEventListener(MouseEvent.MOUSE_DOWN, player1CivChoice2);
btn_chooseCivExpansion.getChildByName("bnt_civExpandChoice3").addEventListener(MouseEvent.MOUSE_DOWN, player1CivChoice3);
btn_chooseCivExpansion.getChildByName("bnt_civExpandChoice4").addEventListener(MouseEvent.MOUSE_DOWN, player1CivChoice4);
btn_chooseCivExpansion.getChildByName("bnt_civExpandChoice5").addEventListener(MouseEvent.MOUSE_DOWN, player1CivChoice5);
btn_chooseCivExpansion.getChildByName("bnt_civExpandChoice6").addEventListener(MouseEvent.MOUSE_DOWN, player1CivChoice6);
btn_chooseCivExpansion.getChildByName("bnt_civExpandChoice1").addEventListener(MouseEvent.MOUSE_OVER, civ1Tooltip);
btn_chooseCivExpansion.getChildByName("bnt_civExpandChoice2").addEventListener(MouseEvent.MOUSE_OVER, civ2Tooltip);
btn_chooseCivExpansion.getChildByName("bnt_civExpandChoice3").addEventListener(MouseEvent.MOUSE_OVER, civ3Tooltip);
btn_chooseCivExpansion.getChildByName("bnt_civExpandChoice4").addEventListener(MouseEvent.MOUSE_OVER, civ4Tooltip);
btn_chooseCivExpansion.getChildByName("bnt_civExpandChoice5").addEventListener(MouseEvent.MOUSE_OVER, civ5Tooltip);
btn_chooseCivExpansion.getChildByName("bnt_civExpandChoice6").addEventListener(MouseEvent.MOUSE_OVER, civ6Tooltip);
btn_chooseCivExpansion.getChildByName("bnt_civExpandChoice1").addEventListener(MouseEvent.MOUSE_OUT, hideTooltip);
btn_chooseCivExpansion.getChildByName("bnt_civExpandChoice2").addEventListener(MouseEvent.MOUSE_OUT, hideTooltip);
btn_chooseCivExpansion.getChildByName("bnt_civExpandChoice3").addEventListener(MouseEvent.MOUSE_OUT, hideTooltip);
btn_chooseCivExpansion.getChildByName("bnt_civExpandChoice4").addEventListener(MouseEvent.MOUSE_OUT, hideTooltip);
btn_chooseCivExpansion.getChildByName("bnt_civExpandChoice5").addEventListener(MouseEvent.MOUSE_OUT, hideTooltip);
btn_chooseCivExpansion.getChildByName("bnt_civExpandChoice6").addEventListener(MouseEvent.MOUSE_OUT, hideTooltip);
mindUpgradeDisplay.getChildByName("btn_closeUpgradeDisplay").addEventListener(MouseEvent.MOUSE_DOWN, hideMindUpgradeDisplay);
skipMiniBoxIntro.addEventListener(MouseEvent.MOUSE_DOWN, skipTutorialIntro);
btn_chooseCivExpansion.addEventListener(MouseEvent.ROLL_OUT, hideCivExpansions);
btn_chooseCivExpansion.deployRobotButton.addEventListener(MouseEvent.MOUSE_DOWN, playerSpawnsUnit);
player1GameBar.getChildByName("enableWallPlace").addEventListener(MouseEvent.MOUSE_DOWN, allowPlayerWallPlace);
player1GameBar.getChildByName("btn_raid").addEventListener(MouseEvent.MOUSE_DOWN, player1Raid);
player1GameBar.getChildByName("btn_menu").addEventListener(MouseEvent.MOUSE_DOWN, showEscMenuCall);
player1GameBar.getChildByName("btnRotateLeft").addEventListener(MouseEvent.MOUSE_DOWN, rotateUnitLeft);
player1GameBar.getChildByName("inst_endturnbuton").addEventListener(MouseEvent.MOUSE_DOWN, endPlayerTurn);
player1GameBar.getChildByName("btn_defensiveMode").addEventListener(MouseEvent.MOUSE_DOWN, defensiveStance);
player1GameBar.getChildByName("enableWallPlace").addEventListener(MouseEvent.MOUSE_OVER, buttonTooltipWallPlace);
player1GameBar.getChildByName("btn_raid").addEventListener(MouseEvent.MOUSE_OVER, buttonTooltipRaid);
player1GameBar.getChildByName("btn_menu").addEventListener(MouseEvent.MOUSE_OVER, buttonTooltipMenu);
player1GameBar.getChildByName("btnRotateLeft").addEventListener(MouseEvent.MOUSE_OVER, buttonTooltipRotate);
player1GameBar.getChildByName("inst_endturnbuton").addEventListener(MouseEvent.MOUSE_OVER, buttonTooltipEndTurn);
player1GameBar.getChildByName("btn_defensiveMode").addEventListener(MouseEvent.MOUSE_OVER, buttonTooltipDefensive);
player1GameBar.getChildByName("enableWallPlace").addEventListener(MouseEvent.MOUSE_OUT, buttonTooltipHide);
player1GameBar.getChildByName("btn_raid").addEventListener(MouseEvent.MOUSE_OUT, buttonTooltipHide);
player1GameBar.getChildByName("btn_menu").addEventListener(MouseEvent.MOUSE_OUT, buttonTooltipHide);
player1GameBar.getChildByName("btnRotateLeft").addEventListener(MouseEvent.MOUSE_OUT, buttonTooltipHide);
player1GameBar.getChildByName("inst_endturnbuton").addEventListener(MouseEvent.MOUSE_OUT, buttonTooltipHide);
player1GameBar.getChildByName("btn_defensiveMode").addEventListener(MouseEvent.MOUSE_OUT, buttonTooltipHide);
play_tuto.addEventListener(MouseEvent.MOUSE_UP, playLearnAsYouPlay);
play_2pw.addEventListener(MouseEvent.MOUSE_UP, gameSettings2);
play_2pf.addEventListener(MouseEvent.MOUSE_UP, gameSettingsFS2);
play_4pf.addEventListener(MouseEvent.MOUSE_UP, gameSettingsFS4);
play_tuto.addEventListener(MouseEvent.MOUSE_OVER, lockPickSound);
play_2pw.addEventListener(MouseEvent.MOUSE_OVER, lockPickSound);
play_2pf.addEventListener(MouseEvent.MOUSE_OVER, lockPickSound);
play_4pf.addEventListener(MouseEvent.MOUSE_OVER, lockPickSound);
btn_easy.addEventListener(MouseEvent.MOUSE_DOWN, setDifficulty1);
btn_norm.addEventListener(MouseEvent.MOUSE_DOWN, setDifficulty2);
btn_hard.addEventListener(MouseEvent.MOUSE_DOWN, setDifficulty3);
escapeMenu.getChildByName("resumeGame").addEventListener(MouseEvent.MOUSE_UP, resumeGame);
escapeMenu.getChildByName("exitGame").addEventListener(MouseEvent.MOUSE_DOWN, exitGame);
escapeMenu.getChildByName("disableSounds").addEventListener(MouseEvent.MOUSE_DOWN, disableSounds);
escapeMenu.getChildByName("disableMusic").addEventListener(MouseEvent.MOUSE_DOWN, disableMusic);
escapeMenu.getChildByName("changeRobotSpeed").addEventListener(MouseEvent.MOUSE_DOWN, changeRobotwalkSpeed);
btn_lin_1.addEventListener(MouseEvent.MOUSE_DOWN, playerSelectsRace1);
btn_lin_2.addEventListener(MouseEvent.MOUSE_DOWN, playerSelectsRace2);
btn_lin_3.addEventListener(MouseEvent.MOUSE_DOWN, playerSelectsRace4);
btn_lin_4.addEventListener(MouseEvent.MOUSE_DOWN, playerSelectsRace3);
btn_lin_1.addEventListener(MouseEvent.MOUSE_OVER, playerInspectsRace1);
btn_lin_2.addEventListener(MouseEvent.MOUSE_OVER, playerInspectsRace2);
btn_lin_3.addEventListener(MouseEvent.MOUSE_OVER, playerInspectsRace4);
btn_lin_4.addEventListener(MouseEvent.MOUSE_OVER, playerInspectsRace3);
monitor.addEventListener(MouseEvent.MOUSE_OVER, playerInspectsOut);
credits.addEventListener(MouseEvent.MOUSE_DOWN, showCredits);
letheGames.addEventListener(MouseEvent.MOUSE_DOWN, goToLetheSite);
playMoreGames.addEventListener(MouseEvent.MOUSE_DOWN, goToSponsorSite);
playMoreGamesText.addEventListener(MouseEvent.MOUSE_DOWN, goToSponsorSite);
escapeMenu.playMoreGamesEsc.addEventListener(MouseEvent.MOUSE_DOWN, goToSponsorSite);
escapeMenu.letheGamesEsc.addEventListener(MouseEvent.MOUSE_DOWN, goToLetheSite);
stage.addEventListener(Event.FULLSCREEN, fullScrHandler);
snd_theme = new theme();
snd_MusicVolume = new SoundTransform();
snd_FXVolume = new SoundTransform();
snd_DefensiveStanceVolume = new SoundTransform();
snd_DiceRoll = new SoundTransform();
snd_MonitorVolume = new SoundTransform();
snd_MonitorVolume.volume = 0.7;
snd_DefensiveStanceVolume.volume = 0.4;
snd_DiceRoll.volume = 0.4;
snd_nullSound = new nullSound();
snd_defensive_stance = new defensive_stance();
snd_diceroll = new diceroll();
snd_placewall = new placewall();
snd_place_gatherer = new place_gatherer();
snd_raid = new raid();
snd_unit_rotate = new unit_rotate();
snd_moveunit = new moveunit();
snd_combat_lose = new combat_lose();
snd_combat_win = new combat_win();
snd_evolution = new evolution();
snd_reinforcement = new reinforcement();
snd_select_DiceRoll = new select_DiceRoll();
snd_gears = new gearsSound();
snd_lights = new lights();
snd_monitorSound = new monitorSound();
snd_game_Victory = new game_Victory();
chan_theme = snd_nullSound.play();
chan_soundFX = snd_nullSound.play();
gameInitialSetup();
setDifficulty2DefaultCall();
play_tuto.alpha = 0;
play_2pw.alpha = 0;
play_2pf.alpha = 0;
play_4pf.alpha = 0;
btn_lin_1.alpha = 0;
btn_lin_2.alpha = 0;
btn_lin_3.alpha = 0;
btn_lin_4.alpha = 0;
btn_easy.alpha = 0;
btn_norm.alpha = 0;
btn_hard.alpha = 0;
btn_norm_gfx.gotoAndPlay("_on");
btn_lin_1_status = 0;
btn_lin_2_status = 0;
btn_lin_3_status = 0;
btn_lin_4_status = 0;
btn_easy_status = 0;
btn_norm_status = 1;
btn_hard_status = 0;
monitor_status = 0;
btn_lin_1.addEventListener(MouseEvent.MOUSE_OVER, overMouse);
btn_lin_1.addEventListener(MouseEvent.MOUSE_OUT, outMouse);
btn_lin_1.addEventListener(MouseEvent.CLICK, clickMouse);
btn_lin_2.addEventListener(MouseEvent.MOUSE_OVER, overMouse);
btn_lin_2.addEventListener(MouseEvent.MOUSE_OUT, outMouse);
btn_lin_2.addEventListener(MouseEvent.CLICK, clickMouse);
btn_lin_3.addEventListener(MouseEvent.MOUSE_OVER, overMouse);
btn_lin_3.addEventListener(MouseEvent.MOUSE_OUT, outMouse);
btn_lin_3.addEventListener(MouseEvent.CLICK, clickMouse);
btn_lin_4.addEventListener(MouseEvent.MOUSE_OVER, overMouse);
btn_lin_4.addEventListener(MouseEvent.MOUSE_OUT, outMouse);
btn_lin_4.addEventListener(MouseEvent.CLICK, clickMouse);
btn_easy.addEventListener(MouseEvent.MOUSE_OVER, overMouse);
btn_easy.addEventListener(MouseEvent.MOUSE_OUT, outMouse);
btn_easy.addEventListener(MouseEvent.CLICK, clickMouse);
btn_norm.addEventListener(MouseEvent.MOUSE_OVER, overMouse);
btn_norm.addEventListener(MouseEvent.MOUSE_OUT, outMouse);
btn_norm.addEventListener(MouseEvent.CLICK, clickMouse);
btn_hard.addEventListener(MouseEvent.MOUSE_OVER, overMouse);
btn_hard.addEventListener(MouseEvent.MOUSE_OUT, outMouse);
btn_hard.addEventListener(MouseEvent.CLICK, clickMouse);
play_tuto.addEventListener(MouseEvent.MOUSE_OVER, overMouse);
play_tuto.addEventListener(MouseEvent.MOUSE_OUT, outMouse);
play_tuto.addEventListener(MouseEvent.CLICK, clickMouse);
play_2pw.addEventListener(MouseEvent.MOUSE_OVER, overMouse);
play_2pw.addEventListener(MouseEvent.MOUSE_OUT, outMouse);
play_2pw.addEventListener(MouseEvent.CLICK, clickMouse);
play_2pf.addEventListener(MouseEvent.MOUSE_OVER, overMouse);
play_2pf.addEventListener(MouseEvent.MOUSE_OUT, outMouse);
play_2pf.addEventListener(MouseEvent.CLICK, clickMouse);
play_4pf.addEventListener(MouseEvent.MOUSE_OVER, overMouse);
play_4pf.addEventListener(MouseEvent.MOUSE_OUT, outMouse);
play_4pf.addEventListener(MouseEvent.CLICK, clickMouse);
MochiBot.track(this, "e20e83fc");
}
}
}//package NEWGROUNDSVERSION_fla
Section 57
//monitor_41 (NEWGROUNDSVERSION_fla.monitor_41)
package NEWGROUNDSVERSION_fla {
import flash.display.*;
public dynamic class monitor_41 extends MovieClip {
public var monitorTextContainer:MovieClip;
public function monitor_41(){
addFrameScript(0, frame1, 14, frame15);
}
function frame1(){
stop();
}
function frame15(){
stop();
}
}
}//package NEWGROUNDSVERSION_fla
Section 58
//newGameFaderLIB_138 (NEWGROUNDSVERSION_fla.newGameFaderLIB_138)
package NEWGROUNDSVERSION_fla {
import flash.display.*;
public dynamic class newGameFaderLIB_138 extends MovieClip {
public function newGameFaderLIB_138(){
addFrameScript(0, frame1, 49, frame50, 99, frame100);
}
function frame1(){
this.stop();
}
function frame50(){
this.stop();
this.stop();
}
function frame100(){
this.visible = false;
}
}
}//package NEWGROUNDSVERSION_fla
Section 59
//play_2pf_gfx_24 (NEWGROUNDSVERSION_fla.play_2pf_gfx_24)
package NEWGROUNDSVERSION_fla {
import flash.display.*;
public dynamic class play_2pf_gfx_24 extends MovieClip {
public var darkness:MovieClip;
public function play_2pf_gfx_24(){
addFrameScript(0, frame1, 10, frame11);
}
function frame1(){
stop();
}
function frame11(){
stop();
}
}
}//package NEWGROUNDSVERSION_fla
Section 60
//play_2pw_gfx_23 (NEWGROUNDSVERSION_fla.play_2pw_gfx_23)
package NEWGROUNDSVERSION_fla {
import flash.display.*;
public dynamic class play_2pw_gfx_23 extends MovieClip {
public var darkness:MovieClip;
public function play_2pw_gfx_23(){
addFrameScript(0, frame1, 10, frame11);
}
function frame1(){
stop();
}
function frame11(){
stop();
}
}
}//package NEWGROUNDSVERSION_fla
Section 61
//play_4pf_gfx_25 (NEWGROUNDSVERSION_fla.play_4pf_gfx_25)
package NEWGROUNDSVERSION_fla {
import flash.display.*;
public dynamic class play_4pf_gfx_25 extends MovieClip {
public var darkness:MovieClip;
public function play_4pf_gfx_25(){
addFrameScript(0, frame1, 10, frame11);
}
function frame1(){
stop();
}
function frame11(){
stop();
}
}
}//package NEWGROUNDSVERSION_fla
Section 62
//play_tuto_gfx_18 (NEWGROUNDSVERSION_fla.play_tuto_gfx_18)
package NEWGROUNDSVERSION_fla {
import flash.display.*;
public dynamic class play_tuto_gfx_18 extends MovieClip {
public var darkness:MovieClip;
public function play_tuto_gfx_18(){
addFrameScript(0, frame1, 10, frame11);
}
function frame1(){
stop();
}
function frame11(){
stop();
}
}
}//package NEWGROUNDSVERSION_fla
Section 63
//preciousLIB_93 (NEWGROUNDSVERSION_fla.preciousLIB_93)
package NEWGROUNDSVERSION_fla {
import flash.display.*;
public dynamic class preciousLIB_93 extends MovieClip {
public function preciousLIB_93(){
addFrameScript(314, frame315);
}
function frame315(){
this.stop();
this.stop();
}
}
}//package NEWGROUNDSVERSION_fla
Section 64
//sponsorSplashLIB_3 (NEWGROUNDSVERSION_fla.sponsorSplashLIB_3)
package NEWGROUNDSVERSION_fla {
import flash.display.*;
public dynamic class sponsorSplashLIB_3 extends MovieClip {
public function sponsorSplashLIB_3(){
addFrameScript(0, frame1, 246, frame247);
}
function frame1(){
this.stop();
this.visible = false;
}
function frame247(){
stop();
}
}
}//package NEWGROUNDSVERSION_fla
Section 65
//tutoBoxMainIntroLIB_145 (NEWGROUNDSVERSION_fla.tutoBoxMainIntroLIB_145)
package NEWGROUNDSVERSION_fla {
import flash.display.*;
public dynamic class tutoBoxMainIntroLIB_145 extends MovieClip {
public function tutoBoxMainIntroLIB_145(){
addFrameScript(6219, frame6220);
}
function frame6220(){
this.stop();
this.visible = false;
}
}
}//package NEWGROUNDSVERSION_fla
Section 66
//txt_selection_26 (NEWGROUNDSVERSION_fla.txt_selection_26)
package NEWGROUNDSVERSION_fla {
import flash.display.*;
public dynamic class txt_selection_26 extends MovieClip {
public function txt_selection_26(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package NEWGROUNDSVERSION_fla
Section 67
//combat_lose (combat_lose)
package {
import flash.media.*;
public dynamic class combat_lose extends Sound {
}
}//package
Section 68
//combat_win (combat_win)
package {
import flash.media.*;
public dynamic class combat_win extends Sound {
}
}//package
Section 69
//defensive_stance (defensive_stance)
package {
import flash.media.*;
public dynamic class defensive_stance extends Sound {
}
}//package
Section 70
//diceroll (diceroll)
package {
import flash.media.*;
public dynamic class diceroll extends Sound {
}
}//package
Section 71
//evolution (evolution)
package {
import flash.media.*;
public dynamic class evolution extends Sound {
}
}//package
Section 72
//game_Victory (game_Victory)
package {
import flash.media.*;
public dynamic class game_Victory extends Sound {
}
}//package
Section 73
//GameShedAchievement (GameShedAchievement)
package {
import flash.display.*;
import flash.net.*;
import flash.system.*;
public class GameShedAchievement {
private static const NOT_INITIALIZED:String = "-2";
private static const USER_ID_NOT_FOUND:String = "-1";
private static const GAME_SHED_ACHIEVEMENT_URL:String = "http://www.gameshed.com/_a_a/ach_humans_adb.php";
private static var _userId:String = "-2";
private static var _crypto:String = "x_m.z;r8h+-8m";
private static var _locked:Boolean = false;
public static function Init(_arg1:DisplayObject, _arg2:String):void{
_crypto = _arg2;
Security.allowDomain("http://www.gameshed.com");
var _local3:Object = _arg1.root.loaderInfo.parameters;
if (_local3.user == null){
_userId = USER_ID_NOT_FOUND;
} else {
_userId = String(_local3.user);
};
}
public static function ActivateAchievement(_arg1:Number):void{
SendStuff(_arg1);
}
private static function SendStuff(_arg1:Number):void{
if (_locked){
return;
};
if (_userId == NOT_INITIALIZED){
throw (new Error("GameShedAchievement API hasn't been initialized. You must call GameShedAchievement.Init(this.root) before sending achievements."));
};
if (_userId == USER_ID_NOT_FOUND){
trace("GameShedAchievementAPI.ActivateAchievement() :: The API has been installed.");
return;
};
var _local2:String = ("user_id=" + GetGameShedUserId());
var _local3:String = ("achievement_id=" + _arg1);
var _local4:String = ((_arg1 + _crypto) + GetGameShedUserId());
var _local5:String = ("key=" + MD5.calcMD5(_local4));
var _local6:URLVariables = new URLVariables(((((_local2 + "&") + _local3) + "&") + _local5));
var _local7:URLRequest = new URLRequest(GAME_SHED_ACHIEVEMENT_URL);
_local7.data = _local6;
_local7.method = URLRequestMethod.POST;
var _local8:URLLoader = new URLLoader();
_local8.load(_local7);
}
public static function GetGameShedUserId():String{
return (_userId);
}
public static function get locked():Boolean{
return (_locked);
}
public static function set locked(_arg1:Boolean):void{
_locked = _arg1;
}
}
}//package
Section 74
//gathererUnitLIB (gathererUnitLIB)
package {
import flash.display.*;
public dynamic class gathererUnitLIB extends MovieClip {
}
}//package
Section 75
//gearsSound (gearsSound)
package {
import flash.media.*;
public dynamic class gearsSound extends Sound {
}
}//package
Section 76
//landTileLIB (landTileLIB)
package {
import flash.display.*;
public dynamic class landTileLIB extends MovieClip {
}
}//package
Section 77
//lights (lights)
package {
import flash.media.*;
public dynamic class lights extends Sound {
}
}//package
Section 78
//MD5 (MD5)
package {
class MD5 {
static var hex_chr = "0123456789abcdef";
private static function bitOR(_arg1, _arg2){
var _local3:* = ((_arg1 & 1) | (_arg2 & 1));
var _local4:* = ((_arg1 >>> 1) | (_arg2 >>> 1));
return (((_local4 << 1) | _local3));
}
private static function bitXOR(_arg1, _arg2){
var _local3:* = ((_arg1 & 1) ^ (_arg2 & 1));
var _local4:* = ((_arg1 >>> 1) ^ (_arg2 >>> 1));
return (((_local4 << 1) | _local3));
}
private static function bitAND(_arg1, _arg2){
var _local3:* = ((_arg1 & 1) & (_arg2 & 1));
var _local4:* = ((_arg1 >>> 1) & (_arg2 >>> 1));
return (((_local4 << 1) | _local3));
}
private static function addme(_arg1, _arg2){
var _local3:* = ((_arg1 & 0xFFFF) + (_arg2 & 0xFFFF));
var _local4:* = (((_arg1 >> 16) + (_arg2 >> 16)) + (_local3 >> 16));
return (((_local4 << 16) | (_local3 & 0xFFFF)));
}
private static function rhex(_arg1){
var _local2:* = "";
var _local3:* = 0;
while (_local3 <= 3) {
_local2 = (_local2 + (hex_chr.charAt(((_arg1 >> ((_local3 * 8) + 4)) & 15)) + hex_chr.charAt(((_arg1 >> (_local3 * 8)) & 15))));
_local3++;
};
return (_local2);
}
private static function str2blks_MD5(_arg1){
var _local2:* = (((_arg1.length + 8) >> 6) + 1);
var _local3:* = new Array((_local2 * 16));
var _local4:* = 0;
while (_local4 < (_local2 * 16)) {
_local3[_local4] = 0;
_local4++;
};
_local4 = 0;
while (_local4 < _arg1.length) {
_local3[(_local4 >> 2)] = (_local3[(_local4 >> 2)] | (_arg1.charCodeAt(_local4) << ((((_arg1.length * 8) + _local4) % 4) * 8)));
_local4++;
};
_local3[(_local4 >> 2)] = (_local3[(_local4 >> 2)] | (128 << ((((_arg1.length * 8) + _local4) % 4) * 8)));
var _local5:* = (_arg1.length * 8);
_local3[((_local2 * 16) - 2)] = (_local5 & 0xFF);
_local3[((_local2 * 16) - 2)] = (_local3[((_local2 * 16) - 2)] | (((_local5 >>> 8) & 0xFF) << 8));
_local3[((_local2 * 16) - 2)] = (_local3[((_local2 * 16) - 2)] | (((_local5 >>> 16) & 0xFF) << 16));
_local3[((_local2 * 16) - 2)] = (_local3[((_local2 * 16) - 2)] | (((_local5 >>> 24) & 0xFF) << 24));
return (_local3);
}
private static function rol(_arg1, _arg2){
return (((_arg1 << _arg2) | (_arg1 >>> (32 - _arg2))));
}
private static function cmn(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6){
return (addme(rol(addme(addme(_arg2, _arg1), addme(_arg4, _arg6)), _arg5), _arg3));
}
private static function ff(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7){
return (cmn(bitOR(bitAND(_arg2, _arg3), bitAND(~(_arg2), _arg4)), _arg1, _arg2, _arg5, _arg6, _arg7));
}
private static function gg(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7){
return (cmn(bitOR(bitAND(_arg2, _arg4), bitAND(_arg3, ~(_arg4))), _arg1, _arg2, _arg5, _arg6, _arg7));
}
private static function hh(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7){
return (cmn(bitXOR(bitXOR(_arg2, _arg3), _arg4), _arg1, _arg2, _arg5, _arg6, _arg7));
}
private static function ii(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7){
return (cmn(bitXOR(_arg3, bitOR(_arg2, ~(_arg4))), _arg1, _arg2, _arg5, _arg6, _arg7));
}
public static function calcMD5(_arg1){
var _local7:*;
var _local9:*;
var _local10:*;
var _local11:*;
var _local12:*;
var _local2:* = str2blks_MD5(_arg1);
var _local3:* = 1732584193;
var _local4:* = -271733879;
var _local5:* = -1732584194;
var _local6:* = 271733878;
var _local8:* = 0;
while (_local8 < _local2.length) {
_local9 = _local3;
_local10 = _local4;
_local11 = _local5;
_local12 = _local6;
_local7 = 0;
_local3 = ff(_local3, _local4, _local5, _local6, _local2[(_local8 + 0)], 7, -680876936);
_local6 = ff(_local6, _local3, _local4, _local5, _local2[(_local8 + 1)], 12, -389564586);
_local5 = ff(_local5, _local6, _local3, _local4, _local2[(_local8 + 2)], 17, 606105819);
_local4 = ff(_local4, _local5, _local6, _local3, _local2[(_local8 + 3)], 22, -1044525330);
_local3 = ff(_local3, _local4, _local5, _local6, _local2[(_local8 + 4)], 7, -176418897);
_local6 = ff(_local6, _local3, _local4, _local5, _local2[(_local8 + 5)], 12, 1200080426);
_local5 = ff(_local5, _local6, _local3, _local4, _local2[(_local8 + 6)], 17, -1473231341);
_local4 = ff(_local4, _local5, _local6, _local3, _local2[(_local8 + 7)], 22, -45705983);
_local3 = ff(_local3, _local4, _local5, _local6, _local2[(_local8 + 8)], 7, 1770035416);
_local6 = ff(_local6, _local3, _local4, _local5, _local2[(_local8 + 9)], 12, -1958414417);
_local5 = ff(_local5, _local6, _local3, _local4, _local2[(_local8 + 10)], 17, -42063);
_local4 = ff(_local4, _local5, _local6, _local3, _local2[(_local8 + 11)], 22, -1990404162);
_local3 = ff(_local3, _local4, _local5, _local6, _local2[(_local8 + 12)], 7, 1804603682);
_local6 = ff(_local6, _local3, _local4, _local5, _local2[(_local8 + 13)], 12, -40341101);
_local5 = ff(_local5, _local6, _local3, _local4, _local2[(_local8 + 14)], 17, -1502002290);
_local4 = ff(_local4, _local5, _local6, _local3, _local2[(_local8 + 15)], 22, 1236535329);
_local3 = gg(_local3, _local4, _local5, _local6, _local2[(_local8 + 1)], 5, -165796510);
_local6 = gg(_local6, _local3, _local4, _local5, _local2[(_local8 + 6)], 9, -1069501632);
_local5 = gg(_local5, _local6, _local3, _local4, _local2[(_local8 + 11)], 14, 643717713);
_local4 = gg(_local4, _local5, _local6, _local3, _local2[(_local8 + 0)], 20, -373897302);
_local3 = gg(_local3, _local4, _local5, _local6, _local2[(_local8 + 5)], 5, -701558691);
_local6 = gg(_local6, _local3, _local4, _local5, _local2[(_local8 + 10)], 9, 38016083);
_local5 = gg(_local5, _local6, _local3, _local4, _local2[(_local8 + 15)], 14, -660478335);
_local4 = gg(_local4, _local5, _local6, _local3, _local2[(_local8 + 4)], 20, -405537848);
_local3 = gg(_local3, _local4, _local5, _local6, _local2[(_local8 + 9)], 5, 568446438);
_local6 = gg(_local6, _local3, _local4, _local5, _local2[(_local8 + 14)], 9, -1019803690);
_local5 = gg(_local5, _local6, _local3, _local4, _local2[(_local8 + 3)], 14, -187363961);
_local4 = gg(_local4, _local5, _local6, _local3, _local2[(_local8 + 8)], 20, 1163531501);
_local3 = gg(_local3, _local4, _local5, _local6, _local2[(_local8 + 13)], 5, -1444681467);
_local6 = gg(_local6, _local3, _local4, _local5, _local2[(_local8 + 2)], 9, -51403784);
_local5 = gg(_local5, _local6, _local3, _local4, _local2[(_local8 + 7)], 14, 1735328473);
_local4 = gg(_local4, _local5, _local6, _local3, _local2[(_local8 + 12)], 20, -1926607734);
_local3 = hh(_local3, _local4, _local5, _local6, _local2[(_local8 + 5)], 4, -378558);
_local6 = hh(_local6, _local3, _local4, _local5, _local2[(_local8 + 8)], 11, -2022574463);
_local5 = hh(_local5, _local6, _local3, _local4, _local2[(_local8 + 11)], 16, 1839030562);
_local4 = hh(_local4, _local5, _local6, _local3, _local2[(_local8 + 14)], 23, -35309556);
_local3 = hh(_local3, _local4, _local5, _local6, _local2[(_local8 + 1)], 4, -1530992060);
_local6 = hh(_local6, _local3, _local4, _local5, _local2[(_local8 + 4)], 11, 1272893353);
_local5 = hh(_local5, _local6, _local3, _local4, _local2[(_local8 + 7)], 16, -155497632);
_local4 = hh(_local4, _local5, _local6, _local3, _local2[(_local8 + 10)], 23, -1094730640);
_local3 = hh(_local3, _local4, _local5, _local6, _local2[(_local8 + 13)], 4, 681279174);
_local6 = hh(_local6, _local3, _local4, _local5, _local2[(_local8 + 0)], 11, -358537222);
_local5 = hh(_local5, _local6, _local3, _local4, _local2[(_local8 + 3)], 16, -722521979);
_local4 = hh(_local4, _local5, _local6, _local3, _local2[(_local8 + 6)], 23, 76029189);
_local3 = hh(_local3, _local4, _local5, _local6, _local2[(_local8 + 9)], 4, -640364487);
_local6 = hh(_local6, _local3, _local4, _local5, _local2[(_local8 + 12)], 11, -421815835);
_local5 = hh(_local5, _local6, _local3, _local4, _local2[(_local8 + 15)], 16, 530742520);
_local4 = hh(_local4, _local5, _local6, _local3, _local2[(_local8 + 2)], 23, -995338651);
_local3 = ii(_local3, _local4, _local5, _local6, _local2[(_local8 + 0)], 6, -198630844);
_local6 = ii(_local6, _local3, _local4, _local5, _local2[(_local8 + 7)], 10, 1126891415);
_local5 = ii(_local5, _local6, _local3, _local4, _local2[(_local8 + 14)], 15, -1416354905);
_local4 = ii(_local4, _local5, _local6, _local3, _local2[(_local8 + 5)], 21, -57434055);
_local3 = ii(_local3, _local4, _local5, _local6, _local2[(_local8 + 12)], 6, 1700485571);
_local6 = ii(_local6, _local3, _local4, _local5, _local2[(_local8 + 3)], 10, -1894986606);
_local5 = ii(_local5, _local6, _local3, _local4, _local2[(_local8 + 10)], 15, -1051523);
_local4 = ii(_local4, _local5, _local6, _local3, _local2[(_local8 + 1)], 21, -2054922799);
_local3 = ii(_local3, _local4, _local5, _local6, _local2[(_local8 + 8)], 6, 1873313359);
_local6 = ii(_local6, _local3, _local4, _local5, _local2[(_local8 + 15)], 10, -30611744);
_local5 = ii(_local5, _local6, _local3, _local4, _local2[(_local8 + 6)], 15, -1560198380);
_local4 = ii(_local4, _local5, _local6, _local3, _local2[(_local8 + 13)], 21, 1309151649);
_local3 = ii(_local3, _local4, _local5, _local6, _local2[(_local8 + 4)], 6, -145523070);
_local6 = ii(_local6, _local3, _local4, _local5, _local2[(_local8 + 11)], 10, -1120210379);
_local5 = ii(_local5, _local6, _local3, _local4, _local2[(_local8 + 2)], 15, 718787259);
_local4 = ii(_local4, _local5, _local6, _local3, _local2[(_local8 + 9)], 21, -343485551);
_local3 = addme(_local3, _local9);
_local4 = addme(_local4, _local10);
_local5 = addme(_local5, _local11);
_local6 = addme(_local6, _local12);
_local8 = (_local8 + 16);
};
return ((((rhex(_local3) + rhex(_local4)) + rhex(_local5)) + rhex(_local6)));
}
}
}//package
Section 79
//MochiBot (MochiBot)
package {
import flash.display.*;
import flash.net.*;
import flash.system.*;
public dynamic class MochiBot extends Sprite {
public static function track(_arg1:Sprite, _arg2:String):MochiBot{
if (Security.sandboxType == "localWithFile"){
return (null);
};
var _local3:MochiBot = new (MochiBot);
_arg1.addChild(_local3);
Security.allowDomain("*");
Security.allowInsecureDomain("*");
var _local4 = "http://core.mochibot.com/my/core.swf";
var _local5:URLVariables = new URLVariables();
_local5["sb"] = Security.sandboxType;
_local5["v"] = Capabilities.version;
_local5["swfid"] = _arg2;
_local5["mv"] = "8";
_local5["fv"] = "9";
var _local6:String = _local3.root.loaderInfo.loaderURL;
if (_local6.indexOf("http") == 0){
_local5["url"] = _local6;
} else {
_local5["url"] = "local";
};
var _local7:URLRequest = new URLRequest(_local4);
_local7.contentType = "application/x-www-form-urlencoded";
_local7.method = URLRequestMethod.POST;
_local7.data = _local5;
var _local8:Loader = new Loader();
_local3.addChild(_local8);
_local8.load(_local7);
return (_local3);
}
}
}//package
Section 80
//monitorSound (monitorSound)
package {
import flash.media.*;
public dynamic class monitorSound extends Sound {
}
}//package
Section 81
//moveunit (moveunit)
package {
import flash.media.*;
public dynamic class moveunit extends Sound {
}
}//package
Section 82
//NewgroundsAPIAsset_big_popup_background (NewgroundsAPIAsset_big_popup_background)
package {
import flash.display.*;
public dynamic class NewgroundsAPIAsset_big_popup_background extends MovieClip {
public var tl:MovieClip;
public var br:MovieClip;
public var tr:MovieClip;
public var l:MovieClip;
public var shadow:MovieClip;
public var r:MovieClip;
public var b:MovieClip;
public var bl:MovieClip;
public var t:MovieClip;
public var c:MovieClip;
}
}//package
Section 83
//nullSound (nullSound)
package {
import flash.media.*;
public dynamic class nullSound extends Sound {
}
}//package
Section 84
//partyUnitLIB (partyUnitLIB)
package {
import flash.display.*;
public dynamic class partyUnitLIB extends MovieClip {
}
}//package
Section 85
//place_gatherer (place_gatherer)
package {
import flash.media.*;
public dynamic class place_gatherer extends Sound {
}
}//package
Section 86
//placewall (placewall)
package {
import flash.media.*;
public dynamic class placewall extends Sound {
}
}//package
Section 87
//raid (raid)
package {
import flash.media.*;
public dynamic class raid extends Sound {
}
}//package
Section 88
//reinforcement (reinforcement)
package {
import flash.media.*;
public dynamic class reinforcement extends Sound {
}
}//package
Section 89
//select_DiceRoll (select_DiceRoll)
package {
import flash.media.*;
public dynamic class select_DiceRoll extends Sound {
}
}//package
Section 90
//starterBuildingLIB (starterBuildingLIB)
package {
import flash.display.*;
public dynamic class starterBuildingLIB extends MovieClip {
}
}//package
Section 91
//theme (theme)
package {
import flash.media.*;
public dynamic class theme extends Sound {
}
}//package
Section 92
//unit_rotate (unit_rotate)
package {
import flash.media.*;
public dynamic class unit_rotate extends Sound {
}
}//package
Section 93
//wallSlotLIB (wallSlotLIB)
package {
import flash.display.*;
public dynamic class wallSlotLIB extends MovieClip {
}
}//package