Frame 1
this.play();
this.load_sounds = false;
this.local_mode = false;
this.s3_mode = true;
this.base_url = "http://www.playr.co.uk/onslaught/";
this.ok_url = this.base_url + "/ok.php";
this.score_url = "http://www.playr.co.uk/onslaught/";
if (this.local_mode == true) {
this.base_url = "http://localhost/~gaby/onslaught/";
this.ok_url = this.base_url + "/ok.php";
this.score_url = this.base_url;
this.score_url = "http://ec2-1.playr.co.uk/onslaught/";
} else if (this.s3_mode == true) {
this.base_url = "http://s3.playr.co.uk/onslaught/";
this.ok_url = this.base_url + "ok.html";
this.score_url = "http://ec2-1.playr.co.uk/onslaught/";
}
this.play();
Frame 4
if (this.load_sounds == true) {
loadMovieNum ("SoundLibrary.swf", 1);
}
Frame 7
this.stop();
_level1._visible = false;
var b_loaded = this.getBytesLoaded();
var b_total = this.getBytesTotal();
if (this.load_sounds == true) {
b_loaded = b_loaded + _level1.getBytesLoaded();
b_total = b_total + _level1.getBytesTotal();
}
if (b_loaded < b_total) {
var pct = Math.floor((b_loaded / b_total) * 100);
this.Loading.text = pct + "%";
this.play();
} else {
this.gotoAndPlay("Loaded");
}
Frame 10
this.gotoAndPlay("Load");
Frame 13
this.stop();
if (this.local_mode == false) {
Loading.text = "Hacking...";
var lv = new LoadVars();
lv.i_am = "kloot";
var lv_into = new LoadVars();
lv_into.onLoad = function (success) {
if (success) {
if (this.ok == 1) {
gotoAndPlay ("Done");
} else {
Loading.text = this.error;
}
} else {
gotoAndPlay ("Done");
}
};
var lv_url = this.ok_url;
lv.sendAndLoad(lv_url, lv_into, "GET");
} else {
this.gotoAndPlay("Done");
}
Frame 16
this.stop();
if (this.view_layout) {
gotoAndPlay (44);
} else {
gotoAndPlay (19);
}
Frame 19
this.attacker_count = 0;
this.attackers = new Array();
this.waves = new Array();
this.smoke_trails = new Array();
this.game_map = "map1";
this.turret_counter = 0;
this.sound_engine = _level1;
this.sound_engine._visible = false;
this.NewAttacker = function (the_energy, the_value) {
this.attacker_count++;
var _local3 = "Attacker" + this.attacker_count;
var _local4 = this.getNextHighestDepth();
var _local2 = this.attachMovie("Attacker", _local3, _local4);
_local2._x = this.Waypoint1._x;
_local2._y = this.Waypoint1._y;
_local2.energy_start = the_energy;
_local2.cash_bounty = the_value;
_local2.waypoint_total = this.waypoint_total;
_local2.active = true;
_local2.my_name = _local3;
this.attackers[_local3] = _local2;
};
this.TidyUp = function () {
for (var _local2 in this.waves) {
removeMovieClip(this.waves[_local2]);
}
for (var _local2 in this.turrets) {
removeMovieClip(this.turrets[_local2]);
}
for (var _local2 in this.attackers) {
removeMovieClip(this.attackers[_local2]);
}
for (var _local2 in this.smoke_trails) {
removeMovieClip(this.smoke_trails[_local2]);
}
this.attackers = new Array();
this.waves = new Array();
this.turrets = new Array();
this.smoke_trails = new Array();
this.smoke_count = 0;
this.TurretHighlightHide();
this.cur_turret = false;
};
this.BaseHit = function () {
return(false);
};
this.KilledAttacker = function () {
return(false);
};
this.rocketSmoke = function (source_obj) {
this.smoke_count++;
var _local5 = "RocketTrail";
var _local3 = "RocketTrail" + this.smoke_count;
var _local4 = this.getNextHighestDepth();
var _local2 = this.attachMovie(_local5, _local3, _local4);
_local2._x = source_obj._x;
_local2._y = source_obj._y;
_local2._rotation = Math.random() * 360;
this.smoke_trails.push(_local2);
};
this.Payment = function (amount) {
if (this.game_over) {
return(false);
}
if (this.player_cash >= amount) {
this.player_cash = this.player_cash - amount;
this.total_spent = this.total_spent + amount;
CashUpdate();
return(true);
}
return(false);
};
this.CanAfford = function (amount) {
if (this.game_over) {
return(false);
}
if (this.player_cash >= amount) {
return(true);
}
return(false);
};
this.CashWin = function (amount) {
this.player_cash = this.player_cash + amount;
CashUpdate();
};
this.CashUpdate = function () {
Cash.text = "$" + this.player_cash;
};
this.degreesToTarget = function (point_from, point_to) {
var _local3 = this.radiansToTarget(point_from, point_to);
var _local2 = _local3 * 57.29578;
return(_local2);
};
this.radiansToTarget = function (point_from, point_to) {
var _local3 = point_from._x;
var _local1 = point_from._y;
var _local4 = point_to._x;
var _local2 = point_to._y;
var _local5 = Math.atan2(_local2 - _local1, _local4 - _local3);
return(_local5);
};
this.DistanceBetween = function (obj_a, obj_b) {
var _local1 = obj_b._x - obj_a._x;
var _local2 = obj_b._y - obj_a._y;
var _local3 = Math.sqrt((_local1 * _local1) + (_local2 * _local2));
return(_local3);
};
this.trigForwardAtAngle = function (the_angle, the_amount) {
var _local4 = parseFloat(the_angle);
var _local2 = _local4 * 0.01745329;
var _local3 = the_amount;
var _local1 = new Object();
_local1.x = Math.cos(_local2) * _local3;
_local1.y = Math.sin(_local2) * _local3;
return(_local1);
};
this.dec2hex = function (dec) {
var _local1 = "0123456789ABCDEF";
if (dec > 15) {
pos1 = _local1.charAt(Math.floor(dec / 16));
pos2 = _local1.charAt(dec - (pos1 * 16));
} else {
pos1 = 0;
pos2 = _local1.charAt(dec);
}
hex = pos1 + pos2;
return(hex);
};
this.sound_engine = _level1;
this.sound_engine._visible = false;
this.sound_engine.sound_muted = true;
this.NewTurret = function (the_x, the_y, the_type) {
if (this.game_over) {
return(false);
}
var _local6 = this.turrets_cost[the_type];
if (!this.Payment(_local6)) {
return(false);
}
this.turret_counter++;
var _local8 = this.getNextHighestDepth();
var _local7 = "Turret" + the_type;
var _local9 = _local7 + this.turret_counter;
var _local4 = _root.attachMovie(_local7, _local9, _local8);
_local4._x = the_x;
_local4._y = the_y;
_local4.turret_type = the_type;
_local4.turret_num = this.turret_counter;
_local4.cash_value = parseInt(_local6);
_local4.active = true;
for (var _local5 in this.turrets) {
var _local3 = this.turrets[_local5];
_local3.notifyNew(_local4);
}
this.turrets.push(_local4);
return(true);
};
this.TryAndBuild = function (the_type) {
this.CancelBuild();
if (this.game_over) {
return(false);
}
var _local9 = _root;
_local9.build_clip = _local9.attachMovie("BuildShape", "BuildShape", _local9.getNextHighestDepth());
_local9.build_clip._x = _root._xmouse;
_local9.build_clip._y = _root._ymouse;
_local9.build_clip.can_build = false;
_local9.build_clip.startDrag();
_local9.build_clip.checkBuild = function () {
var _local18 = _root.turrets_cost[the_type];
if (_local18 > _root.player_cash) {
this.can_afford = false;
return(false);
}
this.can_afford = true;
if ((((this.hitTest(_root.OutOfBoundsTop) || (this.hitTest(_root.OutOfBoundsRight))) || (this.hitTest(_root.OutOfBoundsBottom))) || (this.hitTest(_root.OutOfBoundsLeft))) || (this.hitTest(_root.OutOfBoundsNav))) {
return(false);
}
var _local14 = (this._width / 2) + 1;
var _local17 = (this._height / 2) + 1;
var _local9 = _root._xmouse;
var _local10 = _root._ymouse;
var _local3 = new Array();
_local3.push(Array(_local9, _local10 + _local17));
_local3.push(Array(_local9, _local10 - _local17));
_local3.push(Array(_local9 + _local14, _local10));
_local3.push(Array(_local9 - _local14, _local10));
var _local12 = 0.8509035 * _local14;
var _local13 = 0.525322 * _local14;
_local3.push(Array(_local9 + _local12, _local10 + _local13));
_local3.push(Array(_local9 + _local12, _local10 - _local13));
_local3.push(Array(_local9 - _local12, _local10 + _local13));
_local3.push(Array(_local9 - _local12, _local10 - _local13));
var _local11 = this._width * 2;
var _local8 = _root.turrets;
for (var _local15 in _local8) {
var _local6 = _local8[_local15];
var _local7 = _root.DistanceBetween(this, _local6);
if (_local7 < _local11) {
for (var _local16 in _local3) {
var _local4 = _local3[_local16][0];
var _local5 = _local3[_local16][1];
if (_local6.hitTest(_local4, _local5, true)) {
return(false);
}
}
}
}
for (var _local16 in _local3) {
var _local4 = _local3[_local16][0];
var _local5 = _local3[_local16][1];
if (_root.AttackerPath.hitTest(_local4, _local5, true)) {
return(false);
}
if (_root.PlayerBase.hitTest(_local4, _local5, true)) {
return(false);
}
}
return(true);
};
_local9.build_clip.onEnterFrame = function () {
var _local2 = this.checkBuild();
this.can_build = _local2;
};
_local9.build_clip.onPress = function () {
if (this.checkBuild()) {
_root.NewTurret(_root._xmouse, _root._ymouse, the_type);
}
this.stopDrag();
removeMovieClip(this);
};
};
this.CancelBuild = function () {
_root.build_clip.stopDrag();
removeMovieClip(_root.build_clip);
};
this.WeaponFired = function () {
this.total_shots++;
};
this.rangeShow = function (the_turret) {
if (!the_turret) {
return(false);
}
if (this.the_range != false) {
return(true);
}
if (the_turret.range_effective > the_turret.weapon_range) {
var _local3 = this.getNextHighestDepth();
var _local4 = "TurretRangeEffective";
var _local6 = _local4 + _local3;
var _local5 = this.attachMovie(_local4, _local6, _local3);
_local5._width = the_turret.range_effective * 2;
_local5._height = the_turret.range_effective * 2;
_local5._x = the_turret._x;
_local5._y = the_turret._y;
this.the_range_effective = _local5;
}
var _local3 = this.getNextHighestDepth();
var _local4 = "TurretRange";
var _local6 = _local4 + _local3;
this.the_range = this.attachMovie(_local4, _local6, _local3);
this.the_range._width = the_turret.weapon_range * 2;
this.the_range._height = the_turret.weapon_range * 2;
this.the_range._x = the_turret._x;
this.the_range._y = the_turret._y;
};
this.rangeHide = function () {
if (this.the_range != "") {
removeMovieClip(this.the_range);
removeMovieClip(this.the_range_effective);
this.the_range = false;
}
};
this.TurretSell = function () {
if (this.game_over) {
return(false);
}
if (this.cur_turret == false) {
return(false);
}
the_turret = this.cur_turret;
the_turret._visible = false;
the_turret.onSell();
var _local6 = the_turret.cash_value;
var _local5 = Math.ceil(_local6 * this.turret_resale);
this.Kerching(the_turret._x, the_turret._y, _local6);
this.CashWin(_local5);
this.CashUnspend(_local5);
var _local3 = new Array();
for (var _local4 in this.turrets) {
var _local2 = this.turrets[_local4];
if (_local2 != the_turret) {
_local2.notifyGone(the_turret);
_local3.push(_local2);
}
}
this.turrets = _local3;
the_turret.removeMovieClip();
this.cur_turret = false;
this.TurretHighlightHide();
return(true);
};
this.TurretGetLayout = function () {
var _local4 = new Array();
for (var _local5 in this.turrets) {
var _local3 = this.turrets[_local5];
var _local2 = new Object();
_local2.x = _local3._x;
_local2.y = _local3._y;
_local2.name = _local3._name;
_local2.turret_type = _local3.turret_type;
_local2.weapon_rotation = _local3.Weapon._rotation;
_local2.upgrade_damage = _local3.upgrade_damage_level;
_local2.upgrade_range = _local3.upgrade_range_level;
_local2.upgrade_rate = _local3.upgrade_rate_level;
_local2.weapon_damage = _local3.weapon_damage;
_local2.weapon_range = _local3.weapon_range;
_local2.weapon_rate = _local3.weapon_rate;
_local2.weapon_fire_count = _local3.weapon_fire_count;
_local2.weapon_kill_count = _local3.weapon_kill_count;
_local4.push(_local2);
}
return(_local4);
};
this.TurretHighlightShow = function () {
if (!this.turret_highlight) {
var _local3 = "TurretHighlight";
var _local2 = this.getNextHighestDepth();
var _local4 = _local3 + _local2;
var _local5 = this.attachMovie(_local3, _local4, _local2);
this.turret_highlight = _local5;
}
this.turret_highlight._x = this.cur_turret._x;
this.turret_highlight._y = this.cur_turret._y;
};
this.TurretHighlightHide = function () {
if (this.turret_highlight) {
this.turret_highlight.removeMovieClip();
}
this.turret_highlight = false;
};
this.TurretFired = function (the_bullet) {
this.bullets.push(the_bullet);
};
this.stop();
this.TidyUp();
this.NextWave = function () {
};
this.waves = new Array();
this.turrets = new Array();
Green1.turret_type = "Green";
Green2.turret_type = "Green";
Green3.turret_type = "Green";
this.turrets.push(Green1);
this.turrets.push(Green2);
this.turrets.push(Green3);
this.waypoint_total = 2;
this.attacker_energy = 220;
this.attacker_value = 1;
WaveyDavey.gotoAndStop("Idle");
WaveyDavey.wave_spacing = 1200;
WaveyDavey.wave_size = 1;
WaveyDavey.attacker_spacing = 1;
WaveyDavey.gotoAndPlay("Spwan");
Frame 24
this.stop();
TidyUp();
this.waypoint_total = 3;
WaveyDavey1.wave_spacing = 1200;
WaveyDavey1.wave_size = 1;
WaveyDavey1.attacker_spacing = 1;
this.attacker_energy = 220;
this.attacker_value = 1;
WaveyDavey1.SendWave();
this.player_cash = 100;
this.turrets_cost = new Array();
this.turrets_cost.Blue = 10;
this.turrets_cost.Green = 15;
this.turrets_cost.Red = 20;
_root.turrets = new Array();
CashUpdate();
Instance of Symbol 547 MovieClip "Keyboard" in Frame 24
onClipEvent (keyDown) {
theKey = Key.getCode();
if (theKey == 49) {
this._parent.TryAndBuild("Blue");
} else if (theKey == 50) {
this._parent.TryAndBuild("Green");
} else if (theKey == 51) {
this._parent.TryAndBuild("Red");
} else if (theKey == 81) {
this._parent.TurretUpgrade.tryUpgradeDamage();
} else if (theKey == 87) {
this._parent.TurretUpgrade.tryUpgradeRange();
} else if (theKey == 69) {
this._parent.TurretUpgrade.tryUpgradeRate();
} else if (theKey == 27) {
this._parent.CancelBuild();
} else if (theKey == 39) {
this._parent.WeaponStore.storeNextItem();
} else if (theKey == 37) {
this._parent.WeaponStore.storePrevItem();
} else if (theKey == 13) {
this._parent.WeaponStore.storeBuyItem();
} else if (theKey == 66) {
this._parent.WeaponStore.storeBuyItem();
}
}
onClipEvent (keyUp) {
var theKey = Key.getCode();
}
Frame 29
this.stop();
TidyUp();
this.NextWave = function () {
this.attacker_energy = this.attacker_energy * 1.12;
this.attacker_value++;
};
this.waves = new Array();
this.turrets = new Array();
Green1.turret_type = "Green";
this.turrets.push(Red1);
this.turrets.push(Green1);
this.turrets.push(Blue1);
this.waypoint_total = 2;
WaveyDavey2.wave_spacing = 1500;
WaveyDavey2.wave_size = 2;
WaveyDavey2.attacker_spacing = 400;
this.attacker_energy = 50;
this.attacker_value = 2;
this.player_cash = 400;
WaveyDavey2.SendWave();
Frame 34
this.stop();
TidyUp();
Instance of Symbol 547 MovieClip "Keyboard" in Frame 34
onClipEvent (keyDown) {
theKey = Key.getCode();
}
onClipEvent (keyUp) {
var theKey = Key.getCode();
}
Frame 39
this.stop();
TidyUp();
Frame 44
this.game_version = "v3.3f";
this.debug_mode = false;
if (this.debug_mode == true) {
this.starting_cash = 100000 /* 0x0186A0 */;
this.game_version = this.game_version + "-d";
}
if (this.game_map == undefined) {
this.game_map = "map1";
}
if (this.starting_cash == undefined) {
this.starting_cash = 9999999999;
}
if (this.starting_lives == undefined) {
this.starting_lives = 100;
}
if (this.attacker_upgrade_rate == undefined) {
this.attacker_upgrade_rate = 1.125;
}
if (this.attacker_start_energy == undefined) {
this.attacker_start_energy = 10;
}
if (this.attacker_speed == undefined) {
this.attacker_speed = 60;
}
if (this.wave_size == undefined) {
this.wave_size = 10;
}
if (this.wave_spacing == undefined) {
this.wave_spacing = 20000;
}
if (this.attacker_spacing == undefined) {
this.attacker_spacing = 700;
}
if (this.turret_resale == undefined) {
this.turret_resale = 0.7;
}
this.waypoint_total = 13;
this.attacker_types = 8;
this.attackers = new Array();
this.waves = new Array();
this.turrets = new Array();
this.turret_builders = new Array();
this.waypoints = new Array();
this.smoke_trails = new Array();
this.bullets = new Array();
this.mines = new Array();
this.turrets_cost = new Array();
this.turrets_cost.Blue = 1;
this.turrets_cost.Green = 1;
this.turrets_cost.Red = 1;
this.turrets_cost.DamageUp = 1;
this.turrets_cost.RangeUp = 1;
this.turrets_cost.RateUp = 1;
this.turrets_cost.DamageUpBig = 1;
this.turrets_cost.DamageUpBigExchange = 1;
this.turrets_cost.RangeUpExchange = 1;
this.turrets_cost.RateUpExchange = 1;
this.turrets_available = new Array();
this.game_over = false;
OutOfBoundsTop._visible = false;
OutOfBoundsRight._visible = false;
OutOfBoundsBottom._visible = false;
OutOfBoundsLeft._visible = false;
OutOfBoundsNav._visible = false;
this.AttackerPath = false;
this.PlayerBase = false;
this.ResetGame = function () {
this.RemoveEverything();
this.ResetVars();
this.RoadCreate();
WaveController.gotoAndStop("Idle");
WaveController.wave_spacing = this.wave_spacing;
WaveController.wave_size = this.wave_size;
WaveController.attacker_spacing = this.attacker_spacing;
WaveController.gotoAndPlay("Spwan");
this.CashUpdate();
};
this.ResetVars = function () {
this.game_over = false;
this.game_level = 0;
this.player_cash = this.starting_cash;
this.player_lives = this.starting_lives;
this.attacker_level = 500;
this.attacker_count = 0;
this.attacker_upgrade = this.attacker_upgrade_rate;
this.attacker_energy = this.attacker_start_energy / this.attacker_upgrade;
this.total_kills = 0;
this.total_spent = 0;
this.total_shots = 0;
this.cur_turret = false;
this.turret_counter = 0;
this.attackers = new Array();
this.waves = new Array();
this.turrets = new Array();
this.turret_builders = new Array();
this.waypoints = new Array();
this.smoke_trails = new Array();
this.mines = new Array();
this.bullets = new Array();
this.turrets_available = new Array();
this.turrets_available.Red = true;
this.turrets_available.Green = true;
this.turrets_available.Blue = true;
if (this.debug_mode == true) {
this.turrets_available.DamageUp = true;
this.turrets_available.RangeUp = true;
this.turrets_available.RateUp = true;
this.turrets_available.DamageUpBig = true;
this.turrets_available.RangeUpBig = true;
this.turrets_available.RateUpBig = true;
this.turrets_available.DamageUpBigExchange = true;
this.turrets_available.RangeUpExchange = true;
this.turrets_available.RateUpExchange = true;
}
PlayerBase.resetLives();
WeaponStore.storeEmpty();
this.rangeHide();
};
this.RemoveEverything = function () {
this.CancelBuild();
for (var _local2 in this.waves) {
removeMovieClip(this.waves[_local2]);
}
for (var _local2 in this.turrets) {
removeMovieClip(this.turrets[_local2]);
}
for (var _local2 in this.turret_builders) {
removeMovieClip(this.turret_builders[_local2]);
}
for (var _local2 in this.attackers) {
removeMovieClip(this.attackers[_local2]);
}
for (var _local2 in this.waypoints) {
removeMovieClip(this.waypoints[_local2]);
}
for (var _local2 in this.mines) {
removeMovieClip(this.mines[_local2]);
}
if (this.GameOver) {
removeMovieClip(this.GameOver);
}
if (this.AttackerPath) {
this.AttackerPath.removeMovieClip();
}
if (this.PlayerBase) {
this.PlayerBase.removeMovieClip();
}
this.TurretHighlightHide();
};
this.StopEverything = function () {
WaveController.gotoAndStop("Stopped");
this.sound_engine.musicFadeStop();
for (var _local3 in this.waves) {
var _local2 = this.waves[_local3];
_local2.active = false;
_local2.gotoAndStop("Stopped");
}
for (var _local3 in this.turrets) {
var _local2 = this.turrets[_local3];
_local2.active = false;
_local2.gotoAndStop("Stopped");
}
for (var _local3 in this.attackers) {
var _local2 = this.attackers[_local3];
_local2.active = false;
_local2.gotoAndStop("Stopped");
}
};
this.RoadCreate = function () {
var _local3 = "TheRoad";
var _local2 = this.getNextHighestDepth();
var _local4 = "AttackerPath";
this.AttackerPath = this.attachMovie(_local4, _local3, _local2);
if (this.map_layouts[this.game_map]) {
this.AttackerPath.map_layout = this.map_layouts[this.game_map];
this.AttackerPath.map_base = this.map_bases[this.game_map];
}
};
this.GotoHomepage = function () {
this.RemoveEverything();
this.ResetVars();
gotoAndPlay (19);
};
this.NextWave = function () {
if (this.game_over) {
return(false);
}
this.game_level++;
this.attacker_value = this.game_level;
this.attacker_energy = this.attacker_energy * this.attacker_upgrade;
this.ReelLevel.setValue(this.game_level);
};
this.message_setup = false;
this.message_hints = new Array("Press 1 to build a blue turret", "Press 2 to build a green turret", "Press 3 to build a red turret", "Hold R to view a turret's range", "Press Q to upgrade the selected turret's damage", "Press W to upgrade the selected turret's range", "Press E to upgrade the selected turret's rate of fire", "Press S to sell a turret, for 75% of the cost of the turret and it's upgrades", "Bored waiting for the next wave? Press the spacebar to send it now", "Use the left and right arrow keys to select a weapon in the store", "Press B to build the currently selected weapon in the store", "Upgrade the range and fire rate on red towers to active 'Holding Pattern'", "Upgrade the damage and fire rate on blue towers to make them 'Freak Out'", "Green towers can link together in a chain to do much more damage", "Two blue turrets in combo mode will lay down landmines", "One green, red and blue turret in combo mode will fire a BFG", "One red and two blue turrets in combo mode will fire a Nuke", "One red, green and blue turret in combo mode will fire a poison rocket", "Two blue and one red turret in combo mode will lay down a big landmine", "Don't drive tired, make time for a break", "Mayonnaise will go bad if you don't keep it refridgerated after opening", "As long as there is an attacker on screen, rockets will head for it", "Rockets in holding pattern mode will always wait for attackers to hit", "Reading the manual can be beneficial to your life", "Laser turrets work better in long chains", "It's often better to upgrade existing turrets rather than build new ones", "Upgrade a turret's damage all the way to activate it's combo mode", "Several grouped turrets in combo mode can fire many different combo weapons", "The combo weapon that is fired depends on which turrets fires first", "Never lick the live terminal, cross the streams or eat bees.", "It's very hard to convince people to read manuals.", "Seriously, check out how to play, it'll make your game more fun", "Do you have the relevant cable?", "Ooh, lovely. Milk with two sugars please!", "There's more fun games to play on http://playr.co.uk/", "There's more fun games to play on http://playr.co.uk/");
this.messageNew = function (the_msg) {
this.message_box.swapDepths(this.getNextHighestDepth());
this.message_box.messageShow(the_msg);
};
this.messageHint = function () {
var _local2 = this.message_hints.length;
var _local4 = Math.floor(Math.random() * _local2);
var _local3 = "Hint: " + this.message_hints[_local4];
this.messageNew(_local3);
};
if (typeof(this.mesage_box) == "movieclip") {
this.message_box.removeMovieClip();
}
var new_id = "MessageBar";
var new_depth = this.getNextHighestDepth();
var new_name = (new_id + new_depth);
this.message_box = this.attachMovie(new_id, new_name, new_depth);
this.message_box._x = 360;
this.message_box._y = 470;
this.rocketSmoke = function (source_obj) {
if (this.smoke_trails == undefined) {
this.smoke_trails = new Array();
}
var _local4 = "RocketTrail";
var _local3 = this.getNextHighestDepth();
var _local5 = _local4 + _local3;
var _local2 = this.attachMovie(_local4, _local5, _local3);
_local2._x = source_obj._x;
_local2._y = source_obj._y;
_local2._rotation = Math.random() * 360;
this.smoke_trails.push(_local2);
};
this.weaponAvailable = function (new_type) {
var _local3 = false;
var _local5 = false;
var _local4 = false;
if (new_type == "RangeUp") {
_local3 = "Turret" + new_type;
_local5 = this.turrets_cost[new_type];
_local4 = new_type;
} else if (new_type == "DamageUp") {
_local3 = "Turret" + new_type;
_local5 = this.turrets_cost[new_type];
_local4 = new_type;
} else if (new_type == "DamageUpBig") {
_local3 = "Turret" + new_type;
_local5 = this.turrets_cost[new_type];
_local4 = new_type;
} else if (new_type == "RateUp") {
_local3 = "Turret" + new_type;
_local5 = this.turrets_cost[new_type];
_local4 = new_type;
} else if (new_type == "RateUpExchange") {
_local3 = "Turret" + new_type;
_local5 = this.turrets_cost[new_type];
_local4 = new_type;
} else if (new_type == "RangeUpExchange") {
_local3 = "Turret" + new_type;
_local5 = this.turrets_cost[new_type];
_local4 = new_type;
} else if (new_type == "DamageUpBigExchange") {
_local3 = "Turret" + new_type;
_local5 = this.turrets_cost[new_type];
_local4 = new_type;
}
if (_local3 != false) {
this.turrets_available[_local4] = true;
WeaponStore.storeAddItem(_local3, _local5, _local4);
this.messageNew("New weapon available in the weapon store!");
}
};
this.weaponStoreUpdate = function () {
if (this.total_kills == 1) {
this.weaponAvailable("RangeUp");
}
if (this.total_kills == 1) {
this.weaponAvailable("DamageUp");
}
if (this.total_kills == 1) {
this.weaponAvailable("RateUpExchange");
}
if (this.total_kills == 1) {
this.weaponAvailable("RangeUpExchange");
}
if (this.total_kills == 1) {
this.weaponAvailable("RateUp");
}
if (this.total_kills == 1) {
this.weaponAvailable("DamageUpBig");
}
if (this.total_kills == 1) {
this.weaponAvailable("DamageUpBigExchange");
}
};
this.NewAttacker = function (the_energy, the_value, wave_num) {
if (this.game_over) {
return(false);
}
this.attacker_count++;
var _local3 = "Attacker" + this.attacker_count;
var _local5 = this.getNextHighestDepth();
var _local4 = "Attacker" + (wave_num % this.attacker_types);
var _local2 = this.attachMovie(_local4, _local3, _local5);
_local2._x = this.Waypoint1._x;
_local2._y = this.Waypoint1._y;
_local2.energy_start = the_energy;
_local2.cash_bounty = the_value;
_local2.waypoint_total = this.waypoint_total;
_local2.move_speed = this.attacker_speed;
_local2.active = true;
_local2.my_name = _local3;
this.attackers[_local3] = _local2;
};
this.KilledAttacker = function (the_att) {
if (this.game_over) {
return(false);
}
var _local5 = the_att.my_name;
this.CashWin(the_att.cash_bounty);
this.Kerching(the_att._x, the_att._y, the_att.cash_bounty);
this.total_kills++;
this.attackers[_local5] = undefined;
this.soundEffect("Death");
var _local3 = new Array();
for (att in this.attackers) {
var _local2 = this.attackers[att]._name;
if (_local2) {
_local3[att] = this.attackers[att];
}
}
this.attackers = _local3;
if (this.total_kills == 500) {
this.messageShow("Five hundred kills! Woot!");
}
if (this.total_kills == 1000) {
this.messageShow("A thousand kills! Keep on going...");
}
if (this.total_kills == 1500) {
this.messageShow("Fifteen hundred kills, is there no stopping you?");
}
if (this.total_kills == 2000) {
this.messageShow("Two thousand kills! Clearly you know what you're doing :)");
}
this.weaponStoreUpdate();
if ((this.total_kills % 157) == 0) {
this.messageHint();
}
this.ReelKills.setValue(this.total_kills);
};
this.BaseHit = function () {
PlayerBase.lifeLost(this.player_lives);
this.player_lives--;
if (this.player_lives == 0) {
this.game_over = true;
this.StopEverything();
var _local3 = this.attachMovie("GameOver", "GameOver", this.getNextHighestDepth());
_local3._x = (_root._width / 2) - (_local3._width / 2);
_local3._y = (_root._height / 2) - (_local3._height / 2);
_local3._alpha = 75;
_local3.total_kills = this.total_kills;
_local3.total_spent = this.total_spent;
_local3.total_shots = this.total_shots;
}
};
this.NewTurret = function (the_x, the_y, the_type) {
if (this.game_over) {
return(false);
}
var _local4 = this.turrets_cost[the_type];
if (!this.Payment(_local4)) {
return(false);
}
this.turret_counter++;
var _local6 = this.getNextHighestDepth();
var _local5 = "TurretBuilder";
var _local7 = _local5 + this.turret_counter;
var _local3 = _root.attachMovie(_local5, _local7, _local6);
_local3._x = the_x;
_local3._y = the_y;
_local3.turret_type = the_type;
_local3.turret_num = this.turret_counter;
_local3.cash_value = parseInt(_local4);
_local3.active = true;
this.turret_builders.push(_local3);
this.soundEffect("Build");
return(true);
};
this.NewTurretBuilt = function (the_builder) {
var _local3 = new Array();
for (var _local5 in this.turret_builders) {
var _local2 = this.turret_builders[_local5];
if (_local2 != the_builder) {
_local3.push(_local2);
continue;
}
}
this.turret_builders = _local3;
the_builder.removeMovieClip();
};
this.TryAndBuild = function (the_type) {
this.CancelBuild();
if (this.game_over) {
return(false);
}
var _local8 = _root;
_local8.build_clip = _local8.attachMovie("BuildShape", "BuildShape", _local8.getNextHighestDepth());
_local8.build_clip._x = _root._xmouse;
_local8.build_clip._y = _root._ymouse;
_local8.build_clip.can_build = false;
_local8.build_clip.weapon_range = _root.WeaponStore.storeGetRange(the_type);
_local8.build_clip.startDrag();
_local8.build_clip.checkBuild = function () {
var _local18 = _root.turrets_cost[the_type];
if (_local18 > _root.player_cash) {
this.can_afford = false;
return(false);
}
this.can_afford = true;
if ((((this.BuildArea.hitTest(_root.OutOfBoundsTop) || (this.BuildArea.hitTest(_root.OutOfBoundsRight))) || (this.BuildArea.hitTest(_root.OutOfBoundsBottom))) || (this.BuildArea.hitTest(_root.OutOfBoundsLeft))) || (this.BuildArea.hitTest(_root.OutOfBoundsNav))) {
return(false);
}
var _local14 = (this.BuildArea._width / 2) + 1;
var _local17 = (this.BuildArea._height / 2) + 1;
var _local9 = _root._xmouse;
var _local10 = _root._ymouse;
var _local3 = new Array();
_local3.push(Array(_local9, _local10 + _local17));
_local3.push(Array(_local9, _local10 - _local17));
_local3.push(Array(_local9 + _local14, _local10));
_local3.push(Array(_local9 - _local14, _local10));
var _local12 = 0.8509035 * _local14;
var _local13 = 0.525322 * _local14;
_local3.push(Array(_local9 + _local12, _local10 + _local13));
_local3.push(Array(_local9 + _local12, _local10 - _local13));
_local3.push(Array(_local9 - _local12, _local10 + _local13));
_local3.push(Array(_local9 - _local12, _local10 - _local13));
var _local11 = this.BuildArea._width;
var _local8 = _root.turrets;
_local8 = _local8.concat(_root.turret_builders);
for (var _local15 in _local8) {
var _local7 = _local8[_local15];
var _local6 = _root.DistanceBetween(this, _local7);
if (_local6 < _local11) {
return(false);
}
}
for (var _local16 in _local3) {
var _local4 = _local3[_local16][0];
var _local5 = _local3[_local16][1];
if (_root.AttackerPath.hitTest(_local4, _local5, true)) {
return(false);
}
if (_root.PlayerBase.hitTest(_local4, _local5, true)) {
return(false);
}
}
return(true);
};
_local8.build_clip.onEnterFrame = function () {
var _local2 = this.checkBuild();
this.can_build = _local2;
};
_local8.build_clip.onPress = function () {
var _local3 = this.checkBuild();
if (_local3 == true) {
_root.NewTurret(_root._xmouse, _root._ymouse, the_type);
}
this.stopDrag();
removeMovieClip(this);
};
};
this.CancelBuild = function () {
_root.build_clip.stopDrag();
removeMovieClip(_root.build_clip);
};
this.WeaponFired = function () {
this.total_shots++;
};
this.rangeShow = function (the_turret) {
if (!the_turret) {
return(false);
}
if (this.the_range != false) {
return(true);
}
if (the_turret.range_effective > the_turret.weapon_range) {
var _local3 = this.getNextHighestDepth();
var _local4 = "TurretRangeEffective";
var _local6 = _local4 + _local3;
var _local5 = this.attachMovie(_local4, _local6, _local3);
_local5._width = the_turret.range_effective * 2;
_local5._height = the_turret.range_effective * 2;
_local5._x = the_turret._x;
_local5._y = the_turret._y;
this.the_range_effective = _local5;
}
var _local3 = this.getNextHighestDepth();
var _local4 = "TurretRange";
var _local6 = _local4 + _local3;
this.the_range = this.attachMovie(_local4, _local6, _local3);
this.the_range._width = the_turret.weapon_range * 2;
this.the_range._height = the_turret.weapon_range * 2;
this.the_range._x = the_turret._x;
this.the_range._y = the_turret._y;
};
this.rangeHide = function () {
if (this.the_range != "") {
removeMovieClip(this.the_range);
removeMovieClip(this.the_range_effective);
this.the_range = false;
}
};
this.TurretSell = function () {
if (this.game_over) {
return(false);
}
if (this.cur_turret == false) {
return(false);
}
the_turret = this.cur_turret;
the_turret._visible = false;
the_turret.onSell();
var _local6 = the_turret.cash_value;
var _local5 = Math.ceil(_local6 * this.turret_resale);
this.Kerching(the_turret._x, the_turret._y, _local5);
this.CashWin(_local5);
this.CashUnspend(_local5);
var _local3 = new Array();
for (var _local4 in this.turrets) {
var _local2 = this.turrets[_local4];
if (_local2 != the_turret) {
_local2.notifyGone(the_turret);
_local3.push(_local2);
continue;
}
}
this.turrets = _local3;
the_turret.removeMovieClip();
this.cur_turret = false;
this.TurretHighlightHide();
return(true);
};
this.TurretGetLayout = function () {
var _local4 = new Array();
for (var _local5 in this.turrets) {
var _local3 = this.turrets[_local5];
var _local2 = new Object();
_local2.x = _local3._x;
_local2.y = _local3._y;
_local2.name = _local3._name;
_local2.turret_type = _local3.turret_type;
_local2.weapon_rotation = _local3.Weapon._rotation;
_local2.upgrade_damage = _local3.upgrade_damage_level;
_local2.upgrade_range = _local3.upgrade_range_level;
_local2.upgrade_rate = _local3.upgrade_rate_level;
_local2.weapon_damage = _local3.weapon_damage;
_local2.weapon_range = _local3.weapon_range;
_local2.weapon_rate = _local3.weapon_rate;
_local2.weapon_fire_count = _local3.weapon_fire_count;
_local2.weapon_kill_count = _local3.weapon_kill_count;
_local4.push(_local2);
}
return(_local4);
};
this.TurretHighlightShow = function () {
if (!this.turret_highlight) {
var _local3 = "TurretHighlight";
var _local2 = this.getNextHighestDepth();
var _local4 = _local3 + _local2;
var _local5 = this.attachMovie(_local3, _local4, _local2);
this.turret_highlight = _local5;
}
this.turret_highlight._x = this.cur_turret._x;
this.turret_highlight._y = this.cur_turret._y;
};
this.TurretHighlightHide = function () {
if (this.turret_highlight) {
this.turret_highlight.removeMovieClip();
}
this.turret_highlight = false;
};
this.TurretFired = function (the_bullet) {
this.bullets.push(the_bullet);
};
this.Payment = function (amount) {
if (this.game_over) {
return(false);
}
if (this.player_cash >= amount) {
this.player_cash = this.player_cash - amount;
this.total_spent = this.total_spent + amount;
CashUpdate();
return(true);
}
return(false);
};
this.CanAfford = function (amount) {
if (this.game_over) {
return(false);
}
if (this.player_cash >= amount) {
return(true);
}
return(false);
};
this.CashWin = function (amount) {
this.player_cash = this.player_cash + amount;
CashUpdate();
};
this.CashUpdate = function () {
this.Cash.text = "$" + this.player_cash;
this.ReelCash.setValue(this.player_cash);
};
this.CashUnspend = function (amount) {
this.total_spent = this.total_spent - amount;
};
this.Kerching = function (the_x, the_y, amount) {
var _local3 = this.getNextHighestDepth();
var _local5 = "Kerching" + _local3;
var _local4 = "CashEarned";
var _local2 = this.attachMovie(_local4, _local5, _local3);
_local2.amount = amount;
_local2._x = the_x;
_local2._y = the_y;
return(_local2);
};
this.degreesToTarget = function (point_from, point_to) {
var _local2 = this.radiansToTarget(point_from, point_to);
return(_local2 * 57.29578);
};
this.radiansToTarget = function (from, to) {
return(Math.atan2(to._y - from._y, to._x - from._x));
};
this.DistanceBetween = function (obj_a, obj_b) {
var _local1 = obj_b._x - obj_a._x;
var _local2 = obj_b._y - obj_a._y;
return(Math.sqrt((_local1 * _local1) + (_local2 * _local2)));
};
this.trigForwardAtAngle = function (theta, hyp) {
var _local2 = theta * 0.01745329;
var _local1 = new Object();
_local1.x = Math.cos(_local2) * hyp;
_local1.y = Math.sin(_local2) * hyp;
return(_local1);
};
this.dec2hex = function (dec) {
var _local1 = "0123456789ABCDEF";
if (dec > 15) {
pos1 = _local1.charAt(Math.floor(dec / 16));
pos2 = _local1.charAt(dec - (pos1 * 16));
} else {
pos1 = 0;
pos2 = _local1.charAt(dec);
}
hex = pos1 + pos2;
return(hex);
};
this.sound_muted = false;
MuteButton._visible = true;
this.sounds = new Array();
this.music = false;
if (this.load_sounds != true) {
this.sound_muted = true;
MuteButton._visible = false;
}
this.musicPlay = function () {
if (this.music == false) {
this.musicSetup();
}
if (this.game_over != true) {
this.music.soundStart();
}
};
this.musicSetup = function () {
if (typeof(this.music) == "movieclip") {
this.music.removeMovieClip();
}
this.music = this.soundNew("MusicImperial");
this.music.playlist_loop = true;
this.music.playlist = new Array("MusicPredator");
};
this.musicFadeStop = function () {
this.music.soundFadeAndStop();
};
this.musicPause = function () {
this.music.soundPause();
};
this.musicRewind = function () {
this.music.soundRewind();
};
this.musicNext = function () {
this.music.soundNextTrack();
};
this.musicStop = function () {
this.music.soundStop();
};
this.soundNew = function (the_track) {
var _local6 = "SoundPlayer";
var _local5 = this.getNextHighestDepth();
var _local8 = _local6 + _local5;
var _local7 = this.attachMovie(_local6, _local8, _local5);
var _local2 = 0;
var _local3 = the_track;
if (_local3 == "RocketFire") {
_local2 = 6;
}
if (_local3 == "BangSmall") {
_local2 = 6;
}
if (_local3 == "Laser") {
_local2 = 6;
}
if (_local3 == "Death") {
_local2 = 10;
}
if (_local3 == "Build") {
_local2 = 4;
}
var _local4 = the_track;
if (_local2 > 0) {
_local4 = (_local3 + "-") + (Math.floor(Math.random() * _local2) + 1);
}
_local7.sound = _local4;
return(_local7);
};
this.soundEffect = function (the_sound) {
if (this.sound_muted == false) {
this.sounds.push(this.soundNew(the_sound));
}
var _local3 = new Array();
for (var _local4 in this.sounds) {
var _local2 = this.sounds[_local4];
if (_local2.duration > 0) {
_local3.push(_local2);
}
}
this.sounds = _local3;
};
this._effectNew = function () {
var _local3 = "VisualEffect";
var _local2 = this.getNextHighestDepth();
var _local4 = _local3 + _local2;
var _local5 = this.attachMovie(_local3, _local4, _local2);
return(_local5);
};
this.effectFadeOut = function (the_obj) {
var _local2 = this._effectNew();
_local2.target_alpha = 0;
_local2.target_obj = the_obj;
return(_local2);
};
this.effectFadeIn = function (the_obj) {
var _local2 = this._effectNew();
_local2.target_alpha = 100;
_local2.target_obj = the_obj;
return(_local2);
};
this.effectWait = function (the_obj) {
var _local2 = this._effectNew();
_local2.target_obj = the_obj;
_local2.wait_time = 1000;
return(_local2);
};
_global.ASProf = {};
ASProf.init = function () {
this._newid = -1;
this._totalTime = 0;
this._methods = {};
this._methodsArr = new this.Array();
this._segmentIDs = {};
this._openSamples = new this.Array();
};
ASProf.begin = function (s) {
if (s == null) {
return(false);
}
if (!this._segmentIDs[s]) {
this._segmentIDs[s] = this._addMethod(s);
}
this._begin(this._segmentIDs[s]);
return(true);
};
ASProf.end = function () {
var _local2 = this._openSamples.pop();
var _local3 = getTimer() - _local2.startTime;
_local2.method.totalTime = _local2.method.totalTime + _local3;
_local2.method.selfTime = _local2.method.selfTime + _local3;
if (_local2._parent) {
_local2._parent.method.selfTime = _local2._parent.method.selfTime - _local3;
} else {
ASProf._totalTime = ASProf._totalTime + _local3;
}
};
ASProf.profile = function (s) {
var f = eval (s);
if (!f) {
return(false);
}
var id = this._addMethod(s);
Set(s, function () {
ASProf._begin(id);
var _local3 = f.apply(this, arguments);
ASProf.end();
return(_local3);
});
ASSetPropFlags(f, null, 0, 1);
for (var i in f) {
Set((s + ".") + i, f[i]);
}
return(true);
};
ASProf.profileObject = function (s) {
var o = eval (s);
if (!o) {
return(false);
}
ASSetPropFlags(o, null, 0, 5);
for (var i in o) {
if (typeof(o[i]) == "function") {
this.profile((s + ".") + i);
}
}
};
ASProf.getFlatGraph = function (order) {
if (order == null) {
order = "selfTime,calls,name";
}
var _local2 = "Flat profile:\n\nEach sample counts as 0.001 seconds.\n % cumulative self self total\n time seconds seconds calls ms/call ms/call name\n";
var _local5 = 0;
this._methodsArr.sortMultiple(order);
var _local6 = this._methodsArr.length;
while (_local6-- , _local6 > -1) {
var _local3 = this._methodsArr[_local6];
if (!_local3.calls) {
continue;
}
_local2 = _local2 + this._formatNumber((_local3.selfTime ? ((100 * _local3.selfTime) / this._totalTime) : 0), 3, 6);
var _local4 = _local3.selfTime / 1000;
_local5 = _local5 + _local4;
_local2 = _local2 + this._formatNumber(_local5, 3, 10);
_local2 = _local2 + this._formatNumber(_local4, 3, 9);
_local2 = _local2 + this._formatNumber(_local3.calls, 0, 9);
_local2 = _local2 + this._formatNumber(_local3.selfTime / _local3.calls, 3, 9);
_local2 = _local2 + this._formatNumber(_local3.totalTime / _local3.calls, 3, 9);
_local2 = _local2 + ((" " + _local3.name) + newline);
}
return(_local2);
};
ASProf._addMethod = function (s) {
var _local2 = ++this._newid;
this._methods[_local2] = new this.Method(s);
this._methodsArr.push(this._methods[_local2]);
return(_local2);
};
ASProf._begin = function (id) {
var _local2 = this._methods[id];
var _local3 = new this.Sample(_local2);
_local2.calls++;
_local3._parent = this._openSamples[this._openSamples.length - 1];
this._openSamples.push(_local3);
};
ASProf._formatNumber = function (n, d, p) {
var _local1 = new ASProf.String(n);
var _local4 = _local1.indexOf(".");
if (_local4 > -1) {
_local1 = _local1.slice(0, (_local4 + d) + 1);
}
var _local2 = _local1.length;
while ((_local2++) < p) {
_local1 = " " + _local1;
}
return(_local1);
};
ASProf.Array = ASconstructor(252, 0);
ASSetNative(ASProf.Array.prototype, 252, "push,pop,concat,shift,unshift,slice,join,splice,toString,sort,reverse,sortOn", 1);
ASProf.Array.prototype.sortMultiple = function (l) {
var cmp = function (a, b, l) {
var _local1 = ASProf.Array.prototype.shift.apply(l);
var _local2 = a[_local1];
var _local3 = b[_local1];
return(((_local2 < _local3) ? -1 : (((_local2 > _local3) ? 1 : ((l.length ? (cmp(a, b, l)) : 0))))));
};
this.sort(function (a, b) {
return(cmp(a, b, ASProf.String.prototype.split.call(l, ",")));
});
};
ASSetPropFlags(ASProf.Array.prototype, null, 3, 7);
ASProf.String = ASconstructor(251, 0);
ASSetNative(ASProf.String.prototype, 251, "valueOf,toString,toUpperCase,toLowerCase,charAt,charCodeAt,concat,indexOf,lastIndexOf,slice,subsring,split,substr,fromCharCode", 1);
ASSetPropFlags(ASProf.String.prototype, null, 3, 7);
ASProf.Method = function (s) {
this.name = s;
this.calls = 0;
this.selfTime = 0;
this.totalTime = 0;
};
ASProf.Sample = function (m) {
this.method = m;
this._parent = null;
this.startTime = getTimer();
};
ASSetPropFlags(ASProf, null, 7);
ASSetPropFlags(_global, "ASProf", 7);
ASProf.init();
this.profileThis = function (thing) {
};
this.profileDump = function () {
};
this.profileThis(this);
var map_layouts = new Array();
var map_bases = new Array();
map_bases.map1 = new Object({x:574.9, y:75.7});
map_layouts.map1 = new Array(new Object({x:0, y:446.2}), new Object({x:84, y:382}), new Object({x:300.45, y:382}), new Object({x:465.85, y:223.6}), new Object({x:636.9, y:223.6}), new Object({x:636.9, y:382}), new Object({x:465.85, y:382}), new Object({x:300.4, y:223.6}), new Object({x:192.2, y:223.6}), new Object({x:192.2, y:35.8}), new Object({x:84, y:35.8}), new Object({x:84, y:129.1}), new Object({x:574.4, y:129.1}));
map_bases.map2 = new Object({x:254.6, y:156.6});
map_layouts.map2 = new Array(new Object({x:655, y:0}), new Object({x:655, y:410}), new Object({x:65, y:410}), new Object({x:65, y:65}), new Object({x:580, y:65}), new Object({x:580, y:335}), new Object({x:140, y:335}), new Object({x:140, y:140}), new Object({x:505, y:140}), new Object({x:505, y:260}), new Object({x:310, y:260}), new Object({x:310, y:240}));
map_bases.map3 = new Object({x:48.2, y:323.2});
map_layouts.map3 = new Array(new Object({x:715, y:65}), new Object({x:583.05, y:65}), new Object({x:583.05, y:390.55}), new Object({x:333.65, y:390.55}), new Object({x:332.85, y:254.85}), new Object({x:456.6, y:254.85}), new Object({x:456.6, y:65}), new Object({x:110.1, y:65}), new Object({x:110.1, y:254.85}), new Object({x:233.35, y:254.85}), new Object({x:233.35, y:353}), new Object({x:147.2, y:353}));
map_bases.map4 = new Object({x:581.2, y:332.6});
map_layouts.map4 = new Array(new Object({x:0, y:209.1}), new Object({x:48.5, y:144.55}), new Object({x:100.35, y:88.95}), new Object({x:161.2, y:50.5}), new Object({x:225.5, y:41.55}), new Object({x:287.55, y:89.6}), new Object({x:308.5, y:176.3}), new Object({x:316, y:273.8}), new Object({x:300.5, y:367.4}), new Object({x:212, y:407.45}), new Object({x:125.85, y:386.45}), new Object({x:75.5, y:337.4}), new Object({x:86.85, y:258.8}), new Object({x:136, y:201.8}), new Object({x:213.5, y:171.8}), new Object({x:333.55, y:177.35}), new Object({x:394.1, y:198.8}), new Object({x:456.05, y:230.2}), new Object({x:512.8, y:266.95}), new Object({x:580.05, y:261}), new Object({x:629.25, y:224.9}), new Object({x:653.4, y:169.3}), new Object({x:659.5, y:110.7}), new Object({x:614.5, y:55.9}), new Object({x:535.25, y:54.6}), new Object({x:459.8, y:99.25}), new Object({x:422.2, y:171.6}), new Object({x:406.05, y:305.3}), new Object({x:446.35, y:354.9}), new Object({x:524.5, y:376}), new Object({x:580.9, y:376}));
map_bases.map5 = new Object({x:587.2, y:249.8});
map_layouts.map5 = new Array(new Object({x:0, y:302.25}), new Object({x:133.8, y:302.25}), new Object({x:156.55, y:283.45}), new Object({x:186.8, y:274.45}), new Object({x:217.05, y:302.25}), new Object({x:263.85, y:302.25}), new Object({x:294.1, y:366.15}), new Object({x:334.8, y:52.2}), new Object({x:363.6, y:415.75}), new Object({x:398.3, y:302.25}), new Object({x:470.65, y:302.25}), new Object({x:491.85, y:274.45}), new Object({x:537.15, y:262.45}), new Object({x:567.35, y:302.25}), new Object({x:585.65, y:302.25}));
map_bases.map6 = new Object({x:564.6, y:356.8});
map_layouts.map6 = new Array(new Object({x:0, y:43.7}), new Object({x:215, y:43.7}), new Object({x:215, y:277.8}), new Object({x:515, y:277.8}), new Object({x:515, y:43.7}), new Object({x:215, y:43.7}), new Object({x:515, y:277.8}), new Object({x:440, y:351.95}), new Object({x:365, y:426.1}), new Object({x:290, y:351.95}), new Object({x:215, y:277.8}), new Object({x:515, y:43.7}), new Object({x:639.85, y:43.7}), new Object({x:639.85, y:368.8}));
map_bases.map7 = new Object({x:24.6, y:356.8});
map_layouts.map7 = new Array(new Object({x:639.85, y:0}), new Object({x:639.85, y:211.85}), new Object({x:462.75, y:211.85}), new Object({x:462.75, y:70.55}), new Object({x:559.8, y:70.55}), new Object({x:559.8, y:381.5}), new Object({x:255.95, y:381.5}), new Object({x:258.3, y:123.15}), new Object({x:404.3, y:123.15}), new Object({x:404.3, y:296.8}), new Object({x:164.3, y:296.8}), new Object({x:164.3, y:40.55}), new Object({x:347.55, y:40.55}), new Object({x:345.85, y:205.85}), new Object({x:97.25, y:205.85}), new Object({x:97.25, y:368.15}));
map_bases.standard = map_bases.map1;
map_layouts.standard = map_layouts.map1;
this.stop();
if (this.view_layout) {
this.gotoAndPlay("View");
} else {
this.ResetGame();
}
Instance of Symbol 547 MovieClip "Keyboard" in Frame 44
onClipEvent (keyDown) {
var theKey = Key.getCode();
var the_type = false;
if (theKey == 49) {
the_type = "Blue";
if (this._parent.turrets_available[the_type] == true) {
this._parent.TryAndBuild(the_type);
}
} else if (theKey == 50) {
the_type = "Green";
if (this._parent.turrets_available[the_type] == true) {
this._parent.TryAndBuild(the_type);
}
} else if (theKey == 51) {
the_type = "Red";
if (this._parent.turrets_available[the_type] == true) {
this._parent.TryAndBuild(the_type);
}
} else if (theKey == 52) {
the_type = "RangeUp";
if (this._parent.turrets_available[the_type] == true) {
this._parent.TryAndBuild(the_type);
}
} else if (theKey == 53) {
the_type = "DamageUp";
if (this._parent.turrets_available[the_type] == true) {
this._parent.TryAndBuild(the_type);
}
} else if (theKey == 54) {
the_type = "RateUp";
if (this._parent.turrets_available[the_type] == true) {
this._parent.TryAndBuild(the_type);
}
} else if (theKey == 55) {
the_type = "DamageUpBig";
if (this._parent.turrets_available[the_type] == true) {
this._parent.TryAndBuild(the_type);
}
} else if (theKey == 56) {
the_type = "DamageUpBigExchange";
if (this._parent.turrets_available[the_type] == true) {
this._parent.TryAndBuild(the_type);
}
} else if (theKey == 57) {
the_type = "RangeUpExchange";
if (this._parent.turrets_available[the_type] == true) {
this._parent.TryAndBuild(the_type);
}
} else if (theKey == 48) {
the_type = "RateUpExchange";
if (this._parent.turrets_available[the_type] == true) {
this._parent.TryAndBuild(the_type);
}
} else if (theKey == 81) {
this._parent.TurretUpgrade.tryUpgradeDamage();
} else if (theKey == 87) {
this._parent.TurretUpgrade.tryUpgradeRange();
} else if (theKey == 68) {
_root.profileDump();
} else if (theKey == 69) {
this._parent.TurretUpgrade.tryUpgradeRate();
} else if (theKey == 70) {
if (_root.cur_turret != false) {
trace("---=== Turret Dump ===---");
trace("Dumping: " + _root.cur_turret);
trace(" ");
for (var i in _root.cur_turret) {
var the_var = _root.cur_turret[i];
var the_type = typeof(the_var);
if (typeof(the_var) == "function") {
continue;
}
if (typeof(the_var) == "object") {
continue;
}
if (typeof(the_var) == "movieclip") {
continue;
}
var space = "";
var key = new String(i);
var len = key.length;
var i = len;
while (i < 30) {
key = key + " ";
i++;
}
trace((key + " > ") + the_var);
}
}
} else if (theKey == 71) {
var new_num = Math.floor(Math.random() * 10);
this._parent.ReelTest.numberShow(new_num);
} else if (theKey == 72) {
this._parent.messageHint();
} else if (theKey == 82) {
this._parent.rangeShow(this._parent.cur_turret);
} else if (theKey == 83) {
this._parent.TurretSell();
} else if (theKey == 32) {
this._parent.WaveController.SendWave();
} else if (theKey == 27) {
this._parent.CancelBuild();
} else if (theKey == 39) {
this._parent.WeaponStore.storeNextItem();
} else if (theKey == 37) {
this._parent.WeaponStore.storePrevItem();
} else if (theKey == 13) {
this._parent.WeaponStore.storeBuyItem();
} else if (theKey == 66) {
this._parent.WeaponStore.storeBuyItem();
}
}
onClipEvent (keyUp) {
var theKey = Key.getCode();
if (theKey == 82) {
this._parent.rangeHide();
}
}
Frame 49
this.stop();
this.game_map = false;
this.waypoint_total = 16;
this.ResetGame();
Frame 54
this.stop();
this.StopEverything();
this.RemoveEverything();
this.ResetVars();
var loaded_layout = false;
ViewLoading._visible = false;
this.game_over = true;
this.player_cash = 0;
var lv = new LoadVars();
lv.id = this.view_layout;
var lv_into = new LoadVars();
lv_into.onLoad = function (success) {
if (success) {
if (this.ok == "1") {
Score.text = this.score;
Spent.text = "$" + this.spent;
Kills.text = this.kills;
Player.text = this.player;
_root.game_map = this.map;
loaded_layout = JSON.parse(this.layout);
ViewLoading._visible = false;
_root.RoadCreate();
play();
}
}
};
ViewLoading._visible = true;
var lv_url = (this.score_url + "view_layout.php");
lv.sendAndLoad(lv_url, lv_into, "GET");
this.LayoutLoad = function (layout) {
var _local5 = JSON.parse(layout);
for (var _local6 in _local5) {
turret = _local5[_local6];
var _local4 = "Turret" + _local6;
var _local3 = "Turret" + turret.turret_type;
var _local2 = _root.attachMovie(_local3, _local4, _root.getNextHighestDepth());
_local2._x = turret.x;
_local2._y = turret.y;
_local2.active = false;
_local2.turret_type = turret.turret_type;
_local2.turret_num = _local6;
_local2.upgrade_damage_level = turret.upgrade_damage;
_local2.upgrade_range_level = turret.upgrade_range;
_local2.upgrade_rate_level = turret.upgrade_rate;
_local2.weapon_damage = turret.weapon_damage;
_local2.weapon_range = turret.weapon_range;
_local2.weapon_rate = turret.weapon_rate;
_local2.Weapon._rotation = turret.weapon_rotation;
_root.turrets.push(_local2);
}
};
Frame 55
this.stop();
var new_list = new Array();
for (var i in this.loaded_layout) {
var the_tur = this.loaded_layout[i];
var the_name = new String(the_tur.name);
var the_type = the_tur.turret_type;
var parts = the_name.split(the_type);
var tur_num = parts[1];
if (isNaN(tur_num)) {
var parts = the_name.split("Turret");
tur_num = parts[1];
}
the_tur.tur_num = parseInt(tur_num);
new_list.push(the_tur);
}
this.loaded_layout = new_list;
this.loaded_layout.sortOn("tur_num", Array.NUMERIC);
this.view_i = 0;
this.view_end = this.loaded_layout.length;
this.play();
Frame 56
this.stop();
turret = this.loaded_layout[this.view_i];
var new_name = ("Turret" + this.view_i);
var new_type = ("Turret" + turret.turret_type);
var new_turret = _root.attachMovie(new_type, new_name, _root.getNextHighestDepth());
new_turret._x = turret.x;
new_turret._y = turret.y;
new_turret.active = false;
new_turret.turret_type = turret.turret_type;
new_turret.turret_num = i;
new_turret.upgrade_damage_level = turret.upgrade_damage;
new_turret.upgrade_range_level = turret.upgrade_range;
new_turret.upgrade_rate_level = turret.upgrade_rate;
new_turret.weapon_damage = turret.weapon_damage;
new_turret.weapon_range = turret.weapon_range;
new_turret.weapon_rate = turret.weapon_rate;
new_turret.Weapon._rotation = turret.weapon_rotation;
_root.turrets.push(new_turret);
this.view_i++;
this.play();
Frame 58
this.stop();
if (this.view_i >= this.view_end) {
this.gotoAndPlay("ViewDone");
} else {
this.gotoAndPlay("ViewBuild");
}
Frame 59
this.stop();
Symbol 5 MovieClip [TurretBuilder] Frame 1
this.stop();
if (this.cash_value == undefined) {
this.cash_value = 0;
}
if (this.turret_type == undefined) {
this.turret_type = "Blue";
}
if (this.turret_num == undefined) {
this.turret_num = 0;
}
if (this.active == undefined) {
this.active = true;
}
this.play();
Symbol 5 MovieClip [TurretBuilder] Frame 11
this.stop();
_root.turret_counter++;
var new_depth = _root.getNextHighestDepth();
var new_type = ("Turret" + this.turret_type);
var new_name = (new_type + _root.turret_counter);
var new_turret = _root.attachMovie(new_type, new_name, new_depth);
new_turret._x = this._x;
new_turret._y = this._y;
new_turret._alpha = 0;
new_turret.turret_type = this.turret_type;
new_turret.turret_num = _root.turret_counter;
new_turret.cash_value = parseInt(this.cash_value);
new_turret.active = this.active;
for (var i in _root.turrets) {
var the_tur = _root.turrets[i];
the_tur.notifyNew(new_turret);
}
_root.turrets.push(new_turret);
this.new_turret = new_turret;
this.play();
Symbol 5 MovieClip [TurretBuilder] Frame 14
this.stop();
this.new_turret._alpha = this.new_turret._alpha + 12;
if (this.new_turret._alpha >= 100) {
this.gotoAndPlay("Done");
} else {
this.play();
}
Symbol 5 MovieClip [TurretBuilder] Frame 16
this.gotoAndPlay("FadeIn");
Symbol 5 MovieClip [TurretBuilder] Frame 18
this.stop();
_root.NewTurretBuilt(this);
Symbol 11 MovieClip [MessageBox] Frame 1
this.stop();
this.setText = function (new_text) {
TheMessage.text = new_text;
};
this.setText("A message");
Symbol 12 MovieClip [MessageBar] Frame 1
this.show_time = 4000;
this.show_total = 0;
this.move_speed = 50;
this.hidden_x = MessageBox._x;
this.hidden_y = MessageBox._y;
this.shown_x = MessageBox._x;
this.shown_y = -MessageBox._height;
this.msg_queue = new Array();
this.showing = false;
this.time_last = false;
this.messageShow = function (the_text) {
this.msg_queue.push(the_text);
this.messageReceived();
};
this.messageReceived = function () {
if (this.showing == false) {
MessageBox.setText(this.msg_queue.shift());
this.time_last = new Date();
this.gotoAndPlay("Reveal");
}
};
this.stop();
this.showing = false;
Symbol 12 MovieClip [MessageBar] Frame 3
this.stop();
var time_now = new Date();
var time_diff = (time_now.getTime() - this.time_last.getTime());
this.time_last = time_now;
this.showing = true;
var target_x = this.shown_x;
var target_y = this.shown_y;
var src_x = MessageBox._x;
var src_y = MessageBox._y;
var pt_from = new Object({_x:src_x, _y:src_y});
var pt_to = new Object({_x:target_x, _y:target_y});
var move_angle = _root.degreesToTarget(pt_from, pt_to);
var move_amount = ((this.time_diff / 1000) * this.move_speed);
var movement = _root.trigForwardAtAngle(move_angle, move_amount);
var d_x = (target_y - src_y);
var d_y = (target_x - src_x);
var dist = Math.sqrt((d_x * d_x) + (d_y * d_y));
var move_d_x = movement.x;
var move_d_y = movement.y;
var move_dist = Math.sqrt((move_d_x * move_d_x) + (move_d_y * move_d_y));
if (dist <= move_dist) {
MessageBox._x = target_x;
MessageBox._y = target_y;
this.show_total = 0;
this.gotoAndPlay("Wait");
} else {
MessageBox._x = MessageBox._x + movement.x;
MessageBox._y = MessageBox._y + movement.y;
this.play();
}
Symbol 12 MovieClip [MessageBar] Frame 4
this.gotoAndPlay("Reveal");
Symbol 12 MovieClip [MessageBar] Frame 5
this.stop();
var time_now = new Date();
var time_diff = (time_now.getTime() - this.time_last.getTime());
this.time_last = time_now;
this.show_total = this.show_total + time_diff;
if (this.show_total >= this.show_time) {
this.gotoAndPlay("Hide");
} else {
this.play();
}
Symbol 12 MovieClip [MessageBar] Frame 6
this.gotoAndPlay("Wait");
Symbol 12 MovieClip [MessageBar] Frame 7
this.stop();
var time_now = new Date();
var time_diff = (time_now.getTime() - this.time_last.getTime());
this.time_last = time_now;
var target_x = this.hidden_x;
var target_y = this.hidden_y;
var src_x = MessageBox._x;
var src_y = MessageBox._y;
var pt_from = new Object({_x:src_x, _y:src_y});
var pt_to = new Object({_x:target_x, _y:target_y});
var move_angle = _root.degreesToTarget(pt_from, pt_to);
var move_amount = ((this.time_diff / 1000) * this.move_speed);
var movement = _root.trigForwardAtAngle(move_angle, move_amount);
var d_x = (target_y - src_y);
var d_y = (target_x - src_x);
var dist = Math.sqrt((d_x * d_x) + (d_y * d_y));
var move_d_x = movement.x;
var move_d_y = movement.y;
var move_dist = Math.sqrt((move_d_x * move_d_x) + (move_d_y * move_d_y));
if (dist <= move_dist) {
MessageBox._x = target_x;
MessageBox._y = target_y;
if (this.msg_queue.length > 0) {
MessageBox.setText(this.msg_queue.shift());
this.time_last = new Date();
this.gotoAndPlay("Reveal");
} else {
this.gotoAndStop("Idle");
}
} else {
MessageBox._x = MessageBox._x + movement.x;
MessageBox._y = MessageBox._y + movement.y;
this.play();
}
Symbol 12 MovieClip [MessageBar] Frame 8
this.gotoAndPlay("Hide");
Symbol 16 MovieClip [RadarBlip] Frame 1
this.play();
Symbol 16 MovieClip [RadarBlip] Frame 52
this.stop();
this.removeMovieClip();
Symbol 20 MovieClip [WeaponStoreItem] Frame 1
this.stop();
if (!this.item_cost) {
this.item_cost = "999";
}
if (!this.item_id) {
this.item_id = "TurretBlue";
}
if (!this.item_type) {
this.item_type = "Blue";
}
var new_id = this.item_id;
var new_lev = this.getNextHighestDepth();
var new_name = (("WeaponRackItem" + new_id) + new_lev);
var new_item = this.attachMovie(new_id, new_name, new_lev);
new_item.active = false;
new_item._x = ItemPoint._x;
new_item._y = ItemPoint._y;
new_item._rotation = 45;
ItemCost.text = "$" + this.item_cost;
this.turret = new_item;
Symbol 23 MovieClip [WeaponController] Frame 1
if (this.weapon_target == undefined) {
this.weapon_target = false;
}
if (this.weapon_range == undefined) {
this.weapon_range = 100;
}
if (this.debug_on == undefined) {
this.debug_on = false;
}
this.weapon = this._parent;
this.debug = function (msg) {
if (this.debug_on == true) {
trace((this + ": ") + msg);
}
};
this.acquire = function (tg_type) {
if (this.targetInRange()) {
return(true);
}
var _local7 = 2000;
var _local6 = 1E23;
var _local9;
var _local8;
var _local10 = this.attackerList();
var _local12 = new Array();
for (var _local11 in _local10) {
var _local3 = _root[_local11];
var _local4 = this.getRange(_local3);
var _local5 = _local3.energy;
if (_local4 <= this.weapon_range) {
if (_local4 < _local7) {
_local7 = _local4;
_local9 = _local3;
}
if (_local5 < _local6) {
_local6 = _local5;
_local8 = _local3;
}
}
}
if (tg_type == "weak") {
if (_local8 != undefined) {
this.weapon_target = _local8;
return(true);
}
} else if (_local9 != undefined) {
this.weapon_target = _local9;
return(true);
}
return(false);
};
this.findAttackerInRange = function (the_type, in_range) {
var _local7 = 1E18;
var _local6 = 1E18;
var _local9;
var _local8;
var _local10 = this.attackerList();
var _local14 = new Array();
for (var _local11 in _local10) {
var _local4 = _root[_local11];
var _local3 = this.getRange(_local4);
var _local5 = _local4.energy;
this.debug((((_local11 + " r=") + _local3) + " e=") + _local5);
if ((!isNaN(_local3)) && (_local3 <= in_range)) {
if (_local3 < _local7) {
_local7 = _local3;
_local9 = _local4;
}
if (_local5 < _local6) {
_local6 = _local5;
_local8 = _local4;
}
}
}
var _local13 = false;
if (the_type == "weak") {
if (_local8 != undefined) {
_local13 = _local8;
}
} else if (_local9 != undefined) {
_local13 = _local9;
}
return(_local13);
};
this.getRange = function (the_target) {
var _local2 = the_target._x - this.weapon._x;
var _local3 = the_target._y - this.weapon._y;
return(Math.sqrt((_local2 * _local2) + (_local3 * _local3)));
};
this.attackerList = function () {
return(_root.attackers);
};
this.targetInRange = function () {
if (this.targetExists()) {
var _local2 = this.getRange(this.weapon_target);
if (_local2 < this.weapon_range) {
return(true);
}
}
return(false);
};
this.pointAtTarget = function (point_from, to_point) {
if (this.targetExists()) {
var _local4 = this.angleToTarget(point_from);
var _local3 = _local4 * 57.29578;
var _local2 = _local3;
to_point._rotation = _local2;
return(_local2);
}
return(false);
};
this.angleToTarget = function (point_from) {
var _local2 = false;
if (this.targetExists()) {
var _local5 = point_from._x;
var _local3 = point_from._y;
var _local6 = this.weapon_target._x;
var _local4 = this.weapon_target._y;
_local2 = Math.atan2(_local4 - _local3, _local6 - _local5);
}
return(_local2);
};
this.targetExists = function () {
if (typeof(this.weapon_target) == "movieclip") {
if (this.weapon_target._name != undefined) {
return(true);
}
}
return(false);
};
_root.profileThis(this.acquire);
this.stop();
Symbol 24 MovieClip Frame 1
this.stop();
this.mine_location = this._parent.mine_location;
this.mine_range = this._parent.mine_range;
this.bullet_speed = this._parent.bullet_speed;
this.bullet_rotation = this._parent.bullet_rotation;
this.bullet_damage = this._parent.bullet_damage;
this.blast = this._parent.blast;
this.blast_type = this._parent.blast_type;
this.blast_damage = this._parent.blast_damage;
this.cluster = this._parent.cluster;
this.cluster_qty = this._parent.cluster_qty;
this.cluster_holding = this._parent.cluster_holding;
this.cluster_damage = this._parent.cluster_damage;
this.cluster_rocket = this._parent.cluster_rocket;
this.cluster_laser = this._parent.cluster_laser;
if (!this.mine_location) {
this.mine_location = false;
}
if (!this.mine_range) {
this.mine_range = 20;
}
if (!this.bullet_speed) {
this.bullet_speed = 220;
}
if (!this.bullet_rotation) {
this.bullet_rotation = 0;
}
if (!this.bullet_damage) {
this.bullet_damage = 1000000 /* 0x0F4240 */;
}
if (!this.blast) {
this.blast = true;
}
if (!this.blast_type) {
this.blast_type = "BlastMedium";
}
if (!this.blast_damage) {
this.blast_damage = 1000000 /* 0x0F4240 */;
}
if (!this.cluster) {
this.cluster = false;
}
if (!this.cluster_qty) {
this.cluster_qty = 5;
}
if (!this.cluster_holding) {
this.cluster_holding = true;
}
if (!this.cluster_damage) {
this.cluster_damage = 1000000 /* 0x0F4240 */;
}
if (!this.cluster_rocket) {
this.cluster_rocket = false;
}
if (!this.cluster_laser) {
this.cluster_laser = false;
}
this.target_obj = this._parent;
this.time_last = new Date();
this.target_locked = false;
this.WeaponController.weapon = this.target_obj;
this.gotoAndPlay("Attack");
this.stop();
Symbol 24 MovieClip Frame 2
this.stop();
var time_now = new Date();
var time_diff = ((time_now.getTime() - this.time_last.getTime()) / 1000);
this.time_last = time_now;
var target_x = this.mine_location.x;
var target_y = this.mine_location.y;
var d_x = (target_x - this.target_obj._x);
var d_y = (target_y - this.target_obj._y);
var dist = Math.sqrt((d_x * d_x) + (d_y * d_y));
var move_x = ((d_x / dist) * (this.bullet_speed * time_diff));
var move_y = ((d_y / dist) * (this.bullet_speed * time_diff));
this.target_obj._x = this.target_obj._x + move_x;
this.target_obj._y = this.target_obj._y + move_y;
move_dist = Math.sqrt((move_x * move_x) + (move_y * move_y));
dist = Math.abs(dist);
move_dist = Math.abs(move_dist);
if (dist <= move_dist) {
this.target_obj._x = target_x;
this.target_obj._y = target_y;
this.gotoAndPlay("Planted");
} else {
this.play();
}
Symbol 24 MovieClip Frame 3
this.stop();
this.gotoAndPlay("Attack");
Symbol 24 MovieClip Frame 4
this.stop();
if (!this.target_locked) {
this.WeaponController.weapon = this.target_obj;
this.target_locked = true;
}
var target = this.WeaponController.findAttackerInRange(near, this.mine_range);
if (target) {
if (this.blast == true) {
var new_type = this.blast_type;
var new_lev = _root.getNextHighestDepth();
var new_name = (new_type + new_lev);
var new_b = _root.attachMovie(new_type, new_name, new_lev);
new_b._x = this.target_obj._x;
new_b._y = this.target_obj._y;
new_b.weapon_damage = this.blast_damage;
}
if (this.cluster == true) {
var new_type = "AddonClusterBlast";
var new_lev = _root.getNextHighestDepth();
var new_name = (new_type + new_lev);
var new_b = _root.attachMovie(new_type, new_name, new_lev);
new_b._x = this.target_obj._x;
new_b._y = this.target_obj._y;
new_b.cluster_damage = this.cluster_damage;
new_b.cluster_qty = this.cluster_qty;
new_b.cluster_laser = this.cluster_laser;
new_b.cluster_holding = this.cluster_holding;
new_b.cluster_rocket = this.cluster_rocket;
}
this.gotoAndPlay("Detonated");
} else {
this.play();
}
Symbol 24 MovieClip Frame 17
this.stop();
this.gotoAndPlay("Planted");
Symbol 24 MovieClip Frame 18
this.stop();
this.target_obj.removeMovieClip();
Symbol 26 MovieClip [Landmine] Frame 1
this.stop();
this.play();
Symbol 26 MovieClip [Landmine] Frame 2
this.play();
Symbol 26 MovieClip [Landmine] Frame 19
this.gotoAndPlay("Beep");
Symbol 31 MovieClip [LandmineBigCluster] Frame 1
this.stop();
this.play();
Symbol 31 MovieClip [LandmineBigCluster] Frame 2
this.play();
Symbol 31 MovieClip [LandmineBigCluster] Frame 19
this.gotoAndPlay("Beep");
Symbol 35 MovieClip [LandmineBigClusterLaser] Frame 1
this.stop();
this.play();
Symbol 35 MovieClip [LandmineBigClusterLaser] Frame 2
this.play();
Symbol 35 MovieClip [LandmineBigClusterLaser] Frame 19
this.gotoAndPlay("Beep");
Symbol 37 MovieClip [LandmineBig] Frame 1
this.stop();
this.play();
Symbol 37 MovieClip [LandmineBig] Frame 2
this.play();
Symbol 37 MovieClip [LandmineBig] Frame 19
this.gotoAndPlay("Beep");
Symbol 44 MovieClip [AddonClusterBlast] Frame 1
this.stop();
if (!this.cluster_damage) {
this.cluster_damage = 1000000 /* 0x0F4240 */;
}
if (!this.cluster_qty) {
this.cluster_qty = 4;
}
if (!this.cluster_laser) {
this.cluster_laser = false;
}
if (!this.cluster_holding) {
this.cluster_holding = true;
}
if (!this.cluster_rocket) {
this.cluster_rocket = "Rocket9";
}
this.gotoAndPlay("Fire");
Symbol 44 MovieClip [AddonClusterBlast] Frame 6
this.stop();
var i = 0;
while (i < this.cluster_qty) {
var new_b_name = ("ClusterRocket" + i);
var new_b_type = this.cluster_rocket;
var new_b_lev = _root.getNextHighestDepth();
var new_b = _root.attachMovie(new_b_type, new_b_name, new_b_lev);
var point = new Object();
point.x = this._x;
point.y = this._y;
new_b._x = point.x;
new_b._y = point.y;
new_b._rotation = new_b._rotation + (((i + 1) / this.cluster_qty) * 360);
var movement = _root.trigForwardAtAngle(new_b._rotation, 30);
new_b._x = new_b._x + movement.x;
new_b._y = new_b._y + movement.y;
new_b.bullet_target = false;
new_b.bullet_damage = this.cluster_damage;
new_b.turret = this;
new_b.holding_pattern = this.cluster_holding;
new_b.laser_capable = this.cluster_laser;
new_b.laser_damage = this.cluster_damage;
i++;
}
this.gotoAndPlay("Spent");
Symbol 44 MovieClip [AddonClusterBlast] Frame 11
this.stop();
this.removeMovieClip();
Symbol 49 MovieClip [SpecialTake] Frame 1
this.play();
Symbol 49 MovieClip [SpecialTake] Frame 14
this.stop();
this.removeMovieClip();
Symbol 52 MovieClip [SpecialFire] Frame 1
this.play();
Symbol 52 MovieClip [SpecialFire] Frame 14
this.stop();
this.removeMovieClip();
Symbol 61 MovieClip [RocketNukeBlast] Frame 1
this.play();
if (this.weapon_damage == undefined) {
this.weapon_damage = 5000000 /* 0x4C4B40 */;
}
Symbol 61 MovieClip [RocketNukeBlast] Frame 5
this.stop();
var spazzed = new Array();
for (var i in _root.attackers) {
var attacker = _root.attackers[i];
var point = new Object();
point.x = attacker._x;
point.y = attacker._y;
if (this.hitTest(point.x, point.y, true)) {
spazzed.push(attacker);
}
}
var i = 0;
while (i < spazzed.length) {
var attacker = spazzed[i];
attacker.hit(this.weapon_damage);
i++;
}
this.play();
Symbol 61 MovieClip [RocketNukeBlast] Frame 38
this.stop();
this.removeMovieClip();
Symbol 64 MovieClip [BlastMedium] Frame 1
this.play();
if (!this.weapon_damage) {
this.weapon_damage = 2000000 /* 0x1E8480 */;
}
Symbol 64 MovieClip [BlastMedium] Frame 5
this.stop();
var spazzed = new Array();
for (var i in _root.attackers) {
var attacker = _root.attackers[i];
var point = new Object();
point.x = attacker._x;
point.y = attacker._y;
if (this.hitTest(point.x, point.y, true)) {
spazzed.push(attacker);
}
}
var i = 0;
while (i < spazzed.length) {
var attacker = spazzed[i];
attacker.hit(this.weapon_damage);
i++;
}
this.play();
Symbol 64 MovieClip [BlastMedium] Frame 38
this.stop();
this.removeMovieClip();
Symbol 70 MovieClip [BlastLarge] Frame 1
this.play();
if (!this.weapon_damage) {
this.weapon_damage = 3000000 /* 0x2DC6C0 */;
}
Symbol 70 MovieClip [BlastLarge] Frame 5
this.stop();
var spazzed = new Array();
for (var i in _root.attackers) {
var attacker = _root.attackers[i];
var point = new Object();
point.x = attacker._x;
point.y = attacker._y;
if (this.hitTest(point.x, point.y, true)) {
spazzed.push(attacker);
}
}
var i = 0;
while (i < spazzed.length) {
var attacker = spazzed[i];
attacker.hit(this.weapon_damage);
i++;
}
this.play();
Symbol 70 MovieClip [BlastLarge] Frame 38
this.stop();
this.removeMovieClip();
Symbol 76 MovieClip [BFGBlast] Frame 1
this.play();
if (!this.weapon_damage) {
this.weapon_damage = 5000000 /* 0x4C4B40 */;
}
Symbol 76 MovieClip [BFGBlast] Frame 5
this.stop();
var spazzed = new Array();
for (var i in _root.attackers) {
var attacker = _root.attackers[i];
var point = new Object();
point.x = attacker._x;
point.y = attacker._y;
if (this.hitTest(point.x, point.y, true)) {
spazzed.push(attacker);
}
}
var i = 0;
while (i < spazzed.length) {
var attacker = spazzed[i];
attacker.hit(this.weapon_damage);
i++;
}
this.play();
Symbol 76 MovieClip [BFGBlast] Frame 38
this.stop();
this.removeMovieClip();
Symbol 83 MovieClip [RocketPoisonCloud] Frame 1
this.play();
Symbol 83 MovieClip [RocketPoisonCloud] Frame 6
this.stop();
for (var i in _root.attackers) {
var attacker = _root.attackers[i];
var point = new Object();
point.x = attacker._x;
point.y = attacker._y;
if (this.hitTest(point.x, point.y, true)) {
var new_speed = (attacker.move_speed / 2);
attacker.setMoveSpeed(new_speed);
}
}
this.play();
Symbol 83 MovieClip [RocketPoisonCloud] Frame 38
this.stop();
this.removeMovieClip();
Symbol 87 MovieClip [CashEarned] Frame 1
this.play();
if (!this.amount) {
this.amount = "0";
}
cash_amount = "$" + this.amount;
Symbol 87 MovieClip [CashEarned] Frame 20
this.stop();
this.removeMovieClip();
Symbol 98 MovieClip [RestartButton] Frame 1
this.stop();
Symbol 100 MovieClip Frame 1
this.stop();
Symbol 107 MovieClip Frame 1
this.stop();
Symbol 143 MovieClip [GameOver] Frame 1
function bitOR(a, b) {
var _local2 = (a & 1) | (b & 1);
var _local1 = (a >>> 1) | (b >>> 1);
return((_local1 << 1) | _local2);
}
function bitXOR(a, b) {
var _local2 = (a & 1) ^ (b & 1);
var _local1 = (a >>> 1) ^ (b >>> 1);
return((_local1 << 1) | _local2);
}
function bitAND(a, b) {
var _local2 = (a & 1) & (b & 1);
var _local1 = (a >>> 1) & (b >>> 1);
return((_local1 << 1) | _local2);
}
function addme(x, y) {
var _local1 = (x & 65535) + (y & 65535);
var _local2 = ((x >> 16) + (y >> 16)) + (_local1 >> 16);
return((_local2 << 16) | (_local1 & 65535));
}
function rhex(num) {
str = "";
j = 0;
while (j <= 3) {
str = str + (hex_chr.charAt((num >> ((j * 8) + 4)) & 15) + hex_chr.charAt((num >> (j * 8)) & 15));
j++;
}
return(str);
}
function str2blks(str) {
nblk = ((str.length + 8) >> 6) + 1;
blks = new Array(nblk * 16);
i = 0;
while (i < (nblk * 16)) {
blks[i] = 0;
i++;
}
i = 0;
while (i < str.length) {
blks[i >> 2] = blks[i >> 2] | (str.charCodeAt(i) << ((((str.length * 8) + i) % 4) * 8));
i++;
}
blks[i >> 2] = blks[i >> 2] | (128 << ((((str.length * 8) + i) % 4) * 8));
var _local2 = str.length * 8;
blks[(nblk * 16) - 2] = _local2 & 255;
blks[(nblk * 16) - 2] = blks[(nblk * 16) - 2] | (((_local2 >>> 8) & 255) << 8);
blks[(nblk * 16) - 2] = blks[(nblk * 16) - 2] | (((_local2 >>> 16) & 255) << 16);
blks[(nblk * 16) - 2] = blks[(nblk * 16) - 2] | (((_local2 >>> 24) & 255) << 24);
return(blks);
}
function rol(num, cnt) {
return((num << cnt) | (num >>> (32 - cnt)));
}
function cmn(q, a, b, x, s, t) {
return(addme(rol(addme(addme(a, q), addme(x, t)), s), b));
}
function ff(a, b, c, d, x, s, t) {
return(cmn(bitOR(bitAND(b, c), bitAND(b ^ 4294967000, d)), a, b, x, s, t));
}
function gg(a, b, c, d, x, s, t) {
return(cmn(bitOR(bitAND(b, d), bitAND(c, d ^ 4294967000)), a, b, x, s, t));
}
function hh(a, b, c, d, x, s, t) {
return(cmn(bitXOR(bitXOR(b, c), d), a, b, x, s, t));
}
function ii(a, b, c, d, x, s, t) {
return(cmn(bitXOR(c, bitOR(b, d ^ 4294967000)), a, b, x, s, t));
}
function makeChecksum(str) {
x = str2blks(str);
a = 1732584193 /* 0x67452301 */;
b = -271733879;
c = -1732584194;
d = 271733878 /* 0x10325476 */;
var _local1;
i = 0;
while (i < x.length) {
olda = a;
oldb = b;
oldc = c;
oldd = d;
_local1 = 0;
a = ff(a, b, c, d, x[i + 0], 7, -680876936);
d = ff(d, a, b, c, x[i + 1], 12, -389564586);
c = ff(c, d, a, b, x[i + 2], 17, 606105819);
b = ff(b, c, d, a, x[i + 3], 22, -1044525330);
a = ff(a, b, c, d, x[i + 4], 7, -176418897);
d = ff(d, a, b, c, x[i + 5], 12, 1200080426);
c = ff(c, d, a, b, x[i + 6], 17, -1473231341);
b = ff(b, c, d, a, x[i + 7], 22, -45705983);
a = ff(a, b, c, d, x[i + 8], 7, 1770035416);
d = ff(d, a, b, c, x[i + 9], 12, -1958414417);
c = ff(c, d, a, b, x[i + 10], 17, -42063);
b = ff(b, c, d, a, x[i + 11], 22, -1990404162);
a = ff(a, b, c, d, x[i + 12], 7, 1804603682);
d = ff(d, a, b, c, x[i + 13], 12, -40341101);
c = ff(c, d, a, b, x[i + 14], 17, -1502002290);
b = ff(b, c, d, a, x[i + 15], 22, 1236535329);
a = gg(a, b, c, d, x[i + 1], 5, -165796510);
d = gg(d, a, b, c, x[i + 6], 9, -1069501632);
c = gg(c, d, a, b, x[i + 11], 14, 643717713);
b = gg(b, c, d, a, x[i + 0], 20, -373897302);
a = gg(a, b, c, d, x[i + 5], 5, -701558691);
d = gg(d, a, b, c, x[i + 10], 9, 38016083);
c = gg(c, d, a, b, x[i + 15], 14, -660478335);
b = gg(b, c, d, a, x[i + 4], 20, -405537848);
a = gg(a, b, c, d, x[i + 9], 5, 568446438);
d = gg(d, a, b, c, x[i + 14], 9, -1019803690);
c = gg(c, d, a, b, x[i + 3], 14, -187363961);
b = gg(b, c, d, a, x[i + 8], 20, 1163531501);
a = gg(a, b, c, d, x[i + 13], 5, -1444681467);
d = gg(d, a, b, c, x[i + 2], 9, -51403784);
c = gg(c, d, a, b, x[i + 7], 14, 1735328473);
b = gg(b, c, d, a, x[i + 12], 20, -1926607734);
a = hh(a, b, c, d, x[i + 5], 4, -378558);
d = hh(d, a, b, c, x[i + 8], 11, -2022574463);
c = hh(c, d, a, b, x[i + 11], 16, 1839030562);
b = hh(b, c, d, a, x[i + 14], 23, -35309556);
a = hh(a, b, c, d, x[i + 1], 4, -1530992060);
d = hh(d, a, b, c, x[i + 4], 11, 1272893353);
c = hh(c, d, a, b, x[i + 7], 16, -155497632);
b = hh(b, c, d, a, x[i + 10], 23, -1094730640);
a = hh(a, b, c, d, x[i + 13], 4, 681279174);
d = hh(d, a, b, c, x[i + 0], 11, -358537222);
c = hh(c, d, a, b, x[i + 3], 16, -722521979);
b = hh(b, c, d, a, x[i + 6], 23, 76029189);
a = hh(a, b, c, d, x[i + 9], 4, -640364487);
d = hh(d, a, b, c, x[i + 12], 11, -421815835);
c = hh(c, d, a, b, x[i + 15], 16, 530742520);
b = hh(b, c, d, a, x[i + 2], 23, -995338651);
a = ii(a, b, c, d, x[i + 0], 6, -198630844);
d = ii(d, a, b, c, x[i + 7], 10, 1126891415);
c = ii(c, d, a, b, x[i + 14], 15, -1416354905);
b = ii(b, c, d, a, x[i + 5], 21, -57434055);
a = ii(a, b, c, d, x[i + 12], 6, 1700485571);
d = ii(d, a, b, c, x[i + 3], 10, -1894986606);
c = ii(c, d, a, b, x[i + 10], 15, -1051523);
b = ii(b, c, d, a, x[i + 1], 21, -2054922799);
a = ii(a, b, c, d, x[i + 8], 6, 1873313359);
d = ii(d, a, b, c, x[i + 15], 10, -30611744);
c = ii(c, d, a, b, x[i + 6], 15, -1560198380);
b = ii(b, c, d, a, x[i + 13], 21, 1309151649);
a = ii(a, b, c, d, x[i + 4], 6, -145523070);
d = ii(d, a, b, c, x[i + 11], 10, -1120210379);
c = ii(c, d, a, b, x[i + 2], 15, 718787259);
b = ii(b, c, d, a, x[i + 9], 21, -343485551);
a = addme(a, olda);
b = addme(b, oldb);
c = addme(c, oldc);
d = addme(d, oldd);
i = i + 16;
}
return(((rhex(a) + rhex(b)) + rhex(c)) + rhex(d));
}
this.stop();
if (!this.total_kills) {
this.total_kills = 0;
}
if (!this.total_shots) {
this.total_shots = 0;
}
if (!this.total_spent) {
this.total_spent = 0;
}
if (!this.total_score) {
this.total_score = 0;
}
this.total_score = this.total_kills * this.total_spent;
Kills.text = this.total_kills;
Shots.text = this.total_shots;
Spent.text = "$" + this.total_spent;
Score.text = this.total_score;
Restart.onPress = function () {
_root.ResetGame();
};
TitleBar.onPress = function () {
this._parent.startDrag();
};
TitleBar.onRelease = function () {
this._parent.stopDrag();
};
stop();
var hex_chr = "0123456789abcdef";
this.new_score_id = false;
this.submitScore = function (target) {
if (target.clicked != true) {
if (this.PlayerName.text == "") {
target.theText.text = "no name!";
return(false);
}
target.clicked = true;
target.theText.text = "sending...";
var _local3 = new LoadVars();
_local3.game = "onslaught";
_local3.player = this.PlayerName.text;
_local3.score = this.total_score;
_local3.kills = this.total_kills;
_local3.shots = this.total_shots;
_local3.spent = this.total_spent;
_local3.damage = this.total_damage;
_local3.v = _root.game_version;
_local3.map = _root.game_map;
var _local6 = _root.TurretGetLayout();
_local3.layout = JSON.stringify(_local6);
var _local5 = (((((((((((_local3.game + _local3.player) + _local3.score) + _local3.kills) + _local3.shots) + _local3.spent) + _local3.damage) + _local3.v) + _local3.map) + "a98bcb9d8eb9ba28") + "a9b99c9b8e98b9a8") + "fb3081bab08b0c8b") + "f0b52661afa6271b";
_local3.verify = makeChecksum(_local5);
var lv_into = new LoadVars();
lv_into.onLoad = function (success) {
if (success) {
if (lv_into.ok == "1") {
target.theText.text = "thanks!";
ButtonScore.onPress = function () {
this._parent.viewScore(lv_into.score_id);
};
this.fx = _root.effectWait(this);
this.fx.the_box = target.theText;
this.fx.onThen = function () {
this.the_box.text = "view score";
};
} else {
target.theText.text = "invalid!!";
}
} else {
target.theText.text = "error!";
}
};
var _local4 = _root.score_url + "submit_score.php";
_local3.sendAndLoad(_local4, lv_into);
}
};
this.viewScore = function (the_id) {
var _local2 = (_root.score_url + "scores.php?show=") + the_id;
getURL (_local2, "_blank", "POST");
};
this.stop();
Instance of Symbol 98 MovieClip [RestartButton] "ButtonRestart" in Symbol 143 MovieClip [GameOver] Frame 1
on (press) {
_root.ResetGame();
}
Instance of Symbol 100 MovieClip "ButtonScore" in Symbol 143 MovieClip [GameOver] Frame 1
on (press) {
this._parent.submitScore(this);
}
Instance of Symbol 107 MovieClip "ButtonBack" in Symbol 143 MovieClip [GameOver] Frame 1
on (press) {
_root.GotoHomepage();
}
Symbol 146 MovieClip [UpgradeGraphScale] Frame 1
this.stop();
if (!this.marker) {
this.marker = "?";
}
Symbol 150 MovieClip [UpgradeGraphScaleMinor] Frame 1
this.stop();
Symbol 151 MovieClip [WaveSender] Frame 1
this.stop();
if (!this.wave_size) {
this.wave_size = 10;
}
if (!this.wave_num) {
this.wave_num = 0;
}
if (!this.attacker_spacing) {
this.attacker_spacing = 1000;
}
if (!this.attacker_energy) {
this.attacker_energy = 10;
}
if (!this.attacker_value) {
this.attacker_value = 1000;
}
this.time_last_attacker = new Date();
this.attackers_sent = 0;
this.gotoAndPlay("Spawn");
this.stop();
Symbol 151 MovieClip [WaveSender] Frame 5
var time_now = new Date();
var time_attacker = (time_now.getTime() - this.time_last_attacker.getTime());
if (time_attacker >= this.attacker_spacing) {
if (this.attackers_sent < this.wave_size) {
this._parent.NewAttacker(this.attacker_energy, this.attacker_value, this.wave_num);
this.attackers_sent++;
this.time_last_attacker = time_now;
} else {
this.gotoAndPlay("Stopped");
}
}
this.play();
Symbol 151 MovieClip [WaveSender] Frame 9
this.gotoAndPlay("Spawn");
Symbol 151 MovieClip [WaveSender] Frame 13
this.stop();
removeMovieClip(this);
Symbol 184 MovieClip Frame 1
this.fire = function () {
this.gotoAndPlay("Fire");
};
Symbol 184 MovieClip Frame 15
this.gotoAndStop("Fire");
Symbol 189 MovieClip Frame 1
if (!this.fire_count) {
this.fire_count = 0;
}
this.fire = function () {
this.setFirePoint();
this.fireMissle();
this.fire_count++;
this.gotoAndPlay("Firing");
};
this.fireMissle = function () {
var _local3 = "Fired" + (this.fire_count % 4);
var _local2 = this[_local3];
_local2.fire();
};
this.setFirePoint = function () {
var _local2 = "FirePoint" + (this.fire_count % 4);
this.FirePoint = this[_local2];
};
this.setFirePoint();
this.stop();
Symbol 189 MovieClip Frame 2
this.play();
Symbol 189 MovieClip Frame 18
this.gotoAndStop("Idle");
Symbol 202 MovieClip [Laser] Frame 1
this.fire = function () {
this.gotoAndPlay("Firing");
};
this.stop();
Symbol 202 MovieClip [Laser] Frame 2
this.play();
Symbol 202 MovieClip [Laser] Frame 16
this.gotoAndStop("Idle");
Symbol 210 MovieClip [Cannon] Frame 1
this.fire = function () {
this.gotoAndPlay("Firing");
};
this.stop();
Symbol 210 MovieClip [Cannon] Frame 2
this.play();
Symbol 210 MovieClip [Cannon] Frame 20
this.gotoAndStop("Idle");
Symbol 212 MovieClip [TurretStats] Frame 1
this.the_damage = 0;
this.the_range = 0;
this.the_rate = 0;
this.the_type = false;
this.getStats = function (the_turret) {
if (the_turret) {
this.the_damage = the_turret.weapon_damage;
this.the_range = the_turret.weapon_range;
this.the_rate = the_turret.weapon_rate;
this.the_type = the_turret.turret_type;
this.updateStats();
this.gotoAndPlay("Viewing");
}
};
this.updateStats = function () {
Damage.text = this.the_damage;
Range.text = this.the_range;
Rate.text = Math.floor(60000 / this.the_rate);
ExampleRed._visible = false;
ExampleGreen._visible = false;
ExampleBlue._visible = false;
if (this.the_type == "Red") {
ExampleRed._visible = true;
} else if (this.the_type == "Green") {
ExampleGreen._visible = true;
} else if (this.the_type == "Blue") {
ExampleBlue._visible = true;
}
};
this.onEnterFrame = function () {
this.turret = _root.cur_turret;
this.getStats(this.turret);
};
this.stop();
Symbol 212 MovieClip [TurretStats] Frame 4
this.stop();
if (this.turret) {
this.getStats(this.turret);
} else {
this.gotoAndStop("Idle");
}
Symbol 215 MovieClip [TurretFreakWarning] Frame 1
this.play();
Symbol 215 MovieClip [TurretFreakWarning] Frame 20
this.gotoAndPlay("Start");
Symbol 222 MovieClip [CannotAfford] Frame 1
this.play();
Symbol 222 MovieClip [CannotAfford] Frame 24
this.gotoAndPlay("Start");
Symbol 224 MovieClip [CannotBuild] Frame 1
this.play();
Symbol 224 MovieClip [CannotBuild] Frame 24
this.gotoAndPlay("Start");
Symbol 227 MovieClip [BuildShape] Frame 1
if (this.weapon_range == undefined) {
this.weapon_range = false;
}
if (this.weapon_range != false) {
this.TurretRange._width = this.weapon_range * 2;
this.TurretRange._height = this.weapon_range * 2;
} else {
this.TurretRange._visible = false;
}
this.canBuild = function (prop, oldVal, newVal) {
if (newVal == true) {
this.CanBuild._visible = true;
this.CannotBuild._visible = false;
this.CannotAfford._visible = false;
} else {
this.CanBuild._visible = false;
if (this.can_afford == true) {
this.CannotBuild._visible = true;
this.CannotAfford._visible = false;
} else {
this.CannotBuild._visible = false;
this.CannotAfford._visible = true;
}
}
return(true);
};
this.watch("can_build", this.canBuild);
Symbol 228 MovieClip [LaserBeam] Frame 1
this.stop();
if (!this.bullet_target) {
this.gotoAndPlay("Hit");
}
if (!this.bullet_damage) {
this.bullet_damage = 1;
}
if (!this.laser_size) {
this.laser_size = 2;
}
this.laser_colour = "0x33cc33";
this.laser_alpha = "50";
this.gotoAndPlay("Attack");
this.stop();
Symbol 228 MovieClip [LaserBeam] Frame 4
this.stop();
var point = new Object();
point.x = this.bullet_target._x - this._x;
point.y = this.bullet_target._y - this._y;
this.lineStyle(this.laser_size, this.laser_colour, this.laser_alpha);
this.lineTo(point.x, point.y);
this.play();
Symbol 228 MovieClip [LaserBeam] Frame 6
if (this.bullet_target) {
this.bullet_target.hit(this.bullet_damage);
}
Symbol 228 MovieClip [LaserBeam] Frame 9
this.stop();
this.removeMovieClip();
Symbol 229 MovieClip [LaserBeam2] Frame 1
this.stop();
if (!this.bullet_target) {
this.gotoAndPlay("Hit");
}
if (!this.bullet_damage) {
this.bullet_damage = 1;
}
if (!this.laser_size) {
this.laser_size = 4;
}
this.laser_colour = "0x33cc33";
this.laser_alpha = "50";
this.gotoAndPlay("Attack");
this.stop();
Symbol 229 MovieClip [LaserBeam2] Frame 4
this.stop();
var point = new Object();
point.x = this.bullet_target._x - this._x;
point.y = this.bullet_target._y - this._y;
this.lineStyle(this.laser_size, this.laser_colour, this.laser_alpha);
this.lineTo(point.x, point.y);
this.play();
Symbol 229 MovieClip [LaserBeam2] Frame 6
if (this.bullet_target) {
this.bullet_target.hit(this.bullet_damage);
}
Symbol 229 MovieClip [LaserBeam2] Frame 9
this.stop();
this.removeMovieClip();
Symbol 230 MovieClip [LaserBeam3] Frame 1
this.stop();
if (!this.bullet_target) {
this.gotoAndPlay("Hit");
}
if (!this.bullet_damage) {
this.bullet_damage = 1;
}
if (!this.laser_size) {
this.laser_size = 6;
}
this.laser_colour = "0x33cc33";
this.laser_alpha = "50";
this.gotoAndPlay("Attack");
this.stop();
Symbol 230 MovieClip [LaserBeam3] Frame 4
this.stop();
var point = new Object();
point.x = this.bullet_target._x - this._x;
point.y = this.bullet_target._y - this._y;
this.lineStyle(this.laser_size, this.laser_colour, this.laser_alpha);
this.lineTo(point.x, point.y);
this.play();
Symbol 230 MovieClip [LaserBeam3] Frame 6
if (this.bullet_target) {
this.bullet_target.hit(this.bullet_damage);
}
Symbol 230 MovieClip [LaserBeam3] Frame 9
this.stop();
this.removeMovieClip();
Symbol 231 MovieClip [LaserBeam4] Frame 1
this.stop();
if (!this.bullet_target) {
this.gotoAndPlay("Hit");
}
if (!this.bullet_damage) {
this.bullet_damage = 1;
}
if (!this.laser_size) {
this.laser_size = 6;
}
this.laser_colour = "0xcccc33";
this.laser_alpha = "50";
this.gotoAndPlay("Attack");
this.stop();
Symbol 231 MovieClip [LaserBeam4] Frame 4
this.stop();
var point = new Object();
point.x = this.bullet_target._x - this._x;
point.y = this.bullet_target._y - this._y;
this.lineStyle(this.laser_size, this.laser_colour, this.laser_alpha);
this.lineTo(point.x, point.y);
this.play();
Symbol 231 MovieClip [LaserBeam4] Frame 6
if (this.bullet_target) {
this.bullet_target.hit(this.bullet_damage);
}
Symbol 231 MovieClip [LaserBeam4] Frame 9
this.stop();
this.removeMovieClip();
Symbol 232 MovieClip [LaserBeam5] Frame 1
this.stop();
if (!this.bullet_target) {
this.gotoAndPlay("Hit");
}
if (!this.bullet_damage) {
this.bullet_damage = 1;
}
if (!this.laser_size) {
this.laser_size = 8;
}
this.laser_colour = "0xcccc33";
this.laser_alpha = "50";
this.gotoAndPlay("Attack");
this.stop();
Symbol 232 MovieClip [LaserBeam5] Frame 4
this.stop();
var point = new Object();
point.x = this.bullet_target._x - this._x;
point.y = this.bullet_target._y - this._y;
this.lineStyle(this.laser_size, this.laser_colour, this.laser_alpha);
this.lineTo(point.x, point.y);
this.play();
Symbol 232 MovieClip [LaserBeam5] Frame 6
if (this.bullet_target) {
this.bullet_target.hit(this.bullet_damage);
}
Symbol 232 MovieClip [LaserBeam5] Frame 9
this.stop();
this.removeMovieClip();
Symbol 233 MovieClip [LaserBeam6] Frame 1
this.stop();
if (!this.bullet_target) {
this.gotoAndPlay("Hit");
}
if (!this.bullet_damage) {
this.bullet_damage = 1;
}
if (!this.laser_size) {
this.laser_size = 8;
}
this.laser_colour = "0xcc3333";
this.laser_alpha = "50";
this.gotoAndPlay("Attack");
this.stop();
Symbol 233 MovieClip [LaserBeam6] Frame 4
this.stop();
var point = new Object();
point.x = this.bullet_target._x - this._x;
point.y = this.bullet_target._y - this._y;
this.lineStyle(this.laser_size, this.laser_colour, this.laser_alpha);
this.lineTo(point.x, point.y);
this.play();
Symbol 233 MovieClip [LaserBeam6] Frame 6
if (this.bullet_target) {
this.bullet_target.hit(this.bullet_damage);
}
Symbol 233 MovieClip [LaserBeam6] Frame 9
this.stop();
this.removeMovieClip();
Symbol 234 MovieClip [LaserBeam7] Frame 1
this.stop();
if (!this.bullet_target) {
this.gotoAndPlay("Hit");
}
if (!this.bullet_damage) {
this.bullet_damage = 1;
}
if (!this.laser_size) {
this.laser_size = 8;
}
this.laser_colour1 = "0x33cc33";
this.laser_colour2 = "0xcc3333";
this.laser_alpha = "50";
this.gotoAndPlay("Attack");
this.stop();
Symbol 234 MovieClip [LaserBeam7] Frame 4
this.stop();
var point = new Object();
point.x = this.bullet_target._x - this._x;
point.y = this.bullet_target._y - this._y;
this.lineStyle(this.laser_size, this.laser_colour1, this.laser_alpha);
this.lineTo(point.x, point.y);
this.moveTo(0, 0);
this.lineStyle(this.laser_size / 2, this.laser_colour2, 100);
this.lineTo(point.x, point.y);
this.play();
Symbol 234 MovieClip [LaserBeam7] Frame 6
if (this.bullet_target) {
this.bullet_target.hit(this.bullet_damage);
}
Symbol 234 MovieClip [LaserBeam7] Frame 9
this.stop();
this.removeMovieClip();
Symbol 235 MovieClip [LaserBeam8] Frame 1
this.stop();
if (!this.bullet_target) {
this.gotoAndPlay("Hit");
}
if (!this.bullet_damage) {
this.bullet_damage = 1;
}
if (!this.laser_size) {
this.laser_size = 8;
}
this.laser_colour1 = "0xcc3333";
this.laser_colour2 = "0xcccc33";
this.laser_alpha = "50";
this.gotoAndPlay("Attack");
this.stop();
Symbol 235 MovieClip [LaserBeam8] Frame 4
this.stop();
var point = new Object();
point.x = this.bullet_target._x - this._x;
point.y = this.bullet_target._y - this._y;
this.lineStyle(this.laser_size, this.laser_colour1, this.laser_alpha);
this.lineTo(point.x, point.y);
this.moveTo(0, 0);
this.lineStyle(this.laser_size / 2, this.laser_colour2, 100);
this.lineTo(point.x, point.y);
this.play();
Symbol 235 MovieClip [LaserBeam8] Frame 6
if (this.bullet_target) {
this.bullet_target.hit(this.bullet_damage);
}
Symbol 235 MovieClip [LaserBeam8] Frame 9
this.stop();
this.removeMovieClip();
Symbol 236 MovieClip [LaserBeam9] Frame 1
this.stop();
if (!this.bullet_target) {
this.gotoAndPlay("Hit");
}
if (!this.bullet_damage) {
this.bullet_damage = 1;
}
if (!this.laser_size) {
this.laser_size = 9;
}
this.laser_colour1 = "0xcc3333";
this.laser_colour2 = "0x3333cc";
this.laser_colour3 = "0xcccc33";
this.laser_alpha = "50";
this.gotoAndPlay("Attack");
this.stop();
Symbol 236 MovieClip [LaserBeam9] Frame 4
this.stop();
var point = new Object();
point.x = this.bullet_target._x - this._x;
point.y = this.bullet_target._y - this._y;
this.lineStyle(this.laser_size, this.laser_colour1, this.laser_alpha);
this.lineTo(point.x, point.y);
this.moveTo(0, 0);
this.lineStyle(this.laser_size / 3, this.laser_colour2, 100);
this.lineTo(point.x, point.y);
this.moveTo(0, 0);
this.lineStyle(this.laser_size / 9, this.laser_colour3, 100);
this.lineTo(point.x, point.y);
this.play();
Symbol 236 MovieClip [LaserBeam9] Frame 6
if (this.bullet_target) {
this.bullet_target.hit(this.bullet_damage);
}
Symbol 236 MovieClip [LaserBeam9] Frame 9
this.stop();
this.removeMovieClip();
Symbol 237 MovieClip [LaserBeam10] Frame 1
this.stop();
if (!this.bullet_target) {
this.gotoAndPlay("Hit");
}
if (!this.bullet_damage) {
this.bullet_damage = 1;
}
if (!this.laser_size) {
this.laser_size = 10;
}
this.laser_colour1 = "0x000000";
this.laser_colour2 = "0xffffff";
this.laser_colour3 = "0xff0000";
this.laser_alpha = "80";
this.gotoAndPlay("Attack");
this.stop();
Symbol 237 MovieClip [LaserBeam10] Frame 4
this.stop();
var point = new Object();
point.x = this.bullet_target._x - this._x;
point.y = this.bullet_target._y - this._y;
this.lineStyle(this.laser_size, this.laser_colour2, this.laser_alpha);
this.lineTo(point.x, point.y);
this.moveTo(0, 0);
this.lineStyle(this.laser_size - 2, this.laser_colour1, 100);
this.lineTo(point.x, point.y);
this.moveTo(0, 0);
this.lineStyle(this.laser_size - 4, this.laser_colour2, 100);
this.lineTo(point.x, point.y);
this.moveTo(0, 0);
this.lineStyle(this.laser_size - 6, this.laser_colour1, 100);
this.lineTo(point.x, point.y);
this.moveTo(0, 0);
this.lineStyle(this.laser_size - 8, this.laser_colour2, 100);
this.lineTo(point.x, point.y);
this.moveTo(0, 0);
this.lineStyle(this.laser_size - 9, this.laser_colour3, 100);
this.lineTo(point.x, point.y);
this.play();
Symbol 237 MovieClip [LaserBeam10] Frame 6
if (this.bullet_target) {
this.bullet_target.hit(this.bullet_damage);
}
Symbol 237 MovieClip [LaserBeam10] Frame 9
this.stop();
this.removeMovieClip();
Symbol 239 MovieClip [Bullet] Frame 1
this.stop();
if (!this.bullet_target) {
this.gotoAndPlay("Hit");
}
if (!this.bullet_damage) {
this.bullet_damage = 1;
}
if (!this.bullet_speed) {
this.bullet_speed = 900;
}
this.time_last = new Date();
this.gotoAndPlay("Attack");
this.stop();
Symbol 239 MovieClip [Bullet] Frame 2
this.stop();
var time_now = new Date();
var time_diff = ((time_now.getTime() - this.time_last.getTime()) / 1000);
this.time_last = time_now;
var target_x = this.bullet_target._x;
var target_y = this.bullet_target._y;
var d_x = (target_x - this._x);
var d_y = (target_y - this._y);
var dist = Math.sqrt((d_x * d_x) + (d_y * d_y));
var move_x = ((d_x / dist) * (this.bullet_speed * time_diff));
var move_y = ((d_y / dist) * (this.bullet_speed * time_diff));
this._x = this._x + move_x;
this._y = this._y + move_y;
move_dist = Math.sqrt((move_x * move_x) + (move_y * move_y));
dist = Math.abs(dist);
move_dist = Math.abs(move_dist);
if (dist <= move_dist) {
this.gotoAndPlay("Hit");
}
this.play();
Symbol 239 MovieClip [Bullet] Frame 3
this.gotoAndPlay("Attack");
Symbol 239 MovieClip [Bullet] Frame 4
this.stop();
if (this.bullet_target) {
this.bullet_target.hit(this.bullet_damage);
}
this.removeMovieClip();
Symbol 240 MovieClip [Bullet2] Frame 1
this.stop();
if (!this.bullet_target) {
this.gotoAndPlay("Hit");
}
if (!this.bullet_damage) {
this.bullet_damage = 1;
}
if (!this.bullet_speed) {
this.bullet_speed = 1024;
}
this.time_last = new Date();
this.gotoAndPlay("Attack");
this.stop();
Symbol 240 MovieClip [Bullet2] Frame 2
this.stop();
var time_now = new Date();
var time_diff = ((time_now.getTime() - this.time_last.getTime()) / 1000);
this.time_last = time_now;
var target_x = this.bullet_target._x;
var target_y = this.bullet_target._y;
var d_x = (target_x - this._x);
var d_y = (target_y - this._y);
var dist = Math.sqrt((d_x * d_x) + (d_y * d_y));
var move_x = ((d_x / dist) * (this.bullet_speed * time_diff));
var move_y = ((d_y / dist) * (this.bullet_speed * time_diff));
this._x = this._x + move_x;
this._y = this._y + move_y;
move_dist = Math.sqrt((move_x * move_x) + (move_y * move_y));
dist = Math.abs(dist);
move_dist = Math.abs(move_dist);
if (dist <= move_dist) {
this.gotoAndPlay("Hit");
}
this.play();
Symbol 240 MovieClip [Bullet2] Frame 3
this.gotoAndPlay("Attack");
Symbol 240 MovieClip [Bullet2] Frame 4
this.stop();
if (this.bullet_target) {
this.bullet_target.hit(this.bullet_damage);
}
this.removeMovieClip();
Symbol 242 MovieClip [Bullet3] Frame 1
this.stop();
if (!this.bullet_target) {
this.gotoAndPlay("Hit");
}
if (!this.bullet_damage) {
this.bullet_damage = 1;
}
if (!this.bullet_speed) {
this.bullet_speed = 1024;
}
this.time_last = new Date();
this.gotoAndPlay("Attack");
this.stop();
Symbol 242 MovieClip [Bullet3] Frame 2
this.stop();
var time_now = new Date();
var time_diff = ((time_now.getTime() - this.time_last.getTime()) / 1000);
this.time_last = time_now;
var target_x = this.bullet_target._x;
var target_y = this.bullet_target._y;
var d_x = (target_x - this._x);
var d_y = (target_y - this._y);
var dist = Math.sqrt((d_x * d_x) + (d_y * d_y));
var move_x = ((d_x / dist) * (this.bullet_speed * time_diff));
var move_y = ((d_y / dist) * (this.bullet_speed * time_diff));
this._x = this._x + move_x;
this._y = this._y + move_y;
move_dist = Math.sqrt((move_x * move_x) + (move_y * move_y));
dist = Math.abs(dist);
move_dist = Math.abs(move_dist);
if (dist <= move_dist) {
this.gotoAndPlay("Hit");
}
this.play();
Symbol 242 MovieClip [Bullet3] Frame 3
this.gotoAndPlay("Attack");
Symbol 242 MovieClip [Bullet3] Frame 4
this.stop();
if (this.bullet_target) {
this.bullet_target.hit(this.bullet_damage);
}
this.removeMovieClip();
Symbol 244 MovieClip [Bullet4] Frame 1
this.stop();
if (!this.bullet_target) {
this.gotoAndPlay("Hit");
}
if (!this.bullet_damage) {
this.bullet_damage = 1;
}
if (!this.bullet_speed) {
this.bullet_speed = 1024;
}
this.time_last = new Date();
this.gotoAndPlay("Attack");
this.stop();
Symbol 244 MovieClip [Bullet4] Frame 2
this.stop();
var time_now = new Date();
var time_diff = ((time_now.getTime() - this.time_last.getTime()) / 1000);
this.time_last = time_now;
var target_x = this.bullet_target._x;
var target_y = this.bullet_target._y;
var d_x = (target_x - this._x);
var d_y = (target_y - this._y);
var dist = Math.sqrt((d_x * d_x) + (d_y * d_y));
var move_x = ((d_x / dist) * (this.bullet_speed * time_diff));
var move_y = ((d_y / dist) * (this.bullet_speed * time_diff));
this._x = this._x + move_x;
this._y = this._y + move_y;
move_dist = Math.sqrt((move_x * move_x) + (move_y * move_y));
dist = Math.abs(dist);
move_dist = Math.abs(move_dist);
if (dist <= move_dist) {
this.gotoAndPlay("Hit");
}
this.play();
Symbol 244 MovieClip [Bullet4] Frame 3
this.gotoAndPlay("Attack");
Symbol 244 MovieClip [Bullet4] Frame 4
this.stop();
if (this.bullet_target) {
this.bullet_target.hit(this.bullet_damage);
}
this.removeMovieClip();
Symbol 246 MovieClip [Bullet5] Frame 1
this.stop();
if (!this.bullet_target) {
this.gotoAndPlay("Hit");
}
if (!this.bullet_damage) {
this.bullet_damage = 1;
}
if (!this.bullet_speed) {
this.bullet_speed = 1024;
}
this.time_last = new Date();
this.gotoAndPlay("Attack");
this.stop();
Symbol 246 MovieClip [Bullet5] Frame 2
this.stop();
var time_now = new Date();
var time_diff = ((time_now.getTime() - this.time_last.getTime()) / 1000);
this.time_last = time_now;
var target_x = this.bullet_target._x;
var target_y = this.bullet_target._y;
var d_x = (target_x - this._x);
var d_y = (target_y - this._y);
var dist = Math.sqrt((d_x * d_x) + (d_y * d_y));
var move_x = ((d_x / dist) * (this.bullet_speed * time_diff));
var move_y = ((d_y / dist) * (this.bullet_speed * time_diff));
this._x = this._x + move_x;
this._y = this._y + move_y;
move_dist = Math.sqrt((move_x * move_x) + (move_y * move_y));
dist = Math.abs(dist);
move_dist = Math.abs(move_dist);
if (dist <= move_dist) {
this.gotoAndPlay("Hit");
}
this.play();
Symbol 246 MovieClip [Bullet5] Frame 3
this.gotoAndPlay("Attack");
Symbol 246 MovieClip [Bullet5] Frame 4
this.stop();
if (this.bullet_target) {
this.bullet_target.hit(this.bullet_damage);
}
this.removeMovieClip();
Symbol 247 MovieClip [Bullet6] Frame 1
this.stop();
if (!this.bullet_target) {
this.gotoAndPlay("Hit");
}
if (!this.bullet_damage) {
this.bullet_damage = 1;
}
if (!this.bullet_speed) {
this.bullet_speed = 1024;
}
this.time_last = new Date();
this.gotoAndPlay("Attack");
this.stop();
Symbol 247 MovieClip [Bullet6] Frame 2
this.stop();
var time_now = new Date();
var time_diff = ((time_now.getTime() - this.time_last.getTime()) / 1000);
this.time_last = time_now;
var target_x = this.bullet_target._x;
var target_y = this.bullet_target._y;
var d_x = (target_x - this._x);
var d_y = (target_y - this._y);
var dist = Math.sqrt((d_x * d_x) + (d_y * d_y));
var move_x = ((d_x / dist) * (this.bullet_speed * time_diff));
var move_y = ((d_y / dist) * (this.bullet_speed * time_diff));
this._x = this._x + move_x;
this._y = this._y + move_y;
move_dist = Math.sqrt((move_x * move_x) + (move_y * move_y));
dist = Math.abs(dist);
move_dist = Math.abs(move_dist);
if (dist <= move_dist) {
this.gotoAndPlay("Hit");
}
this.play();
Symbol 247 MovieClip [Bullet6] Frame 3
this.gotoAndPlay("Attack");
Symbol 247 MovieClip [Bullet6] Frame 4
this.stop();
if (this.bullet_target) {
this.bullet_target.hit(this.bullet_damage);
}
this.removeMovieClip();
Symbol 249 MovieClip [Bullet7] Frame 1
this.stop();
if (!this.bullet_target) {
this.gotoAndPlay("Hit");
}
if (!this.bullet_damage) {
this.bullet_damage = 1;
}
if (!this.bullet_speed) {
this.bullet_speed = 1024;
}
this.time_last = new Date();
this.gotoAndPlay("Attack");
this.stop();
Symbol 249 MovieClip [Bullet7] Frame 2
this.stop();
var time_now = new Date();
var time_diff = ((time_now.getTime() - this.time_last.getTime()) / 1000);
this.time_last = time_now;
var target_x = this.bullet_target._x;
var target_y = this.bullet_target._y;
var d_x = (target_x - this._x);
var d_y = (target_y - this._y);
var dist = Math.sqrt((d_x * d_x) + (d_y * d_y));
var move_x = ((d_x / dist) * (this.bullet_speed * time_diff));
var move_y = ((d_y / dist) * (this.bullet_speed * time_diff));
this._x = this._x + move_x;
this._y = this._y + move_y;
move_dist = Math.sqrt((move_x * move_x) + (move_y * move_y));
dist = Math.abs(dist);
move_dist = Math.abs(move_dist);
if (dist <= move_dist) {
this.gotoAndPlay("Hit");
}
this.play();
Symbol 249 MovieClip [Bullet7] Frame 3
this.gotoAndPlay("Attack");
Symbol 249 MovieClip [Bullet7] Frame 4
this.stop();
if (this.bullet_target) {
this.bullet_target.hit(this.bullet_damage);
}
this.removeMovieClip();
Symbol 251 MovieClip [Bullet8] Frame 1
this.stop();
if (!this.bullet_target) {
this.gotoAndPlay("Hit");
}
if (!this.bullet_damage) {
this.bullet_damage = 1;
}
if (!this.bullet_speed) {
this.bullet_speed = 1024;
}
this.time_last = new Date();
this.gotoAndPlay("Attack");
this.stop();
Symbol 251 MovieClip [Bullet8] Frame 2
this.stop();
var time_now = new Date();
var time_diff = ((time_now.getTime() - this.time_last.getTime()) / 1000);
this.time_last = time_now;
var target_x = this.bullet_target._x;
var target_y = this.bullet_target._y;
var d_x = (target_x - this._x);
var d_y = (target_y - this._y);
var dist = Math.sqrt((d_x * d_x) + (d_y * d_y));
var move_x = ((d_x / dist) * (this.bullet_speed * time_diff));
var move_y = ((d_y / dist) * (this.bullet_speed * time_diff));
this._x = this._x + move_x;
this._y = this._y + move_y;
move_dist = Math.sqrt((move_x * move_x) + (move_y * move_y));
dist = Math.abs(dist);
move_dist = Math.abs(move_dist);
if (dist <= move_dist) {
this.gotoAndPlay("Hit");
}
this.play();
Symbol 251 MovieClip [Bullet8] Frame 3
this.gotoAndPlay("Attack");
Symbol 251 MovieClip [Bullet8] Frame 4
this.stop();
if (this.bullet_target) {
this.bullet_target.hit(this.bullet_damage);
}
this.removeMovieClip();
Symbol 253 MovieClip [ClusterBomb] Frame 1
this.stop();
if (!this.bullet_damage) {
this.bullet_damage = 1000000 /* 0x0F4240 */;
}
if (!this.bullet_speed) {
this.bullet_speed = 750;
}
if (!this.cluster_damage) {
this.cluster_damage = 1000000 /* 0x0F4240 */;
}
if (!this.cluster_qty) {
this.cluster_qty = 4;
}
if (!this.cluster_laser) {
this.cluster_laser = false;
}
if (!this.cluster_holding) {
this.cluster_holding = true;
}
if (!this.cluster_rocket) {
this.cluster_rocket = "Rocket9";
}
if (!this.blast) {
this.blast = false;
}
if (!this.blast_type) {
this.blast_type = "BlastMedium";
}
if (!this.blast_damage) {
this.blast_damage = 1000000 /* 0x0F4240 */;
}
if (!this.bullet_target) {
this.gotoAndPlay("Hit");
}
this.time_last = new Date();
this.gotoAndPlay("Attack");
this.stop();
Symbol 253 MovieClip [ClusterBomb] Frame 2
this.stop();
var time_now = new Date();
var time_diff = ((time_now.getTime() - this.time_last.getTime()) / 1000);
this.time_last = time_now;
var target_x = this.bullet_target._x;
var target_y = this.bullet_target._y;
var d_x = (target_x - this._x);
var d_y = (target_y - this._y);
var dist = Math.sqrt((d_x * d_x) + (d_y * d_y));
var move_x = ((d_x / dist) * (this.bullet_speed * time_diff));
var move_y = ((d_y / dist) * (this.bullet_speed * time_diff));
this._x = this._x + move_x;
this._y = this._y + move_y;
move_dist = Math.sqrt((move_x * move_x) + (move_y * move_y));
dist = Math.abs(dist);
move_dist = Math.abs(move_dist);
if (dist <= move_dist) {
this._x = target_x;
this._y = target_y;
this.gotoAndPlay("Hit");
} else {
this.play();
}
Symbol 253 MovieClip [ClusterBomb] Frame 3
this.gotoAndPlay("Attack");
Symbol 253 MovieClip [ClusterBomb] Frame 4
this.stop();
if (this.bullet_target) {
this.bullet_target.hit(this.bullet_damage);
}
if (!this.blast) {
this.blast = false;
}
if (!this.blast_type) {
this.blast_type = "BlastMedium";
}
if (!this.blast_damage) {
this.blast_damage = 1000000 /* 0x0F4240 */;
}
var new_type = "AddonClusterBlast";
var new_lev = _root.getNextHighestDepth();
var new_name = (new_type + new_lev);
var new_b = _root.attachMovie(new_type, new_name, new_lev);
new_b._x = this._x;
new_b._y = this._y;
new_b.cluster_damage = this.cluster_damage;
new_b.cluster_qty = this.cluster_qty;
new_b.cluster_laser = this.cluster_laser;
new_b.cluster_holding = this.cluster_holding;
new_b.cluster_rocket = this.cluster_rocket;
if (this.blast == true) {
var new_type = this.blast_type;
var new_lev = _root.getNextHighestDepth();
var new_name = (new_type + new_lev);
var new_b = _root.attachMovie(new_type, new_name, new_lev);
new_b._x = this._x;
new_b._y = this._y;
new_b.weapon_damage = this.blast_damage;
}
this.removeMovieClip();
Symbol 255 MovieClip [Bullet9] Frame 1
this.stop();
if (!this.bullet_target) {
this.gotoAndPlay("Hit");
}
if (!this.bullet_damage) {
this.bullet_damage = 1;
}
if (!this.bullet_speed) {
this.bullet_speed = 1024;
}
this.time_last = new Date();
this.gotoAndPlay("Attack");
this.stop();
Symbol 255 MovieClip [Bullet9] Frame 2
this.stop();
var time_now = new Date();
var time_diff = ((time_now.getTime() - this.time_last.getTime()) / 1000);
this.time_last = time_now;
var target_x = this.bullet_target._x;
var target_y = this.bullet_target._y;
var d_x = (target_x - this._x);
var d_y = (target_y - this._y);
var dist = Math.sqrt((d_x * d_x) + (d_y * d_y));
var move_x = ((d_x / dist) * (this.bullet_speed * time_diff));
var move_y = ((d_y / dist) * (this.bullet_speed * time_diff));
this._x = this._x + move_x;
this._y = this._y + move_y;
move_dist = Math.sqrt((move_x * move_x) + (move_y * move_y));
dist = Math.abs(dist);
move_dist = Math.abs(move_dist);
if (dist <= move_dist) {
this.gotoAndPlay("Hit");
}
this.play();
Symbol 255 MovieClip [Bullet9] Frame 3
this.gotoAndPlay("Attack");
Symbol 255 MovieClip [Bullet9] Frame 4
this.stop();
if (this.bullet_target) {
this.bullet_target.hit(this.bullet_damage);
}
this.removeMovieClip();
Symbol 262 MovieClip [RadarDish] Frame 1
this.active = this._parent.active;
if (this.active == undefined) {
this.active = true;
}
this.blip = function () {
this.blip_last = new Date();
var _local10 = Math.random();
if (_local10 > this.blip_chance) {
return(true);
}
var _local6 = "RadarBlip";
var _local5 = this.getNextHighestDepth();
var _local7 = _local6 + _local5;
var _local3 = this.attachMovie(_local6, _local7, _local5);
var _local9 = Math.floor(Math.random() * 4);
var _local8 = "Blip" + _local9;
var _local4 = Sweep[_local8];
var _local2 = new Object();
_local2.x = _local4._x;
_local2.y = _local4._y;
Sweep.localToGlobal(_local2);
this.globalToLocal(_local2);
_local3._x = _local2.x;
_local3._y = _local2.y;
return(_local3);
};
this.time_last = new Date();
this.blip_last = this.time_last;
this.blip_rate = 73;
this.blip_chance = 0.55;
this.sweep_rate = 80;
this.stop();
if (this.active == true) {
this.play();
}
Symbol 262 MovieClip [RadarDish] Frame 3
this.stop();
var time_now = new Date();
var time_diff = (time_now.getTime() - this.time_last.getTime());
var blip_diff = (time_now.getTime() - this.blip_last.getTime());
var the_blip_rate = (60000 / this.blip_rate);
if (blip_diff >= the_blip_rate) {
this.blip();
}
var new_rot = (this.sweep_rate * (time_diff / 1000));
Sweep._rotation = Sweep._rotation + new_rot;
time_last = time_now;
this.play();
Symbol 262 MovieClip [RadarDish] Frame 5
this.gotoAndPlay("Scan");
Symbol 263 MovieClip [TurretRangeUp] Frame 1
if (this.active == undefined) {
this.active = true;
}
if (this.weapon_damage == undefined) {
this.weapon_damage = 0;
}
if (this.weapon_range == undefined) {
this.weapon_range = 80;
}
if (this.weapon_rate == undefined) {
this.weapon_rate = 0;
}
if (this.cash_value == undefined) {
this.cash_value = 0;
}
if (this.modify_damage == undefined) {
this.modify_damage = 0;
}
if (this.modify_range == undefined) {
this.modify_range = 100;
}
if (this.modify_rate == undefined) {
this.modify_rate = 0;
}
if (this.modify_damage_mult == undefined) {
this.modify_damage_mult = 0;
}
if (this.modify_range_mult == undefined) {
this.modify_range_mult = 0;
}
if (this.modify_rate_mult == undefined) {
this.modify_rate_mult = 0;
}
this.notified_new = new Array();
this.notifyNew = function (the_turret) {
this.notified_new.push(the_turret);
return(true);
};
this.notifyGone = function (the_turret) {
return(true);
};
this.onSell = function () {
var _local2 = 0;
while (_local2 < this.turrets_in_range.length) {
var _local3 = this.turrets_in_range[_local2];
this.modifyUnAssert(_local3);
_local2++;
}
};
this.onPress = function () {
if (this._parent.cur_turret) {
_root.TurretHighlightHide();
}
if (this._parent.cur_turret == this) {
this._parent.cur_turret = false;
_root.TurretHighlightHide();
} else {
this._parent.cur_turret = this;
_root.TurretHighlightShow();
}
};
if (this.damage_added == undefined) {
this.damage_added = 0;
}
if (this.damage_mult == undefined) {
this.damage_mult = 1;
}
if (this.range_added == undefined) {
this.range_added = 0;
}
if (this.range_mult == undefined) {
this.range_mult = 1;
}
if (this.rate_added == undefined) {
this.rate_added = 0;
}
if (this.rate_mult == undefined) {
this.rate_mult = 1;
}
if (this.damage_effective == undefined) {
this.damage_effective = this.weapon_damage;
}
if (this.range_effective == undefined) {
this.range_effective = this.weapon_range;
}
if (this.rate_effective == undefined) {
this.rate_effective = this.weapon_rate;
}
this.turrets_in_range = new Array();
this.modify_possible = true;
this.modifyGain = function (the_type, the_amount) {
if (this.modify_possible == false) {
return(false);
}
var _local2 = parseFloat(the_amount);
if (the_type == "damage_added") {
this.damage_added = this.damage_added + _local2;
} else if (the_type == "damage_mult") {
this.damage_mult = this.damage_mult + _local2;
} else if (the_type == "range_added") {
this.range_added = this.range_added + _local2;
} else if (the_type == "range_mult") {
this.range_mult = this.range_mult + _local2;
} else if (the_type == "rate_added") {
this.rate_added = this.rate_added + _local2;
} else if (the_type == "rate_mult") {
this.rate_mult = this.rate_mult + _local2;
}
if (_local2 > 0) {
}
this.modifyUpdate();
};
this.modifyUpdate = function () {
this.damage_effective = this.modifyDamage(this.weapon_damage);
this.range_effective = this.modifyRange(this.weapon_range);
this.rate_effective = this.modifyRate(this.weapon_rate);
this.WeaponController.weapon_range = this.range_effective;
return(true);
};
this.modifyDumpStats = function () {
trace((this + ": added damage ") + this.damage_added);
trace((this + ": added range ") + this.range_added);
trace((this + ": added rate ") + this.rate_added);
trace((this + ": mult damage ") + this.damage_mult);
trace((this + ": mult range ") + this.range_mult);
trace((this + ": mult rate ") + this.rate_mult);
trace((this + ": weapon damage ") + this.weapon_damage);
trace((this + ": weapon range ") + this.weapon_range);
trace((this + ": weapon rate ") + this.weapon_rate);
trace((this + ": effective damage ") + this.damage_effective);
trace((this + ": effective range ") + this.range_effective);
trace((this + ": effective rate ") + this.rate_effective);
};
this.modifyLose = function (the_type, the_amount) {
this.modifyGain(the_type, -the_amount);
};
this.modifyDamage = function (the_amount) {
var _local3 = parseFloat(the_amount);
var _local2 = (_local3 + this.damage_added) * this.damage_mult;
_local2 = Math.max(_local2, 0);
return(_local2);
};
this.modifyRange = function (the_amount) {
var _local3 = parseFloat(the_amount);
var _local2 = (_local3 + this.range_added) * this.range_mult;
_local2 = Math.max(_local2, 0);
return(_local2);
};
this.modifyRate = function (the_amount) {
var _local3 = parseFloat(the_amount);
var _local2 = (_local3 + this.rate_added) * this.rate_mult;
_local2 = Math.max(_local2, 0);
return(_local2);
};
this.modifyGetInRange = function (the_range) {
this.turrets_in_range = new Array();
var _local9 = the_range;
var _local8 = _root.turrets;
var _local3 = 0;
while (_local3 < _local8.length) {
var _local4 = _local8[_local3];
if (point != this) {
var _local5 = _local4._x - this._x;
var _local6 = _local4._y - this._y;
var _local7 = Math.sqrt((_local5 * _local5) + (_local6 * _local6));
if (_local7 <= _local9) {
this.turrets_in_range.push(_local4);
}
}
_local3++;
}
};
this.modifyAssert = function () {
var _local2 = 0;
while (_local2 < this.turrets_in_range.length) {
var _local3 = this.turrets_in_range[_local2];
this._modifyAssert(_local3);
_local2++;
}
};
this._modifyAssert = function (the_turret) {
the_turret.modifyGain("damage_added", this.modify_damage);
the_turret.modifyGain("range_added", this.modify_range);
the_turret.modifyGain("rate_added", this.modify_rate);
the_turret.modifyGain("damage_mult", this.modify_damage_mult);
the_turret.modifyGain("range_mult", this.modify_range_mult);
the_turret.modifyGain("rate_mult", this.modify_rate_mult);
};
this.modifyUnAssert = function (the_turret) {
the_turret.modifyLose("damage_added", this.modify_damage);
the_turret.modifyLose("range_added", this.modify_range);
the_turret.modifyLose("rate_added", this.modify_rate);
the_turret.modifyLose("damage_mult", this.modify_damage_mult);
the_turret.modifyLose("range_mult", this.modify_range_mult);
the_turret.modifyLose("rate_mult", this.modify_rate_mult);
};
this.modifyNotifyNew = function (the_turret) {
var _local3 = the_turret._x - this._x;
var _local4 = the_turret._y - this._y;
var _local5 = Math.sqrt((_local3 * _local3) + (_local4 * _local4));
if (_local5 <= this.weapon_range) {
this.turrets_in_range.push(the_turret);
this._modifyAssert(the_turret);
}
};
this.modify_possible = false;
if (!this.upgrade_damage_level) {
this.upgrade_damage_level = 0;
}
if (!this.upgrade_range_level) {
this.upgrade_range_level = 0;
}
if (!this.upgrade_rate_level) {
this.upgrade_rate_level = 0;
}
this.max_damage = 0;
this.max_range = 0;
this.max_rate = 0;
this.max_built = false;
this.cost_damage = 0;
this.cost_range = 0;
this.cost_rate = 0;
this.cost_built = false;
this.upgrade_to_damage = 0;
this.upgrade_to_range = 0;
this.upgrade_to_rate = 0;
this.upgrade_to_built = false;
this.upgrade_pct_damage = 0;
this.upgrade_pct_range = 0;
this.upgrade_pct_rate = 0;
this.upgrade_pct_built = false;
this.upgrade_weapon_at_damage = new Array();
this._upgradeDone = function () {
this.cost_built = false;
this.upgrade_to_built = false;
this.upgrade_pct_built = false;
var _local2 = this.getMax("damage");
if (_local2 == this.weapon_damage) {
this.special_capable = true;
}
this.IndicateDamage.setPercentage(this.upgradeLevelAsPercent("damage"));
this.IndicateRange.setPercentage(this.upgradeLevelAsPercent("range"));
this.IndicateRate.setPercentage(this.upgradeLevelAsPercent("rate"));
this.modifyUpdate();
this.upgradeDone();
};
this.upgradeGetWeaponAtDamage = function (the_damage) {
if (this.upgrade_weapon_at_damage[the_damage]) {
return(this.upgrade_weapon_at_damage[the_damage]);
}
var _local8 = this.getMax("damage");
if (the_damage > _local8) {
return(this.max_bullet);
}
var _local6 = 0;
var _local4 = this.getMax("damage");
var _local5 = 0;
for (var _local7 in this.upgrade_damage) {
_local5++;
}
for (var _local7 in this.upgrade_damage) {
_local6 = _local4;
_local4 = parseInt(_local7);
if ((the_damage < _local6) && (the_damage >= _local4)) {
var _local2 = this.upgrade_bullet[_local5];
this.upgrade_weapon_at_damage[the_damage] = _local2;
return(_local2);
}
_local5--;
}
return(this.weapon_type);
};
this.getUpgrade = function (the_type) {
if (this.cost_built == false) {
this.upgrade_to_damage = this._getUpgrade("damage");
this.upgrade_to_range = this._getUpgrade("range");
this.upgrade_to_rate = this._getUpgrade("rate");
this.upgrade_to_built = true;
}
if (the_type == "damage") {
return(this.upgrade_to_damage);
}
if (the_type == "range") {
return(this.upgrade_to_range);
}
if (the_type == "rate") {
return(this.upgrade_to_rate);
}
return(false);
};
this._getUpgrade = function (the_type) {
var _local2 = new Array();
var _local3 = false;
if (the_type == "damage") {
_local2 = this.upgrade_damage;
_local3 = this.upgrade_damage_level;
} else if (the_type == "range") {
_local2 = this.upgrade_range;
_local3 = this.upgrade_range_level;
} else if (the_type == "rate") {
_local2 = this.upgrade_rate;
_local3 = this.upgrade_rate_level;
} else {
return(false);
}
var _local4 = 0;
for (var _local5 in _local2) {
_local4++;
}
if (_local3 >= _local4) {
return(false);
}
count = _local4 - 1;
for (var _local5 in _local2) {
if (count eq _local3) {
return(_local5);
}
count--;
}
return(false);
};
this.getUpgradeCost = function (the_type) {
if (this.cost_built == false) {
this.cost_damage = this._getUpgradeCost("damage");
this.cost_range = this._getUpgradeCost("range");
this.cost_rate = this._getUpgradeCost("rate");
this.cost_built = true;
}
if (the_type == "damage") {
return(this.cost_damage);
}
if (the_type == "range") {
return(this.cost_range);
}
if (the_type == "rate") {
return(this.cost_rate);
}
return(false);
};
this._getUpgradeCost = function (the_type) {
var _local2;
var _local3;
if (the_type == "damage") {
_local2 = this.upgrade_damage;
_local3 = this.upgrade_damage_level;
} else if (the_type == "range") {
_local2 = this.upgrade_range;
_local3 = this.upgrade_range_level;
} else if (the_type == "rate") {
_local2 = this.upgrade_rate;
_local3 = this.upgrade_rate_level;
} else {
return(false);
}
var _local4 = 0;
for (var _local5 in _local2) {
_local4++;
}
if (_local3 >= _local4) {
return(false);
}
count = _local4 - 1;
for (var _local5 in _local2) {
if (count eq _local3) {
return(_local2[_local5]);
}
count--;
}
return(false);
};
this.getMax = function (the_type) {
if (this.max_built == false) {
this.max_damage = this._getMax("damage");
this.max_range = this._getMax("range");
this.max_rate = this._getMax("rate");
this.max_built = true;
}
if (the_type == "damage") {
return(this.max_damage);
}
if (the_type == "range") {
return(this.max_range);
}
if (the_type == "rate") {
return(this.max_rate);
}
return(false);
};
this._getMax = function (the_type) {
var _local5;
var _local7;
if (the_type == "damage") {
_local5 = this.upgrade_damage;
_local7 = this.upgrade_damage_level;
} else if (the_type == "range") {
_local5 = this.upgrade_range;
_local7 = this.upgrade_range_level;
} else if (the_type == "rate") {
_local5 = this.upgrade_rate;
_local7 = this.upgrade_rate_level;
} else {
return(false);
}
var _local4 = new Number(0);
for (var _local6 in _local5) {
var _local3 = new Number(_local6);
var _local2 = _local3.valueOf();
if (_local2 > _local4) {
_local4 = _local2;
}
}
return(_local4);
};
this.upgradeDamage = function () {
var _local4 = this.upgrade_damage;
var _local8 = this.upgrade_damage_level;
var _local6 = _local8 + 1;
var _local5 = 0;
for (var _local7 in _local4) {
_local5++;
}
if (_local6 > _local5) {
return(false);
}
count = _local5;
for (var _local7 in _local4) {
if (count eq _local6) {
var _local3 = _local4[_local7];
if (_root.Payment(_local3)) {
this.cash_value = this.cash_value + _local3;
this.weapon_damage = _local7;
this.upgrade_damage_level++;
this._upgradeDone();
return(true);
}
return(false);
}
count--;
}
return(false);
};
this.upgradeRange = function () {
var _local4 = this.upgrade_range;
var _local8 = this.upgrade_range_level;
var _local6 = _local8 + 1;
var _local5 = 0;
for (var _local7 in _local4) {
_local5++;
}
if (_local6 > _local5) {
return(false);
}
count = _local5;
for (var _local7 in _local4) {
if (count eq _local6) {
var _local3 = _local4[_local7];
if (_root.Payment(_local3)) {
this.cash_value = this.cash_value + _local3;
this.weapon_range = _local7;
this.upgrade_range_level++;
this._upgradeDone();
return(true);
}
return(false);
}
count--;
}
return(false);
};
this.upgradeRate = function () {
var _local4 = this.upgrade_rate;
var _local8 = this.upgrade_rate_level;
var _local6 = _local8 + 1;
var _local5 = 0;
for (var _local7 in _local4) {
_local5++;
}
if (_local6 > _local5) {
return(false);
}
count = _local5;
for (var _local7 in _local4) {
if (count eq _local6) {
var _local3 = _local4[_local7];
if (_root.Payment(_local3)) {
this.cash_value = this.cash_value + _local3;
this.weapon_rate = _local7;
this.upgrade_rate_level++;
this._upgradeDone();
return(true);
}
return(false);
}
count--;
}
return(false);
};
this.upgradeLevelAsPercent = function (the_type) {
if (this.upgrade_pct_built == false) {
this.upgrade_pct_damage = this._upgradeLevelAsPercent("damage");
this.upgrade_pct_range = this._upgradeLevelAsPercent("range");
this.upgrade_pct_rate = this._upgradeLevelAsPercent("rate");
this.upgrade_pct_built = true;
}
if (the_type == "damage") {
return(this.upgrade_pct_damage);
}
if (the_type == "range") {
return(this.upgrade_pct_range);
}
if (the_type == "rate") {
return(this.upgrade_pct_rate);
}
return(false);
};
this._upgradeLevelAsPercent = function (the_type) {
var _local2;
var _local5;
if (the_type == "damage") {
_local2 = this.upgrade_damage;
_local5 = this.upgrade_damage_level;
} else if (the_type == "range") {
_local2 = this.upgrade_range;
_local5 = this.upgrade_range_level;
} else if (the_type == "rate") {
_local2 = this.upgrade_rate;
_local5 = this.upgrade_rate_level;
} else {
return(false);
}
var _local3 = 0;
for (var _local4 in _local2) {
_local3++;
}
var _local7 = Math.ceil((_local5 / _local3) * 100);
return(_local7);
};
this.upgrade_damage = new Array();
this.upgrade_range = new Array();
this.upgrade_range["130"] = 1500;
this.upgrade_rate = new Array();
this.upgradeDone = function () {
this.onSell();
this.modifyGetInRange(this.weapon_range);
this.modifyAssert();
this.modifyUpdate();
};
this.stop();
this.Weapon.stop();
if (this.active == true) {
this.Weapon.play();
this.play();
}
Symbol 263 MovieClip [TurretRangeUp] Frame 4
this.stop();
this.modifyGetInRange(this.weapon_range);
this.modifyAssert();
this.play();
Symbol 263 MovieClip [TurretRangeUp] Frame 7
this.stop();
for (var i in this.notified_new) {
var turret = this.notified_new[i];
this.modifyNotifyNew(turret);
}
this.notified_new = new Array();
this.play();
Symbol 263 MovieClip [TurretRangeUp] Frame 10
this.stop();
if (this.active == true) {
this.gotoAndPlay("Scan");
} else {
this.Weapon.stop();
}
Symbol 265 MovieClip [ModifyExchanger] Frame 1
this.stop();
Symbol 266 MovieClip [TurretRangeUpExchange] Frame 1
if (this.active == undefined) {
this.active = true;
}
if (this.weapon_damage == undefined) {
this.weapon_damage = 0;
}
if (this.weapon_range == undefined) {
this.weapon_range = 80;
}
if (this.weapon_rate == undefined) {
this.weapon_rate = 0;
}
if (this.cash_value == undefined) {
this.cash_value = 0;
}
if (this.modify_damage == undefined) {
this.modify_damage = 0;
}
if (this.modify_range == undefined) {
this.modify_range = 100;
}
if (this.modify_rate == undefined) {
this.modify_rate = 0;
}
if (this.modify_damage_mult == undefined) {
this.modify_damage_mult = 0;
}
if (this.modify_range_mult == undefined) {
this.modify_range_mult = 0;
}
if (this.modify_rate_mult == undefined) {
this.modify_rate_mult = -0.25;
}
this.notified_new = new Array();
this.notifyNew = function (the_turret) {
this.notified_new.push(the_turret);
return(true);
};
this.notifyGone = function (the_turret) {
return(true);
};
this.onSell = function () {
var _local2 = 0;
while (_local2 < this.turrets_in_range.length) {
var _local3 = this.turrets_in_range[_local2];
this.modifyUnAssert(_local3);
_local2++;
}
};
this.onPress = function () {
if (this._parent.cur_turret) {
_root.TurretHighlightHide();
}
if (this._parent.cur_turret == this) {
this._parent.cur_turret = false;
_root.TurretHighlightHide();
} else {
this._parent.cur_turret = this;
_root.TurretHighlightShow();
}
};
if (this.damage_added == undefined) {
this.damage_added = 0;
}
if (this.damage_mult == undefined) {
this.damage_mult = 1;
}
if (this.range_added == undefined) {
this.range_added = 0;
}
if (this.range_mult == undefined) {
this.range_mult = 1;
}
if (this.rate_added == undefined) {
this.rate_added = 0;
}
if (this.rate_mult == undefined) {
this.rate_mult = 1;
}
if (this.damage_effective == undefined) {
this.damage_effective = this.weapon_damage;
}
if (this.range_effective == undefined) {
this.range_effective = this.weapon_range;
}
if (this.rate_effective == undefined) {
this.rate_effective = this.weapon_rate;
}
this.turrets_in_range = new Array();
this.modify_possible = true;
this.modifyGain = function (the_type, the_amount) {
if (this.modify_possible == false) {
return(false);
}
var _local2 = parseFloat(the_amount);
if (the_type == "damage_added") {
this.damage_added = this.damage_added + _local2;
} else if (the_type == "damage_mult") {
this.damage_mult = this.damage_mult + _local2;
} else if (the_type == "range_added") {
this.range_added = this.range_added + _local2;
} else if (the_type == "range_mult") {
this.range_mult = this.range_mult + _local2;
} else if (the_type == "rate_added") {
this.rate_added = this.rate_added + _local2;
} else if (the_type == "rate_mult") {
this.rate_mult = this.rate_mult + _local2;
}
if (_local2 > 0) {
}
this.modifyUpdate();
};
this.modifyUpdate = function () {
this.damage_effective = this.modifyDamage(this.weapon_damage);
this.range_effective = this.modifyRange(this.weapon_range);
this.rate_effective = this.modifyRate(this.weapon_rate);
this.WeaponController.weapon_range = this.range_effective;
return(true);
};
this.modifyDumpStats = function () {
trace((this + ": added damage ") + this.damage_added);
trace((this + ": added range ") + this.range_added);
trace((this + ": added rate ") + this.rate_added);
trace((this + ": mult damage ") + this.damage_mult);
trace((this + ": mult range ") + this.range_mult);
trace((this + ": mult rate ") + this.rate_mult);
trace((this + ": weapon damage ") + this.weapon_damage);
trace((this + ": weapon range ") + this.weapon_range);
trace((this + ": weapon rate ") + this.weapon_rate);
trace((this + ": effective damage ") + this.damage_effective);
trace((this + ": effective range ") + this.range_effective);
trace((this + ": effective rate ") + this.rate_effective);
};
this.modifyLose = function (the_type, the_amount) {
this.modifyGain(the_type, -the_amount);
};
this.modifyDamage = function (the_amount) {
var _local3 = parseFloat(the_amount);
var _local2 = (_local3 + this.damage_added) * this.damage_mult;
_local2 = Math.max(_local2, 0);
return(_local2);
};
this.modifyRange = function (the_amount) {
var _local3 = parseFloat(the_amount);
var _local2 = (_local3 + this.range_added) * this.range_mult;
_local2 = Math.max(_local2, 0);
return(_local2);
};
this.modifyRate = function (the_amount) {
var _local3 = parseFloat(the_amount);
var _local2 = (_local3 + this.rate_added) * this.rate_mult;
_local2 = Math.max(_local2, 0);
return(_local2);
};
this.modifyGetInRange = function (the_range) {
this.turrets_in_range = new Array();
var _local9 = the_range;
var _local8 = _root.turrets;
var _local3 = 0;
while (_local3 < _local8.length) {
var _local4 = _local8[_local3];
if (point != this) {
var _local5 = _local4._x - this._x;
var _local6 = _local4._y - this._y;
var _local7 = Math.sqrt((_local5 * _local5) + (_local6 * _local6));
if (_local7 <= _local9) {
this.turrets_in_range.push(_local4);
}
}
_local3++;
}
};
this.modifyAssert = function () {
var _local2 = 0;
while (_local2 < this.turrets_in_range.length) {
var _local3 = this.turrets_in_range[_local2];
this._modifyAssert(_local3);
_local2++;
}
};
this._modifyAssert = function (the_turret) {
the_turret.modifyGain("damage_added", this.modify_damage);
the_turret.modifyGain("range_added", this.modify_range);
the_turret.modifyGain("rate_added", this.modify_rate);
the_turret.modifyGain("damage_mult", this.modify_damage_mult);
the_turret.modifyGain("range_mult", this.modify_range_mult);
the_turret.modifyGain("rate_mult", this.modify_rate_mult);
};
this.modifyUnAssert = function (the_turret) {
the_turret.modifyLose("damage_added", this.modify_damage);
the_turret.modifyLose("range_added", this.modify_range);
the_turret.modifyLose("rate_added", this.modify_rate);
the_turret.modifyLose("damage_mult", this.modify_damage_mult);
the_turret.modifyLose("range_mult", this.modify_range_mult);
the_turret.modifyLose("rate_mult", this.modify_rate_mult);
};
this.modifyNotifyNew = function (the_turret) {
var _local3 = the_turret._x - this._x;
var _local4 = the_turret._y - this._y;
var _local5 = Math.sqrt((_local3 * _local3) + (_local4 * _local4));
if (_local5 <= this.weapon_range) {
this.turrets_in_range.push(the_turret);
this._modifyAssert(the_turret);
}
};
this.modify_possible = false;
if (!this.upgrade_damage_level) {
this.upgrade_damage_level = 0;
}
if (!this.upgrade_range_level) {
this.upgrade_range_level = 0;
}
if (!this.upgrade_rate_level) {
this.upgrade_rate_level = 0;
}
this.max_damage = 0;
this.max_range = 0;
this.max_rate = 0;
this.max_built = false;
this.cost_damage = 0;
this.cost_range = 0;
this.cost_rate = 0;
this.cost_built = false;
this.upgrade_to_damage = 0;
this.upgrade_to_range = 0;
this.upgrade_to_rate = 0;
this.upgrade_to_built = false;
this.upgrade_pct_damage = 0;
this.upgrade_pct_range = 0;
this.upgrade_pct_rate = 0;
this.upgrade_pct_built = false;
this.upgrade_weapon_at_damage = new Array();
this._upgradeDone = function () {
this.cost_built = false;
this.upgrade_to_built = false;
this.upgrade_pct_built = false;
var _local2 = this.getMax("damage");
if (_local2 == this.weapon_damage) {
this.special_capable = true;
}
this.IndicateDamage.setPercentage(this.upgradeLevelAsPercent("damage"));
this.IndicateRange.setPercentage(this.upgradeLevelAsPercent("range"));
this.IndicateRate.setPercentage(this.upgradeLevelAsPercent("rate"));
this.modifyUpdate();
this.upgradeDone();
};
this.upgradeGetWeaponAtDamage = function (the_damage) {
if (this.upgrade_weapon_at_damage[the_damage]) {
return(this.upgrade_weapon_at_damage[the_damage]);
}
var _local8 = this.getMax("damage");
if (the_damage > _local8) {
return(this.max_bullet);
}
var _local6 = 0;
var _local4 = this.getMax("damage");
var _local5 = 0;
for (var _local7 in this.upgrade_damage) {
_local5++;
}
for (var _local7 in this.upgrade_damage) {
_local6 = _local4;
_local4 = parseInt(_local7);
if ((the_damage < _local6) && (the_damage >= _local4)) {
var _local2 = this.upgrade_bullet[_local5];
this.upgrade_weapon_at_damage[the_damage] = _local2;
return(_local2);
}
_local5--;
}
return(this.weapon_type);
};
this.getUpgrade = function (the_type) {
if (this.cost_built == false) {
this.upgrade_to_damage = this._getUpgrade("damage");
this.upgrade_to_range = this._getUpgrade("range");
this.upgrade_to_rate = this._getUpgrade("rate");
this.upgrade_to_built = true;
}
if (the_type == "damage") {
return(this.upgrade_to_damage);
}
if (the_type == "range") {
return(this.upgrade_to_range);
}
if (the_type == "rate") {
return(this.upgrade_to_rate);
}
return(false);
};
this._getUpgrade = function (the_type) {
var _local2 = new Array();
var _local3 = false;
if (the_type == "damage") {
_local2 = this.upgrade_damage;
_local3 = this.upgrade_damage_level;
} else if (the_type == "range") {
_local2 = this.upgrade_range;
_local3 = this.upgrade_range_level;
} else if (the_type == "rate") {
_local2 = this.upgrade_rate;
_local3 = this.upgrade_rate_level;
} else {
return(false);
}
var _local4 = 0;
for (var _local5 in _local2) {
_local4++;
}
if (_local3 >= _local4) {
return(false);
}
count = _local4 - 1;
for (var _local5 in _local2) {
if (count eq _local3) {
return(_local5);
}
count--;
}
return(false);
};
this.getUpgradeCost = function (the_type) {
if (this.cost_built == false) {
this.cost_damage = this._getUpgradeCost("damage");
this.cost_range = this._getUpgradeCost("range");
this.cost_rate = this._getUpgradeCost("rate");
this.cost_built = true;
}
if (the_type == "damage") {
return(this.cost_damage);
}
if (the_type == "range") {
return(this.cost_range);
}
if (the_type == "rate") {
return(this.cost_rate);
}
return(false);
};
this._getUpgradeCost = function (the_type) {
var _local2;
var _local3;
if (the_type == "damage") {
_local2 = this.upgrade_damage;
_local3 = this.upgrade_damage_level;
} else if (the_type == "range") {
_local2 = this.upgrade_range;
_local3 = this.upgrade_range_level;
} else if (the_type == "rate") {
_local2 = this.upgrade_rate;
_local3 = this.upgrade_rate_level;
} else {
return(false);
}
var _local4 = 0;
for (var _local5 in _local2) {
_local4++;
}
if (_local3 >= _local4) {
return(false);
}
count = _local4 - 1;
for (var _local5 in _local2) {
if (count eq _local3) {
return(_local2[_local5]);
}
count--;
}
return(false);
};
this.getMax = function (the_type) {
if (this.max_built == false) {
this.max_damage = this._getMax("damage");
this.max_range = this._getMax("range");
this.max_rate = this._getMax("rate");
this.max_built = true;
}
if (the_type == "damage") {
return(this.max_damage);
}
if (the_type == "range") {
return(this.max_range);
}
if (the_type == "rate") {
return(this.max_rate);
}
return(false);
};
this._getMax = function (the_type) {
var _local5;
var _local7;
if (the_type == "damage") {
_local5 = this.upgrade_damage;
_local7 = this.upgrade_damage_level;
} else if (the_type == "range") {
_local5 = this.upgrade_range;
_local7 = this.upgrade_range_level;
} else if (the_type == "rate") {
_local5 = this.upgrade_rate;
_local7 = this.upgrade_rate_level;
} else {
return(false);
}
var _local4 = new Number(0);
for (var _local6 in _local5) {
var _local3 = new Number(_local6);
var _local2 = _local3.valueOf();
if (_local2 > _local4) {
_local4 = _local2;
}
}
return(_local4);
};
this.upgradeDamage = function () {
var _local4 = this.upgrade_damage;
var _local8 = this.upgrade_damage_level;
var _local6 = _local8 + 1;
var _local5 = 0;
for (var _local7 in _local4) {
_local5++;
}
if (_local6 > _local5) {
return(false);
}
count = _local5;
for (var _local7 in _local4) {
if (count eq _local6) {
var _local3 = _local4[_local7];
if (_root.Payment(_local3)) {
this.cash_value = this.cash_value + _local3;
this.weapon_damage = _local7;
this.upgrade_damage_level++;
this._upgradeDone();
return(true);
}
return(false);
}
count--;
}
return(false);
};
this.upgradeRange = function () {
var _local4 = this.upgrade_range;
var _local8 = this.upgrade_range_level;
var _local6 = _local8 + 1;
var _local5 = 0;
for (var _local7 in _local4) {
_local5++;
}
if (_local6 > _local5) {
return(false);
}
count = _local5;
for (var _local7 in _local4) {
if (count eq _local6) {
var _local3 = _local4[_local7];
if (_root.Payment(_local3)) {
this.cash_value = this.cash_value + _local3;
this.weapon_range = _local7;
this.upgrade_range_level++;
this._upgradeDone();
return(true);
}
return(false);
}
count--;
}
return(false);
};
this.upgradeRate = function () {
var _local4 = this.upgrade_rate;
var _local8 = this.upgrade_rate_level;
var _local6 = _local8 + 1;
var _local5 = 0;
for (var _local7 in _local4) {
_local5++;
}
if (_local6 > _local5) {
return(false);
}
count = _local5;
for (var _local7 in _local4) {
if (count eq _local6) {
var _local3 = _local4[_local7];
if (_root.Payment(_local3)) {
this.cash_value = this.cash_value + _local3;
this.weapon_rate = _local7;
this.upgrade_rate_level++;
this._upgradeDone();
return(true);
}
return(false);
}
count--;
}
return(false);
};
this.upgradeLevelAsPercent = function (the_type) {
if (this.upgrade_pct_built == false) {
this.upgrade_pct_damage = this._upgradeLevelAsPercent("damage");
this.upgrade_pct_range = this._upgradeLevelAsPercent("range");
this.upgrade_pct_rate = this._upgradeLevelAsPercent("rate");
this.upgrade_pct_built = true;
}
if (the_type == "damage") {
return(this.upgrade_pct_damage);
}
if (the_type == "range") {
return(this.upgrade_pct_range);
}
if (the_type == "rate") {
return(this.upgrade_pct_rate);
}
return(false);
};
this._upgradeLevelAsPercent = function (the_type) {
var _local2;
var _local5;
if (the_type == "damage") {
_local2 = this.upgrade_damage;
_local5 = this.upgrade_damage_level;
} else if (the_type == "range") {
_local2 = this.upgrade_range;
_local5 = this.upgrade_range_level;
} else if (the_type == "rate") {
_local2 = this.upgrade_rate;
_local5 = this.upgrade_rate_level;
} else {
return(false);
}
var _local3 = 0;
for (var _local4 in _local2) {
_local3++;
}
var _local7 = Math.ceil((_local5 / _local3) * 100);
return(_local7);
};
this.upgrade_damage = new Array();
this.upgrade_range = new Array();
this.upgrade_range["130"] = 1500;
this.upgrade_rate = new Array();
this.upgradeDone = function () {
this.onSell();
this.modifyGetInRange(this.weapon_range);
this.modifyAssert();
this.modifyUpdate();
};
this.stop();
this.Weapon.stop();
if (this.active == true) {
this.Weapon.play();
this.play();
}
Symbol 266 MovieClip [TurretRangeUpExchange] Frame 4
this.stop();
this.modifyGetInRange(this.weapon_range);
this.modifyAssert();
this.play();
Symbol 266 MovieClip [TurretRangeUpExchange] Frame 7
this.stop();
for (var i in this.notified_new) {
var turret = this.notified_new[i];
this.modifyNotifyNew(turret);
}
this.notified_new = new Array();
this.play();
Symbol 266 MovieClip [TurretRangeUpExchange] Frame 10
this.stop();
if (this.active == true) {
this.gotoAndPlay("Scan");
} else {
this.Weapon.stop();
}
Symbol 277 MovieClip [TurretDamageUp] Frame 1
if (this.active == undefined) {
this.active = true;
}
if (this.weapon_damage == undefined) {
this.weapon_damage = 0;
}
if (this.weapon_range == undefined) {
this.weapon_range = 80;
}
if (this.weapon_rate == undefined) {
this.weapon_rate = 0;
}
if (this.cash_value == undefined) {
this.cash_value = 0;
}
if (this.modify_damage == undefined) {
this.modify_damage = 0;
}
if (this.modify_range == undefined) {
this.modify_range = 0;
}
if (this.modify_rate == undefined) {
this.modify_rate = 0;
}
if (this.modify_damage_mult == undefined) {
this.modify_damage_mult = 0.4;
}
if (this.modify_range_mult == undefined) {
this.modify_range_mult = 0;
}
if (this.modify_rate_mult == undefined) {
this.modify_rate_mult = 0;
}
this.notified_new = new Array();
this.notifyNew = function (the_turret) {
this.notified_new.push(the_turret);
return(true);
};
this.notifyGone = function (the_turret) {
return(true);
};
this.onSell = function () {
var _local2 = 0;
while (_local2 < this.turrets_in_range.length) {
var _local3 = this.turrets_in_range[_local2];
this.modifyUnAssert(_local3);
_local2++;
}
};
this.onPress = function () {
if (this._parent.cur_turret) {
_root.TurretHighlightHide();
}
if (this._parent.cur_turret == this) {
this._parent.cur_turret = false;
_root.TurretHighlightHide();
} else {
this._parent.cur_turret = this;
_root.TurretHighlightShow();
}
};
if (this.damage_added == undefined) {
this.damage_added = 0;
}
if (this.damage_mult == undefined) {
this.damage_mult = 1;
}
if (this.range_added == undefined) {
this.range_added = 0;
}
if (this.range_mult == undefined) {
this.range_mult = 1;
}
if (this.rate_added == undefined) {
this.rate_added = 0;
}
if (this.rate_mult == undefined) {
this.rate_mult = 1;
}
if (this.damage_effective == undefined) {
this.damage_effective = this.weapon_damage;
}
if (this.range_effective == undefined) {
this.range_effective = this.weapon_range;
}
if (this.rate_effective == undefined) {
this.rate_effective = this.weapon_rate;
}
this.turrets_in_range = new Array();
this.modify_possible = true;
this.modifyGain = function (the_type, the_amount) {
if (this.modify_possible == false) {
return(false);
}
var _local2 = parseFloat(the_amount);
if (the_type == "damage_added") {
this.damage_added = this.damage_added + _local2;
} else if (the_type == "damage_mult") {
this.damage_mult = this.damage_mult + _local2;
} else if (the_type == "range_added") {
this.range_added = this.range_added + _local2;
} else if (the_type == "range_mult") {
this.range_mult = this.range_mult + _local2;
} else if (the_type == "rate_added") {
this.rate_added = this.rate_added + _local2;
} else if (the_type == "rate_mult") {
this.rate_mult = this.rate_mult + _local2;
}
if (_local2 > 0) {
}
this.modifyUpdate();
};
this.modifyUpdate = function () {
this.damage_effective = this.modifyDamage(this.weapon_damage);
this.range_effective = this.modifyRange(this.weapon_range);
this.rate_effective = this.modifyRate(this.weapon_rate);
this.WeaponController.weapon_range = this.range_effective;
return(true);
};
this.modifyDumpStats = function () {
trace((this + ": added damage ") + this.damage_added);
trace((this + ": added range ") + this.range_added);
trace((this + ": added rate ") + this.rate_added);
trace((this + ": mult damage ") + this.damage_mult);
trace((this + ": mult range ") + this.range_mult);
trace((this + ": mult rate ") + this.rate_mult);
trace((this + ": weapon damage ") + this.weapon_damage);
trace((this + ": weapon range ") + this.weapon_range);
trace((this + ": weapon rate ") + this.weapon_rate);
trace((this + ": effective damage ") + this.damage_effective);
trace((this + ": effective range ") + this.range_effective);
trace((this + ": effective rate ") + this.rate_effective);
};
this.modifyLose = function (the_type, the_amount) {
this.modifyGain(the_type, -the_amount);
};
this.modifyDamage = function (the_amount) {
var _local3 = parseFloat(the_amount);
var _local2 = (_local3 + this.damage_added) * this.damage_mult;
_local2 = Math.max(_local2, 0);
return(_local2);
};
this.modifyRange = function (the_amount) {
var _local3 = parseFloat(the_amount);
var _local2 = (_local3 + this.range_added) * this.range_mult;
_local2 = Math.max(_local2, 0);
return(_local2);
};
this.modifyRate = function (the_amount) {
var _local3 = parseFloat(the_amount);
var _local2 = (_local3 + this.rate_added) * this.rate_mult;
_local2 = Math.max(_local2, 0);
return(_local2);
};
this.modifyGetInRange = function (the_range) {
this.turrets_in_range = new Array();
var _local9 = the_range;
var _local8 = _root.turrets;
var _local3 = 0;
while (_local3 < _local8.length) {
var _local4 = _local8[_local3];
if (point != this) {
var _local5 = _local4._x - this._x;
var _local6 = _local4._y - this._y;
var _local7 = Math.sqrt((_local5 * _local5) + (_local6 * _local6));
if (_local7 <= _local9) {
this.turrets_in_range.push(_local4);
}
}
_local3++;
}
};
this.modifyAssert = function () {
var _local2 = 0;
while (_local2 < this.turrets_in_range.length) {
var _local3 = this.turrets_in_range[_local2];
this._modifyAssert(_local3);
_local2++;
}
};
this._modifyAssert = function (the_turret) {
the_turret.modifyGain("damage_added", this.modify_damage);
the_turret.modifyGain("range_added", this.modify_range);
the_turret.modifyGain("rate_added", this.modify_rate);
the_turret.modifyGain("damage_mult", this.modify_damage_mult);
the_turret.modifyGain("range_mult", this.modify_range_mult);
the_turret.modifyGain("rate_mult", this.modify_rate_mult);
};
this.modifyUnAssert = function (the_turret) {
the_turret.modifyLose("damage_added", this.modify_damage);
the_turret.modifyLose("range_added", this.modify_range);
the_turret.modifyLose("rate_added", this.modify_rate);
the_turret.modifyLose("damage_mult", this.modify_damage_mult);
the_turret.modifyLose("range_mult", this.modify_range_mult);
the_turret.modifyLose("rate_mult", this.modify_rate_mult);
};
this.modifyNotifyNew = function (the_turret) {
var _local3 = the_turret._x - this._x;
var _local4 = the_turret._y - this._y;
var _local5 = Math.sqrt((_local3 * _local3) + (_local4 * _local4));
if (_local5 <= this.weapon_range) {
this.turrets_in_range.push(the_turret);
this._modifyAssert(the_turret);
}
};
this.modify_possible = false;
if (!this.upgrade_damage_level) {
this.upgrade_damage_level = 0;
}
if (!this.upgrade_range_level) {
this.upgrade_range_level = 0;
}
if (!this.upgrade_rate_level) {
this.upgrade_rate_level = 0;
}
this.max_damage = 0;
this.max_range = 0;
this.max_rate = 0;
this.max_built = false;
this.cost_damage = 0;
this.cost_range = 0;
this.cost_rate = 0;
this.cost_built = false;
this.upgrade_to_damage = 0;
this.upgrade_to_range = 0;
this.upgrade_to_rate = 0;
this.upgrade_to_built = false;
this.upgrade_pct_damage = 0;
this.upgrade_pct_range = 0;
this.upgrade_pct_rate = 0;
this.upgrade_pct_built = false;
this.upgrade_weapon_at_damage = new Array();
this._upgradeDone = function () {
this.cost_built = false;
this.upgrade_to_built = false;
this.upgrade_pct_built = false;
var _local2 = this.getMax("damage");
if (_local2 == this.weapon_damage) {
this.special_capable = true;
}
this.IndicateDamage.setPercentage(this.upgradeLevelAsPercent("damage"));
this.IndicateRange.setPercentage(this.upgradeLevelAsPercent("range"));
this.IndicateRate.setPercentage(this.upgradeLevelAsPercent("rate"));
this.modifyUpdate();
this.upgradeDone();
};
this.upgradeGetWeaponAtDamage = function (the_damage) {
if (this.upgrade_weapon_at_damage[the_damage]) {
return(this.upgrade_weapon_at_damage[the_damage]);
}
var _local8 = this.getMax("damage");
if (the_damage > _local8) {
return(this.max_bullet);
}
var _local6 = 0;
var _local4 = this.getMax("damage");
var _local5 = 0;
for (var _local7 in this.upgrade_damage) {
_local5++;
}
for (var _local7 in this.upgrade_damage) {
_local6 = _local4;
_local4 = parseInt(_local7);
if ((the_damage < _local6) && (the_damage >= _local4)) {
var _local2 = this.upgrade_bullet[_local5];
this.upgrade_weapon_at_damage[the_damage] = _local2;
return(_local2);
}
_local5--;
}
return(this.weapon_type);
};
this.getUpgrade = function (the_type) {
if (this.cost_built == false) {
this.upgrade_to_damage = this._getUpgrade("damage");
this.upgrade_to_range = this._getUpgrade("range");
this.upgrade_to_rate = this._getUpgrade("rate");
this.upgrade_to_built = true;
}
if (the_type == "damage") {
return(this.upgrade_to_damage);
}
if (the_type == "range") {
return(this.upgrade_to_range);
}
if (the_type == "rate") {
return(this.upgrade_to_rate);
}
return(false);
};
this._getUpgrade = function (the_type) {
var _local2 = new Array();
var _local3 = false;
if (the_type == "damage") {
_local2 = this.upgrade_damage;
_local3 = this.upgrade_damage_level;
} else if (the_type == "range") {
_local2 = this.upgrade_range;
_local3 = this.upgrade_range_level;
} else if (the_type == "rate") {
_local2 = this.upgrade_rate;
_local3 = this.upgrade_rate_level;
} else {
return(false);
}
var _local4 = 0;
for (var _local5 in _local2) {
_local4++;
}
if (_local3 >= _local4) {
return(false);
}
count = _local4 - 1;
for (var _local5 in _local2) {
if (count eq _local3) {
return(_local5);
}
count--;
}
return(false);
};
this.getUpgradeCost = function (the_type) {
if (this.cost_built == false) {
this.cost_damage = this._getUpgradeCost("damage");
this.cost_range = this._getUpgradeCost("range");
this.cost_rate = this._getUpgradeCost("rate");
this.cost_built = true;
}
if (the_type == "damage") {
return(this.cost_damage);
}
if (the_type == "range") {
return(this.cost_range);
}
if (the_type == "rate") {
return(this.cost_rate);
}
return(false);
};
this._getUpgradeCost = function (the_type) {
var _local2;
var _local3;
if (the_type == "damage") {
_local2 = this.upgrade_damage;
_local3 = this.upgrade_damage_level;
} else if (the_type == "range") {
_local2 = this.upgrade_range;
_local3 = this.upgrade_range_level;
} else if (the_type == "rate") {
_local2 = this.upgrade_rate;
_local3 = this.upgrade_rate_level;
} else {
return(false);
}
var _local4 = 0;
for (var _local5 in _local2) {
_local4++;
}
if (_local3 >= _local4) {
return(false);
}
count = _local4 - 1;
for (var _local5 in _local2) {
if (count eq _local3) {
return(_local2[_local5]);
}
count--;
}
return(false);
};
this.getMax = function (the_type) {
if (this.max_built == false) {
this.max_damage = this._getMax("damage");
this.max_range = this._getMax("range");
this.max_rate = this._getMax("rate");
this.max_built = true;
}
if (the_type == "damage") {
return(this.max_damage);
}
if (the_type == "range") {
return(this.max_range);
}
if (the_type == "rate") {
return(this.max_rate);
}
return(false);
};
this._getMax = function (the_type) {
var _local5;
var _local7;
if (the_type == "damage") {
_local5 = this.upgrade_damage;
_local7 = this.upgrade_damage_level;
} else if (the_type == "range") {
_local5 = this.upgrade_range;
_local7 = this.upgrade_range_level;
} else if (the_type == "rate") {
_local5 = this.upgrade_rate;
_local7 = this.upgrade_rate_level;
} else {
return(false);
}
var _local4 = new Number(0);
for (var _local6 in _local5) {
var _local3 = new Number(_local6);
var _local2 = _local3.valueOf();
if (_local2 > _local4) {
_local4 = _local2;
}
}
return(_local4);
};
this.upgradeDamage = function () {
var _local4 = this.upgrade_damage;
var _local8 = this.upgrade_damage_level;
var _local6 = _local8 + 1;
var _local5 = 0;
for (var _local7 in _local4) {
_local5++;
}
if (_local6 > _local5) {
return(false);
}
count = _local5;
for (var _local7 in _local4) {
if (count eq _local6) {
var _local3 = _local4[_local7];
if (_root.Payment(_local3)) {
this.cash_value = this.cash_value + _local3;
this.weapon_damage = _local7;
this.upgrade_damage_level++;
this._upgradeDone();
return(true);
}
return(false);
}
count--;
}
return(false);
};
this.upgradeRange = function () {
var _local4 = this.upgrade_range;
var _local8 = this.upgrade_range_level;
var _local6 = _local8 + 1;
var _local5 = 0;
for (var _local7 in _local4) {
_local5++;
}
if (_local6 > _local5) {
return(false);
}
count = _local5;
for (var _local7 in _local4) {
if (count eq _local6) {
var _local3 = _local4[_local7];
if (_root.Payment(_local3)) {
this.cash_value = this.cash_value + _local3;
this.weapon_range = _local7;
this.upgrade_range_level++;
this._upgradeDone();
return(true);
}
return(false);
}
count--;
}
return(false);
};
this.upgradeRate = function () {
var _local4 = this.upgrade_rate;
var _local8 = this.upgrade_rate_level;
var _local6 = _local8 + 1;
var _local5 = 0;
for (var _local7 in _local4) {
_local5++;
}
if (_local6 > _local5) {
return(false);
}
count = _local5;
for (var _local7 in _local4) {
if (count eq _local6) {
var _local3 = _local4[_local7];
if (_root.Payment(_local3)) {
this.cash_value = this.cash_value + _local3;
this.weapon_rate = _local7;
this.upgrade_rate_level++;
this._upgradeDone();
return(true);
}
return(false);
}
count--;
}
return(false);
};
this.upgradeLevelAsPercent = function (the_type) {
if (this.upgrade_pct_built == false) {
this.upgrade_pct_damage = this._upgradeLevelAsPercent("damage");
this.upgrade_pct_range = this._upgradeLevelAsPercent("range");
this.upgrade_pct_rate = this._upgradeLevelAsPercent("rate");
this.upgrade_pct_built = true;
}
if (the_type == "damage") {
return(this.upgrade_pct_damage);
}
if (the_type == "range") {
return(this.upgrade_pct_range);
}
if (the_type == "rate") {
return(this.upgrade_pct_rate);
}
return(false);
};
this._upgradeLevelAsPercent = function (the_type) {
var _local2;
var _local5;
if (the_type == "damage") {
_local2 = this.upgrade_damage;
_local5 = this.upgrade_damage_level;
} else if (the_type == "range") {
_local2 = this.upgrade_range;
_local5 = this.upgrade_range_level;
} else if (the_type == "rate") {
_local2 = this.upgrade_rate;
_local5 = this.upgrade_rate_level;
} else {
return(false);
}
var _local3 = 0;
for (var _local4 in _local2) {
_local3++;
}
var _local7 = Math.ceil((_local5 / _local3) * 100);
return(_local7);
};
this.upgrade_damage = new Array();
this.upgrade_range = new Array();
this.upgrade_range["130"] = 1500;
this.upgrade_rate = new Array();
this.upgradeDone = function () {
this.onSell();
this.modifyGetInRange(this.weapon_range);
this.modifyAssert();
this.modifyUpdate();
};
this.stop();
this.Weapon.stop();
if (this.active == true) {
this.Weapon.play();
this.play();
} else {
this.Weapon.stop();
}
Symbol 277 MovieClip [TurretDamageUp] Frame 4
this.stop();
this.modifyGetInRange(this.weapon_range);
this.modifyAssert();
this.play();
Symbol 277 MovieClip [TurretDamageUp] Frame 7
this.stop();
for (var i in this.notified_new) {
var turret = this.notified_new[i];
this.modifyNotifyNew(turret);
}
this.notified_new = new Array();
this.play();
Symbol 277 MovieClip [TurretDamageUp] Frame 10
this.stop();
if (this.active == true) {
this.gotoAndPlay("Scan");
} else {
this.Weapon.stop();
}
Symbol 283 MovieClip [RangerPulse] Frame 1
this.stop();
this.active = this._parent.active;
if (this.active == undefined) {
this.active = true;
}
if (this.active == true) {
this.play();
}
Symbol 283 MovieClip [RangerPulse] Frame 25
this.gotoAndPlay("Pulse");
Symbol 284 MovieClip [TurretRateUp] Frame 1
if (this.active == undefined) {
this.active = true;
}
if (this.weapon_damage == undefined) {
this.weapon_damage = 0;
}
if (this.weapon_range == undefined) {
this.weapon_range = 80;
}
if (this.weapon_rate == undefined) {
this.weapon_rate = 0;
}
if (this.cash_value == undefined) {
this.cash_value = 0;
}
if (this.modify_damage == undefined) {
this.modify_damage = 0;
}
if (this.modify_range == undefined) {
this.modify_range = 0;
}
if (this.modify_rate == undefined) {
this.modify_rate = 0;
}
if (this.modify_damage_mult == undefined) {
this.modify_damage_mult = 0;
}
if (this.modify_range_mult == undefined) {
this.modify_range_mult = 0;
}
if (this.modify_rate_mult == undefined) {
this.modify_rate_mult = 1;
}
this.notified_new = new Array();
this.notifyNew = function (the_turret) {
this.notified_new.push(the_turret);
return(true);
};
this.notifyGone = function (the_turret) {
return(true);
};
this.onSell = function () {
var _local2 = 0;
while (_local2 < this.turrets_in_range.length) {
var _local3 = this.turrets_in_range[_local2];
this.modifyUnAssert(_local3);
_local2++;
}
};
this.onPress = function () {
if (this._parent.cur_turret) {
_root.TurretHighlightHide();
}
if (this._parent.cur_turret == this) {
this._parent.cur_turret = false;
_root.TurretHighlightHide();
} else {
this._parent.cur_turret = this;
_root.TurretHighlightShow();
}
};
if (this.damage_added == undefined) {
this.damage_added = 0;
}
if (this.damage_mult == undefined) {
this.damage_mult = 1;
}
if (this.range_added == undefined) {
this.range_added = 0;
}
if (this.range_mult == undefined) {
this.range_mult = 1;
}
if (this.rate_added == undefined) {
this.rate_added = 0;
}
if (this.rate_mult == undefined) {
this.rate_mult = 1;
}
if (this.damage_effective == undefined) {
this.damage_effective = this.weapon_damage;
}
if (this.range_effective == undefined) {
this.range_effective = this.weapon_range;
}
if (this.rate_effective == undefined) {
this.rate_effective = this.weapon_rate;
}
this.turrets_in_range = new Array();
this.modify_possible = true;
this.modifyGain = function (the_type, the_amount) {
if (this.modify_possible == false) {
return(false);
}
var _local2 = parseFloat(the_amount);
if (the_type == "damage_added") {
this.damage_added = this.damage_added + _local2;
} else if (the_type == "damage_mult") {
this.damage_mult = this.damage_mult + _local2;
} else if (the_type == "range_added") {
this.range_added = this.range_added + _local2;
} else if (the_type == "range_mult") {
this.range_mult = this.range_mult + _local2;
} else if (the_type == "rate_added") {
this.rate_added = this.rate_added + _local2;
} else if (the_type == "rate_mult") {
this.rate_mult = this.rate_mult + _local2;
}
if (_local2 > 0) {
}
this.modifyUpdate();
};
this.modifyUpdate = function () {
this.damage_effective = this.modifyDamage(this.weapon_damage);
this.range_effective = this.modifyRange(this.weapon_range);
this.rate_effective = this.modifyRate(this.weapon_rate);
this.WeaponController.weapon_range = this.range_effective;
return(true);
};
this.modifyDumpStats = function () {
trace((this + ": added damage ") + this.damage_added);
trace((this + ": added range ") + this.range_added);
trace((this + ": added rate ") + this.rate_added);
trace((this + ": mult damage ") + this.damage_mult);
trace((this + ": mult range ") + this.range_mult);
trace((this + ": mult rate ") + this.rate_mult);
trace((this + ": weapon damage ") + this.weapon_damage);
trace((this + ": weapon range ") + this.weapon_range);
trace((this + ": weapon rate ") + this.weapon_rate);
trace((this + ": effective damage ") + this.damage_effective);
trace((this + ": effective range ") + this.range_effective);
trace((this + ": effective rate ") + this.rate_effective);
};
this.modifyLose = function (the_type, the_amount) {
this.modifyGain(the_type, -the_amount);
};
this.modifyDamage = function (the_amount) {
var _local3 = parseFloat(the_amount);
var _local2 = (_local3 + this.damage_added) * this.damage_mult;
_local2 = Math.max(_local2, 0);
return(_local2);
};
this.modifyRange = function (the_amount) {
var _local3 = parseFloat(the_amount);
var _local2 = (_local3 + this.range_added) * this.range_mult;
_local2 = Math.max(_local2, 0);
return(_local2);
};
this.modifyRate = function (the_amount) {
var _local3 = parseFloat(the_amount);
var _local2 = (_local3 + this.rate_added) * this.rate_mult;
_local2 = Math.max(_local2, 0);
return(_local2);
};
this.modifyGetInRange = function (the_range) {
this.turrets_in_range = new Array();
var _local9 = the_range;
var _local8 = _root.turrets;
var _local3 = 0;
while (_local3 < _local8.length) {
var _local4 = _local8[_local3];
if (point != this) {
var _local5 = _local4._x - this._x;
var _local6 = _local4._y - this._y;
var _local7 = Math.sqrt((_local5 * _local5) + (_local6 * _local6));
if (_local7 <= _local9) {
this.turrets_in_range.push(_local4);
}
}
_local3++;
}
};
this.modifyAssert = function () {
var _local2 = 0;
while (_local2 < this.turrets_in_range.length) {
var _local3 = this.turrets_in_range[_local2];
this._modifyAssert(_local3);
_local2++;
}
};
this._modifyAssert = function (the_turret) {
the_turret.modifyGain("damage_added", this.modify_damage);
the_turret.modifyGain("range_added", this.modify_range);
the_turret.modifyGain("rate_added", this.modify_rate);
the_turret.modifyGain("damage_mult", this.modify_damage_mult);
the_turret.modifyGain("range_mult", this.modify_range_mult);
the_turret.modifyGain("rate_mult", this.modify_rate_mult);
};
this.modifyUnAssert = function (the_turret) {
the_turret.modifyLose("damage_added", this.modify_damage);
the_turret.modifyLose("range_added", this.modify_range);
the_turret.modifyLose("rate_added", this.modify_rate);
the_turret.modifyLose("damage_mult", this.modify_damage_mult);
the_turret.modifyLose("range_mult", this.modify_range_mult);
the_turret.modifyLose("rate_mult", this.modify_rate_mult);
};
this.modifyNotifyNew = function (the_turret) {
var _local3 = the_turret._x - this._x;
var _local4 = the_turret._y - this._y;
var _local5 = Math.sqrt((_local3 * _local3) + (_local4 * _local4));
if (_local5 <= this.weapon_range) {
this.turrets_in_range.push(the_turret);
this._modifyAssert(the_turret);
}
};
this.modify_possible = false;
if (!this.upgrade_damage_level) {
this.upgrade_damage_level = 0;
}
if (!this.upgrade_range_level) {
this.upgrade_range_level = 0;
}
if (!this.upgrade_rate_level) {
this.upgrade_rate_level = 0;
}
this.max_damage = 0;
this.max_range = 0;
this.max_rate = 0;
this.max_built = false;
this.cost_damage = 0;
this.cost_range = 0;
this.cost_rate = 0;
this.cost_built = false;
this.upgrade_to_damage = 0;
this.upgrade_to_range = 0;
this.upgrade_to_rate = 0;
this.upgrade_to_built = false;
this.upgrade_pct_damage = 0;
this.upgrade_pct_range = 0;
this.upgrade_pct_rate = 0;
this.upgrade_pct_built = false;
this.upgrade_weapon_at_damage = new Array();
this._upgradeDone = function () {
this.cost_built = false;
this.upgrade_to_built = false;
this.upgrade_pct_built = false;
var _local2 = this.getMax("damage");
if (_local2 == this.weapon_damage) {
this.special_capable = true;
}
this.IndicateDamage.setPercentage(this.upgradeLevelAsPercent("damage"));
this.IndicateRange.setPercentage(this.upgradeLevelAsPercent("range"));
this.IndicateRate.setPercentage(this.upgradeLevelAsPercent("rate"));
this.modifyUpdate();
this.upgradeDone();
};
this.upgradeGetWeaponAtDamage = function (the_damage) {
if (this.upgrade_weapon_at_damage[the_damage]) {
return(this.upgrade_weapon_at_damage[the_damage]);
}
var _local8 = this.getMax("damage");
if (the_damage > _local8) {
return(this.max_bullet);
}
var _local6 = 0;
var _local4 = this.getMax("damage");
var _local5 = 0;
for (var _local7 in this.upgrade_damage) {
_local5++;
}
for (var _local7 in this.upgrade_damage) {
_local6 = _local4;
_local4 = parseInt(_local7);
if ((the_damage < _local6) && (the_damage >= _local4)) {
var _local2 = this.upgrade_bullet[_local5];
this.upgrade_weapon_at_damage[the_damage] = _local2;
return(_local2);
}
_local5--;
}
return(this.weapon_type);
};
this.getUpgrade = function (the_type) {
if (this.cost_built == false) {
this.upgrade_to_damage = this._getUpgrade("damage");
this.upgrade_to_range = this._getUpgrade("range");
this.upgrade_to_rate = this._getUpgrade("rate");
this.upgrade_to_built = true;
}
if (the_type == "damage") {
return(this.upgrade_to_damage);
}
if (the_type == "range") {
return(this.upgrade_to_range);
}
if (the_type == "rate") {
return(this.upgrade_to_rate);
}
return(false);
};
this._getUpgrade = function (the_type) {
var _local2 = new Array();
var _local3 = false;
if (the_type == "damage") {
_local2 = this.upgrade_damage;
_local3 = this.upgrade_damage_level;
} else if (the_type == "range") {
_local2 = this.upgrade_range;
_local3 = this.upgrade_range_level;
} else if (the_type == "rate") {
_local2 = this.upgrade_rate;
_local3 = this.upgrade_rate_level;
} else {
return(false);
}
var _local4 = 0;
for (var _local5 in _local2) {
_local4++;
}
if (_local3 >= _local4) {
return(false);
}
count = _local4 - 1;
for (var _local5 in _local2) {
if (count eq _local3) {
return(_local5);
}
count--;
}
return(false);
};
this.getUpgradeCost = function (the_type) {
if (this.cost_built == false) {
this.cost_damage = this._getUpgradeCost("damage");
this.cost_range = this._getUpgradeCost("range");
this.cost_rate = this._getUpgradeCost("rate");
this.cost_built = true;
}
if (the_type == "damage") {
return(this.cost_damage);
}
if (the_type == "range") {
return(this.cost_range);
}
if (the_type == "rate") {
return(this.cost_rate);
}
return(false);
};
this._getUpgradeCost = function (the_type) {
var _local2;
var _local3;
if (the_type == "damage") {
_local2 = this.upgrade_damage;
_local3 = this.upgrade_damage_level;
} else if (the_type == "range") {
_local2 = this.upgrade_range;
_local3 = this.upgrade_range_level;
} else if (the_type == "rate") {
_local2 = this.upgrade_rate;
_local3 = this.upgrade_rate_level;
} else {
return(false);
}
var _local4 = 0;
for (var _local5 in _local2) {
_local4++;
}
if (_local3 >= _local4) {
return(false);
}
count = _local4 - 1;
for (var _local5 in _local2) {
if (count eq _local3) {
return(_local2[_local5]);
}
count--;
}
return(false);
};
this.getMax = function (the_type) {
if (this.max_built == false) {
this.max_damage = this._getMax("damage");
this.max_range = this._getMax("range");
this.max_rate = this._getMax("rate");
this.max_built = true;
}
if (the_type == "damage") {
return(this.max_damage);
}
if (the_type == "range") {
return(this.max_range);
}
if (the_type == "rate") {
return(this.max_rate);
}
return(false);
};
this._getMax = function (the_type) {
var _local5;
var _local7;
if (the_type == "damage") {
_local5 = this.upgrade_damage;
_local7 = this.upgrade_damage_level;
} else if (the_type == "range") {
_local5 = this.upgrade_range;
_local7 = this.upgrade_range_level;
} else if (the_type == "rate") {
_local5 = this.upgrade_rate;
_local7 = this.upgrade_rate_level;
} else {
return(false);
}
var _local4 = new Number(0);
for (var _local6 in _local5) {
var _local3 = new Number(_local6);
var _local2 = _local3.valueOf();
if (_local2 > _local4) {
_local4 = _local2;
}
}
return(_local4);
};
this.upgradeDamage = function () {
var _local4 = this.upgrade_damage;
var _local8 = this.upgrade_damage_level;
var _local6 = _local8 + 1;
var _local5 = 0;
for (var _local7 in _local4) {
_local5++;
}
if (_local6 > _local5) {
return(false);
}
count = _local5;
for (var _local7 in _local4) {
if (count eq _local6) {
var _local3 = _local4[_local7];
if (_root.Payment(_local3)) {
this.cash_value = this.cash_value + _local3;
this.weapon_damage = _local7;
this.upgrade_damage_level++;
this._upgradeDone();
return(true);
}
return(false);
}
count--;
}
return(false);
};
this.upgradeRange = function () {
var _local4 = this.upgrade_range;
var _local8 = this.upgrade_range_level;
var _local6 = _local8 + 1;
var _local5 = 0;
for (var _local7 in _local4) {
_local5++;
}
if (_local6 > _local5) {
return(false);
}
count = _local5;
for (var _local7 in _local4) {
if (count eq _local6) {
var _local3 = _local4[_local7];
if (_root.Payment(_local3)) {
this.cash_value = this.cash_value + _local3;
this.weapon_range = _local7;
this.upgrade_range_level++;
this._upgradeDone();
return(true);
}
return(false);
}
count--;
}
return(false);
};
this.upgradeRate = function () {
var _local4 = this.upgrade_rate;
var _local8 = this.upgrade_rate_level;
var _local6 = _local8 + 1;
var _local5 = 0;
for (var _local7 in _local4) {
_local5++;
}
if (_local6 > _local5) {
return(false);
}
count = _local5;
for (var _local7 in _local4) {
if (count eq _local6) {
var _local3 = _local4[_local7];
if (_root.Payment(_local3)) {
this.cash_value = this.cash_value + _local3;
this.weapon_rate = _local7;
this.upgrade_rate_level++;
this._upgradeDone();
return(true);
}
return(false);
}
count--;
}
return(false);
};
this.upgradeLevelAsPercent = function (the_type) {
if (this.upgrade_pct_built == false) {
this.upgrade_pct_damage = this._upgradeLevelAsPercent("damage");
this.upgrade_pct_range = this._upgradeLevelAsPercent("range");
this.upgrade_pct_rate = this._upgradeLevelAsPercent("rate");
this.upgrade_pct_built = true;
}
if (the_type == "damage") {
return(this.upgrade_pct_damage);
}
if (the_type == "range") {
return(this.upgrade_pct_range);
}
if (the_type == "rate") {
return(this.upgrade_pct_rate);
}
return(false);
};
this._upgradeLevelAsPercent = function (the_type) {
var _local2;
var _local5;
if (the_type == "damage") {
_local2 = this.upgrade_damage;
_local5 = this.upgrade_damage_level;
} else if (the_type == "range") {
_local2 = this.upgrade_range;
_local5 = this.upgrade_range_level;
} else if (the_type == "rate") {
_local2 = this.upgrade_rate;
_local5 = this.upgrade_rate_level;
} else {
return(false);
}
var _local3 = 0;
for (var _local4 in _local2) {
_local3++;
}
var _local7 = Math.ceil((_local5 / _local3) * 100);
return(_local7);
};
this.upgrade_damage = new Array();
this.upgrade_range = new Array();
this.upgrade_range["130"] = 1500;
this.upgrade_rate = new Array();
this.upgradeDone = function () {
this.onSell();
this.modifyGetInRange(this.weapon_range);
this.modifyAssert();
this.modifyUpdate();
};
this.stop();
this.Weapon.stop();
if (this.active == true) {
this.Weapon.play();
this.play();
} else {
this.Weapon.stop();
}
Symbol 284 MovieClip [TurretRateUp] Frame 4
this.stop();
this.modifyGetInRange(this.weapon_range);
this.modifyAssert();
this.play();
Symbol 284 MovieClip [TurretRateUp] Frame 7
this.stop();
for (var i in this.notified_new) {
var turret = this.notified_new[i];
this.modifyNotifyNew(turret);
}
this.notified_new = new Array();
this.play();
Symbol 284 MovieClip [TurretRateUp] Frame 10
this.stop();
if (this.active == true) {
this.gotoAndPlay("Scan");
} else {
this.Weapon.stop();
}
Symbol 285 MovieClip [TurretRateUpExchange] Frame 1
if (this.active == undefined) {
this.active = true;
}
if (this.weapon_range == undefined) {
this.weapon_range = 80;
}
if (this.weapon_damage == undefined) {
this.weapon_damage = 0;
}
if (this.weapon_rate == undefined) {
this.weapon_rate = 0;
}
if (this.cash_value == undefined) {
this.cash_value = 0;
}
if (this.modify_range == undefined) {
this.modify_range = 0;
}
if (this.modify_damage == undefined) {
this.modify_damage = 0;
}
if (this.modify_rate == undefined) {
this.modify_rate = 0;
}
if (this.modify_damage_mult == undefined) {
this.modify_damage_mult = -0.4;
}
if (this.modify_range_mult == undefined) {
this.modify_range_mult = -0.1;
}
if (this.modify_rate_mult == undefined) {
this.modify_rate_mult = 1;
}
this.notified_new = new Array();
this.notifyNew = function (the_turret) {
this.notified_new.push(the_turret);
return(true);
};
this.notifyGone = function (the_turret) {
return(true);
};
this.onSell = function () {
var _local2 = 0;
while (_local2 < this.turrets_in_range.length) {
var _local3 = this.turrets_in_range[_local2];
this.modifyUnAssert(_local3);
_local2++;
}
};
this.onPress = function () {
if (this._parent.cur_turret) {
_root.TurretHighlightHide();
}
if (this._parent.cur_turret == this) {
this._parent.cur_turret = false;
_root.TurretHighlightHide();
} else {
this._parent.cur_turret = this;
_root.TurretHighlightShow();
}
};
if (this.damage_added == undefined) {
this.damage_added = 0;
}
if (this.damage_mult == undefined) {
this.damage_mult = 1;
}
if (this.range_added == undefined) {
this.range_added = 0;
}
if (this.range_mult == undefined) {
this.range_mult = 1;
}
if (this.rate_added == undefined) {
this.rate_added = 0;
}
if (this.rate_mult == undefined) {
this.rate_mult = 1;
}
if (this.damage_effective == undefined) {
this.damage_effective = this.weapon_damage;
}
if (this.range_effective == undefined) {
this.range_effective = this.weapon_range;
}
if (this.rate_effective == undefined) {
this.rate_effective = this.weapon_rate;
}
this.turrets_in_range = new Array();
this.modify_possible = true;
this.modifyGain = function (the_type, the_amount) {
if (this.modify_possible == false) {
return(false);
}
var _local2 = parseFloat(the_amount);
if (the_type == "damage_added") {
this.damage_added = this.damage_added + _local2;
} else if (the_type == "damage_mult") {
this.damage_mult = this.damage_mult + _local2;
} else if (the_type == "range_added") {
this.range_added = this.range_added + _local2;
} else if (the_type == "range_mult") {
this.range_mult = this.range_mult + _local2;
} else if (the_type == "rate_added") {
this.rate_added = this.rate_added + _local2;
} else if (the_type == "rate_mult") {
this.rate_mult = this.rate_mult + _local2;
}
if (_local2 > 0) {
}
this.modifyUpdate();
};
this.modifyUpdate = function () {
this.damage_effective = this.modifyDamage(this.weapon_damage);
this.range_effective = this.modifyRange(this.weapon_range);
this.rate_effective = this.modifyRate(this.weapon_rate);
this.WeaponController.weapon_range = this.range_effective;
return(true);
};
this.modifyDumpStats = function () {
trace((this + ": added damage ") + this.damage_added);
trace((this + ": added range ") + this.range_added);
trace((this + ": added rate ") + this.rate_added);
trace((this + ": mult damage ") + this.damage_mult);
trace((this + ": mult range ") + this.range_mult);
trace((this + ": mult rate ") + this.rate_mult);
trace((this + ": weapon damage ") + this.weapon_damage);
trace((this + ": weapon range ") + this.weapon_range);
trace((this + ": weapon rate ") + this.weapon_rate);
trace((this + ": effective damage ") + this.damage_effective);
trace((this + ": effective range ") + this.range_effective);
trace((this + ": effective rate ") + this.rate_effective);
};
this.modifyLose = function (the_type, the_amount) {
this.modifyGain(the_type, -the_amount);
};
this.modifyDamage = function (the_amount) {
var _local3 = parseFloat(the_amount);
var _local2 = (_local3 + this.damage_added) * this.damage_mult;
_local2 = Math.max(_local2, 0);
return(_local2);
};
this.modifyRange = function (the_amount) {
var _local3 = parseFloat(the_amount);
var _local2 = (_local3 + this.range_added) * this.range_mult;
_local2 = Math.max(_local2, 0);
return(_local2);
};
this.modifyRate = function (the_amount) {
var _local3 = parseFloat(the_amount);
var _local2 = (_local3 + this.rate_added) * this.rate_mult;
_local2 = Math.max(_local2, 0);
return(_local2);
};
this.modifyGetInRange = function (the_range) {
this.turrets_in_range = new Array();
var _local9 = the_range;
var _local8 = _root.turrets;
var _local3 = 0;
while (_local3 < _local8.length) {
var _local4 = _local8[_local3];
if (point != this) {
var _local5 = _local4._x - this._x;
var _local6 = _local4._y - this._y;
var _local7 = Math.sqrt((_local5 * _local5) + (_local6 * _local6));
if (_local7 <= _local9) {
this.turrets_in_range.push(_local4);
}
}
_local3++;
}
};
this.modifyAssert = function () {
var _local2 = 0;
while (_local2 < this.turrets_in_range.length) {
var _local3 = this.turrets_in_range[_local2];
this._modifyAssert(_local3);
_local2++;
}
};
this._modifyAssert = function (the_turret) {
the_turret.modifyGain("damage_added", this.modify_damage);
the_turret.modifyGain("range_added", this.modify_range);
the_turret.modifyGain("rate_added", this.modify_rate);
the_turret.modifyGain("damage_mult", this.modify_damage_mult);
the_turret.modifyGain("range_mult", this.modify_range_mult);
the_turret.modifyGain("rate_mult", this.modify_rate_mult);
};
this.modifyUnAssert = function (the_turret) {
the_turret.modifyLose("damage_added", this.modify_damage);
the_turret.modifyLose("range_added", this.modify_range);
the_turret.modifyLose("rate_added", this.modify_rate);
the_turret.modifyLose("damage_mult", this.modify_damage_mult);
the_turret.modifyLose("range_mult", this.modify_range_mult);
the_turret.modifyLose("rate_mult", this.modify_rate_mult);
};
this.modifyNotifyNew = function (the_turret) {
var _local3 = the_turret._x - this._x;
var _local4 = the_turret._y - this._y;
var _local5 = Math.sqrt((_local3 * _local3) + (_local4 * _local4));
if (_local5 <= this.weapon_range) {
this.turrets_in_range.push(the_turret);
this._modifyAssert(the_turret);
}
};
this.modify_possible = false;
if (!this.upgrade_damage_level) {
this.upgrade_damage_level = 0;
}
if (!this.upgrade_range_level) {
this.upgrade_range_level = 0;
}
if (!this.upgrade_rate_level) {
this.upgrade_rate_level = 0;
}
this.max_damage = 0;
this.max_range = 0;
this.max_rate = 0;
this.max_built = false;
this.cost_damage = 0;
this.cost_range = 0;
this.cost_rate = 0;
this.cost_built = false;
this.upgrade_to_damage = 0;
this.upgrade_to_range = 0;
this.upgrade_to_rate = 0;
this.upgrade_to_built = false;
this.upgrade_pct_damage = 0;
this.upgrade_pct_range = 0;
this.upgrade_pct_rate = 0;
this.upgrade_pct_built = false;
this.upgrade_weapon_at_damage = new Array();
this._upgradeDone = function () {
this.cost_built = false;
this.upgrade_to_built = false;
this.upgrade_pct_built = false;
var _local2 = this.getMax("damage");
if (_local2 == this.weapon_damage) {
this.special_capable = true;
}
this.IndicateDamage.setPercentage(this.upgradeLevelAsPercent("damage"));
this.IndicateRange.setPercentage(this.upgradeLevelAsPercent("range"));
this.IndicateRate.setPercentage(this.upgradeLevelAsPercent("rate"));
this.modifyUpdate();
this.upgradeDone();
};
this.upgradeGetWeaponAtDamage = function (the_damage) {
if (this.upgrade_weapon_at_damage[the_damage]) {
return(this.upgrade_weapon_at_damage[the_damage]);
}
var _local8 = this.getMax("damage");
if (the_damage > _local8) {
return(this.max_bullet);
}
var _local6 = 0;
var _local4 = this.getMax("damage");
var _local5 = 0;
for (var _local7 in this.upgrade_damage) {
_local5++;
}
for (var _local7 in this.upgrade_damage) {
_local6 = _local4;
_local4 = parseInt(_local7);
if ((the_damage < _local6) && (the_damage >= _local4)) {
var _local2 = this.upgrade_bullet[_local5];
this.upgrade_weapon_at_damage[the_damage] = _local2;
return(_local2);
}
_local5--;
}
return(this.weapon_type);
};
this.getUpgrade = function (the_type) {
if (this.cost_built == false) {
this.upgrade_to_damage = this._getUpgrade("damage");
this.upgrade_to_range = this._getUpgrade("range");
this.upgrade_to_rate = this._getUpgrade("rate");
this.upgrade_to_built = true;
}
if (the_type == "damage") {
return(this.upgrade_to_damage);
}
if (the_type == "range") {
return(this.upgrade_to_range);
}
if (the_type == "rate") {
return(this.upgrade_to_rate);
}
return(false);
};
this._getUpgrade = function (the_type) {
var _local2 = new Array();
var _local3 = false;
if (the_type == "damage") {
_local2 = this.upgrade_damage;
_local3 = this.upgrade_damage_level;
} else if (the_type == "range") {
_local2 = this.upgrade_range;
_local3 = this.upgrade_range_level;
} else if (the_type == "rate") {
_local2 = this.upgrade_rate;
_local3 = this.upgrade_rate_level;
} else {
return(false);
}
var _local4 = 0;
for (var _local5 in _local2) {
_local4++;
}
if (_local3 >= _local4) {
return(false);
}
count = _local4 - 1;
for (var _local5 in _local2) {
if (count eq _local3) {
return(_local5);
}
count--;
}
return(false);
};
this.getUpgradeCost = function (the_type) {
if (this.cost_built == false) {
this.cost_damage = this._getUpgradeCost("damage");
this.cost_range = this._getUpgradeCost("range");
this.cost_rate = this._getUpgradeCost("rate");
this.cost_built = true;
}
if (the_type == "damage") {
return(this.cost_damage);
}
if (the_type == "range") {
return(this.cost_range);
}
if (the_type == "rate") {
return(this.cost_rate);
}
return(false);
};
this._getUpgradeCost = function (the_type) {
var _local2;
var _local3;
if (the_type == "damage") {
_local2 = this.upgrade_damage;
_local3 = this.upgrade_damage_level;
} else if (the_type == "range") {
_local2 = this.upgrade_range;
_local3 = this.upgrade_range_level;
} else if (the_type == "rate") {
_local2 = this.upgrade_rate;
_local3 = this.upgrade_rate_level;
} else {
return(false);
}
var _local4 = 0;
for (var _local5 in _local2) {
_local4++;
}
if (_local3 >= _local4) {
return(false);
}
count = _local4 - 1;
for (var _local5 in _local2) {
if (count eq _local3) {
return(_local2[_local5]);
}
count--;
}
return(false);
};
this.getMax = function (the_type) {
if (this.max_built == false) {
this.max_damage = this._getMax("damage");
this.max_range = this._getMax("range");
this.max_rate = this._getMax("rate");
this.max_built = true;
}
if (the_type == "damage") {
return(this.max_damage);
}
if (the_type == "range") {
return(this.max_range);
}
if (the_type == "rate") {
return(this.max_rate);
}
return(false);
};
this._getMax = function (the_type) {
var _local5;
var _local7;
if (the_type == "damage") {
_local5 = this.upgrade_damage;
_local7 = this.upgrade_damage_level;
} else if (the_type == "range") {
_local5 = this.upgrade_range;
_local7 = this.upgrade_range_level;
} else if (the_type == "rate") {
_local5 = this.upgrade_rate;
_local7 = this.upgrade_rate_level;
} else {
return(false);
}
var _local4 = new Number(0);
for (var _local6 in _local5) {
var _local3 = new Number(_local6);
var _local2 = _local3.valueOf();
if (_local2 > _local4) {
_local4 = _local2;
}
}
return(_local4);
};
this.upgradeDamage = function () {
var _local4 = this.upgrade_damage;
var _local8 = this.upgrade_damage_level;
var _local6 = _local8 + 1;
var _local5 = 0;
for (var _local7 in _local4) {
_local5++;
}
if (_local6 > _local5) {
return(false);
}
count = _local5;
for (var _local7 in _local4) {
if (count eq _local6) {
var _local3 = _local4[_local7];
if (_root.Payment(_local3)) {
this.cash_value = this.cash_value + _local3;
this.weapon_damage = _local7;
this.upgrade_damage_level++;
this._upgradeDone();
return(true);
}
return(false);
}
count--;
}
return(false);
};
this.upgradeRange = function () {
var _local4 = this.upgrade_range;
var _local8 = this.upgrade_range_level;
var _local6 = _local8 + 1;
var _local5 = 0;
for (var _local7 in _local4) {
_local5++;
}
if (_local6 > _local5) {
return(false);
}
count = _local5;
for (var _local7 in _local4) {
if (count eq _local6) {
var _local3 = _local4[_local7];
if (_root.Payment(_local3)) {
this.cash_value = this.cash_value + _local3;
this.weapon_range = _local7;
this.upgrade_range_level++;
this._upgradeDone();
return(true);
}
return(false);
}
count--;
}
return(false);
};
this.upgradeRate = function () {
var _local4 = this.upgrade_rate;
var _local8 = this.upgrade_rate_level;
var _local6 = _local8 + 1;
var _local5 = 0;
for (var _local7 in _local4) {
_local5++;
}
if (_local6 > _local5) {
return(false);
}
count = _local5;
for (var _local7 in _local4) {
if (count eq _local6) {
var _local3 = _local4[_local7];
if (_root.Payment(_local3)) {
this.cash_value = this.cash_value + _local3;
this.weapon_rate = _local7;
this.upgrade_rate_level++;
this._upgradeDone();
return(true);
}
return(false);
}
count--;
}
return(false);
};
this.upgradeLevelAsPercent = function (the_type) {
if (this.upgrade_pct_built == false) {
this.upgrade_pct_damage = this._upgradeLevelAsPercent("damage");
this.upgrade_pct_range = this._upgradeLevelAsPercent("range");
this.upgrade_pct_rate = this._upgradeLevelAsPercent("rate");
this.upgrade_pct_built = true;
}
if (the_type == "damage") {
return(this.upgrade_pct_damage);
}
if (the_type == "range") {
return(this.upgrade_pct_range);
}
if (the_type == "rate") {
return(this.upgrade_pct_rate);
}
return(false);
};
this._upgradeLevelAsPercent = function (the_type) {
var _local2;
var _local5;
if (the_type == "damage") {
_local2 = this.upgrade_damage;
_local5 = this.upgrade_damage_level;
} else if (the_type == "range") {
_local2 = this.upgrade_range;
_local5 = this.upgrade_range_level;
} else if (the_type == "rate") {
_local2 = this.upgrade_rate;
_local5 = this.upgrade_rate_level;
} else {
return(false);
}
var _local3 = 0;
for (var _local4 in _local2) {
_local3++;
}
var _local7 = Math.ceil((_local5 / _local3) * 100);
return(_local7);
};
this.upgrade_damage = new Array();
this.upgrade_range = new Array();
this.upgrade_range["130"] = 1500;
this.upgrade_rate = new Array();
this.upgradeDone = function () {
this.onSell();
this.modifyGetInRange(this.weapon_range);
this.modifyAssert();
this.modifyUpdate();
};
this.stop();
this.Weapon.stop();
if (this.active == true) {
this.Weapon.play();
this.play();
} else {
this.Weapon.stop();
}
Symbol 285 MovieClip [TurretRateUpExchange] Frame 4
this.stop();
this.modifyGetInRange(this.weapon_range);
this.modifyAssert();
this.play();
Symbol 285 MovieClip [TurretRateUpExchange] Frame 7
this.stop();
for (var i in this.notified_new) {
var turret = this.notified_new[i];
this.modifyNotifyNew(turret);
}
this.notified_new = new Array();
this.play();
Symbol 285 MovieClip [TurretRateUpExchange] Frame 10
this.stop();
if (this.active == true) {
this.gotoAndPlay("Scan");
} else {
this.Weapon.stop();
}
Symbol 287 MovieClip [TurretDamageUpBig] Frame 1
if (this.active == undefined) {
this.active = true;
}
if (this.weapon_damage == undefined) {
this.weapon_damage = 0;
}
if (this.weapon_range == undefined) {
this.weapon_range = 80;
}
if (this.weapon_rate == undefined) {
this.weapon_rate = 0;
}
if (this.cash_value == undefined) {
this.cash_value = 0;
}
if (this.modify_damage == undefined) {
this.modify_damage = 0;
}
if (this.modify_range == undefined) {
this.modify_range = 0;
}
if (this.modify_rate == undefined) {
this.modify_rate = 0;
}
if (this.modify_damage_mult == undefined) {
this.modify_damage_mult = 1;
}
if (this.modify_range_mult == undefined) {
this.modify_range_mult = 0;
}
if (this.modify_rate_mult == undefined) {
this.modify_rate_mult = 0;
}
this.notified_new = new Array();
this.notifyNew = function (the_turret) {
this.notified_new.push(the_turret);
return(true);
};
this.notifyGone = function (the_turret) {
return(true);
};
this.onSell = function () {
var _local2 = 0;
while (_local2 < this.turrets_in_range.length) {
var _local3 = this.turrets_in_range[_local2];
this.modifyUnAssert(_local3);
_local2++;
}
};
this.onPress = function () {
if (this._parent.cur_turret) {
_root.TurretHighlightHide();
}
if (this._parent.cur_turret == this) {
this._parent.cur_turret = false;
_root.TurretHighlightHide();
} else {
this._parent.cur_turret = this;
_root.TurretHighlightShow();
}
};
if (this.damage_added == undefined) {
this.damage_added = 0;
}
if (this.damage_mult == undefined) {
this.damage_mult = 1;
}
if (this.range_added == undefined) {
this.range_added = 0;
}
if (this.range_mult == undefined) {
this.range_mult = 1;
}
if (this.rate_added == undefined) {
this.rate_added = 0;
}
if (this.rate_mult == undefined) {
this.rate_mult = 1;
}
if (this.damage_effective == undefined) {
this.damage_effective = this.weapon_damage;
}
if (this.range_effective == undefined) {
this.range_effective = this.weapon_range;
}
if (this.rate_effective == undefined) {
this.rate_effective = this.weapon_rate;
}
this.turrets_in_range = new Array();
this.modify_possible = true;
this.modifyGain = function (the_type, the_amount) {
if (this.modify_possible == false) {
return(false);
}
var _local2 = parseFloat(the_amount);
if (the_type == "damage_added") {
this.damage_added = this.damage_added + _local2;
} else if (the_type == "damage_mult") {
this.damage_mult = this.damage_mult + _local2;
} else if (the_type == "range_added") {
this.range_added = this.range_added + _local2;
} else if (the_type == "range_mult") {
this.range_mult = this.range_mult + _local2;
} else if (the_type == "rate_added") {
this.rate_added = this.rate_added + _local2;
} else if (the_type == "rate_mult") {
this.rate_mult = this.rate_mult + _local2;
}
if (_local2 > 0) {
}
this.modifyUpdate();
};
this.modifyUpdate = function () {
this.damage_effective = this.modifyDamage(this.weapon_damage);
this.range_effective = this.modifyRange(this.weapon_range);
this.rate_effective = this.modifyRate(this.weapon_rate);
this.WeaponController.weapon_range = this.range_effective;
return(true);
};
this.modifyDumpStats = function () {
trace((this + ": added damage ") + this.damage_added);
trace((this + ": added range ") + this.range_added);
trace((this + ": added rate ") + this.rate_added);
trace((this + ": mult damage ") + this.damage_mult);
trace((this + ": mult range ") + this.range_mult);
trace((this + ": mult rate ") + this.rate_mult);
trace((this + ": weapon damage ") + this.weapon_damage);
trace((this + ": weapon range ") + this.weapon_range);
trace((this + ": weapon rate ") + this.weapon_rate);
trace((this + ": effective damage ") + this.damage_effective);
trace((this + ": effective range ") + this.range_effective);
trace((this + ": effective rate ") + this.rate_effective);
};
this.modifyLose = function (the_type, the_amount) {
this.modifyGain(the_type, -the_amount);
};
this.modifyDamage = function (the_amount) {
var _local3 = parseFloat(the_amount);
var _local2 = (_local3 + this.damage_added) * this.damage_mult;
_local2 = Math.max(_local2, 0);
return(_local2);
};
this.modifyRange = function (the_amount) {
var _local3 = parseFloat(the_amount);
var _local2 = (_local3 + this.range_added) * this.range_mult;
_local2 = Math.max(_local2, 0);
return(_local2);
};
this.modifyRate = function (the_amount) {
var _local3 = parseFloat(the_amount);
var _local2 = (_local3 + this.rate_added) * this.rate_mult;
_local2 = Math.max(_local2, 0);
return(_local2);
};
this.modifyGetInRange = function (the_range) {
this.turrets_in_range = new Array();
var _local9 = the_range;
var _local8 = _root.turrets;
var _local3 = 0;
while (_local3 < _local8.length) {
var _local4 = _local8[_local3];
if (point != this) {
var _local5 = _local4._x - this._x;
var _local6 = _local4._y - this._y;
var _local7 = Math.sqrt((_local5 * _local5) + (_local6 * _local6));
if (_local7 <= _local9) {
this.turrets_in_range.push(_local4);
}
}
_local3++;
}
};
this.modifyAssert = function () {
var _local2 = 0;
while (_local2 < this.turrets_in_range.length) {
var _local3 = this.turrets_in_range[_local2];
this._modifyAssert(_local3);
_local2++;
}
};
this._modifyAssert = function (the_turret) {
the_turret.modifyGain("damage_added", this.modify_damage);
the_turret.modifyGain("range_added", this.modify_range);
the_turret.modifyGain("rate_added", this.modify_rate);
the_turret.modifyGain("damage_mult", this.modify_damage_mult);
the_turret.modifyGain("range_mult", this.modify_range_mult);
the_turret.modifyGain("rate_mult", this.modify_rate_mult);
};
this.modifyUnAssert = function (the_turret) {
the_turret.modifyLose("damage_added", this.modify_damage);
the_turret.modifyLose("range_added", this.modify_range);
the_turret.modifyLose("rate_added", this.modify_rate);
the_turret.modifyLose("damage_mult", this.modify_damage_mult);
the_turret.modifyLose("range_mult", this.modify_range_mult);
the_turret.modifyLose("rate_mult", this.modify_rate_mult);
};
this.modifyNotifyNew = function (the_turret) {
var _local3 = the_turret._x - this._x;
var _local4 = the_turret._y - this._y;
var _local5 = Math.sqrt((_local3 * _local3) + (_local4 * _local4));
if (_local5 <= this.weapon_range) {
this.turrets_in_range.push(the_turret);
this._modifyAssert(the_turret);
}
};
this.modify_possible = false;
if (!this.upgrade_damage_level) {
this.upgrade_damage_level = 0;
}
if (!this.upgrade_range_level) {
this.upgrade_range_level = 0;
}
if (!this.upgrade_rate_level) {
this.upgrade_rate_level = 0;
}
this.max_damage = 0;
this.max_range = 0;
this.max_rate = 0;
this.max_built = false;
this.cost_damage = 0;
this.cost_range = 0;
this.cost_rate = 0;
this.cost_built = false;
this.upgrade_to_damage = 0;
this.upgrade_to_range = 0;
this.upgrade_to_rate = 0;
this.upgrade_to_built = false;
this.upgrade_pct_damage = 0;
this.upgrade_pct_range = 0;
this.upgrade_pct_rate = 0;
this.upgrade_pct_built = false;
this.upgrade_weapon_at_damage = new Array();
this._upgradeDone = function () {
this.cost_built = false;
this.upgrade_to_built = false;
this.upgrade_pct_built = false;
var _local2 = this.getMax("damage");
if (_local2 == this.weapon_damage) {
this.special_capable = true;
}
this.IndicateDamage.setPercentage(this.upgradeLevelAsPercent("damage"));
this.IndicateRange.setPercentage(this.upgradeLevelAsPercent("range"));
this.IndicateRate.setPercentage(this.upgradeLevelAsPercent("rate"));
this.modifyUpdate();
this.upgradeDone();
};
this.upgradeGetWeaponAtDamage = function (the_damage) {
if (this.upgrade_weapon_at_damage[the_damage]) {
return(this.upgrade_weapon_at_damage[the_damage]);
}
var _local8 = this.getMax("damage");
if (the_damage > _local8) {
return(this.max_bullet);
}
var _local6 = 0;
var _local4 = this.getMax("damage");
var _local5 = 0;
for (var _local7 in this.upgrade_damage) {
_local5++;
}
for (var _local7 in this.upgrade_damage) {
_local6 = _local4;
_local4 = parseInt(_local7);
if ((the_damage < _local6) && (the_damage >= _local4)) {
var _local2 = this.upgrade_bullet[_local5];
this.upgrade_weapon_at_damage[the_damage] = _local2;
return(_local2);
}
_local5--;
}
return(this.weapon_type);
};
this.getUpgrade = function (the_type) {
if (this.cost_built == false) {
this.upgrade_to_damage = this._getUpgrade("damage");
this.upgrade_to_range = this._getUpgrade("range");
this.upgrade_to_rate = this._getUpgrade("rate");
this.upgrade_to_built = true;
}
if (the_type == "damage") {
return(this.upgrade_to_damage);
}
if (the_type == "range") {
return(this.upgrade_to_range);
}
if (the_type == "rate") {
return(this.upgrade_to_rate);
}
return(false);
};
this._getUpgrade = function (the_type) {
var _local2 = new Array();
var _local3 = false;
if (the_type == "damage") {
_local2 = this.upgrade_damage;
_local3 = this.upgrade_damage_level;
} else if (the_type == "range") {
_local2 = this.upgrade_range;
_local3 = this.upgrade_range_level;
} else if (the_type == "rate") {
_local2 = this.upgrade_rate;
_local3 = this.upgrade_rate_level;
} else {
return(false);
}
var _local4 = 0;
for (var _local5 in _local2) {
_local4++;
}
if (_local3 >= _local4) {
return(false);
}
count = _local4 - 1;
for (var _local5 in _local2) {
if (count eq _local3) {
return(_local5);
}
count--;
}
return(false);
};
this.getUpgradeCost = function (the_type) {
if (this.cost_built == false) {
this.cost_damage = this._getUpgradeCost("damage");
this.cost_range = this._getUpgradeCost("range");
this.cost_rate = this._getUpgradeCost("rate");
this.cost_built = true;
}
if (the_type == "damage") {
return(this.cost_damage);
}
if (the_type == "range") {
return(this.cost_range);
}
if (the_type == "rate") {
return(this.cost_rate);
}
return(false);
};
this._getUpgradeCost = function (the_type) {
var _local2;
var _local3;
if (the_type == "damage") {
_local2 = this.upgrade_damage;
_local3 = this.upgrade_damage_level;
} else if (the_type == "range") {
_local2 = this.upgrade_range;
_local3 = this.upgrade_range_level;
} else if (the_type == "rate") {
_local2 = this.upgrade_rate;
_local3 = this.upgrade_rate_level;
} else {
return(false);
}
var _local4 = 0;
for (var _local5 in _local2) {
_local4++;
}
if (_local3 >= _local4) {
return(false);
}
count = _local4 - 1;
for (var _local5 in _local2) {
if (count eq _local3) {
return(_local2[_local5]);
}
count--;
}
return(false);
};
this.getMax = function (the_type) {
if (this.max_built == false) {
this.max_damage = this._getMax("damage");
this.max_range = this._getMax("range");
this.max_rate = this._getMax("rate");
this.max_built = true;
}
if (the_type == "damage") {
return(this.max_damage);
}
if (the_type == "range") {
return(this.max_range);
}
if (the_type == "rate") {
return(this.max_rate);
}
return(false);
};
this._getMax = function (the_type) {
var _local5;
var _local7;
if (the_type == "damage") {
_local5 = this.upgrade_damage;
_local7 = this.upgrade_damage_level;
} else if (the_type == "range") {
_local5 = this.upgrade_range;
_local7 = this.upgrade_range_level;
} else if (the_type == "rate") {
_local5 = this.upgrade_rate;
_local7 = this.upgrade_rate_level;
} else {
return(false);
}
var _local4 = new Number(0);
for (var _local6 in _local5) {
var _local3 = new Number(_local6);
var _local2 = _local3.valueOf();
if (_local2 > _local4) {
_local4 = _local2;
}
}
return(_local4);
};
this.upgradeDamage = function () {
var _local4 = this.upgrade_damage;
var _local8 = this.upgrade_damage_level;
var _local6 = _local8 + 1;
var _local5 = 0;
for (var _local7 in _local4) {
_local5++;
}
if (_local6 > _local5) {
return(false);
}
count = _local5;
for (var _local7 in _local4) {
if (count eq _local6) {
var _local3 = _local4[_local7];
if (_root.Payment(_local3)) {
this.cash_value = this.cash_value + _local3;
this.weapon_damage = _local7;
this.upgrade_damage_level++;
this._upgradeDone();
return(true);
}
return(false);
}
count--;
}
return(false);
};
this.upgradeRange = function () {
var _local4 = this.upgrade_range;
var _local8 = this.upgrade_range_level;
var _local6 = _local8 + 1;
var _local5 = 0;
for (var _local7 in _local4) {
_local5++;
}
if (_local6 > _local5) {
return(false);
}
count = _local5;
for (var _local7 in _local4) {
if (count eq _local6) {
var _local3 = _local4[_local7];
if (_root.Payment(_local3)) {
this.cash_value = this.cash_value + _local3;
this.weapon_range = _local7;
this.upgrade_range_level++;
this._upgradeDone();
return(true);
}
return(false);
}
count--;
}
return(false);
};
this.upgradeRate = function () {
var _local4 = this.upgrade_rate;
var _local8 = this.upgrade_rate_level;
var _local6 = _local8 + 1;
var _local5 = 0;
for (var _local7 in _local4) {
_local5++;
}
if (_local6 > _local5) {
return(false);
}
count = _local5;
for (var _local7 in _local4) {
if (count eq _local6) {
var _local3 = _local4[_local7];
if (_root.Payment(_local3)) {
this.cash_value = this.cash_value + _local3;
this.weapon_rate = _local7;
this.upgrade_rate_level++;
this._upgradeDone();
return(true);
}
return(false);
}
count--;
}
return(false);
};
this.upgradeLevelAsPercent = function (the_type) {
if (this.upgrade_pct_built == false) {
this.upgrade_pct_damage = this._upgradeLevelAsPercent("damage");
this.upgrade_pct_range = this._upgradeLevelAsPercent("range");
this.upgrade_pct_rate = this._upgradeLevelAsPercent("rate");
this.upgrade_pct_built = true;
}
if (the_type == "damage") {
return(this.upgrade_pct_damage);
}
if (the_type == "range") {
return(this.upgrade_pct_range);
}
if (the_type == "rate") {
return(this.upgrade_pct_rate);
}
return(false);
};
this._upgradeLevelAsPercent = function (the_type) {
var _local2;
var _local5;
if (the_type == "damage") {
_local2 = this.upgrade_damage;
_local5 = this.upgrade_damage_level;
} else if (the_type == "range") {
_local2 = this.upgrade_range;
_local5 = this.upgrade_range_level;
} else if (the_type == "rate") {
_local2 = this.upgrade_rate;
_local5 = this.upgrade_rate_level;
} else {
return(false);
}
var _local3 = 0;
for (var _local4 in _local2) {
_local3++;
}
var _local7 = Math.ceil((_local5 / _local3) * 100);
return(_local7);
};
this.upgrade_damage = new Array();
this.upgrade_range = new Array();
this.upgrade_range["130"] = 1500;
this.upgrade_rate = new Array();
this.upgradeDone = function () {
this.onSell();
this.modifyGetInRange(this.weapon_range);
this.modifyAssert();
this.modifyUpdate();
};
this.stop();
this.Weapon.stop();
if (this.active == true) {
this.Weapon.play();
this.play();
} else {
this.Weapon.stop();
}
Symbol 287 MovieClip [TurretDamageUpBig] Frame 4
this.stop();
this.modifyGetInRange(this.weapon_range);
this.modifyAssert();
this.play();
Symbol 287 MovieClip [TurretDamageUpBig] Frame 7
this.stop();
for (var i in this.notified_new) {
var turret = this.notified_new[i];
this.modifyNotifyNew(turret);
}
this.notified_new = new Array();
this.play();
Symbol 287 MovieClip [TurretDamageUpBig] Frame 10
this.stop();
if (this.active == true) {
this.gotoAndPlay("Scan");
} else {
this.Weapon.stop();
}
Symbol 288 MovieClip [TurretDamageUpBigExchange] Frame 1
if (this.active == undefined) {
this.active = true;
}
if (this.weapon_range == undefined) {
this.weapon_range = 80;
}
if (this.weapon_damage == undefined) {
this.weapon_damage = 0;
}
if (this.weapon_rate == undefined) {
this.weapon_rate = 0;
}
if (this.cash_value == undefined) {
this.cash_value = 0;
}
if (this.modify_damage == undefined) {
this.modify_damage = 0;
}
if (this.modify_range == undefined) {
this.modify_range = 0;
}
if (this.modify_rate == undefined) {
this.modify_rate = 0;
}
if (this.modify_damage_mult == undefined) {
this.modify_damage_mult = 1;
}
if (this.modify_range_mult == undefined) {
this.modify_range_mult = -0.3;
}
if (this.modify_rate_mult == undefined) {
this.modify_rate_mult = -0.3;
}
this.notified_new = new Array();
this.notifyNew = function (the_turret) {
this.notified_new.push(the_turret);
return(true);
};
this.notifyGone = function (the_turret) {
return(true);
};
this.onSell = function () {
var _local2 = 0;
while (_local2 < this.turrets_in_range.length) {
var _local3 = this.turrets_in_range[_local2];
this.modifyUnAssert(_local3);
_local2++;
}
};
this.onPress = function () {
if (this._parent.cur_turret) {
_root.TurretHighlightHide();
}
if (this._parent.cur_turret == this) {
this._parent.cur_turret = false;
_root.TurretHighlightHide();
} else {
this._parent.cur_turret = this;
_root.TurretHighlightShow();
}
};
if (this.damage_added == undefined) {
this.damage_added = 0;
}
if (this.damage_mult == undefined) {
this.damage_mult = 1;
}
if (this.range_added == undefined) {
this.range_added = 0;
}
if (this.range_mult == undefined) {
this.range_mult = 1;
}
if (this.rate_added == undefined) {
this.rate_added = 0;
}
if (this.rate_mult == undefined) {
this.rate_mult = 1;
}
if (this.damage_effective == undefined) {
this.damage_effective = this.weapon_damage;
}
if (this.range_effective == undefined) {
this.range_effective = this.weapon_range;
}
if (this.rate_effective == undefined) {
this.rate_effective = this.weapon_rate;
}
this.turrets_in_range = new Array();
this.modify_possible = true;
this.modifyGain = function (the_type, the_amount) {
if (this.modify_possible == false) {
return(false);
}
var _local2 = parseFloat(the_amount);
if (the_type == "damage_added") {
this.damage_added = this.damage_added + _local2;
} else if (the_type == "damage_mult") {
this.damage_mult = this.damage_mult + _local2;
} else if (the_type == "range_added") {
this.range_added = this.range_added + _local2;
} else if (the_type == "range_mult") {
this.range_mult = this.range_mult + _local2;
} else if (the_type == "rate_added") {
this.rate_added = this.rate_added + _local2;
} else if (the_type == "rate_mult") {
this.rate_mult = this.rate_mult + _local2;
}
if (_local2 > 0) {
}
this.modifyUpdate();
};
this.modifyUpdate = function () {
this.damage_effective = this.modifyDamage(this.weapon_damage);
this.range_effective = this.modifyRange(this.weapon_range);
this.rate_effective = this.modifyRate(this.weapon_rate);
this.WeaponController.weapon_range = this.range_effective;
return(true);
};
this.modifyDumpStats = function () {
trace((this + ": added damage ") + this.damage_added);
trace((this + ": added range ") + this.range_added);
trace((this + ": added rate ") + this.rate_added);
trace((this + ": mult damage ") + this.damage_mult);
trace((this + ": mult range ") + this.range_mult);
trace((this + ": mult rate ") + this.rate_mult);
trace((this + ": weapon damage ") + this.weapon_damage);
trace((this + ": weapon range ") + this.weapon_range);
trace((this + ": weapon rate ") + this.weapon_rate);
trace((this + ": effective damage ") + this.damage_effective);
trace((this + ": effective range ") + this.range_effective);
trace((this + ": effective rate ") + this.rate_effective);
};
this.modifyLose = function (the_type, the_amount) {
this.modifyGain(the_type, -the_amount);
};
this.modifyDamage = function (the_amount) {
var _local3 = parseFloat(the_amount);
var _local2 = (_local3 + this.damage_added) * this.damage_mult;
_local2 = Math.max(_local2, 0);
return(_local2);
};
this.modifyRange = function (the_amount) {
var _local3 = parseFloat(the_amount);
var _local2 = (_local3 + this.range_added) * this.range_mult;
_local2 = Math.max(_local2, 0);
return(_local2);
};
this.modifyRate = function (the_amount) {
var _local3 = parseFloat(the_amount);
var _local2 = (_local3 + this.rate_added) * this.rate_mult;
_local2 = Math.max(_local2, 0);
return(_local2);
};
this.modifyGetInRange = function (the_range) {
this.turrets_in_range = new Array();
var _local9 = the_range;
var _local8 = _root.turrets;
var _local3 = 0;
while (_local3 < _local8.length) {
var _local4 = _local8[_local3];
if (point != this) {
var _local5 = _local4._x - this._x;
var _local6 = _local4._y - this._y;
var _local7 = Math.sqrt((_local5 * _local5) + (_local6 * _local6));
if (_local7 <= _local9) {
this.turrets_in_range.push(_local4);
}
}
_local3++;
}
};
this.modifyAssert = function () {
var _local2 = 0;
while (_local2 < this.turrets_in_range.length) {
var _local3 = this.turrets_in_range[_local2];
this._modifyAssert(_local3);
_local2++;
}
};
this._modifyAssert = function (the_turret) {
the_turret.modifyGain("damage_added", this.modify_damage);
the_turret.modifyGain("range_added", this.modify_range);
the_turret.modifyGain("rate_added", this.modify_rate);
the_turret.modifyGain("damage_mult", this.modify_damage_mult);
the_turret.modifyGain("range_mult", this.modify_range_mult);
the_turret.modifyGain("rate_mult", this.modify_rate_mult);
};
this.modifyUnAssert = function (the_turret) {
the_turret.modifyLose("damage_added", this.modify_damage);
the_turret.modifyLose("range_added", this.modify_range);
the_turret.modifyLose("rate_added", this.modify_rate);
the_turret.modifyLose("damage_mult", this.modify_damage_mult);
the_turret.modifyLose("range_mult", this.modify_range_mult);
the_turret.modifyLose("rate_mult", this.modify_rate_mult);
};
this.modifyNotifyNew = function (the_turret) {
var _local3 = the_turret._x - this._x;
var _local4 = the_turret._y - this._y;
var _local5 = Math.sqrt((_local3 * _local3) + (_local4 * _local4));
if (_local5 <= this.weapon_range) {
this.turrets_in_range.push(the_turret);
this._modifyAssert(the_turret);
}
};
this.modify_possible = false;
if (!this.upgrade_damage_level) {
this.upgrade_damage_level = 0;
}
if (!this.upgrade_range_level) {
this.upgrade_range_level = 0;
}
if (!this.upgrade_rate_level) {
this.upgrade_rate_level = 0;
}
this.max_damage = 0;
this.max_range = 0;
this.max_rate = 0;
this.max_built = false;
this.cost_damage = 0;
this.cost_range = 0;
this.cost_rate = 0;
this.cost_built = false;
this.upgrade_to_damage = 0;
this.upgrade_to_range = 0;
this.upgrade_to_rate = 0;
this.upgrade_to_built = false;
this.upgrade_pct_damage = 0;
this.upgrade_pct_range = 0;
this.upgrade_pct_rate = 0;
this.upgrade_pct_built = false;
this.upgrade_weapon_at_damage = new Array();
this._upgradeDone = function () {
this.cost_built = false;
this.upgrade_to_built = false;
this.upgrade_pct_built = false;
var _local2 = this.getMax("damage");
if (_local2 == this.weapon_damage) {
this.special_capable = true;
}
this.IndicateDamage.setPercentage(this.upgradeLevelAsPercent("damage"));
this.IndicateRange.setPercentage(this.upgradeLevelAsPercent("range"));
this.IndicateRate.setPercentage(this.upgradeLevelAsPercent("rate"));
this.modifyUpdate();
this.upgradeDone();
};
this.upgradeGetWeaponAtDamage = function (the_damage) {
if (this.upgrade_weapon_at_damage[the_damage]) {
return(this.upgrade_weapon_at_damage[the_damage]);
}
var _local8 = this.getMax("damage");
if (the_damage > _local8) {
return(this.max_bullet);
}
var _local6 = 0;
var _local4 = this.getMax("damage");
var _local5 = 0;
for (var _local7 in this.upgrade_damage) {
_local5++;
}
for (var _local7 in this.upgrade_damage) {
_local6 = _local4;
_local4 = parseInt(_local7);
if ((the_damage < _local6) && (the_damage >= _local4)) {
var _local2 = this.upgrade_bullet[_local5];
this.upgrade_weapon_at_damage[the_damage] = _local2;
return(_local2);
}
_local5--;
}
return(this.weapon_type);
};
this.getUpgrade = function (the_type) {
if (this.cost_built == false) {
this.upgrade_to_damage = this._getUpgrade("damage");
this.upgrade_to_range = this._getUpgrade("range");
this.upgrade_to_rate = this._getUpgrade("rate");
this.upgrade_to_built = true;
}
if (the_type == "damage") {
return(this.upgrade_to_damage);
}
if (the_type == "range") {
return(this.upgrade_to_range);
}
if (the_type == "rate") {
return(this.upgrade_to_rate);
}
return(false);
};
this._getUpgrade = function (the_type) {
var _local2 = new Array();
var _local3 = false;
if (the_type == "damage") {
_local2 = this.upgrade_damage;
_local3 = this.upgrade_damage_level;
} else if (the_type == "range") {
_local2 = this.upgrade_range;
_local3 = this.upgrade_range_level;
} else if (the_type == "rate") {
_local2 = this.upgrade_rate;
_local3 = this.upgrade_rate_level;
} else {
return(false);
}
var _local4 = 0;
for (var _local5 in _local2) {
_local4++;
}
if (_local3 >= _local4) {
return(false);
}
count = _local4 - 1;
for (var _local5 in _local2) {
if (count eq _local3) {
return(_local5);
}
count--;
}
return(false);
};
this.getUpgradeCost = function (the_type) {
if (this.cost_built == false) {
this.cost_damage = this._getUpgradeCost("damage");
this.cost_range = this._getUpgradeCost("range");
this.cost_rate = this._getUpgradeCost("rate");
this.cost_built = true;
}
if (the_type == "damage") {
return(this.cost_damage);
}
if (the_type == "range") {
return(this.cost_range);
}
if (the_type == "rate") {
return(this.cost_rate);
}
return(false);
};
this._getUpgradeCost = function (the_type) {
var _local2;
var _local3;
if (the_type == "damage") {
_local2 = this.upgrade_damage;
_local3 = this.upgrade_damage_level;
} else if (the_type == "range") {
_local2 = this.upgrade_range;
_local3 = this.upgrade_range_level;
} else if (the_type == "rate") {
_local2 = this.upgrade_rate;
_local3 = this.upgrade_rate_level;
} else {
return(false);
}
var _local4 = 0;
for (var _local5 in _local2) {
_local4++;
}
if (_local3 >= _local4) {
return(false);
}
count = _local4 - 1;
for (var _local5 in _local2) {
if (count eq _local3) {
return(_local2[_local5]);
}
count--;
}
return(false);
};
this.getMax = function (the_type) {
if (this.max_built == false) {
this.max_damage = this._getMax("damage");
this.max_range = this._getMax("range");
this.max_rate = this._getMax("rate");
this.max_built = true;
}
if (the_type == "damage") {
return(this.max_damage);
}
if (the_type == "range") {
return(this.max_range);
}
if (the_type == "rate") {
return(this.max_rate);
}
return(false);
};
this._getMax = function (the_type) {
var _local5;
var _local7;
if (the_type == "damage") {
_local5 = this.upgrade_damage;
_local7 = this.upgrade_damage_level;
} else if (the_type == "range") {
_local5 = this.upgrade_range;
_local7 = this.upgrade_range_level;
} else if (the_type == "rate") {
_local5 = this.upgrade_rate;
_local7 = this.upgrade_rate_level;
} else {
return(false);
}
var _local4 = new Number(0);
for (var _local6 in _local5) {
var _local3 = new Number(_local6);
var _local2 = _local3.valueOf();
if (_local2 > _local4) {
_local4 = _local2;
}
}
return(_local4);
};
this.upgradeDamage = function () {
var _local4 = this.upgrade_damage;
var _local8 = this.upgrade_damage_level;
var _local6 = _local8 + 1;
var _local5 = 0;
for (var _local7 in _local4) {
_local5++;
}
if (_local6 > _local5) {
return(false);
}
count = _local5;
for (var _local7 in _local4) {
if (count eq _local6) {
var _local3 = _local4[_local7];
if (_root.Payment(_local3)) {
this.cash_value = this.cash_value + _local3;
this.weapon_damage = _local7;
this.upgrade_damage_level++;
this._upgradeDone();
return(true);
}
return(false);
}
count--;
}
return(false);
};
this.upgradeRange = function () {
var _local4 = this.upgrade_range;
var _local8 = this.upgrade_range_level;
var _local6 = _local8 + 1;
var _local5 = 0;
for (var _local7 in _local4) {
_local5++;
}
if (_local6 > _local5) {
return(false);
}
count = _local5;
for (var _local7 in _local4) {
if (count eq _local6) {
var _local3 = _local4[_local7];
if (_root.Payment(_local3)) {
this.cash_value = this.cash_value + _local3;
this.weapon_range = _local7;
this.upgrade_range_level++;
this._upgradeDone();
return(true);
}
return(false);
}
count--;
}
return(false);
};
this.upgradeRate = function () {
var _local4 = this.upgrade_rate;
var _local8 = this.upgrade_rate_level;
var _local6 = _local8 + 1;
var _local5 = 0;
for (var _local7 in _local4) {
_local5++;
}
if (_local6 > _local5) {
return(false);
}
count = _local5;
for (var _local7 in _local4) {
if (count eq _local6) {
var _local3 = _local4[_local7];
if (_root.Payment(_local3)) {
this.cash_value = this.cash_value + _local3;
this.weapon_rate = _local7;
this.upgrade_rate_level++;
this._upgradeDone();
return(true);
}
return(false);
}
count--;
}
return(false);
};
this.upgradeLevelAsPercent = function (the_type) {
if (this.upgrade_pct_built == false) {
this.upgrade_pct_damage = this._upgradeLevelAsPercent("damage");
this.upgrade_pct_range = this._upgradeLevelAsPercent("range");
this.upgrade_pct_rate = this._upgradeLevelAsPercent("rate");
this.upgrade_pct_built = true;
}
if (the_type == "damage") {
return(this.upgrade_pct_damage);
}
if (the_type == "range") {
return(this.upgrade_pct_range);
}
if (the_type == "rate") {
return(this.upgrade_pct_rate);
}
return(false);
};
this._upgradeLevelAsPercent = function (the_type) {
var _local2;
var _local5;
if (the_type == "damage") {
_local2 = this.upgrade_damage;
_local5 = this.upgrade_damage_level;
} else if (the_type == "range") {
_local2 = this.upgrade_range;
_local5 = this.upgrade_range_level;
} else if (the_type == "rate") {
_local2 = this.upgrade_rate;
_local5 = this.upgrade_rate_level;
} else {
return(false);
}
var _local3 = 0;
for (var _local4 in _local2) {
_local3++;
}
var _local7 = Math.ceil((_local5 / _local3) * 100);
return(_local7);
};
this.upgrade_damage = new Array();
this.upgrade_range = new Array();
this.upgrade_range["130"] = 1500;
this.upgrade_rate = new Array();
this.upgradeDone = function () {
this.onSell();
this.modifyGetInRange(this.weapon_range);
this.modifyAssert();
this.modifyUpdate();
};
this.stop();
this.Weapon.stop();
if (this.active == true) {
this.Weapon.play();
this.play();
} else {
this.Weapon.stop();
}
Symbol 288 MovieClip [TurretDamageUpBigExchange] Frame 4
this.stop();
this.modifyGetInRange(this.weapon_range);
this.modifyAssert();
this.play();
Symbol 288 MovieClip [TurretDamageUpBigExchange] Frame 7
this.stop();
for (var i in this.notified_new) {
var turret = this.notified_new[i];
this.modifyNotifyNew(turret);
}
this.notified_new = new Array();
this.play();
Symbol 288 MovieClip [TurretDamageUpBigExchange] Frame 10
this.stop();
if (this.active == true) {
this.gotoAndPlay("Scan");
} else {
this.Weapon.stop();
}
Symbol 293 MovieClip [AttackerEngine] Frame 1
this.stop();
this.waypoint_total = this._parent.waypoint_total;
this.active = this._parent.active;
this.energy_start = this._parent.energy_start;
this.move_speed = this._parent.move_speed;
if (this.waypoint_total == undefined) {
this.waypoint_total = 12;
}
if (this.active == undefined) {
this.active = true;
}
if (this.energy_start == undefined) {
this.energy_start = 3;
}
if (this.move_speed == undefined) {
this.move_speed = 60;
}
this.energy = this.energy_start;
this.health = Math.floor((this.energy / this.energy_start) * 100);
this._parent.health = this.health;
this._parent.energy = this.energy;
this.waypoint_cur = 1;
this.snap_dist = 2;
this.time_last = false;
this.the_obj = this._parent;
this.repoint = false;
this.engineHit = function (damage) {
if (this.active != true) {
return(false);
}
this.energy = this.energy - damage;
this.health = Math.ceil((this.energy / this.energy_start) * 100);
this._parent.health = this.health;
this._parent.energy = this.energy;
if (this.energy <= 0) {
this.engineDead();
}
};
this.engineDead = function () {
if (this.active != true) {
return(false);
}
_root.KilledAttacker(this.the_obj);
this.engineRemove();
};
this.engineAttack = function () {
this.time_last = new Date();
this.gotoAndPlay("Setup");
};
this.engineRemove = function () {
this._parent.removeMovieClip();
};
this._parent.hit = function (the_damage) {
this.AttackerEngine.engineHit(the_damage);
};
this._parent.attack = function () {
this.AttackerEngine.engineAttack();
};
this._parent.dead = function () {
this.AttackerEngine.engineDead();
};
this._parent.setMoveSpeed = function (new_speed) {
this.AttackerEngine.move_speed = new_speed;
this.move_speed = new_speed;
};
if (this.active == true) {
this.engineAttack();
}
Symbol 293 MovieClip [AttackerEngine] Frame 3
this.stop();
if (this._parent.point_body == false) {
this.point_body = false;
} else {
this.point_body = true;
}
this.repoint = this.point_body;
this.gotoAndPlay("Attack");
Symbol 293 MovieClip [AttackerEngine] Frame 5
this.stop();
this.active = this._parent.active;
if (this.active != true) {
this.gotoAndPlay("Stopped");
}
var wp_next = Number(this.waypoint_cur + 1);
if (wp_next > this.waypoint_total) {
this.gotoAndStop("Hit");
} else {
var wp_name = ("Waypoint" + wp_next);
wp_next = _root[wp_name];
var move_angle = _root.degreesToTarget(this.the_obj, wp_next);
if (this.repoint == true) {
this.repoint = false;
this.the_obj.Body._rotation = move_angle;
}
var dist = _root.DistanceBetween(wp_next, this.the_obj);
var time_now = new Date();
var time_diff = ((time_now.getTime() - time_last.getTime()) / 1000);
time_last = time_now;
var move_amount = (this.move_speed * time_diff);
var movement = _root.trigForwardAtAngle(move_angle, move_amount);
var move_x = movement.x;
var move_y = movement.y;
var dist_move = Math.sqrt((move_x * move_x) + (move_y * move_y));
if ((dist <= dist_move) || (dist <= this.snap_dist)) {
this.the_obj._x = wp_next._x;
this.the_obj._y = wp_next._y;
this.waypoint_cur = this.waypoint_cur + 1;
this.repoint = this.point_body;
} else {
this.the_obj._x = this.the_obj._x + move_x;
this.the_obj._y = this.the_obj._y + move_y;
}
this.play();
}
Symbol 293 MovieClip [AttackerEngine] Frame 6
this.stop();
this.gotoAndPlay("Attack");
Symbol 293 MovieClip [AttackerEngine] Frame 7
this.stop();
_root.BaseHit();
this.engineRemove();
Symbol 293 MovieClip [AttackerEngine] Frame 9
this.stop();
Symbol 294 MovieClip [Attacker] Frame 1
this.stop();
this.point_body = false;
Symbol 296 MovieClip [Attacker0] Frame 1
this.stop();
this.point_body = false;
Symbol 301 MovieClip [Attacker1] Frame 1
this.stop();
Symbol 306 MovieClip [Attacker2] Frame 1
this.stop();
this.point_body = false;
Symbol 311 MovieClip [Attacker3] Frame 1
this.stop();
Symbol 316 MovieClip [Attacker4] Frame 1
this.stop();
Symbol 321 MovieClip [Attacker5] Frame 1
this.stop();
Symbol 326 MovieClip [Attacker6] Frame 1
this.stop();
this.point_body = false;
Symbol 331 MovieClip [Attacker7] Frame 1
this.stop();
Symbol 336 MovieClip [Attacker8] Frame 1
this.stop();
Symbol 341 MovieClip [RocketTrail] Frame 1
this.play();
Symbol 341 MovieClip [RocketTrail] Frame 16
this.removeMovieClip();
Symbol 343 MovieClip [RocketManager] Frame 1
this.stop();
this.bullet_damage = this._parent.bullet_damage;
this.bullet_speed = this._parent.bullet_speed;
this.bullet_rotation = this._parent.bullet_rotation;
this.bullet_target = this._parent.bullet_target;
this.bullet_no_rotate = this._parent.bullet_no_rotate;
this.holding_pattern = this._parent.holding_pattern;
this.holding_initially = this._parent.holding_initially;
this.impact_range = this._parent.impact_range;
this.weapon_reacquire = this._parent.weapon_reacquire;
if (!this.bullet_damage) {
this.bullet_damage = 1;
}
if (!this.bullet_speed) {
this.bullet_speed = 250;
}
if (!this.bullet_rotation) {
this.bullet_rotation = 270;
}
if (!this.bullet_no_rotate) {
this.bullet_no_rotate = false;
}
if (!this.bullet_target) {
this.bullet_target = false;
}
if (!this.holding_pattern) {
this.holding_pattern = false;
}
if (!this.holding_initially) {
this.holding_initially = false;
}
if (!this.impact_range) {
this.impact_range = 1;
}
if (!this.weapon_reacquire) {
this.weapon_reacquire = false;
}
if (this.bullet_no_rotate == true) {
this.bullet_rotation = 0;
}
this.holding_dir = 1;
if (Math.random() >= 0.5) {
this.holding_dir = -1;
}
this.WeaponController.weapon_target = this.bullet_target;
this.WeaponController.weapon_range = Math.max(_root._width, _root._height);
this.WeaponController.weapon = this._parent._parent;
this.target_locked = false;
this.time_last = new Date();
this.target_obj = this._parent;
if (this.holding_initially == true) {
this.gotoAndPlay("Holding");
} else {
this.gotoAndPlay("Attack");
}
this.engineGetForwardMovement = function (time_diff) {
var _local5 = this.target_obj._rotation;
var _local3 = _local5 * 0.01745329;
var _local4 = this.bullet_speed * time_diff;
var _local2 = new Object();
_local2.x = Math.cos(_local3) * _local4;
_local2.y = Math.sin(_local3) * _local4;
return(_local2);
};
this.engineAcquire = function (the_target) {
this.bullet_target = the_target;
this.target_locked = true;
this.WeaponController.weapon_target = this.bullet_target;
this.gotoAndPlay("Attack");
};
this._parent.acquire = function (the_target) {
this.RocketEngine.engineAcquire(the_target);
};
this.laser_capable = this._parent.laser_capable;
this.laser_damage = this._parent.laser_damage;
this.laser_range = this._parent.laser_range;
this.laser_rate = this._parent.laser_rate;
this.laser_type = this._parent.laser_type;
if (!this.laser_capable) {
this.laser_capable = false;
}
if (!this.laser_damage) {
this.laser_damage = 500;
}
if (!this.laser_range) {
this.laser_range = 180;
}
if (!this.laser_rate) {
this.laser_rate = 180;
}
if (!this.laser_type) {
this.laser_type = "LaserBeam";
}
this.laser_fire_rate = 1000 / (this.laser_rate / 60);
this.laser_at_damage = new Array();
this.laser_type = "LaserBeam";
this.laser_fired = new Date();
this.laser_fire_count = 0;
this.laser_damage_list = new Array(25, 50, 120, 400, 1500, 3900, 9300, 19500, 35000);
this.laser_bullet_list = new Array();
this.laser_bullet_list["0"] = "LaserBeam";
this.laser_bullet_list["1"] = "LaserBeam2";
this.laser_bullet_list["2"] = "LaserBeam3";
this.laser_bullet_list["3"] = "LaserBeam4";
this.laser_bullet_list["4"] = "LaserBeam5";
this.laser_bullet_list["5"] = "LaserBeam6";
this.laser_bullet_list["6"] = "LaserBeam7";
this.laser_bullet_list["7"] = "LaserBeam8";
this.laser_bullet_list["8"] = "LaserBeam9";
this.laser_bullet_list["9"] = "LaserBeam10";
this.laserFire = function (the_target, the_damage) {
this.laser_fired = new Date();
this.laser_fired_count++;
_root.WeaponFired();
var _local7 = "RocketLaser" + this.weapon_fire_count;
var _local5 = this.laserGetWeaponAtDamage(the_damage);
var _local6 = _root.getNextHighestDepth();
var _local4 = _root.attachMovie(_local5, _local7, _local6);
var _local3 = new Object();
_local3.x = 0;
_local3.y = 0;
this.localToGlobal(_local3);
_local4._x = _local3.x;
_local4._y = _local3.y;
_local4.bullet_target = the_target;
_local4.bullet_damage = the_damage;
_local4.turret = this;
};
this.laserGetWeaponAtDamage = function (the_damage) {
if (this.laser_at_damage[the_damage]) {
return(this.laser_at_damage[the_damage]);
}
var _local5 = 0;
var _local6 = 0;
var _local2 = 0;
_local2 = 0;
while (_local2 < this.laser_damage_list.length) {
_local6 = _local5;
_local5 = parseInt(this.laser_damage_list[_local2]);
if ((the_damage >= _local6) && (the_damage < _local5)) {
var _local3 = this.laser_bullet_list[_local2];
this.laser_at_damage[the_damage] = _local3;
return(_local3);
}
_local2++;
}
var _local3 = this.laser_bullet_list[_local2];
this.laser_at_damage[the_damage] = _local3;
return(_local3);
};
this.laserAcquireAndFire = function () {
var _local2 = this.WeaponController.findAttackerInRange("near", this.laser_range);
if (_local2 != false) {
this.laserFire(_local2, this.laser_damage);
}
};
this.stop();
Symbol 343 MovieClip [RocketManager] Frame 2
this.stop();
if (!this.target_locked) {
this.WeaponController.weapon = this._parent;
this.WeaponController.pointAtTarget(this.target_obj, this.target_obj);
this.target_locked = true;
}
_root.rocketSmoke(this.target_obj);
var time_now = new Date();
var time_diff = ((time_now.getTime() - this.time_last.getTime()) / 1000);
this.time_last = time_now;
if (this.WeaponController.targetExists()) {
var rad = this.WeaponController.angleToTarget(this.target_obj);
var deg_target = (rad * 57.29578);
var deg_diff = (deg_target - this.target_obj._rotation);
var move_deg = (this.bullet_rotation * time_diff);
if (Math.abs(deg_diff) < Math.abs(move_deg)) {
this.target_obj._rotation = deg_target;
} else {
var angle_left = ((deg_diff + 360) % 360);
var angle_right = ((360 - deg_diff) % 360);
if (angle_right < angle_left) {
this.target_obj._rotation = this.target_obj._rotation - move_deg;
} else {
this.target_obj._rotation = this.target_obj._rotation + move_deg;
}
}
var movement = this.engineGetForwardMovement(time_diff);
var move_x = movement.x;
var move_y = movement.y;
var move_dist = Math.sqrt((move_x * move_x) + (move_y * move_y));
var d_x = (this.bullet_target._x - this.target_obj._x);
var d_y = (this.bullet_target._y - this.target_obj._y);
var tgt_dist = Math.sqrt((d_x * d_x) + (d_y * d_y));
if ((!isNaN(tgt_dist)) && (tgt_dist < move_dist)) {
this.gotoAndPlay("Hit");
} else if ((!isNaN(tgt_dist)) && (tgt_dist < this.impact_range)) {
this.gotoAndPlay("Hit");
} else {
this.target_obj._x = this.target_obj._x + movement.x;
this.target_obj._y = this.target_obj._y + movement.y;
this.play();
}
if (this.laser_capable == true) {
var fire_diff = (time_now.getTime() - this.laser_fired.getTime());
if (fire_diff >= this.laser_fire_rate) {
this.laserAcquireAndFire();
}
}
} else if (this.WeaponController.acquire()) {
this.bullet_target = this.WeaponController.weapon_target;
this.play();
} else if (this.holding_pattern == true) {
var move_deg = (this.bullet_rotation * time_diff);
this.target_obj._rotation = this.target_obj._rotation + (move_deg * this.holding_dir);
var movement = this.engineGetForwardMovement(time_diff);
this.target_obj._x = this.target_obj._x + movement.x;
this.target_obj._y = this.target_obj._y + movement.y;
this.play();
} else {
this.gotoAndPlay("Hit");
}
Symbol 343 MovieClip [RocketManager] Frame 3
this.stop();
if (this.weapon_reacquire == true) {
var the_range = this.WeaponController.weapon_range;
var the_type = "near";
nearest = this.WeaponController.findAttackerInRange(the_type, the_range);
this.engineAcquire(nearest);
} else {
this.gotoAndPlay("Attack");
}
Symbol 343 MovieClip [RocketManager] Frame 4
this.stop();
var time_now = new Date();
var time_diff = ((time_now.getTime() - this.time_last.getTime()) / 1000);
this.time_last = time_now;
_root.rocketSmoke(this.target_obj);
if (this.holding_pattern == true) {
var move_deg = (this.bullet_rotation * time_diff);
this.target_obj._rotation = this.target_obj._rotation + (move_deg * this.holding_dir);
var movement = this.engineGetForwardMovement(time_diff);
this.target_obj._x = this.target_obj._x + movement.x;
this.target_obj._y = this.target_obj._y + movement.y;
this.play();
} else {
this.gotoAndPlay("Hit");
}
Symbol 343 MovieClip [RocketManager] Frame 5
this.stop();
this.gotoAndPlay("Holding");
Symbol 343 MovieClip [RocketManager] Frame 6
this.stop();
if (this.bullet_target) {
this.bullet_target.hit(this.bullet_damage);
}
this.target_obj.hit();
this.target_obj.removeMovieClip();
Symbol 344 MovieClip [Rocket] Frame 1
this.stop();
Symbol 349 MovieClip [BFGOrb1] Frame 1
this.play();
Symbol 349 MovieClip [BFGOrb1] Frame 42
this.gotoAndPlay("Start");
Symbol 354 MovieClip [BFGOrb2] Frame 1
this.play();
Symbol 354 MovieClip [BFGOrb2] Frame 38
this.gotoAndPlay("Start");
Symbol 356 MovieClip [BFGOrb3] Frame 1
this.play();
Symbol 356 MovieClip [BFGOrb3] Frame 64
this.gotoAndPlay("Start");
Symbol 357 MovieClip [BFG] Frame 1
this.stop();
if (!this.laser_damage) {
this.laser_damage = 5000000 /* 0x4C4B40 */;
}
if (!this.laser_rate) {
this.laser_rate = 240;
}
if (!this.laser_range) {
this.laser_range = 250;
}
if (!this.bullet_speed) {
this.bullet_speed = 60;
}
if (!this.bullet_damage) {
this.bullet_damage = 5000000 /* 0x4C4B40 */;
}
if (!this.impact_range) {
this.impact_range = 10;
}
this.laser_capable = true;
this.bullet_no_rotate = true;
this.holding_pattern = true;
this.weapon_reacquire = true;
this.onEnterFrame = function () {
var _local2 = -this._width;
var _local4 = 720;
var _local3 = -this._height;
var _local5 = 560;
if ((((this._x < _local2) || (this._x > _local4)) || (this._y < _local3)) || (this._y > _local5)) {
this.removeMovieClip();
}
};
this.hit = function () {
var _local4 = _root.getNextHighestDepth();
var _local5 = "BFGBlast" + _local4;
var _local6 = "BFGBlast";
var _local3 = _root.attachMovie(_local6, _local5, _local4);
_local3._x = this._x;
_local3._y = this._y;
_local3.weapon_damage = this.bullet_damage;
};
Symbol 358 MovieClip Frame 1
this.weapon_damage = this._parent.addon_weapon_damage;
this.weapon_range = this._parent.addon_weapon_range;
this.weapon_rate = this._parent.addon_weapon_rate;
this.weapon_type = this._parent.addon_weapon_type;
this.holding_pattern = this._parent.addon_holding_pattern;
this.holding_initially = this._parent.addon_holding_initially;
this.laser_capable = this._parent.addon_laser_capable;
this.laser_damage = this._parent.addon_laser_damage;
this.laser_range = this._parent.addon_laser_range;
this.laser_rate = this._parent.addon_laser_rate;
this.laser_type = this._parent.addon_laser_type;
if (!this.weapon_damage) {
this.weapon_damage = 50;
}
if (!this.weapon_range) {
this.weapon_range = 200;
}
if (!this.weapon_rate) {
this.weapon_rate = 200;
}
if (!this.weapon_type) {
this.weapon_type = "Rocket3";
}
if (!this.holding_pattern) {
this.holding_pattern = false;
}
if (!this.holding_initially) {
this.holding_initially = false;
}
if (!this.laser_capable) {
this.laser_capable = false;
}
if (!this.laser_damage) {
this.laser_damage = 500;
}
if (!this.laser_range) {
this.laser_range = 180;
}
if (!this.laser_rate) {
this.laser_rate = 180;
}
if (!this.laser_type) {
this.laser_type = "LaserBeam";
}
this.weapon_fired = 0;
this.weapon_fire_count = 0;
this.weapon_kill_count = 0;
this.WeaponController.weapon_range = this.weapon_range;
this.WeaponController.Weapon = this._parent;
this.fireAt = function (the_target, the_damage) {
this.weapon_fired = new Date();
this.weapon_fire_count++;
_root.WeaponFired();
var _local7 = "AddonRocket" + this.weapon_fire_count;
var _local5 = this.weapon_type;
var _local6 = _root.getNextHighestDepth();
var _local3 = _root.attachMovie(_local5, _local7, _local6);
var _local4 = new Object();
_local4.x = this._x;
_local4.y = this._y;
this.localToGlobal(_local4);
_local3._x = _local4.x;
_local3._y = _local4.y;
_local3._rotation = this.Weapon._rotation;
_local3.bullet_target = the_target;
_local3.bullet_damage = the_damage;
_local3.turret = this;
_local3.holding_pattern = this.holding_pattern;
return(_local3);
};
if (this.active == true) {
this.gotoAndPlay("Fire");
}
Symbol 358 MovieClip Frame 2
this.stop();
var time_now = new Date();
var time_diff = (time_now.getTime() - this.weapon_fired.getTime());
var fire_rate = (1000 / (this.weapon_rate / 60));
if (this.WeaponController.acquire()) {
if (this.WeaponController.targetInRange()) {
this.WeaponController.pointAtTarget(this, this.Weapon);
}
if (time_diff >= this.fire_rate) {
if (this.WeaponController.targetInRange()) {
this.fireAt(this.WeaponController.weapon_target, this.weapon_damage);
}
}
}
this.play();
Symbol 358 MovieClip Frame 3
if (this._parent.active == false) {
this.gotoAndPlay("Stopped");
} else {
this.gotoAndPlay("Fire");
}
Symbol 358 MovieClip Frame 4
this.stop();
Symbol 359 MovieClip [BFGRocket] Frame 1
this.stop();
if (!this.laser_damage) {
this.laser_damage = 5000000 /* 0x4C4B40 */;
}
if (!this.laser_rate) {
this.laser_rate = 240;
}
if (!this.laser_range) {
this.laser_range = 250;
}
if (!this.bullet_speed) {
this.bullet_speed = 60;
}
if (!this.bullet_damage) {
this.bullet_damage = 5000000 /* 0x4C4B40 */;
}
if (!this.impact_range) {
this.impact_range = 10;
}
this.laser_capable = true;
this.bullet_no_rotate = true;
this.holding_pattern = true;
this.weapon_reacquire = true;
this.onEnterFrame = function () {
var _local2 = -this._width;
var _local4 = 720;
var _local3 = -this._height;
var _local5 = 560;
if ((((this._x < _local2) || (this._x > _local4)) || (this._y < _local3)) || (this._y > _local5)) {
this.removeMovieClip();
}
};
this.hit = function () {
var _local3 = _root.getNextHighestDepth();
var _local5 = "BFGBlast" + _local3;
var _local6 = "BFGBlast";
var _local4 = _root.attachMovie(_local6, _local5, _local3);
_local4._x = this._x;
_local4._y = this._y;
};
this.addon_weapon_damage = 5000000 /* 0x4C4B40 */;
this.addon_weapon_range = _root._width;
this.addon_weapon_rate = 180;
this.addon_holding_pattern = true;
this.addon_laser_capable = false;
Symbol 361 MovieClip [RocketPoison] Frame 1
this.stop();
this.hit = function () {
var _local3 = _root.getNextHighestDepth();
var _local5 = "PoisonCloud" + _local3;
var _local6 = "RocketPoisonCloud";
var _local4 = _root.attachMovie(_local6, _local5, _local3);
_local4._x = this._x;
_local4._y = this._y;
};
Symbol 363 MovieClip [RocketNuke] Frame 1
this.stop();
if (this.weapon_damage == undefined) {
this.weapon_damage = 5000000 /* 0x4C4B40 */;
}
this.hit = function () {
var _local4 = _root.getNextHighestDepth();
var _local5 = "NukeBlast" + _local4;
var _local6 = "RocketNukeBlast";
var _local3 = _root.attachMovie(_local6, _local5, _local4);
_local3._x = this._x;
_local3._y = this._y;
_local3.weapon_damage = this.weapon_damage;
};
Symbol 365 MovieClip [Rocket2] Frame 1
this.stop();
Symbol 367 MovieClip [Rocket9] Frame 1
this.stop();
Symbol 369 MovieClip [Rocket3] Frame 1
this.stop();
Symbol 371 MovieClip [Rocket4] Frame 1
this.stop();
Symbol 373 MovieClip [Rocket6] Frame 1
this.stop();
Symbol 375 MovieClip [Rocket8] Frame 1
this.stop();
Symbol 377 MovieClip [Rocket7] Frame 1
this.stop();
Symbol 379 MovieClip [Rocket5] Frame 1
this.stop();
Symbol 380 MovieClip [SoundPlayer] Frame 1
if (this.playlist == undefined) {
this.playlist = new Array();
}
if (this.playlist_loop == undefined) {
this.playlist_loop = false;
}
if (this.sound == undefined) {
this.sound = false;
}
if (this.volume_start == undefined) {
this.volume_start = 100;
}
if (this.volume_fade == undefined) {
this.volume_fade = 5;
}
if (this.then_stop == undefined) {
this.then_stop = false;
}
this.cur_track = false;
this.sound_playing = false;
this.soundNextTrack = function () {
trace(((this + "=") + this.sound) + ": next track");
this.gotoAndPlay("FadeOut");
};
this.soundFadeAndStop = function () {
this.then_stop = true;
this.gotoAndPlay("FadeOut");
};
this.soundStart = function () {
if (this.sound_playing == true) {
this.gotoAndPlay("NowPlaying");
} else {
this.gotoAndPlay("Play");
}
};
this.soundPause = function () {
this.sound_pos = this.cur_track.position;
this.gotoAndStop("Stopped");
};
this.soundRewind = function () {
this.cur_track.stop();
this.sound_pos = 0;
this.soundStart();
};
this.soundStop = function () {
this.cur_track.stop();
this.gotoAndPlay("Stopped");
};
this.stop();
if (this.sound != false) {
this.playlist.unshift(this.sound);
}
if (this.playlist.length == 0) {
this.removeMovieClip();
} else {
this.soundStart();
}
Symbol 380 MovieClip [SoundPlayer] Frame 4
this.stop();
this.cur_track.stop();
Symbol 380 MovieClip [SoundPlayer] Frame 7
this.stop();
var the_track = this.playlist.shift();
if (this.playlist_loop == true) {
this.playlist.push(the_track);
}
this.cur_track = new Object(_root[the_track]);
this.cur_track.from = this;
this.sound_playing = true;
this.sound_pos = 0;
this.cur_track.onSoundComplete = function () {
this.from.removeMovieClip();
};
this.play();
Symbol 380 MovieClip [SoundPlayer] Frame 10
this.stop();
this.cur_track.setVolume(this.volume_start);
var start_at = this.sound_pos;
if (start_at > 0) {
start_at = start_at / 1000;
} else {
start_at = 0;
}
this.cur_track.start();
Symbol 380 MovieClip [SoundPlayer] Frame 13
this.stop();
var the_volume = this.cur_track.getVolume();
var ended = false;
if (this.cur_track.position == this.cur_track.duration) {
ended = true;
}
if (the_volume > 0) {
this.cur_track.setVolume(0);
this.play();
} else {
trace(((this + "=") + this.sound) + ": Stop");
if (this.then_stop == true) {
trace(((this + "=") + this.sound) + ": Stop");
this.then_stop == false;
this.sound_pos = 0;
this.sound_playing = false;
} else if (this.playlist.length > 0) {
trace(((this + "=") + this.sound) + ": Next");
} else {
trace(((this + "=") + this.sound) + ": Halt and quit");
}
}
Symbol 380 MovieClip [SoundPlayer] Frame 16
this.gotoAndPlay("FadeOut");
Symbol 381 MovieClip [VisualEffect] Frame 1
this.stop();
if (this.target_x == undefined) {
this.target_x = false;
}
if (this.target_y == undefined) {
this.target_y = false;
}
if (this.target_alpha == undefined) {
this.target_alpha = false;
}
if (this.target_obj == undefined) {
this.target_obj = false;
}
if (this.wait_time == undefined) {
this.wait_time = false;
}
if (this.move_speed == undefined) {
this.move_speed = 1000;
}
if (this.then_goto == undefined) {
this.then_goto = false;
}
if (this.then_wait == undefined) {
this.then_wait = false;
}
if (this.then_fade == undefined) {
this.then_fade = false;
}
this.done = false;
this.time_last = new Date();
this.setup_done = false;
this.then_done = false;
if (this.target_obj != false) {
if (this.wait_time != false) {
this.gotoAndPlay("Wait");
} else {
this.gotoAndPlay("Move");
}
} else {
this.removeMovieClip();
}
Symbol 381 MovieClip [VisualEffect] Frame 2
this.stop();
if (this.setup_done == false) {
this.wait_until = this.time_last.getTime() + parseFloat(this.wait_time);
this.setup_done = true;
}
var date_now = new Date();
var time_now = date_now.getTime();
if (time_now >= this.wait_until) {
this.gotoAndPlay("Then");
} else {
this.play();
}
Symbol 381 MovieClip [VisualEffect] Frame 3
this.stop();
this.gotoAndPlay("Wait");
Symbol 381 MovieClip [VisualEffect] Frame 4
this.stop();
if (this.setup_done == false) {
this.orig_x = this.target_obj._x;
this.orig_y = this.target_obj._y;
this.orig_alpha = this.target_obj._alpha;
this.dist_x = this.target_x - this.orig_x;
this.dist_y = this.target_y - this.orig_y;
this.dist_alpha = this.target_alpha - this.orig_alpha;
this.time_last = new Date();
this.time_total = 0;
this.setup_done = true;
}
var date_now = new Date();
var time_now = date_now.getTime();
var time_last = this.time_last.getTime();
var time_diff = (time_now - time_last);
this.time_last = date_now;
var then_ready = true;
this.time_total = this.time_total + time_diff;
var pct_done = (this.time_total / this.move_speed);
if (this.target_alpha >= 0) {
if (pct_done < 1) {
var new_alpha = (this.orig_alpha + (this.dist_alpha * pct_done));
this.target_obj._alpha = new_alpha;
then_ready = false;
} else {
this.target_obj._alpha = this.target_alpha;
}
}
if (this.target_x || (this.target_y)) {
if (pct_done < 100) {
var new_x = (this.orig_x + (this.dist_x * pct_done));
var new_y = (this.orig_y + (this.dist_y * pct_done));
this.target_obj._x = new_x;
this.target_obj._y = new_y;
then_ready = false;
} else {
this.target_obj._x = this.target_x;
this.target_obj._y = this.target_y;
}
}
if (then_ready == true) {
this.gotoAndPlay("Then");
} else {
this.play();
}
Symbol 381 MovieClip [VisualEffect] Frame 5
this.stop();
this.gotoAndPlay("Move");
Symbol 381 MovieClip [VisualEffect] Frame 6
this.stop();
this.onThen();
this.removeMovieClip();
Symbol 385 MovieClip [Mute] Frame 1
this.stop();
this.sound_muted = false;
Muted._visible = false;
this.onPress = function () {
if (this.sound_muted == false) {
this.sound_muted = true;
} else {
this.sound_muted = false;
}
this._parent.sound_muted = this.sound_muted;
Muted._visible = this._parent.sound_muted;
};
Symbol 396 MovieClip [UpgradeBuyButton] Frame 1
if (!this.the_cost) {
this.the_cost = 1000000 /* 0x0F4240 */;
}
this.CanBuy._visible = false;
this.CannotBuy._visible = true;
this.setCost = function (new_cost) {
this.the_cost = new_cost;
BuyCost.text = "$" + this.the_cost;
};
this.setMax = function () {
this.CanBuy._visible = false;
this.CannotBuy._visible = true;
BuyCost.text = "Max!";
};
onEnterFrame = function () {
if (_root.CanAfford(this.the_cost)) {
this.CanBuy._visible = true;
this.CannotBuy._visible = false;
} else {
this.CanBuy._visible = false;
this.CannotBuy._visible = true;
}
};
this.stop();
Symbol 398 MovieClip [UpgradeGraphBar] Frame 1
this.stop();
Symbol 400 MovieClip [UpgradeGraphBarGreen] Frame 1
this.stop();
Symbol 402 MovieClip [UpgradeGraphBarYellow] Frame 1
this.stop();
Symbol 407 MovieClip [UpgradeGraph] Frame 1
if (this.peak_max == undefined) {
this.peak_max = 100000 /* 0x0186A0 */;
}
if (this.steps == undefined) {
this.steps = new Array();
this.steps.push(100);
this.steps.push(1000);
this.steps.push(10000);
this.steps.push(60000);
}
if (this.bar_x == undefined) {
this.bar_x = 3;
}
if (this.bar_y == undefined) {
this.bar_y = 14;
}
if (this.bar_space == undefined) {
this.bar_space = 1;
}
if (this.step_bars == undefined) {
this.step_bars = 15;
}
if (this.scale_minor == undefined) {
this.scale_minor = 9;
}
this.setCurrent = function (the_val) {
this.setValue(the_val, "BarCurrent");
};
this.setPossible = function (the_val) {
this.setValue(the_val, "BarPossible");
};
this.setLimit = function (the_val) {
var _local2 = "BarLimit";
var _local3 = this.getWidth(the_val);
this[_local2]._width = this.bar_x;
this[_local2]._height = this.bar_y;
this[_local2]._x = _local3 - this.bar_x;
this[_local2]._y = 0;
};
this.setValue = function (the_val, the_bar) {
var _local3 = this.getWidth(the_val);
this[the_bar]._width = _local3;
this[the_bar]._height = this.bar_y;
this[the_bar]._y = 0;
};
this.getWidth = function (the_val) {
var _local11 = this.steps;
var _local5 = 0;
var _local4 = 0;
var _local3 = 0;
while (_local3 < _local11.length) {
var _local2 = this.steps[_local3];
if (the_val >= _local2) {
_local4 = _local4 + (this.step_bars * (this.bar_x + this.bar_space));
} else if ((the_val >= _local5) && (the_val < _local2)) {
var _local7 = this.step_bars * (this.bar_x + this.bar_space);
var _local9 = _local2 - _local5;
var _local8 = the_val - _local5;
var _local10 = _local8 / _local9;
_local4 = _local4 + (_local7 * _local10);
}
_local5 = _local2;
_local3++;
}
return(_local4);
};
var block_width = (this.step_bars * (this.bar_x + this.bar_space));
var minor_num = (this.steps.length * this.scale_minor);
var minor_space = (block_width / this.scale_minor);
var i = 1;
while (i <= minor_num) {
var new_item = "UpgradeGraphScaleMinor";
var new_name = ((("ScaleMinorUnit-" + i) + "-") + j);
var new_depth = this.getNextHighestDepth();
new_unit = this.attachMovie(new_item, new_name, new_depth);
new_unit._x = i * minor_space;
new_unit._y = 0;
i++;
}
var i = 1;
while (i <= this.steps.length) {
var new_item = "UpgradeGraphScale";
var new_name = ((("ScaleUnit-" + i) + "-") + j);
var new_depth = this.getNextHighestDepth();
new_unit = this.attachMovie(new_item, new_name, new_depth);
new_unit._x = i * block_width;
new_unit._y = 0;
new_unit.marker = this.steps[i - 1];
i++;
}
var block_width = (this.step_bars * (this.bar_x + this.bar_space));
var full_width = this.steps.length;
this.Background._width = (block_width * full_width) + 2;
this.Background._height = this.bar_y + 2;
this.Background._x = -1;
this.Background._y = 0;
this.Background._visible = true;
this.Fade._width = (block_width * full_width) + 1;
this.Fade._height = this.bar_y;
this.Fade._x = 0;
this.Fade._y = 0;
this.Fade._visible = true;
this.stop();
Symbol 427 Button
on (press) {
this.tryUpgradeRate();
}
Symbol 428 Button
on (press) {
this.tryUpgradeRange();
}
Symbol 429 Button
on (press) {
this.tryUpgradeDamage();
}
Symbol 430 MovieClip [UpgradePanel] Frame 1
this.damage_upgrade = false;
this.damage_cost = false;
this.damage_max = false;
this.range_upgrade = false;
this.range_cost = false;
this.range_max = false;
this.rate_upgrade = false;
this.rate_cost = false;
this.rate_max = false;
this.turret_damage = false;
this.turret_range = false;
this.turret_rate = false;
this.turret_type = false;
this.getStats = function (the_turret) {
if (the_turret) {
this.damage_upgrade = the_turret.getUpgrade("damage");
this.damage_cost = the_turret.getUpgradeCost("damage");
this.damage_max = the_turret.getMax("damage");
this.range_upgrade = the_turret.getUpgrade("range");
this.range_cost = the_turret.getUpgradeCost("range");
this.range_max = the_turret.getMax("range");
this.rate_upgrade = the_turret.getUpgrade("rate");
this.rate_cost = the_turret.getUpgradeCost("rate");
this.rate_max = the_turret.getMax("rate");
this.turret_damage = the_turret.weapon_damage;
this.turret_range = the_turret.weapon_range;
this.turret_rate = the_turret.weapon_rate;
this.turret_type = the_turret.turret_type;
this.updateStats();
this.gotoAndPlay("Viewing");
}
};
this.updateStats = function () {
this.GraphDamage.setCurrent(this.turret_damage);
this.GraphDamage.setPossible(this.damage_upgrade);
this.GraphDamage.setLimit(this.damage_max);
this.GraphRange.setCurrent(this.turret_range);
this.GraphRange.setPossible(this.range_upgrade);
this.GraphRange.setLimit(this.range_max);
this.GraphRate.setCurrent(this.turret_rate);
this.GraphRate.setPossible(this.rate_upgrade);
this.GraphRate.setLimit(this.rate_max);
DamageCost.text = "";
RangeCost.text = "";
RateCost.text = "";
if (this.damage_upgrade) {
BuyDamage.setCost(this.damage_cost);
}
if (this.range_upgrade) {
BuyRange.setCost(this.range_cost);
}
if (this.rate_upgrade) {
BuyRate.setCost(this.rate_cost);
}
if (this.turret_damage eq this.damage_max) {
BuyDamage.setMax();
}
if (this.turret_range eq this.range_max) {
BuyRange.setMax();
}
if (this.turret_rate eq this.rate_max) {
BuyRate.setMax();
}
};
this.onEnterFrame = function () {
this.turret = _root.cur_turret;
if (this.turret) {
this.getStats(this.turret);
}
};
this.tryUpgradeDamage = function () {
if (this.damage_upgrade) {
this.turret.upgradeDamage();
}
};
this.tryUpgradeRange = function () {
if (this.range_upgrade) {
this.turret.upgradeRange();
}
};
this.tryUpgradeRate = function () {
if (this.rate_upgrade) {
this.turret.upgradeRate();
}
};
_root.cur_turret_name = "";
this.stop();
Symbol 430 MovieClip [UpgradePanel] Frame 4
this.GraphDamage.steps = new Array();
this.GraphDamage.steps.push(10);
this.GraphDamage.steps.push(100);
this.GraphDamage.steps.push(1000);
this.GraphDamage.steps.push(10000);
this.GraphDamage.steps.push(65000);
this.GraphRange.steps = new Array();
this.GraphRange.steps.push(100);
this.GraphRange.steps.push(150);
this.GraphRange.steps.push(200);
this.GraphRange.steps.push(250);
this.GraphRange.steps.push(350);
this.GraphRate.steps = new Array();
this.GraphRate.steps.push(50);
this.GraphRate.steps.push(100);
this.GraphRate.steps.push(150);
this.GraphRate.steps.push(200);
this.GraphRate.steps.push(250);
_root.cur_turret_name = _root.cur_turret._name;
this.stop();
if (this.turret) {
this.getStats(this.turret);
} else {
this.gotoAndStop("Idle");
}
Symbol 433 MovieClip [WeaponStoreRack] Frame 1
this.stop();
this.item_list = new Array();
this.item_width = 42;
this.item_height = 50;
this.view_move_speed = 250;
this.by_type = new Array();
this.rackItemAdd = function (item_id, item_cost, item_type) {
var _local4 = "WeaponStoreItem";
var _local3 = this.getNextHighestDepth();
var _local7 = _local4 + _local3;
var _local2 = this.attachMovie(_local4, _local7, _local3);
_local2.item_cost = item_cost;
_local2.item_id = item_id;
_local2.item_type = item_type;
var _local8 = this.rackSize();
var _local5 = _local8 * this.item_width;
var _local6 = 0;
_local2._x = _local5;
_local2._y = _local6;
this.item_list.push(_local2);
this.by_type[item_type] = _local2;
};
this.rackItemType = function (item_num) {
var _local2 = this.item_list[item_num];
return(_local2.item_type);
};
this.rackView = function (item_num) {
this.target_x = (-item_num) * this.item_width;
this.target_y = this._y;
this.time_last = new Date();
this.gotoAndPlay("ViewItem");
};
this.rackSize = function () {
return(this.item_list.length);
};
this.rackReset = function () {
var _local3 = 0;
while (_local3 < this.item_list.length) {
var _local4 = this.item_list[_local3];
_local4.removeMovieClip();
_local3++;
}
this.item_list = new Array();
this.rackItemAdd("TurretBlue", _root.turrets_cost.Blue, "Blue");
this.rackItemAdd("TurretGreen", _root.turrets_cost.Green, "Green");
this.rackItemAdd("TurretRed", _root.turrets_cost.Red, "Red");
};
this.rackTypeRange = function (the_type) {
var _local3 = this.by_type[the_type];
var _local2 = _local3.turret.weapon_range;
return(_local2);
};
this.stop();
this.rackReset();
Symbol 433 MovieClip [WeaponStoreRack] Frame 2
this.stop();
Symbol 433 MovieClip [WeaponStoreRack] Frame 3
this.stop();
var time_now = new Date();
var time_diff = ((time_now.getTime() - this.time_last.getTime()) / 1000);
this.time_last = time_now;
var d_x = (this.target_x - this._x);
var d_y = (this.target_y - this._y);
var dist = Math.sqrt((d_x * d_x) + (d_y * d_y));
var move_x = ((d_x / dist) * (this.view_move_speed * time_diff));
var move_y = ((d_y / dist) * (this.view_move_speed * time_diff));
this._x = this._x + move_x;
this._y = this._y + move_y;
move_dist = Math.sqrt((move_x * move_x) + (move_y * move_y));
dist = Math.abs(dist);
move_dist = Math.abs(move_dist);
if (dist <= move_dist) {
this._x = this.target_x;
this._y = this.target_y;
this.gotoAndStop("Idle");
} else {
this.play();
}
Symbol 433 MovieClip [WeaponStoreRack] Frame 4
this.gotoAndPlay("ViewItem");
Symbol 439 Button
on (release) {
storePrevItem();
}
Symbol 442 Button
on (release) {
storeNextItem();
}
Symbol 443 MovieClip [WeaponStore] Frame 1
this.stop();
this.item_current = 0;
this.storeNextItem = function () {
var _local2 = this.item_current + 1;
var _local3 = WeaponRack.rackSize();
if (_local2 < _local3) {
this.item_current = _local2;
}
WeaponRack.rackView(this.item_current);
};
this.storePrevItem = function () {
var _local2 = this.item_current - 1;
if (_local2 >= 0) {
this.item_current = _local2;
}
WeaponRack.rackView(this.item_current);
};
this.storeAddItem = function (item_id, item_cost, item_type) {
WeaponRack.rackItemAdd(item_id, item_cost, item_type);
};
this.storeBuyItem = function () {
var _local3 = WeaponRack.rackItemType(this.item_current);
_root.TryAndBuild(_local3);
};
this.storeEmpty = function () {
WeaponRack.rackReset();
this.item_current = 0;
WeaponRack.rackView(this.item_current);
};
this.storeGetRange = function (the_type) {
return(WeaponRack.rackTypeRange(the_type));
};
this.stop();
WeaponRack.setMask(WeaponStoreMask);
Symbol 461 MovieClip Frame 1
this.stop();
this.killed = function () {
this.gotoAndStop("Dead");
};
this.alive = function () {
this.gotoAndStop("Alive");
};
this.stop();
Symbol 461 MovieClip Frame 6
this.stop();
Symbol 462 MovieClip [PlayerBase] Frame 1
this.stop();
this.lifeLost = function (the_life) {
var _local3 = "Life" + the_life;
var _local2 = this[_local3];
if (_local2) {
_local2.killed();
}
};
this.resetLives = function () {
var _local2 = 1;
while (_local2 <= 10) {
var _local4 = "Life" + _local2;
var _local3 = this[_local4];
if (_local3) {
_local3.alive();
}
_local2++;
}
};
this.onLoad = function () {
this.resetLives();
};
Symbol 466 MovieClip [WaveManager] Frame 1
this.stop();
if (this.wave_spacing == undefined) {
this.wave_spacing = 20000;
}
if (this.wave_size == undefined) {
this.wave_size = 10;
}
if (this.attacker_spacing == undefined) {
this.attacker_spacing = 1000;
}
this.time_last_wave = new Date();
this.cur_wave = 0;
this.SendWave = function () {
this.time_last_wave = time_now;
this.attackers_sent = 0;
this._parent.NextWave();
var _local5 = "WaveSender";
var _local4 = "WaveSender" + this.cur_wave;
var _local3 = this._parent.getNextHighestDepth();
var _local2 = this._parent.attachMovie(_local5, _local4, _local3);
_local2.wave_size = this.wave_size;
_local2.wave_num = this.cur_wave;
_local2.attacker_spacing = this.attacker_spacing;
_local2.attacker_energy = this._parent.attacker_energy;
_local2.attacker_value = this._parent.attacker_value;
this._parent.waves.push(_local2);
this.cur_wave++;
};
this.gotoAndPlay("Spawn");
this.stop();
Symbol 466 MovieClip [WaveManager] Frame 5
var time_now = new Date();
var time_wave = (time_now.getTime() - this.time_last_wave.getTime());
if (time_wave >= this.wave_spacing) {
this.SendWave();
}
var time_wave_secs = Math.floor((Math.abs(time_wave) - this.wave_spacing) / 1000);
var next_mins = Math.floor(Math.abs(time_wave_secs) / 60);
var next_secs = (Math.abs(time_wave_secs) % 60);
if (next_secs < 10) {
next_secs = "0" + next_secs;
}
if (next_mins < 10) {
next_mins = "0" + next_mins;
}
this.WaveText.text = next_secs;
this.play();
Symbol 466 MovieClip [WaveManager] Frame 9
this.gotoAndPlay("Spawn");
Symbol 466 MovieClip [WaveManager] Frame 13
this.stop();
Symbol 467 MovieClip [AttackerPath] Frame 1
this.stop();
if (!this.dump_points) {
this.dump_points = false;
}
if (!this.waypoint_total) {
this.waypoint_total = this._parent.waypoint_total;
}
if (!this.line_width) {
this.line_width = 28;
}
if (!this.line_colour) {
this.line_colour = "0xb2885b";
}
if (!this.line_alpha) {
this.line_alpha = "100";
}
if (!this.mao_layout) {
this.mao_layout = false;
}
if (!this.map_base) {
this.map_base = false;
}
if (this.map_layout) {
var count = 0;
var i = 0;
while (i < this.map_layout.length) {
count++;
var point = this.map_layout[i];
var new_name = ("Waypoint" + count);
var new_depth = this._parent.getNextHighestDepth();
var new_id = "Waypoint";
var new_wp = this._parent.attachMovie(new_id, new_name, new_depth);
new_wp._x = point.x;
new_wp._y = point.y;
new_wp._visible = false;
this._parent.waypoints.push(new_wp);
i++;
}
this.waypoint_total = count;
this._parent.waypoint_total = count;
}
if (this.map_base) {
var point = this.map_base;
var new_name = "PlayerBase";
var new_depth = this._parent.getNextHighestDepth();
var new_id = "PlayerBase";
var new_base = this._parent.attachMovie(new_id, new_name, new_depth);
new_base._x = point.x;
new_base._y = point.y;
_root.PlayerBase = new_base;
}
this._x = 0;
this._y = 0;
this.map_as_vec = new Array();
this.mine_points = new Array();
var point = this._parent.Waypoint1;
this.moveTo(point._x, point._y);
this.lineStyle(this.line_width + 3, "0x666666", this.line_alpha);
if (this.dump_points) {
trace((point._x + ", ") + point._y);
}
var point_from = new Object({_x:point._x, _y:point._y});
var point_to = new Object();
var i = 2;
while (i <= this.waypoint_total) {
var point = this._parent["Waypoint" + i];
this.lineTo(point._x, point._y);
var point_to = new Object({_x:point._x, _y:point._y});
var d_x = (point_to._x - point_from._x);
var d_y = (point_to._y - point_from._y);
var dist = Math.sqrt((d_x * d_x) + (d_y * d_y));
var move_dist = 4;
this.num_points = dist / move_dist;
this.angle_from = new Object({_x:point_from._x, _y:point_from._y});
this.angle_to = new Object({_x:point_to._x, _y:point_to._y});
var angle = _root.degreesToTarget(angle_from, angle_to);
var am_at = new Object({_x:point_from._x, _y:point_from._y});
var j = 0;
while (j < num_points) {
var movement = _root.trigForwardAtAngle(angle, move_dist);
am_at._x = am_at._x + movement.x;
am_at._y = am_at._y + movement.y;
var the_point = new Object({_x:am_at._x, _y:am_at._y});
this.mine_points.push(the_point);
j++;
}
var point_vec = new Object({from:point_from, to:point_to});
this.map_as_vec.push(point_vec);
point_from = point_to;
if (this.dump_points) {
trace((point._x + ", ") + point._y);
}
i++;
}
var point = this._parent.Waypoint1;
this.moveTo(point._x, point._y);
this.lineStyle(this.line_width, this.line_colour, this.line_alpha);
var i = 2;
while (i <= this.waypoint_total) {
var point = this._parent["Waypoint" + i];
this.lineTo(point._x, point._y);
i++;
}
this.getRoadAsVectors = function () {
return(this.map_as_vec);
};
this.getMinePoints = function () {
return(this.mine_points);
};
Symbol 477 MovieClip [TurretUpgradeLevels] Frame 1
this.stop();
if (this.init_val == undefined) {
this.init_val = false;
}
if (this.full_sweep == undefined) {
this.full_sweep = 120;
}
this.setPercentage = function (new_val) {
var _local3 = Math.min(100, Math.max(0, new_val));
var _local6 = 99.9;
var _local4 = 0 + ((_local3 / 100) * this.full_sweep);
_local4 = _local4 / 2;
this.BarLeft._rotation = _local4;
this.LineLeft._rotation = _local4;
this.BarRight._rotation = 180 + (-_local4);
this.LineRight._rotation = 180 + (-_local4);
var _local22 = 255;
var _local17 = 32;
var _local23 = 32;
var _local25 = (("0x" + _root.dec2hex(_local22)) + _root.dec2hex(_local17)) + _root.dec2hex(_local23);
var _local10 = 255;
var _local9 = 255;
var _local11 = 32;
var _local35 = (("0x" + _root.dec2hex(_local10)) + _root.dec2hex(_local9)) + _root.dec2hex(_local11);
var _local24 = 64;
var _local18 = 255;
var _local26 = 64;
var _local27 = (("0x" + _root.dec2hex(_local24)) + _root.dec2hex(_local18)) + _root.dec2hex(_local26);
var _local8 = _local22;
var _local14 = _local17;
var _local7 = _local23;
var _local19 = _local10;
var _local20 = _local9;
var _local28 = _local11;
if (_local3 >= _local6) {
_local8 = _local10;
_local14 = _local9;
_local7 = _local11;
_local19 = _local24;
_local20 = _local18;
_local28 = _local26;
}
var _local31 = _local19 - _local8;
var _local33 = _local20 - _local14;
var _local29 = _local28 - _local7;
var _local13 = new Color(this.BarLeft);
var _local12 = new Color(this.BarRight);
if (_local3 >= 100) {
_local13.setRGB(_local27);
_local12.setRGB(_local27);
this.LineLeft._visible = false;
this.LineRight._visible = false;
} else if (_local3 <= 0) {
_local13.setRGB(_local25);
_local12.setRGB(_local25);
} else {
var _local5 = 0;
if (_local3 < _local6) {
var _local15 = _local3;
var _local16 = _local6;
_local5 = _local15 / _local16;
} else {
var _local15 = _local3 - _local6;
var _local16 = 100 - _local6;
_local5 = _local15 / _local16;
}
var _local32 = Math.floor(_local8 + (_local5 * _local31));
var _local30 = Math.floor(_local14 + (_local5 * _local33));
var _local34 = Math.floor(_local7 + (_local5 * _local29));
var _local21 = (("0x" + _root.dec2hex(_local32)) + _root.dec2hex(_local30)) + _root.dec2hex(_local34);
_local13.setRGB(_local21);
_local12.setRGB(_local21);
}
};
if (this.init_val != false) {
this.setPercentage(this.init_val);
}
Symbol 479 MovieClip [TurretBlue] Frame 1
if (this.active == undefined) {
this.active = true;
}
if (!this.weapon_damage) {
this.weapon_damage = 15;
}
if (!this.weapon_range) {
this.weapon_range = 130;
}
if (!this.weapon_rate) {
this.weapon_rate = 100;
}
this.weapon_angle = 0;
this.weapon_type = "Bullet";
this.weapon_fired = 0;
this.weapon_fire_count = 0;
this.weapon_kill_count = 0;
this.Highlight._visible = false;
if (!this.cash_value) {
this.cash_value = 0;
}
this.WeaponController.weapon_range = this.weapon_range;
this.WeaponController.weapon = this.Weapon;
this.WeaponLegs._rotation = Math.random() * 90;
this.fireAt = function (the_target, the_damage) {
this.weapon_fired = new Date();
this.Weapon.fire();
this.weapon_fire_count++;
_root.WeaponFired();
var _local7 = "BlueBullet" + this.weapon_fire_count;
var _local5 = this.weapon_type;
var _local6 = _root.getNextHighestDepth();
var _local3 = _root.attachMovie(_local5, _local7, _local6);
var _local4 = new Object();
_local4.x = this.Weapon.FirePoint._x;
_local4.y = this.Weapon.FirePoint._y;
this.Weapon.localToGlobal(_local4);
_local3._x = _local4.x;
_local3._y = _local4.y;
_root.soundEffect("BangSmall");
_local3.bullet_target = the_target;
_local3.bullet_damage = the_damage;
_local3.turret = this;
_root.TurretFired(_local3);
return(_local3);
};
this.notifyGone = function (the_turret) {
return(true);
};
this.onPress = function () {
if (this._parent.cur_turret) {
_root.TurretHighlightHide();
}
if (this._parent.cur_turret == this) {
this._parent.cur_turret = false;
_root.TurretHighlightHide();
} else {
this._parent.cur_turret = this;
_root.TurretHighlightShow();
}
};
if (this.damage_added == undefined) {
this.damage_added = 0;
}
if (this.damage_mult == undefined) {
this.damage_mult = 1;
}
if (this.range_added == undefined) {
this.range_added = 0;
}
if (this.range_mult == undefined) {
this.range_mult = 1;
}
if (this.rate_added == undefined) {
this.rate_added = 0;
}
if (this.rate_mult == undefined) {
this.rate_mult = 1;
}
if (this.damage_effective == undefined) {
this.damage_effective = this.weapon_damage;
}
if (this.range_effective == undefined) {
this.range_effective = this.weapon_range;
}
if (this.rate_effective == undefined) {
this.rate_effective = this.weapon_rate;
}
this.turrets_in_range = new Array();
this.modify_possible = true;
this.modifyGain = function (the_type, the_amount) {
if (this.modify_possible == false) {
return(false);
}
var _local2 = parseFloat(the_amount);
if (the_type == "damage_added") {
this.damage_added = this.damage_added + _local2;
} else if (the_type == "damage_mult") {
this.damage_mult = this.damage_mult + _local2;
} else if (the_type == "range_added") {
this.range_added = this.range_added + _local2;
} else if (the_type == "range_mult") {
this.range_mult = this.range_mult + _local2;
} else if (the_type == "rate_added") {
this.rate_added = this.rate_added + _local2;
} else if (the_type == "rate_mult") {
this.rate_mult = this.rate_mult + _local2;
}
if (_local2 > 0) {
}
this.modifyUpdate();
};
this.modifyUpdate = function () {
this.damage_effective = this.modifyDamage(this.weapon_damage);
this.range_effective = this.modifyRange(this.weapon_range);
this.rate_effective = this.modifyRate(this.weapon_rate);
this.WeaponController.weapon_range = this.range_effective;
return(true);
};
this.modifyDumpStats = function () {
trace((this + ": added damage ") + this.damage_added);
trace((this + ": added range ") + this.range_added);
trace((this + ": added rate ") + this.rate_added);
trace((this + ": mult damage ") + this.damage_mult);
trace((this + ": mult range ") + this.range_mult);
trace((this + ": mult rate ") + this.rate_mult);
trace((this + ": weapon damage ") + this.weapon_damage);
trace((this + ": weapon range ") + this.weapon_range);
trace((this + ": weapon rate ") + this.weapon_rate);
trace((this + ": effective damage ") + this.damage_effective);
trace((this + ": effective range ") + this.range_effective);
trace((this + ": effective rate ") + this.rate_effective);
};
this.modifyLose = function (the_type, the_amount) {
this.modifyGain(the_type, -the_amount);
};
this.modifyDamage = function (the_amount) {
var _local3 = parseFloat(the_amount);
var _local2 = (_local3 + this.damage_added) * this.damage_mult;
_local2 = Math.max(_local2, 0);
return(_local2);
};
this.modifyRange = function (the_amount) {
var _local3 = parseFloat(the_amount);
var _local2 = (_local3 + this.range_added) * this.range_mult;
_local2 = Math.max(_local2, 0);
return(_local2);
};
this.modifyRate = function (the_amount) {
var _local3 = parseFloat(the_amount);
var _local2 = (_local3 + this.rate_added) * this.rate_mult;
_local2 = Math.max(_local2, 0);
return(_local2);
};
this.modifyGetInRange = function (the_range) {
this.turrets_in_range = new Array();
var _local9 = the_range;
var _local8 = _root.turrets;
var _local3 = 0;
while (_local3 < _local8.length) {
var _local4 = _local8[_local3];
if (point != this) {
var _local5 = _local4._x - this._x;
var _local6 = _local4._y - this._y;
var _local7 = Math.sqrt((_local5 * _local5) + (_local6 * _local6));
if (_local7 <= _local9) {
this.turrets_in_range.push(_local4);
}
}
_local3++;
}
};
this.modifyAssert = function () {
var _local2 = 0;
while (_local2 < this.turrets_in_range.length) {
var _local3 = this.turrets_in_range[_local2];
this._modifyAssert(_local3);
_local2++;
}
};
this._modifyAssert = function (the_turret) {
the_turret.modifyGain("damage_added", this.modify_damage);
the_turret.modifyGain("range_added", this.modify_range);
the_turret.modifyGain("rate_added", this.modify_rate);
the_turret.modifyGain("damage_mult", this.modify_damage_mult);
the_turret.modifyGain("range_mult", this.modify_range_mult);
the_turret.modifyGain("rate_mult", this.modify_rate_mult);
};
this.modifyUnAssert = function (the_turret) {
the_turret.modifyLose("damage_added", this.modify_damage);
the_turret.modifyLose("range_added", this.modify_range);
the_turret.modifyLose("rate_added", this.modify_rate);
the_turret.modifyLose("damage_mult", this.modify_damage_mult);
the_turret.modifyLose("range_mult", this.modify_range_mult);
the_turret.modifyLose("rate_mult", this.modify_rate_mult);
};
this.modifyNotifyNew = function (the_turret) {
var _local3 = the_turret._x - this._x;
var _local4 = the_turret._y - this._y;
var _local5 = Math.sqrt((_local3 * _local3) + (_local4 * _local4));
if (_local5 <= this.weapon_range) {
this.turrets_in_range.push(the_turret);
this._modifyAssert(the_turret);
}
};
this.freak_available = false;
this.freak_level_damage = 4;
this.freak_level_range = 0;
this.freak_level_rate = 4;
this.freak_last = new Date();
this.freak_start = new Date();
this.freak_next = false;
this.freak_length = 5000;
this.freak_space = 80000 /* 0x013880 */;
this.freak_damage_mult = 3;
this.freak_range_mult = 1;
this.freak_rate_mult = 4;
this.freak_twitch_x = 4;
this.freak_twitch_y = 4;
this.freak_start_x = this.Weapon._x;
this.freak_start_y = this.Weapon._y;
this.freak_warn_time = 3000;
this.freak_total_time = this.freak_length + this.freak_warn_time;
this.freakOut = function () {
var _local2 = new Date();
this.freak_last = _local2.getTime();
this.freak_start = _local2.getTime();
this.freak_warning = false;
this.gotoAndPlay("Freakout");
return(true);
};
this.freakOutJitter = function () {
var _local2 = Math.floor(Math.random() * this.freak_twitch_x);
var _local3 = Math.floor(Math.random() * this.freak_twitch_y);
var _local4 = this.Weapon._x - this.freak_start_x;
var _local5 = this.Weapon._y - this.freak_start_y;
if (_local4 > 0) {
this.Weapon._x = this.Weapon._x - _local2;
} else {
this.Weapon._x = this.Weapon._x + _local2;
}
if (_local5 > 0) {
this.Weapon._y = this.Weapon._y - _local3;
} else {
this.Weapon._y = this.Weapon._y + _local3;
}
};
this.freakOutNext = function () {
var _local6 = new Date();
var _local4 = _local6.getTime();
var _local2 = this.freak_space / 2;
var _local3 = Math.random() * _local2;
var _local5 = (this.upgrade_rate_level * this.freak_rate_mult) * 1000;
return(((_local4 + _local2) + _local3) - _local5);
};
if (!this.upgrade_damage_level) {
this.upgrade_damage_level = 0;
}
if (!this.upgrade_range_level) {
this.upgrade_range_level = 0;
}
if (!this.upgrade_rate_level) {
this.upgrade_rate_level = 0;
}
this.max_damage = 0;
this.max_range = 0;
this.max_rate = 0;
this.max_built = false;
this.cost_damage = 0;
this.cost_range = 0;
this.cost_rate = 0;
this.cost_built = false;
this.upgrade_to_damage = 0;
this.upgrade_to_range = 0;
this.upgrade_to_rate = 0;
this.upgrade_to_built = false;
this.upgrade_pct_damage = 0;
this.upgrade_pct_range = 0;
this.upgrade_pct_rate = 0;
this.upgrade_pct_built = false;
this.upgrade_weapon_at_damage = new Array();
this._upgradeDone = function () {
this.cost_built = false;
this.upgrade_to_built = false;
this.upgrade_pct_built = false;
var _local2 = this.getMax("damage");
if (_local2 == this.weapon_damage) {
this.special_capable = true;
}
this.IndicateDamage.setPercentage(this.upgradeLevelAsPercent("damage"));
this.IndicateRange.setPercentage(this.upgradeLevelAsPercent("range"));
this.IndicateRate.setPercentage(this.upgradeLevelAsPercent("rate"));
this.modifyUpdate();
this.upgradeDone();
};
this.upgradeGetWeaponAtDamage = function (the_damage) {
if (this.upgrade_weapon_at_damage[the_damage]) {
return(this.upgrade_weapon_at_damage[the_damage]);
}
var _local8 = this.getMax("damage");
if (the_damage > _local8) {
return(this.max_bullet);
}
var _local6 = 0;
var _local4 = this.getMax("damage");
var _local5 = 0;
for (var _local7 in this.upgrade_damage) {
_local5++;
}
for (var _local7 in this.upgrade_damage) {
_local6 = _local4;
_local4 = parseInt(_local7);
if ((the_damage < _local6) && (the_damage >= _local4)) {
var _local2 = this.upgrade_bullet[_local5];
this.upgrade_weapon_at_damage[the_damage] = _local2;
return(_local2);
}
_local5--;
}
return(this.weapon_type);
};
this.getUpgrade = function (the_type) {
if (this.cost_built == false) {
this.upgrade_to_damage = this._getUpgrade("damage");
this.upgrade_to_range = this._getUpgrade("range");
this.upgrade_to_rate = this._getUpgrade("rate");
this.upgrade_to_built = true;
}
if (the_type == "damage") {
return(this.upgrade_to_damage);
}
if (the_type == "range") {
return(this.upgrade_to_range);
}
if (the_type == "rate") {
return(this.upgrade_to_rate);
}
return(false);
};
this._getUpgrade = function (the_type) {
var _local2 = new Array();
var _local3 = false;
if (the_type == "damage") {
_local2 = this.upgrade_damage;
_local3 = this.upgrade_damage_level;
} else if (the_type == "range") {
_local2 = this.upgrade_range;
_local3 = this.upgrade_range_level;
} else if (the_type == "rate") {
_local2 = this.upgrade_rate;
_local3 = this.upgrade_rate_level;
} else {
return(false);
}
var _local4 = 0;
for (var _local5 in _local2) {
_local4++;
}
if (_local3 >= _local4) {
return(false);
}
count = _local4 - 1;
for (var _local5 in _local2) {
if (count eq _local3) {
return(_local5);
}
count--;
}
return(false);
};
this.getUpgradeCost = function (the_type) {
if (this.cost_built == false) {
this.cost_damage = this._getUpgradeCost("damage");
this.cost_range = this._getUpgradeCost("range");
this.cost_rate = this._getUpgradeCost("rate");
this.cost_built = true;
}
if (the_type == "damage") {
return(this.cost_damage);
}
if (the_type == "range") {
return(this.cost_range);
}
if (the_type == "rate") {
return(this.cost_rate);
}
return(false);
};
this._getUpgradeCost = function (the_type) {
var _local2;
var _local3;
if (the_type == "damage") {
_local2 = this.upgrade_damage;
_local3 = this.upgrade_damage_level;
} else if (the_type == "range") {
_local2 = this.upgrade_range;
_local3 = this.upgrade_range_level;
} else if (the_type == "rate") {
_local2 = this.upgrade_rate;
_local3 = this.upgrade_rate_level;
} else {
return(false);
}
var _local4 = 0;
for (var _local5 in _local2) {
_local4++;
}
if (_local3 >= _local4) {
return(false);
}
count = _local4 - 1;
for (var _local5 in _local2) {
if (count eq _local3) {
return(_local2[_local5]);
}
count--;
}
return(false);
};
this.getMax = function (the_type) {
if (this.max_built == false) {
this.max_damage = this._getMax("damage");
this.max_range = this._getMax("range");
this.max_rate = this._getMax("rate");
this.max_built = true;
}
if (the_type == "damage") {
return(this.max_damage);
}
if (the_type == "range") {
return(this.max_range);
}
if (the_type == "rate") {
return(this.max_rate);
}
return(false);
};
this._getMax = function (the_type) {
var _local5;
var _local7;
if (the_type == "damage") {
_local5 = this.upgrade_damage;
_local7 = this.upgrade_damage_level;
} else if (the_type == "range") {
_local5 = this.upgrade_range;
_local7 = this.upgrade_range_level;
} else if (the_type == "rate") {
_local5 = this.upgrade_rate;
_local7 = this.upgrade_rate_level;
} else {
return(false);
}
var _local4 = new Number(0);
for (var _local6 in _local5) {
var _local3 = new Number(_local6);
var _local2 = _local3.valueOf();
if (_local2 > _local4) {
_local4 = _local2;
}
}
return(_local4);
};
this.upgradeDamage = function () {
var _local4 = this.upgrade_damage;
var _local8 = this.upgrade_damage_level;
var _local6 = _local8 + 1;
var _local5 = 0;
for (var _local7 in _local4) {
_local5++;
}
if (_local6 > _local5) {
return(false);
}
count = _local5;
for (var _local7 in _local4) {
if (count eq _local6) {
var _local3 = _local4[_local7];
if (_root.Payment(_local3)) {
this.cash_value = this.cash_value + _local3;
this.weapon_damage = _local7;
this.upgrade_damage_level++;
this._upgradeDone();
return(true);
}
return(false);
}
count--;
}
return(false);
};
this.upgradeRange = function () {
var _local4 = this.upgrade_range;
var _local8 = this.upgrade_range_level;
var _local6 = _local8 + 1;
var _local5 = 0;
for (var _local7 in _local4) {
_local5++;
}
if (_local6 > _local5) {
return(false);
}
count = _local5;
for (var _local7 in _local4) {
if (count eq _local6) {
var _local3 = _local4[_local7];
if (_root.Payment(_local3)) {
this.cash_value = this.cash_value + _local3;
this.weapon_range = _local7;
this.upgrade_range_level++;
this._upgradeDone();
return(true);
}
return(false);
}
count--;
}
return(false);
};
this.upgradeRate = function () {
var _local4 = this.upgrade_rate;
var _local8 = this.upgrade_rate_level;
var _local6 = _local8 + 1;
var _local5 = 0;
for (var _local7 in _local4) {
_local5++;
}
if (_local6 > _local5) {
return(false);
}
count = _local5;
for (var _local7 in _local4) {
if (count eq _local6) {
var _local3 = _local4[_local7];
if (_root.Payment(_local3)) {
this.cash_value = this.cash_value + _local3;
this.weapon_rate = _local7;
this.upgrade_rate_level++;
this._upgradeDone();
return(true);
}
return(false);
}
count--;
}
return(false);
};
this.upgradeLevelAsPercent = function (the_type) {
if (this.upgrade_pct_built == false) {
this.upgrade_pct_damage = this._upgradeLevelAsPercent("damage");
this.upgrade_pct_range = this._upgradeLevelAsPercent("range");
this.upgrade_pct_rate = this._upgradeLevelAsPercent("rate");
this.upgrade_pct_built = true;
}
if (the_type == "damage") {
return(this.upgrade_pct_damage);
}
if (the_type == "range") {
return(this.upgrade_pct_range);
}
if (the_type == "rate") {
return(this.upgrade_pct_rate);
}
return(false);
};
this._upgradeLevelAsPercent = function (the_type) {
var _local2;
var _local5;
if (the_type == "damage") {
_local2 = this.upgrade_damage;
_local5 = this.upgrade_damage_level;
} else if (the_type == "range") {
_local2 = this.upgrade_range;
_local5 = this.upgrade_range_level;
} else if (the_type == "rate") {
_local2 = this.upgrade_rate;
_local5 = this.upgrade_rate_level;
} else {
return(false);
}
var _local3 = 0;
for (var _local4 in _local2) {
_local3++;
}
var _local7 = Math.ceil((_local5 / _local3) * 100);
return(_local7);
};
this.upgrade_damage = new Array();
this.upgrade_damage["30"] = 20;
this.upgrade_damage["60"] = 50;
this.upgrade_damage["150"] = 100;
this.upgrade_damage["400"] = 250;
this.upgrade_damage["1200"] = 600;
this.upgrade_damage["3100"] = 1000;
this.upgrade_damage["8500"] = 1100;
this.upgrade_damage["18400"] = 1200;
this.upgrade_damage["46000"] = 1500;
this.upgrade_range = new Array();
this.upgrade_range["140"] = 30;
this.upgrade_range["150"] = 100;
this.upgrade_range["165"] = 200;
this.upgrade_range["180"] = 500;
this.upgrade_range["220"] = 950;
this.upgrade_rate = new Array();
this.upgrade_rate["110"] = 50;
this.upgrade_rate["125"] = 150;
this.upgrade_rate["140"] = 300;
this.upgrade_rate["160"] = 450;
this.upgrade_rate["180"] = 950;
this.upgrade_rate["200"] = 1000;
this.upgrade_rate["240"] = 1450;
this.upgrade_bullet = new Array();
this.upgrade_bullet["1"] = "Bullet";
this.upgrade_bullet["2"] = "Bullet2";
this.upgrade_bullet["3"] = "Bullet3";
this.upgrade_bullet["4"] = "Bullet4";
this.upgrade_bullet["5"] = "Bullet5";
this.upgrade_bullet["6"] = "Bullet6";
this.upgrade_bullet["7"] = "Bullet7";
this.upgrade_bullet["8"] = "Bullet8";
this.upgrade_bullet["9"] = "Bullet9";
this.max_bullet = "Bullet9";
this.upgradeDone = function () {
this.modifyUpdate();
if (this.upgrade_bullet[upgrade_damage_level]) {
this.weapon_type = this.upgrade_bullet[upgrade_damage_level];
}
this.WeaponController.weapon_range = this.range_effective;
if (((this.upgrade_damage_level >= this.freak_level_damage) && (this.upgrade_range_level >= this.freak_level_range)) && (this.upgrade_rate_level >= this.freak_level_rate)) {
this.freak_available = true;
if (this.freak_next == false) {
this.freak_next = this.freakOutNext();
}
}
};
this.special_capable = false;
this.special_fired = new Date();
this.special_range = 70;
this.special_rate = 7;
this.mine_locations = new Array();
this.mine_located = false;
this.specialGetInRange = function () {
var _local11 = this._x;
var _local12 = this._y;
this.special_blue = new Array();
this.special_green = new Array();
this.special_red = new Array();
var _local10 = this.special_range;
var _local3 = 0;
while (_local3 < _root.turrets.length) {
the_turret = _root.turrets[_local3];
var _local8 = the_turret._x;
var _local9 = the_turret._y;
var _local5 = _local8 - _local11;
var _local6 = _local9 - _local12;
var _local7 = Math.sqrt((_local6 * _local6) + (_local5 * _local5));
if ((((_local7 < _local10) && (the_turret.special_capable)) && (the_turret != this)) && (the_turret.specialCanFire() == true)) {
var _local4 = the_turret.turret_type;
if (_local4 == "Blue") {
special_blue.push(the_turret);
}
if (_local4 == "Green") {
special_green.push(the_turret);
}
if (_local4 == "Red") {
special_red.push(the_turret);
}
}
_local3++;
}
};
this.specialFireBullet = function (the_type) {
var _local3 = this.weapon_type;
this.weapon_type = the_type;
var _local2 = this.fireAt(this.WeaponController.weapon_target, this.damage_effective);
this.weapon_type = _local3;
return(_local2);
};
this.specialPickOne = function (the_list) {
if (the_list.length <= 1) {
return(the_list);
}
var _local2 = Math.floor(Math.random() * the_list.length);
return(the_list[_local2]);
};
this.specialPickTwo = function (the_list) {
if (the_list.length <= 2) {
return(the_list);
}
var _local2 = the_list.length;
while (_local2-- , _local2) {
var _local3 = Math.floor(Math.random() * (_local2 + 1));
var _local4 = the_list[_local2];
var _local5 = the_list[_local3];
the_list[_local2] = _local5;
the_list[_local3] = _local4;
}
var _local6 = new Array();
_local6.push(the_list[0]);
_local6.push(the_list[1]);
return(_local6);
};
this.specialTake = function (in_list) {
if (typeof(in_list) == "movieclip") {
in_list = new Array(input);
}
var _local4 = 0;
while (_local4 < in_list.length) {
the_turret = in_list[_local4];
the_turret.special_fired = new Date();
var _local7 = "SpecialTake";
var _local6 = _root.getNextHighestDepth();
var _local8 = _local7 + _local6;
var _local3 = _root.attachMovie(_local7, _local8, _local6);
var _local5 = _root.degreesToTarget(the_turret, this);
_local3._rotation = _local5;
_local3._x = the_turret._x;
_local3._y = the_turret._y;
the_turret.Weapon._rotation = _local5;
_local4++;
}
};
this.specialFired = function () {
the_turret = this;
the_turret.special_fired = new Date();
var _local5 = "SpecialFire";
var _local4 = _root.getNextHighestDepth();
var _local6 = _local5 + _local4;
var _local3 = _root.attachMovie(_local5, _local6, _local4);
_local3._rotation = the_turret._rotation;
_local3._x = the_turret._x;
_local3._y = the_turret._y;
};
this.specialPointAtMe = function (the_turret) {
deg = _root.degreesToTarget(the_turret, this);
the_turret.Weapon._rotation = deg;
};
this.specialCanFire = function () {
if (this.special_capable != true) {
return(false);
}
var _local7 = new Date();
var _local2 = _local7.getTime();
var _local9 = this.weapon_fired.getTime();
var _local6 = this.special_fired.getTime();
var _local8 = _local2 - _local9;
var _local4 = 1000 / (this.rate_effective / 60);
if (_local8 < _local4) {
return(false);
}
var _local3 = _local2 - _local6;
var _local5 = 1000 / (this.special_rate / 60);
if (_local3 < _local5) {
return(false);
}
return(true);
};
this.specialFindMinepoints = function () {
this.special_minepoints = new Array();
var _local13 = this.getMax("range");
var _local10 = _root.AttackerPath.getMinePoints();
var _local3 = 0;
while (_local3 < _local10.length) {
var _local4 = _local10[_local3];
var _local5 = _local4._x;
var _local6 = _local4._y;
var _local7 = _local5 - this._x;
var _local8 = _local6 - this._y;
var _local9 = Math.sqrt((_local7 * _local7) + (_local8 * _local8));
if (_local9 <= _local13) {
this.mine_locations.push(new Object({x:_local5, y:_local6}));
}
_local3++;
}
this.mine_located = true;
};
this.specialFindMinepoints();
this.specialFireClusterBomb = function () {
this.specialFired();
var _local3 = "ClusterBomb";
var _local2 = this.specialFireBullet(_local3);
_local2.cluster_qty = 5;
_local2.cluster_holding = true;
_local2.cluster_damage = this.modifyDamage(1000000);
_local2.bullet_damage = this.modifyDamage(1000000);
this.specialTake(this.specialPickOne(this.special_red));
return(_local2);
};
this.specialFireBigClusterBomb = function () {
this.specialFired();
var _local3 = "ClusterBomb";
var _local2 = this.specialFireBullet(_local3);
_local2.cluster_qty = 10;
_local2.cluster_holding = true;
_local2.cluster_damage = this.modifyDamage(2000000);
_local2.bullet_damage = this.modifyDamage(2000000);
_local2.blast = true;
_local2.blast_type = "BlastLarge";
_local2.blast_damage = this.modifyDamage(3000000);
this.specialTake(this.specialPickTwo(this.special_red));
return(_local2);
};
this.specialFireLaserClusterBomb = function () {
this.specialFired();
var _local3 = "ClusterBomb";
var _local2 = this.specialFireBullet(_local3);
_local2.cluster_qty = 5;
_local2.cluster_holding = true;
_local2.cluster_damage = this.modifyDamage(2000000);
_local2.cluster_laser = true;
_local2.bullet_damage = this.modifyDamage(2000000);
_local2.blast = true;
_local2.blast_type = "BlastMedium";
_local2.blast_damage = this.modifyDamage(3000000);
this.specialTake(this.specialPickOne(this.special_red));
this.specialTake(this.specialPickOne(this.special_green));
return(_local2);
};
this.specialFireBigLaserClusterBomb = function () {
this.specialFired();
var _local3 = "ClusterBomb";
var _local2 = this.specialFireBullet(_local3);
_local2.cluster_qty = 10;
_local2.cluster_holding = true;
_local2.cluster_damage = this.modifyDamage(4000000);
_local2.cluster_laser = true;
_local2.bullet_damage = this.modifyDamage(4000000);
_local2.blast = true;
_local2.blast_type = "BlastLarge";
_local2.blast_damage = this.modifyDamage(5000000);
this.specialTake(this.specialPickTwo(this.special_red));
this.specialTake(this.specialPickOne(this.special_green));
return(_local2);
};
this.specialFireLandmine = function () {
this.specialFired();
if (!this.mine_located) {
this.specialFindMinepoints();
this.mine_located = true;
}
this.specialTake(this.specialPickOne(this.special_blue));
var _local4 = "Landmine";
var _local3 = this.specialFireBullet(_local4);
_local3.mine_location = this.specialPickOne(this.mine_locations);
_local3._x = this._x;
_local3._y = this._y;
_local3.blast = true;
_local3.cluster = false;
_local3.bullet_damage = this.modifyDamage(1000000);
_root.mines.push(_local3);
return(_local3);
};
this.specialFireBigLandmine = function () {
this.specialFired();
if (!this.mine_located) {
this.specialFindMinepoints();
this.mine_located = true;
}
var _local4 = "LandmineBig";
var _local3 = this.specialFireBullet(_local4);
_local3.mine_location = this.specialPickOne(this.mine_locations);
_local3.bullet_damage = this.modifyDamage(2000000);
_local3.cluster = false;
_local3.blast = true;
_local3.blast_type = "BlastLarge";
_local3.blast_damage = this.modifyDamage(3000000);
this.specialTake(this.specialPickOne(this.special_red));
this.specialTake(this.specialPickOne(this.special_blue));
_root.mines.push(_local3);
return(_local3);
};
this.specialFireBigClusterLandmine = function () {
this.specialFired();
if (!this.mine_located) {
this.specialFindMinepoints();
this.mine_located = true;
}
var _local4 = "LandmineBigCluster";
var _local3 = this.specialFireBullet(_local4);
_local3.mine_location = this.specialPickOne(this.mine_locations);
_local3.bullet_damage = this.modifyDamage(4000000);
_local3.cluster = true;
_local3.cluster_qty = 10;
_local3.cluster_holding = true;
_local3.cluster_damage = this.modifyDamage(4000000);
_local3.cluster_laser = false;
_local3.bullet_damage = this.modifyDamage(4000000);
_local3.blast = true;
_local3.blast_type = "BlastLarge";
_local3.blast_damage = this.modifyDamage(4000000);
this.specialTake(this.specialPickTwo(this.special_red));
this.specialTake(this.specialPickOne(this.special_blue));
_root.mines.push(_local3);
return(_local3);
};
this.specialFireBigLaserClusterLandmine = function () {
this.specialFired();
if (!this.mine_located) {
this.specialFindMinepoints();
this.mine_located = true;
}
var _local4 = "LandmineBigClusterLaser";
var _local3 = this.specialFireBullet(_local4);
_local3.mine_location = this.specialPickOne(this.mine_locations);
_local3.bullet_damage = this.modifyDamage(5000000);
_local3.cluster = true;
_local3.cluster_qty = 10;
_local3.cluster_holding = true;
_local3.cluster_damage = this.modifyDamage(5000000);
_local3.cluster_laser = true;
_local3.bullet_damage = this.modifyDamage(5000000);
_local3.blast = true;
_local3.blast_type = "BlastLarge";
_local3.blast_damage = this.modifyDamage(5000000);
this.specialTake(this.specialPickTwo(this.special_red));
this.specialTake(this.specialPickOne(this.special_blue));
this.specialTake(this.specialPickOne(this.special_green));
_root.mines.push(_local3);
return(_local3);
};
this.specialFireBFG = function () {
this.specialFired();
var _local3 = this.linkFire(this, 0);
var _local2 = this.specialFireBullet("BFG");
_local2.bullet_damage = this.modifyDamage(5000000 + _local3);
_local2.laser_damage = this.modifyDamage(5000000 + _local3);
_local2.laser_rate = 240;
this.specialTake(this.specialPickOne(this.special_red));
this.specialTake(this.specialPickOne(this.special_blue));
return(true);
};
this.specialFireRocketBFG = function () {
this.specialFired();
var _local3 = this.linkFire(this, 0);
var _local2 = this.specialFireBullet("BFGRocket");
this.specialTake(this.specialPickOne(this.special_blue));
this.specialTake(this.specialPickTwo(this.special_red));
_local2.bullet_damage = this.modifyDamage(5000000 + _local3);
_local2.laser_damage = this.modifyDamage(5000000 + _local3);
_local2.laser_rate = 240;
return(true);
};
this.specialFireLaserRocket = function () {
this.specialFired();
var _local2 = this.fireAt(this.WeaponController.weapon_target, this.damage_effective);
var _local3 = this.specialPickOne(this.special_green);
var _local4 = _local3.linkFire(this, 0);
this.specialTake(_local3);
_local2.laser_capable = true;
_local2.laser_damage = this.modifyDamage(_local4);
_local2.bullet_speed = 100;
return(true);
};
this.specialFirePoisonGas = function () {
this.specialFired();
var _local2 = this.specialFireBullet("RocketPoison");
_local2.bullet_speed = 150;
_local2.holding_pattern = true;
this.specialTake(this.specialPickOne(this.special_green));
this.specialTake(this.specialPickOne(this.special_blue));
return(true);
};
this.specialFireNuke = function () {
this.specialFired();
var _local2 = this.specialFireBullet("RocketNuke");
_local2.bullet_speed = 150;
_local2.holding_pattern = true;
_local2.weapon_damage = this.modifyDamage(5000000);
this.specialTake(this.specialPickTwo(this.special_blue));
return(true);
};
this.specialFire = function () {
this.specialGetInRange();
var _local3 = this.special_blue.length;
var _local4 = this.special_green.length;
var _local2 = this.special_red.length;
if (((_local2 >= 2) && (_local4 >= 1)) && (_local3 >= 1)) {
return(this.specialFireBigLaserClusterLandmine());
}
if ((_local2 >= 2) && (_local3 >= 1)) {
return(this.specialFireBigClusterLandmine());
}
if ((_local2 >= 2) && (_local4 >= 1)) {
return(this.specialFireBigLaserClusterBomb());
}
if ((_local2 >= 1) && (_local4 >= 1)) {
return(this.specialFireLaserClusterBomb());
}
if (_local2 >= 2) {
return(this.specialFireBigClusterBomb());
}
if ((_local2 >= 1) && (_local3 >= 1)) {
return(this.specialFireBigLandmine());
}
if (_local2 >= 1) {
return(this.specialFireClusterBomb());
}
if (_local3 >= 1) {
return(this.specialFireLandmine());
}
return(false);
};
this.tryFiring = function (the_rate, the_damage) {
var _local4 = 1000 / (the_rate / 60);
var _local6 = 1000 / (this.special_rate / 60);
var _local2 = new Date();
var _local5 = _local2.getTime();
var _local7 = this.weapon_fired.getTime();
var _local8 = _local5 - _local7;
if (this.WeaponController.acquire()) {
if (_local8 >= _local4) {
if (this.WeaponController.targetInRange()) {
this.WeaponController.pointAtTarget(this, this.Weapon);
var _local3 = _local2.getTime() - this.special_fired.getTime();
if ((this.special_capable == true) && (_local3 > _local6)) {
if (this.specialFire()) {
} else {
this.fireAt(this.WeaponController.weapon_target, the_damage);
}
} else {
this.fireAt(this.WeaponController.weapon_target, the_damage);
}
}
}
}
};
this.stop();
if (this.active == true) {
this.gotoAndPlay("Fire");
}
this.IndicateDamage.init_val = this.upgradeLevelAsPercent("damage");
this.IndicateRange.init_val = this.upgradeLevelAsPercent("range");
this.IndicateRate.init_val = this.upgradeLevelAsPercent("rate");
_root.profileThis(this);
_root.profileThis(this.WeaponController);
Symbol 479 MovieClip [TurretBlue] Frame 4
this.stop();
var time_now = new Date();
var the_time = time_now.getTime();
if ((this.freak_available == true) && ((the_time - this.freak_next) >= 0)) {
this.freakOut();
} else {
this.tryFiring(this.rate_effective, this.damage_effective);
}
this.play();
Symbol 479 MovieClip [TurretBlue] Frame 7
this.gotoAndPlay("Fire");
Symbol 479 MovieClip [TurretBlue] Frame 10
this.stop();
var time_now = new Date();
time_now = time_now.getTime();
var freak_time = (time_now - this.freak_start);
var fire_time = (time_now - this.weapon_fired.getTime());
if (freak_time <= this.freak_total_time) {
if (freak_time <= this.freak_warn_time) {
if (this.freak_warning == false) {
var warn = attachMovie("TurretFreakWarning", "FreakWarn", this.getNextHighestDepth());
this.freak_warning = warn;
}
this.tryFiring(this.rate_effective, this.damage_effective);
} else {
if (this.freak_warning) {
this.freak_warning.removeMovieClip();
}
var new_rate = (this.rate_effective * this.freak_rate_mult);
var new_dmg = (this.damage_effective * this.freak_damage_mult);
this.tryFiring(new_rate, new_dmg);
this.freakOutJitter();
}
this.play();
} else {
this.Weapon._x = this.freak_start_x;
this.Weapon._y = this.freak_start_y;
this.freak_next = this.freakOutNext();
this.gotoAndPlay("Fire");
}
Symbol 479 MovieClip [TurretBlue] Frame 11
this.gotoAndPlay("Freakout");
Symbol 479 MovieClip [TurretBlue] Frame 14
this.stop();
Symbol 481 MovieClip [TurretRed] Frame 1
if (this.active == undefined) {
this.active = true;
}
if (!this.weapon_damage) {
this.weapon_damage = 50;
}
if (!this.weapon_range) {
this.weapon_range = 200;
}
if (!this.weapon_rate) {
this.weapon_rate = 50;
}
this.weapon_angle = 0;
this.weapon_type = "Rocket";
this.weapon_fired = 0;
this.weapon_fire_count = 0;
this.weapon_kill_count = 0;
this.Highlight._visible = false;
if (!this.cash_value) {
this.cash_value = 0;
}
this.holding_pattern = false;
this.holding_round = false;
this.WeaponController.weapon_range = this.weapon_range;
this.WeaponController.weapon = this.Weapon;
this.fireAt = function (the_target, the_damage) {
this.Weapon.fire();
this.weapon_fired = new Date();
this.weapon_fire_count++;
_root.WeaponFired();
var _local7 = "RedBullet" + this.weapon_fire_count;
var _local5 = this.weapon_type;
var _local6 = _root.getNextHighestDepth();
var _local3 = _root.attachMovie(_local5, _local7, _local6);
var _local4 = new Object();
_local4.x = this.Weapon.FirePoint._x;
_local4.y = this.Weapon.FirePoint._y;
this.Weapon.localToGlobal(_local4);
_local3._x = _local4.x;
_local3._y = _local4.y;
_local3._rotation = this.Weapon._rotation;
_local3.bullet_target = the_target;
_local3.bullet_damage = the_damage;
_local3.turret = this;
_local3.holding_pattern = this.holding_pattern;
if (this.holding_round == true) {
_local3.holding_initially = this.holding_round;
this.holdingAdd(_local3);
}
_root.TurretFired(_local3);
_root.soundEffect("RocketFire");
return(_local3);
};
this.notifyGone = function (the_turret) {
return(true);
};
this.onPress = function () {
if (this._parent.cur_turret) {
_root.TurretHighlightHide();
}
if (this._parent.cur_turret == this) {
this._parent.cur_turret = false;
_root.TurretHighlightHide();
} else {
this._parent.cur_turret = this;
_root.TurretHighlightShow();
}
};
if (this.damage_added == undefined) {
this.damage_added = 0;
}
if (this.damage_mult == undefined) {
this.damage_mult = 1;
}
if (this.range_added == undefined) {
this.range_added = 0;
}
if (this.range_mult == undefined) {
this.range_mult = 1;
}
if (this.rate_added == undefined) {
this.rate_added = 0;
}
if (this.rate_mult == undefined) {
this.rate_mult = 1;
}
if (this.damage_effective == undefined) {
this.damage_effective = this.weapon_damage;
}
if (this.range_effective == undefined) {
this.range_effective = this.weapon_range;
}
if (this.rate_effective == undefined) {
this.rate_effective = this.weapon_rate;
}
this.turrets_in_range = new Array();
this.modify_possible = true;
this.modifyGain = function (the_type, the_amount) {
if (this.modify_possible == false) {
return(false);
}
var _local2 = parseFloat(the_amount);
if (the_type == "damage_added") {
this.damage_added = this.damage_added + _local2;
} else if (the_type == "damage_mult") {
this.damage_mult = this.damage_mult + _local2;
} else if (the_type == "range_added") {
this.range_added = this.range_added + _local2;
} else if (the_type == "range_mult") {
this.range_mult = this.range_mult + _local2;
} else if (the_type == "rate_added") {
this.rate_added = this.rate_added + _local2;
} else if (the_type == "rate_mult") {
this.rate_mult = this.rate_mult + _local2;
}
if (_local2 > 0) {
}
this.modifyUpdate();
};
this.modifyUpdate = function () {
this.damage_effective = this.modifyDamage(this.weapon_damage);
this.range_effective = this.modifyRange(this.weapon_range);
this.rate_effective = this.modifyRate(this.weapon_rate);
this.WeaponController.weapon_range = this.range_effective;
return(true);
};
this.modifyDumpStats = function () {
trace((this + ": added damage ") + this.damage_added);
trace((this + ": added range ") + this.range_added);
trace((this + ": added rate ") + this.rate_added);
trace((this + ": mult damage ") + this.damage_mult);
trace((this + ": mult range ") + this.range_mult);
trace((this + ": mult rate ") + this.rate_mult);
trace((this + ": weapon damage ") + this.weapon_damage);
trace((this + ": weapon range ") + this.weapon_range);
trace((this + ": weapon rate ") + this.weapon_rate);
trace((this + ": effective damage ") + this.damage_effective);
trace((this + ": effective range ") + this.range_effective);
trace((this + ": effective rate ") + this.rate_effective);
};
this.modifyLose = function (the_type, the_amount) {
this.modifyGain(the_type, -the_amount);
};
this.modifyDamage = function (the_amount) {
var _local3 = parseFloat(the_amount);
var _local2 = (_local3 + this.damage_added) * this.damage_mult;
_local2 = Math.max(_local2, 0);
return(_local2);
};
this.modifyRange = function (the_amount) {
var _local3 = parseFloat(the_amount);
var _local2 = (_local3 + this.range_added) * this.range_mult;
_local2 = Math.max(_local2, 0);
return(_local2);
};
this.modifyRate = function (the_amount) {
var _local3 = parseFloat(the_amount);
var _local2 = (_local3 + this.rate_added) * this.rate_mult;
_local2 = Math.max(_local2, 0);
return(_local2);
};
this.modifyGetInRange = function (the_range) {
this.turrets_in_range = new Array();
var _local9 = the_range;
var _local8 = _root.turrets;
var _local3 = 0;
while (_local3 < _local8.length) {
var _local4 = _local8[_local3];
if (point != this) {
var _local5 = _local4._x - this._x;
var _local6 = _local4._y - this._y;
var _local7 = Math.sqrt((_local5 * _local5) + (_local6 * _local6));
if (_local7 <= _local9) {
this.turrets_in_range.push(_local4);
}
}
_local3++;
}
};
this.modifyAssert = function () {
var _local2 = 0;
while (_local2 < this.turrets_in_range.length) {
var _local3 = this.turrets_in_range[_local2];
this._modifyAssert(_local3);
_local2++;
}
};
this._modifyAssert = function (the_turret) {
the_turret.modifyGain("damage_added", this.modify_damage);
the_turret.modifyGain("range_added", this.modify_range);
the_turret.modifyGain("rate_added", this.modify_rate);
the_turret.modifyGain("damage_mult", this.modify_damage_mult);
the_turret.modifyGain("range_mult", this.modify_range_mult);
the_turret.modifyGain("rate_mult", this.modify_rate_mult);
};
this.modifyUnAssert = function (the_turret) {
the_turret.modifyLose("damage_added", this.modify_damage);
the_turret.modifyLose("range_added", this.modify_range);
the_turret.modifyLose("rate_added", this.modify_rate);
the_turret.modifyLose("damage_mult", this.modify_damage_mult);
the_turret.modifyLose("range_mult", this.modify_range_mult);
the_turret.modifyLose("rate_mult", this.modify_rate_mult);
};
this.modifyNotifyNew = function (the_turret) {
var _local3 = the_turret._x - this._x;
var _local4 = the_turret._y - this._y;
var _local5 = Math.sqrt((_local3 * _local3) + (_local4 * _local4));
if (_local5 <= this.weapon_range) {
this.turrets_in_range.push(the_turret);
this._modifyAssert(the_turret);
}
};
this.holding_current = new Array();
this.holding_max = 4;
this.upgrade_holding_damage = 0;
this.upgrade_holding_range = 3;
this.upgrade_holding_rate = 3;
this.holdingAdd = function (shell) {
this.holding_current.push(shell);
};
this.holdingFinished = function (shell) {
var _local3 = new Array();
for (var _local4 in this.holding_current) {
var _local2 = this.holding_current[_local4];
if (_local2 != shell) {
_local3.push(_local2);
}
}
this.holding_current = _local3;
};
this.holdingEmpty = function () {
this.holding_current = new Array();
};
if (!this.upgrade_damage_level) {
this.upgrade_damage_level = 0;
}
if (!this.upgrade_range_level) {
this.upgrade_range_level = 0;
}
if (!this.upgrade_rate_level) {
this.upgrade_rate_level = 0;
}
this.max_damage = 0;
this.max_range = 0;
this.max_rate = 0;
this.max_built = false;
this.cost_damage = 0;
this.cost_range = 0;
this.cost_rate = 0;
this.cost_built = false;
this.upgrade_to_damage = 0;
this.upgrade_to_range = 0;
this.upgrade_to_rate = 0;
this.upgrade_to_built = false;
this.upgrade_pct_damage = 0;
this.upgrade_pct_range = 0;
this.upgrade_pct_rate = 0;
this.upgrade_pct_built = false;
this.upgrade_weapon_at_damage = new Array();
this._upgradeDone = function () {
this.cost_built = false;
this.upgrade_to_built = false;
this.upgrade_pct_built = false;
var _local2 = this.getMax("damage");
if (_local2 == this.weapon_damage) {
this.special_capable = true;
}
this.IndicateDamage.setPercentage(this.upgradeLevelAsPercent("damage"));
this.IndicateRange.setPercentage(this.upgradeLevelAsPercent("range"));
this.IndicateRate.setPercentage(this.upgradeLevelAsPercent("rate"));
this.modifyUpdate();
this.upgradeDone();
};
this.upgradeGetWeaponAtDamage = function (the_damage) {
if (this.upgrade_weapon_at_damage[the_damage]) {
return(this.upgrade_weapon_at_damage[the_damage]);
}
var _local8 = this.getMax("damage");
if (the_damage > _local8) {
return(this.max_bullet);
}
var _local6 = 0;
var _local4 = this.getMax("damage");
var _local5 = 0;
for (var _local7 in this.upgrade_damage) {
_local5++;
}
for (var _local7 in this.upgrade_damage) {
_local6 = _local4;
_local4 = parseInt(_local7);
if ((the_damage < _local6) && (the_damage >= _local4)) {
var _local2 = this.upgrade_bullet[_local5];
this.upgrade_weapon_at_damage[the_damage] = _local2;
return(_local2);
}
_local5--;
}
return(this.weapon_type);
};
this.getUpgrade = function (the_type) {
if (this.cost_built == false) {
this.upgrade_to_damage = this._getUpgrade("damage");
this.upgrade_to_range = this._getUpgrade("range");
this.upgrade_to_rate = this._getUpgrade("rate");
this.upgrade_to_built = true;
}
if (the_type == "damage") {
return(this.upgrade_to_damage);
}
if (the_type == "range") {
return(this.upgrade_to_range);
}
if (the_type == "rate") {
return(this.upgrade_to_rate);
}
return(false);
};
this._getUpgrade = function (the_type) {
var _local2 = new Array();
var _local3 = false;
if (the_type == "damage") {
_local2 = this.upgrade_damage;
_local3 = this.upgrade_damage_level;
} else if (the_type == "range") {
_local2 = this.upgrade_range;
_local3 = this.upgrade_range_level;
} else if (the_type == "rate") {
_local2 = this.upgrade_rate;
_local3 = this.upgrade_rate_level;
} else {
return(false);
}
var _local4 = 0;
for (var _local5 in _local2) {
_local4++;
}
if (_local3 >= _local4) {
return(false);
}
count = _local4 - 1;
for (var _local5 in _local2) {
if (count eq _local3) {
return(_local5);
}
count--;
}
return(false);
};
this.getUpgradeCost = function (the_type) {
if (this.cost_built == false) {
this.cost_damage = this._getUpgradeCost("damage");
this.cost_range = this._getUpgradeCost("range");
this.cost_rate = this._getUpgradeCost("rate");
this.cost_built = true;
}
if (the_type == "damage") {
return(this.cost_damage);
}
if (the_type == "range") {
return(this.cost_range);
}
if (the_type == "rate") {
return(this.cost_rate);
}
return(false);
};
this._getUpgradeCost = function (the_type) {
var _local2;
var _local3;
if (the_type == "damage") {
_local2 = this.upgrade_damage;
_local3 = this.upgrade_damage_level;
} else if (the_type == "range") {
_local2 = this.upgrade_range;
_local3 = this.upgrade_range_level;
} else if (the_type == "rate") {
_local2 = this.upgrade_rate;
_local3 = this.upgrade_rate_level;
} else {
return(false);
}
var _local4 = 0;
for (var _local5 in _local2) {
_local4++;
}
if (_local3 >= _local4) {
return(false);
}
count = _local4 - 1;
for (var _local5 in _local2) {
if (count eq _local3) {
return(_local2[_local5]);
}
count--;
}
return(false);
};
this.getMax = function (the_type) {
if (this.max_built == false) {
this.max_damage = this._getMax("damage");
this.max_range = this._getMax("range");
this.max_rate = this._getMax("rate");
this.max_built = true;
}
if (the_type == "damage") {
return(this.max_damage);
}
if (the_type == "range") {
return(this.max_range);
}
if (the_type == "rate") {
return(this.max_rate);
}
return(false);
};
this._getMax = function (the_type) {
var _local5;
var _local7;
if (the_type == "damage") {
_local5 = this.upgrade_damage;
_local7 = this.upgrade_damage_level;
} else if (the_type == "range") {
_local5 = this.upgrade_range;
_local7 = this.upgrade_range_level;
} else if (the_type == "rate") {
_local5 = this.upgrade_rate;
_local7 = this.upgrade_rate_level;
} else {
return(false);
}
var _local4 = new Number(0);
for (var _local6 in _local5) {
var _local3 = new Number(_local6);
var _local2 = _local3.valueOf();
if (_local2 > _local4) {
_local4 = _local2;
}
}
return(_local4);
};
this.upgradeDamage = function () {
var _local4 = this.upgrade_damage;
var _local8 = this.upgrade_damage_level;
var _local6 = _local8 + 1;
var _local5 = 0;
for (var _local7 in _local4) {
_local5++;
}
if (_local6 > _local5) {
return(false);
}
count = _local5;
for (var _local7 in _local4) {
if (count eq _local6) {
var _local3 = _local4[_local7];
if (_root.Payment(_local3)) {
this.cash_value = this.cash_value + _local3;
this.weapon_damage = _local7;
this.upgrade_damage_level++;
this._upgradeDone();
return(true);
}
return(false);
}
count--;
}
return(false);
};
this.upgradeRange = function () {
var _local4 = this.upgrade_range;
var _local8 = this.upgrade_range_level;
var _local6 = _local8 + 1;
var _local5 = 0;
for (var _local7 in _local4) {
_local5++;
}
if (_local6 > _local5) {
return(false);
}
count = _local5;
for (var _local7 in _local4) {
if (count eq _local6) {
var _local3 = _local4[_local7];
if (_root.Payment(_local3)) {
this.cash_value = this.cash_value + _local3;
this.weapon_range = _local7;
this.upgrade_range_level++;
this._upgradeDone();
return(true);
}
return(false);
}
count--;
}
return(false);
};
this.upgradeRate = function () {
var _local4 = this.upgrade_rate;
var _local8 = this.upgrade_rate_level;
var _local6 = _local8 + 1;
var _local5 = 0;
for (var _local7 in _local4) {
_local5++;
}
if (_local6 > _local5) {
return(false);
}
count = _local5;
for (var _local7 in _local4) {
if (count eq _local6) {
var _local3 = _local4[_local7];
if (_root.Payment(_local3)) {
this.cash_value = this.cash_value + _local3;
this.weapon_rate = _local7;
this.upgrade_rate_level++;
this._upgradeDone();
return(true);
}
return(false);
}
count--;
}
return(false);
};
this.upgradeLevelAsPercent = function (the_type) {
if (this.upgrade_pct_built == false) {
this.upgrade_pct_damage = this._upgradeLevelAsPercent("damage");
this.upgrade_pct_range = this._upgradeLevelAsPercent("range");
this.upgrade_pct_rate = this._upgradeLevelAsPercent("rate");
this.upgrade_pct_built = true;
}
if (the_type == "damage") {
return(this.upgrade_pct_damage);
}
if (the_type == "range") {
return(this.upgrade_pct_range);
}
if (the_type == "rate") {
return(this.upgrade_pct_rate);
}
return(false);
};
this._upgradeLevelAsPercent = function (the_type) {
var _local2;
var _local5;
if (the_type == "damage") {
_local2 = this.upgrade_damage;
_local5 = this.upgrade_damage_level;
} else if (the_type == "range") {
_local2 = this.upgrade_range;
_local5 = this.upgrade_range_level;
} else if (the_type == "rate") {
_local2 = this.upgrade_rate;
_local5 = this.upgrade_rate_level;
} else {
return(false);
}
var _local3 = 0;
for (var _local4 in _local2) {
_local3++;
}
var _local7 = Math.ceil((_local5 / _local3) * 100);
return(_local7);
};
this.upgrade_damage = new Array();
this.upgrade_damage["120"] = 50;
this.upgrade_damage["350"] = 100;
this.upgrade_damage["800"] = 200;
this.upgrade_damage["1950"] = 350;
this.upgrade_damage["6050"] = 650;
this.upgrade_damage["11500"] = 1200;
this.upgrade_damage["27000"] = 1300;
this.upgrade_damage["48900"] = 1500;
this.upgrade_damage["65000"] = 1500;
this.upgrade_range = new Array();
this.upgrade_range["210"] = 35;
this.upgrade_range["220"] = 80;
this.upgrade_range["230"] = 160;
this.upgrade_range["250"] = 400;
this.upgrade_range["275"] = 900;
this.upgrade_range["300"] = 1100;
this.upgrade_range["325"] = 1300;
this.upgrade_range["350"] = 1500;
this.upgrade_rate = new Array();
this.upgrade_rate["60"] = 30;
this.upgrade_rate["70"] = 60;
this.upgrade_rate["85"] = 115;
this.upgrade_rate["100"] = 200;
this.upgrade_rate["115"] = 340;
this.upgrade_rate["135"] = 600;
this.upgrade_rate["155"] = 900;
this.upgrade_rate["180"] = 1050;
this.upgrade_rate["210"] = 1150;
this.upgrade_bullet = new Array();
this.upgrade_bullet["1"] = "Rocket";
this.upgrade_bullet["2"] = "Rocket2";
this.upgrade_bullet["3"] = "Rocket3";
this.upgrade_bullet["4"] = "Rocket4";
this.upgrade_bullet["5"] = "Rocket5";
this.upgrade_bullet["6"] = "Rocket6";
this.upgrade_bullet["7"] = "Rocket7";
this.upgrade_bullet["8"] = "Rocket8";
this.upgrade_bullet["9"] = "Rocket9";
this.upgradeDone = function () {
this.modifyUpdate();
if (this.upgrade_bullet[upgrade_damage_level]) {
this.weapon_type = this.upgrade_bullet[upgrade_damage_level];
}
this.WeaponController.weapon_range = this.range_effective;
if (((this.upgrade_damage_level >= this.upgrade_holding_damage) && (this.upgrade_range_level >= this.upgrade_holding_range)) && (this.upgrade_rate_level >= this.upgrade_holding_rate)) {
this.holding_pattern = true;
}
};
this.special_capable = false;
this.special_fired = new Date();
this.special_range = 70;
this.special_rate = 7;
this.mine_locations = new Array();
this.mine_located = false;
this.specialGetInRange = function () {
var _local11 = this._x;
var _local12 = this._y;
this.special_blue = new Array();
this.special_green = new Array();
this.special_red = new Array();
var _local10 = this.special_range;
var _local3 = 0;
while (_local3 < _root.turrets.length) {
the_turret = _root.turrets[_local3];
var _local8 = the_turret._x;
var _local9 = the_turret._y;
var _local5 = _local8 - _local11;
var _local6 = _local9 - _local12;
var _local7 = Math.sqrt((_local6 * _local6) + (_local5 * _local5));
if ((((_local7 < _local10) && (the_turret.special_capable)) && (the_turret != this)) && (the_turret.specialCanFire() == true)) {
var _local4 = the_turret.turret_type;
if (_local4 == "Blue") {
special_blue.push(the_turret);
}
if (_local4 == "Green") {
special_green.push(the_turret);
}
if (_local4 == "Red") {
special_red.push(the_turret);
}
}
_local3++;
}
};
this.specialFireBullet = function (the_type) {
var _local3 = this.weapon_type;
this.weapon_type = the_type;
var _local2 = this.fireAt(this.WeaponController.weapon_target, this.damage_effective);
this.weapon_type = _local3;
return(_local2);
};
this.specialPickOne = function (the_list) {
if (the_list.length <= 1) {
return(the_list);
}
var _local2 = Math.floor(Math.random() * the_list.length);
return(the_list[_local2]);
};
this.specialPickTwo = function (the_list) {
if (the_list.length <= 2) {
return(the_list);
}
var _local2 = the_list.length;
while (_local2-- , _local2) {
var _local3 = Math.floor(Math.random() * (_local2 + 1));
var _local4 = the_list[_local2];
var _local5 = the_list[_local3];
the_list[_local2] = _local5;
the_list[_local3] = _local4;
}
var _local6 = new Array();
_local6.push(the_list[0]);
_local6.push(the_list[1]);
return(_local6);
};
this.specialTake = function (in_list) {
if (typeof(in_list) == "movieclip") {
in_list = new Array(input);
}
var _local4 = 0;
while (_local4 < in_list.length) {
the_turret = in_list[_local4];
the_turret.special_fired = new Date();
var _local7 = "SpecialTake";
var _local6 = _root.getNextHighestDepth();
var _local8 = _local7 + _local6;
var _local3 = _root.attachMovie(_local7, _local8, _local6);
var _local5 = _root.degreesToTarget(the_turret, this);
_local3._rotation = _local5;
_local3._x = the_turret._x;
_local3._y = the_turret._y;
the_turret.Weapon._rotation = _local5;
_local4++;
}
};
this.specialFired = function () {
the_turret = this;
the_turret.special_fired = new Date();
var _local5 = "SpecialFire";
var _local4 = _root.getNextHighestDepth();
var _local6 = _local5 + _local4;
var _local3 = _root.attachMovie(_local5, _local6, _local4);
_local3._rotation = the_turret._rotation;
_local3._x = the_turret._x;
_local3._y = the_turret._y;
};
this.specialPointAtMe = function (the_turret) {
deg = _root.degreesToTarget(the_turret, this);
the_turret.Weapon._rotation = deg;
};
this.specialCanFire = function () {
if (this.special_capable != true) {
return(false);
}
var _local7 = new Date();
var _local2 = _local7.getTime();
var _local9 = this.weapon_fired.getTime();
var _local6 = this.special_fired.getTime();
var _local8 = _local2 - _local9;
var _local4 = 1000 / (this.rate_effective / 60);
if (_local8 < _local4) {
return(false);
}
var _local3 = _local2 - _local6;
var _local5 = 1000 / (this.special_rate / 60);
if (_local3 < _local5) {
return(false);
}
return(true);
};
this.specialFindMinepoints = function () {
this.special_minepoints = new Array();
var _local13 = this.getMax("range");
var _local10 = _root.AttackerPath.getMinePoints();
var _local3 = 0;
while (_local3 < _local10.length) {
var _local4 = _local10[_local3];
var _local5 = _local4._x;
var _local6 = _local4._y;
var _local7 = _local5 - this._x;
var _local8 = _local6 - this._y;
var _local9 = Math.sqrt((_local7 * _local7) + (_local8 * _local8));
if (_local9 <= _local13) {
this.mine_locations.push(new Object({x:_local5, y:_local6}));
}
_local3++;
}
this.mine_located = true;
};
this.specialFindMinepoints();
this.specialFireClusterBomb = function () {
this.specialFired();
var _local3 = "ClusterBomb";
var _local2 = this.specialFireBullet(_local3);
_local2.cluster_qty = 5;
_local2.cluster_holding = true;
_local2.cluster_damage = this.modifyDamage(1000000);
_local2.bullet_damage = this.modifyDamage(1000000);
this.specialTake(this.specialPickOne(this.special_red));
return(_local2);
};
this.specialFireBigClusterBomb = function () {
this.specialFired();
var _local3 = "ClusterBomb";
var _local2 = this.specialFireBullet(_local3);
_local2.cluster_qty = 10;
_local2.cluster_holding = true;
_local2.cluster_damage = this.modifyDamage(2000000);
_local2.bullet_damage = this.modifyDamage(2000000);
_local2.blast = true;
_local2.blast_type = "BlastLarge";
_local2.blast_damage = this.modifyDamage(3000000);
this.specialTake(this.specialPickTwo(this.special_red));
return(_local2);
};
this.specialFireLaserClusterBomb = function () {
this.specialFired();
var _local3 = "ClusterBomb";
var _local2 = this.specialFireBullet(_local3);
_local2.cluster_qty = 5;
_local2.cluster_holding = true;
_local2.cluster_damage = this.modifyDamage(2000000);
_local2.cluster_laser = true;
_local2.bullet_damage = this.modifyDamage(2000000);
_local2.blast = true;
_local2.blast_type = "BlastMedium";
_local2.blast_damage = this.modifyDamage(3000000);
this.specialTake(this.specialPickOne(this.special_red));
this.specialTake(this.specialPickOne(this.special_green));
return(_local2);
};
this.specialFireBigLaserClusterBomb = function () {
this.specialFired();
var _local3 = "ClusterBomb";
var _local2 = this.specialFireBullet(_local3);
_local2.cluster_qty = 10;
_local2.cluster_holding = true;
_local2.cluster_damage = this.modifyDamage(4000000);
_local2.cluster_laser = true;
_local2.bullet_damage = this.modifyDamage(4000000);
_local2.blast = true;
_local2.blast_type = "BlastLarge";
_local2.blast_damage = this.modifyDamage(5000000);
this.specialTake(this.specialPickTwo(this.special_red));
this.specialTake(this.specialPickOne(this.special_green));
return(_local2);
};
this.specialFireLandmine = function () {
this.specialFired();
if (!this.mine_located) {
this.specialFindMinepoints();
this.mine_located = true;
}
this.specialTake(this.specialPickOne(this.special_blue));
var _local4 = "Landmine";
var _local3 = this.specialFireBullet(_local4);
_local3.mine_location = this.specialPickOne(this.mine_locations);
_local3._x = this._x;
_local3._y = this._y;
_local3.blast = true;
_local3.cluster = false;
_local3.bullet_damage = this.modifyDamage(1000000);
_root.mines.push(_local3);
return(_local3);
};
this.specialFireBigLandmine = function () {
this.specialFired();
if (!this.mine_located) {
this.specialFindMinepoints();
this.mine_located = true;
}
var _local4 = "LandmineBig";
var _local3 = this.specialFireBullet(_local4);
_local3.mine_location = this.specialPickOne(this.mine_locations);
_local3.bullet_damage = this.modifyDamage(2000000);
_local3.cluster = false;
_local3.blast = true;
_local3.blast_type = "BlastLarge";
_local3.blast_damage = this.modifyDamage(3000000);
this.specialTake(this.specialPickOne(this.special_red));
this.specialTake(this.specialPickOne(this.special_blue));
_root.mines.push(_local3);
return(_local3);
};
this.specialFireBigClusterLandmine = function () {
this.specialFired();
if (!this.mine_located) {
this.specialFindMinepoints();
this.mine_located = true;
}
var _local4 = "LandmineBigCluster";
var _local3 = this.specialFireBullet(_local4);
_local3.mine_location = this.specialPickOne(this.mine_locations);
_local3.bullet_damage = this.modifyDamage(4000000);
_local3.cluster = true;
_local3.cluster_qty = 10;
_local3.cluster_holding = true;
_local3.cluster_damage = this.modifyDamage(4000000);
_local3.cluster_laser = false;
_local3.bullet_damage = this.modifyDamage(4000000);
_local3.blast = true;
_local3.blast_type = "BlastLarge";
_local3.blast_damage = this.modifyDamage(4000000);
this.specialTake(this.specialPickTwo(this.special_red));
this.specialTake(this.specialPickOne(this.special_blue));
_root.mines.push(_local3);
return(_local3);
};
this.specialFireBigLaserClusterLandmine = function () {
this.specialFired();
if (!this.mine_located) {
this.specialFindMinepoints();
this.mine_located = true;
}
var _local4 = "LandmineBigClusterLaser";
var _local3 = this.specialFireBullet(_local4);
_local3.mine_location = this.specialPickOne(this.mine_locations);
_local3.bullet_damage = this.modifyDamage(5000000);
_local3.cluster = true;
_local3.cluster_qty = 10;
_local3.cluster_holding = true;
_local3.cluster_damage = this.modifyDamage(5000000);
_local3.cluster_laser = true;
_local3.bullet_damage = this.modifyDamage(5000000);
_local3.blast = true;
_local3.blast_type = "BlastLarge";
_local3.blast_damage = this.modifyDamage(5000000);
this.specialTake(this.specialPickTwo(this.special_red));
this.specialTake(this.specialPickOne(this.special_blue));
this.specialTake(this.specialPickOne(this.special_green));
_root.mines.push(_local3);
return(_local3);
};
this.specialFireBFG = function () {
this.specialFired();
var _local3 = this.linkFire(this, 0);
var _local2 = this.specialFireBullet("BFG");
_local2.bullet_damage = this.modifyDamage(5000000 + _local3);
_local2.laser_damage = this.modifyDamage(5000000 + _local3);
_local2.laser_rate = 240;
this.specialTake(this.specialPickOne(this.special_red));
this.specialTake(this.specialPickOne(this.special_blue));
return(true);
};
this.specialFireRocketBFG = function () {
this.specialFired();
var _local3 = this.linkFire(this, 0);
var _local2 = this.specialFireBullet("BFGRocket");
this.specialTake(this.specialPickOne(this.special_blue));
this.specialTake(this.specialPickTwo(this.special_red));
_local2.bullet_damage = this.modifyDamage(5000000 + _local3);
_local2.laser_damage = this.modifyDamage(5000000 + _local3);
_local2.laser_rate = 240;
return(true);
};
this.specialFireLaserRocket = function () {
this.specialFired();
var _local2 = this.fireAt(this.WeaponController.weapon_target, this.damage_effective);
var _local3 = this.specialPickOne(this.special_green);
var _local4 = _local3.linkFire(this, 0);
this.specialTake(_local3);
_local2.laser_capable = true;
_local2.laser_damage = this.modifyDamage(_local4);
_local2.bullet_speed = 100;
return(true);
};
this.specialFirePoisonGas = function () {
this.specialFired();
var _local2 = this.specialFireBullet("RocketPoison");
_local2.bullet_speed = 150;
_local2.holding_pattern = true;
this.specialTake(this.specialPickOne(this.special_green));
this.specialTake(this.specialPickOne(this.special_blue));
return(true);
};
this.specialFireNuke = function () {
this.specialFired();
var _local2 = this.specialFireBullet("RocketNuke");
_local2.bullet_speed = 150;
_local2.holding_pattern = true;
_local2.weapon_damage = this.modifyDamage(5000000);
this.specialTake(this.specialPickTwo(this.special_blue));
return(true);
};
this.specialFire = function () {
this.specialGetInRange();
var _local2 = this.special_blue.length;
var _local3 = this.special_green.length;
var _local4 = this.special_red.length;
if (_local2 >= 2) {
this.specialFireNuke();
} else {
if ((_local2 >= 1) && (_local3 >= 1)) {
return(this.specialFirePoisonGas());
}
if (_local3 >= 1) {
return(this.specialFireLaserRocket());
}
return(false);
}
};
this.stop();
if (this.active == true) {
this.gotoAndPlay("Fire");
}
this.IndicateDamage.init_val = this.upgradeLevelAsPercent("damage");
this.IndicateRange.init_val = this.upgradeLevelAsPercent("range");
this.IndicateRate.init_val = this.upgradeLevelAsPercent("rate");
_root.profileThis(this);
_root.profileThis(this.WeaponController);
Symbol 481 MovieClip [TurretRed] Frame 4
this.stop();
var time_now = new Date();
var time_diff = (time_now.getTime() - this.weapon_fired.getTime());
var fire_rate = (1000 / (this.rate_effective / 60));
if (this.WeaponController.acquire("weak")) {
for (var shot in this.holding_current) {
var the_shot = this.holding_current[shot];
the_shot.acquire(this.WeaponController.weapon_target);
}
this.holdingEmpty();
if (this.WeaponController.targetInRange()) {
this.WeaponController.pointAtTarget(this, this.Weapon);
}
if (time_diff >= this.fire_rate) {
if (this.WeaponController.targetInRange()) {
var special_diff = (time_now.getTime() - this.special_fired.getTime());
if ((this.special_capable == true) && (special_diff > this.special_rate)) {
if (this.specialFire()) {
} else {
this.fireAt(this.WeaponController.weapon_target, this.damage_effective);
}
} else {
this.fireAt(this.WeaponController.weapon_target, this.damage_effective);
}
}
}
} else if (this.holding_pattern) {
if (time_diff >= fire_rate) {
var holding_shots = 0;
for (var i in this.holding_current) {
holding_shots++;
}
if (holding_shots < this.holding_max) {
this.holding_round = true;
this.fireAt(false, this.damage_effective);
this.holding_round = false;
}
}
}
this.play();
Symbol 481 MovieClip [TurretRed] Frame 7
this.gotoAndPlay("Fire");
Symbol 481 MovieClip [TurretRed] Frame 10
this.stop();
Symbol 485 MovieClip [TurretGreen] Frame 1
if (this.active == undefined) {
this.active = true;
}
if (!this.weapon_damage) {
this.weapon_damage = 25;
}
if (!this.weapon_range) {
this.weapon_range = 100;
}
if (!this.weapon_rate) {
this.weapon_rate = 60;
}
this.weapon_angle = 0;
this.weapon_type = "LaserBeam";
this.weapon_fired = 0;
this.weapon_fire_count = 0;
this.weapon_kill_count = 0;
this.Highlight._visible = false;
if (!this.cash_value) {
this.cash_value = 0;
}
this.WeaponController.weapon_range = this.weapon_range;
this.WeaponController.weapon = this.Weapon;
this.fireAt = function (the_target, the_damage) {
this.weapon_fired = new Date();
this.Weapon.fire();
this.weapon_fire_count++;
_root.WeaponFired();
var _local7 = "GreenBullet" + this.weapon_fire_count;
var _local5 = this.weapon_type;
var _local6 = this._parent.getNextHighestDepth();
var _local3 = this._parent.attachMovie(_local5, _local7, _local6);
var _local4 = new Object();
_local4.x = this.Weapon.FirePoint._x;
_local4.y = this.Weapon.FirePoint._y;
this.Weapon.localToGlobal(_local4);
_local3._x = _local4.x;
_local3._y = _local4.y;
_local3.bullet_target = the_target;
_local3.bullet_damage = the_damage;
_local3.turret = this;
_root.TurretFired(_local3);
_root.soundEffect("Laser");
return(_local3);
};
this.notifyGone = function (the_turret) {
this.linkNotifyGone(the_turret);
return(true);
};
this.onPress = function () {
if (this._parent.cur_turret) {
_root.TurretHighlightHide();
}
if (this._parent.cur_turret == this) {
this._parent.cur_turret = false;
_root.TurretHighlightHide();
} else {
this._parent.cur_turret = this;
_root.TurretHighlightShow();
}
};
if (this.damage_added == undefined) {
this.damage_added = 0;
}
if (this.damage_mult == undefined) {
this.damage_mult = 1;
}
if (this.range_added == undefined) {
this.range_added = 0;
}
if (this.range_mult == undefined) {
this.range_mult = 1;
}
if (this.rate_added == undefined) {
this.rate_added = 0;
}
if (this.rate_mult == undefined) {
this.rate_mult = 1;
}
if (this.damage_effective == undefined) {
this.damage_effective = this.weapon_damage;
}
if (this.range_effective == undefined) {
this.range_effective = this.weapon_range;
}
if (this.rate_effective == undefined) {
this.rate_effective = this.weapon_rate;
}
this.turrets_in_range = new Array();
this.modify_possible = true;
this.modifyGain = function (the_type, the_amount) {
if (this.modify_possible == false) {
return(false);
}
var _local2 = parseFloat(the_amount);
if (the_type == "damage_added") {
this.damage_added = this.damage_added + _local2;
} else if (the_type == "damage_mult") {
this.damage_mult = this.damage_mult + _local2;
} else if (the_type == "range_added") {
this.range_added = this.range_added + _local2;
} else if (the_type == "range_mult") {
this.range_mult = this.range_mult + _local2;
} else if (the_type == "rate_added") {
this.rate_added = this.rate_added + _local2;
} else if (the_type == "rate_mult") {
this.rate_mult = this.rate_mult + _local2;
}
if (_local2 > 0) {
}
this.modifyUpdate();
};
this.modifyUpdate = function () {
this.damage_effective = this.modifyDamage(this.weapon_damage);
this.range_effective = this.modifyRange(this.weapon_range);
this.rate_effective = this.modifyRate(this.weapon_rate);
this.WeaponController.weapon_range = this.range_effective;
return(true);
};
this.modifyDumpStats = function () {
trace((this + ": added damage ") + this.damage_added);
trace((this + ": added range ") + this.range_added);
trace((this + ": added rate ") + this.rate_added);
trace((this + ": mult damage ") + this.damage_mult);
trace((this + ": mult range ") + this.range_mult);
trace((this + ": mult rate ") + this.rate_mult);
trace((this + ": weapon damage ") + this.weapon_damage);
trace((this + ": weapon range ") + this.weapon_range);
trace((this + ": weapon rate ") + this.weapon_rate);
trace((this + ": effective damage ") + this.damage_effective);
trace((this + ": effective range ") + this.range_effective);
trace((this + ": effective rate ") + this.rate_effective);
};
this.modifyLose = function (the_type, the_amount) {
this.modifyGain(the_type, -the_amount);
};
this.modifyDamage = function (the_amount) {
var _local3 = parseFloat(the_amount);
var _local2 = (_local3 + this.damage_added) * this.damage_mult;
_local2 = Math.max(_local2, 0);
return(_local2);
};
this.modifyRange = function (the_amount) {
var _local3 = parseFloat(the_amount);
var _local2 = (_local3 + this.range_added) * this.range_mult;
_local2 = Math.max(_local2, 0);
return(_local2);
};
this.modifyRate = function (the_amount) {
var _local3 = parseFloat(the_amount);
var _local2 = (_local3 + this.rate_added) * this.rate_mult;
_local2 = Math.max(_local2, 0);
return(_local2);
};
this.modifyGetInRange = function (the_range) {
this.turrets_in_range = new Array();
var _local9 = the_range;
var _local8 = _root.turrets;
var _local3 = 0;
while (_local3 < _local8.length) {
var _local4 = _local8[_local3];
if (point != this) {
var _local5 = _local4._x - this._x;
var _local6 = _local4._y - this._y;
var _local7 = Math.sqrt((_local5 * _local5) + (_local6 * _local6));
if (_local7 <= _local9) {
this.turrets_in_range.push(_local4);
}
}
_local3++;
}
};
this.modifyAssert = function () {
var _local2 = 0;
while (_local2 < this.turrets_in_range.length) {
var _local3 = this.turrets_in_range[_local2];
this._modifyAssert(_local3);
_local2++;
}
};
this._modifyAssert = function (the_turret) {
the_turret.modifyGain("damage_added", this.modify_damage);
the_turret.modifyGain("range_added", this.modify_range);
the_turret.modifyGain("rate_added", this.modify_rate);
the_turret.modifyGain("damage_mult", this.modify_damage_mult);
the_turret.modifyGain("range_mult", this.modify_range_mult);
the_turret.modifyGain("rate_mult", this.modify_rate_mult);
};
this.modifyUnAssert = function (the_turret) {
the_turret.modifyLose("damage_added", this.modify_damage);
the_turret.modifyLose("range_added", this.modify_range);
the_turret.modifyLose("rate_added", this.modify_rate);
the_turret.modifyLose("damage_mult", this.modify_damage_mult);
the_turret.modifyLose("range_mult", this.modify_range_mult);
the_turret.modifyLose("rate_mult", this.modify_rate_mult);
};
this.modifyNotifyNew = function (the_turret) {
var _local3 = the_turret._x - this._x;
var _local4 = the_turret._y - this._y;
var _local5 = Math.sqrt((_local3 * _local3) + (_local4 * _local4));
if (_local5 <= this.weapon_range) {
this.turrets_in_range.push(the_turret);
this._modifyAssert(the_turret);
}
};
this.link_can_do = true;
this.link_mult = 1.25;
this.link_in_range = new Array();
this.link_offered = false;
this.LinkWantedFlag._visible = false;
this.LinkOfferedFlag._visible = false;
this.linkGetTurretsInRange = function () {
this.link_in_range = new Array();
var _local5 = _root.turrets;
for (var _local6 in _local5) {
var _local3 = _local5[_local6];
if ((_local3.turret_type == "Green") && (this != _local3)) {
var _local4 = _root.DistanceBetween(this, _local3);
if (_local4 <= this.range_effective) {
this.link_in_range.push(_local3);
}
if (_local4 <= _local3.range_effective) {
_local3.link_in_range.push(this);
}
}
}
};
this.linkNotifyNew = function () {
for (var _local3 in this.link_in_range) {
var _local2 = this.link_in_range[_local3];
_local2.link_in_range.push(this);
}
};
this.linkNotifyGone = function (the_tur) {
var _local3 = new Array();
for (var _local5 in this.link_in_range) {
var _local2 = this.link_in_range[_local5];
if (_local2 != the_tur) {
_local3.push(_local2);
}
}
this.link_in_range = _local3;
};
this.linkFire = function (the_target, the_damage) {
this.linkOffered(false);
the_damage = new Number(this.damage_effective);
var _local5 = new Array();
var _local8 = 0;
for (var _local9 in this.link_in_range) {
var _local3 = this.link_in_range[_local9];
if (_local3.link_offered == true) {
_local3.linkOffered(false);
_local5.push(_local3);
_local8++;
}
}
if (_local8 == 0) {
this.fireAt(the_target, the_damage);
return(the_damage);
}
for (var _local9 in _local5) {
var _local3 = _local5[_local9];
var _local7 = _root.degreesToTarget(_local3, this);
_local3.Weapon._rotation = _local7;
var _local4 = _local3.linkFire(this, 0);
_local4 = _local4 * this.link_mult;
the_damage = new Number(the_damage + _local4);
}
this.weapon_type = this.upgradeGetWeaponAtDamage(the_damage);
this.fireAt(the_target, the_damage);
this.weapon_type = this.upgrade_bullet[this.upgrade_damage_level];
return(the_damage);
};
this.linkWanted = function (the_state) {
if (the_state == true) {
this.link_wanted = true;
} else {
this.link_wanted = false;
}
this.LinkWantedFlag._visible = this.link_wanted;
};
this.linkOffered = function (the_state) {
if (the_state == true) {
this.link_offered = true;
} else {
this.link_offered = false;
}
this.LinkOfferedFlag._visible = this.link_offered;
};
this.linkGetTurretsInRange();
this.linkNotifyNew();
if (!this.upgrade_damage_level) {
this.upgrade_damage_level = 0;
}
if (!this.upgrade_range_level) {
this.upgrade_range_level = 0;
}
if (!this.upgrade_rate_level) {
this.upgrade_rate_level = 0;
}
this.max_damage = 0;
this.max_range = 0;
this.max_rate = 0;
this.max_built = false;
this.cost_damage = 0;
this.cost_range = 0;
this.cost_rate = 0;
this.cost_built = false;
this.upgrade_to_damage = 0;
this.upgrade_to_range = 0;
this.upgrade_to_rate = 0;
this.upgrade_to_built = false;
this.upgrade_pct_damage = 0;
this.upgrade_pct_range = 0;
this.upgrade_pct_rate = 0;
this.upgrade_pct_built = false;
this.upgrade_weapon_at_damage = new Array();
this._upgradeDone = function () {
this.cost_built = false;
this.upgrade_to_built = false;
this.upgrade_pct_built = false;
var _local2 = this.getMax("damage");
if (_local2 == this.weapon_damage) {
this.special_capable = true;
}
this.IndicateDamage.setPercentage(this.upgradeLevelAsPercent("damage"));
this.IndicateRange.setPercentage(this.upgradeLevelAsPercent("range"));
this.IndicateRate.setPercentage(this.upgradeLevelAsPercent("rate"));
this.modifyUpdate();
this.upgradeDone();
};
this.upgradeGetWeaponAtDamage = function (the_damage) {
if (this.upgrade_weapon_at_damage[the_damage]) {
return(this.upgrade_weapon_at_damage[the_damage]);
}
var _local8 = this.getMax("damage");
if (the_damage > _local8) {
return(this.max_bullet);
}
var _local6 = 0;
var _local4 = this.getMax("damage");
var _local5 = 0;
for (var _local7 in this.upgrade_damage) {
_local5++;
}
for (var _local7 in this.upgrade_damage) {
_local6 = _local4;
_local4 = parseInt(_local7);
if ((the_damage < _local6) && (the_damage >= _local4)) {
var _local2 = this.upgrade_bullet[_local5];
this.upgrade_weapon_at_damage[the_damage] = _local2;
return(_local2);
}
_local5--;
}
return(this.weapon_type);
};
this.getUpgrade = function (the_type) {
if (this.cost_built == false) {
this.upgrade_to_damage = this._getUpgrade("damage");
this.upgrade_to_range = this._getUpgrade("range");
this.upgrade_to_rate = this._getUpgrade("rate");
this.upgrade_to_built = true;
}
if (the_type == "damage") {
return(this.upgrade_to_damage);
}
if (the_type == "range") {
return(this.upgrade_to_range);
}
if (the_type == "rate") {
return(this.upgrade_to_rate);
}
return(false);
};
this._getUpgrade = function (the_type) {
var _local2 = new Array();
var _local3 = false;
if (the_type == "damage") {
_local2 = this.upgrade_damage;
_local3 = this.upgrade_damage_level;
} else if (the_type == "range") {
_local2 = this.upgrade_range;
_local3 = this.upgrade_range_level;
} else if (the_type == "rate") {
_local2 = this.upgrade_rate;
_local3 = this.upgrade_rate_level;
} else {
return(false);
}
var _local4 = 0;
for (var _local5 in _local2) {
_local4++;
}
if (_local3 >= _local4) {
return(false);
}
count = _local4 - 1;
for (var _local5 in _local2) {
if (count eq _local3) {
return(_local5);
}
count--;
}
return(false);
};
this.getUpgradeCost = function (the_type) {
if (this.cost_built == false) {
this.cost_damage = this._getUpgradeCost("damage");
this.cost_range = this._getUpgradeCost("range");
this.cost_rate = this._getUpgradeCost("rate");
this.cost_built = true;
}
if (the_type == "damage") {
return(this.cost_damage);
}
if (the_type == "range") {
return(this.cost_range);
}
if (the_type == "rate") {
return(this.cost_rate);
}
return(false);
};
this._getUpgradeCost = function (the_type) {
var _local2;
var _local3;
if (the_type == "damage") {
_local2 = this.upgrade_damage;
_local3 = this.upgrade_damage_level;
} else if (the_type == "range") {
_local2 = this.upgrade_range;
_local3 = this.upgrade_range_level;
} else if (the_type == "rate") {
_local2 = this.upgrade_rate;
_local3 = this.upgrade_rate_level;
} else {
return(false);
}
var _local4 = 0;
for (var _local5 in _local2) {
_local4++;
}
if (_local3 >= _local4) {
return(false);
}
count = _local4 - 1;
for (var _local5 in _local2) {
if (count eq _local3) {
return(_local2[_local5]);
}
count--;
}
return(false);
};
this.getMax = function (the_type) {
if (this.max_built == false) {
this.max_damage = this._getMax("damage");
this.max_range = this._getMax("range");
this.max_rate = this._getMax("rate");
this.max_built = true;
}
if (the_type == "damage") {
return(this.max_damage);
}
if (the_type == "range") {
return(this.max_range);
}
if (the_type == "rate") {
return(this.max_rate);
}
return(false);
};
this._getMax = function (the_type) {
var _local5;
var _local7;
if (the_type == "damage") {
_local5 = this.upgrade_damage;
_local7 = this.upgrade_damage_level;
} else if (the_type == "range") {
_local5 = this.upgrade_range;
_local7 = this.upgrade_range_level;
} else if (the_type == "rate") {
_local5 = this.upgrade_rate;
_local7 = this.upgrade_rate_level;
} else {
return(false);
}
var _local4 = new Number(0);
for (var _local6 in _local5) {
var _local3 = new Number(_local6);
var _local2 = _local3.valueOf();
if (_local2 > _local4) {
_local4 = _local2;
}
}
return(_local4);
};
this.upgradeDamage = function () {
var _local4 = this.upgrade_damage;
var _local8 = this.upgrade_damage_level;
var _local6 = _local8 + 1;
var _local5 = 0;
for (var _local7 in _local4) {
_local5++;
}
if (_local6 > _local5) {
return(false);
}
count = _local5;
for (var _local7 in _local4) {
if (count eq _local6) {
var _local3 = _local4[_local7];
if (_root.Payment(_local3)) {
this.cash_value = this.cash_value + _local3;
this.weapon_damage = _local7;
this.upgrade_damage_level++;
this._upgradeDone();
return(true);
}
return(false);
}
count--;
}
return(false);
};
this.upgradeRange = function () {
var _local4 = this.upgrade_range;
var _local8 = this.upgrade_range_level;
var _local6 = _local8 + 1;
var _local5 = 0;
for (var _local7 in _local4) {
_local5++;
}
if (_local6 > _local5) {
return(false);
}
count = _local5;
for (var _local7 in _local4) {
if (count eq _local6) {
var _local3 = _local4[_local7];
if (_root.Payment(_local3)) {
this.cash_value = this.cash_value + _local3;
this.weapon_range = _local7;
this.upgrade_range_level++;
this._upgradeDone();
return(true);
}
return(false);
}
count--;
}
return(false);
};
this.upgradeRate = function () {
var _local4 = this.upgrade_rate;
var _local8 = this.upgrade_rate_level;
var _local6 = _local8 + 1;
var _local5 = 0;
for (var _local7 in _local4) {
_local5++;
}
if (_local6 > _local5) {
return(false);
}
count = _local5;
for (var _local7 in _local4) {
if (count eq _local6) {
var _local3 = _local4[_local7];
if (_root.Payment(_local3)) {
this.cash_value = this.cash_value + _local3;
this.weapon_rate = _local7;
this.upgrade_rate_level++;
this._upgradeDone();
return(true);
}
return(false);
}
count--;
}
return(false);
};
this.upgradeLevelAsPercent = function (the_type) {
if (this.upgrade_pct_built == false) {
this.upgrade_pct_damage = this._upgradeLevelAsPercent("damage");
this.upgrade_pct_range = this._upgradeLevelAsPercent("range");
this.upgrade_pct_rate = this._upgradeLevelAsPercent("rate");
this.upgrade_pct_built = true;
}
if (the_type == "damage") {
return(this.upgrade_pct_damage);
}
if (the_type == "range") {
return(this.upgrade_pct_range);
}
if (the_type == "rate") {
return(this.upgrade_pct_rate);
}
return(false);
};
this._upgradeLevelAsPercent = function (the_type) {
var _local2;
var _local5;
if (the_type == "damage") {
_local2 = this.upgrade_damage;
_local5 = this.upgrade_damage_level;
} else if (the_type == "range") {
_local2 = this.upgrade_range;
_local5 = this.upgrade_range_level;
} else if (the_type == "rate") {
_local2 = this.upgrade_rate;
_local5 = this.upgrade_rate_level;
} else {
return(false);
}
var _local3 = 0;
for (var _local4 in _local2) {
_local3++;
}
var _local7 = Math.ceil((_local5 / _local3) * 100);
return(_local7);
};
this.upgrade_damage = new Array();
this.upgrade_damage["50"] = 20;
this.upgrade_damage["120"] = 50;
this.upgrade_damage["400"] = 125;
this.upgrade_damage["1500"] = 300;
this.upgrade_damage["3900"] = 700;
this.upgrade_damage["9300"] = 850;
this.upgrade_damage["19500"] = 950;
this.upgrade_damage["35000"] = 1000;
this.upgrade_range = new Array();
this.upgrade_range["110"] = 15;
this.upgrade_range["125"] = 25;
this.upgrade_range["140"] = 40;
this.upgrade_range["160"] = 65;
this.upgrade_range["180"] = 105;
this.upgrade_range["205"] = 170;
this.upgrade_range["230"] = 275;
this.upgrade_range["255"] = 445;
this.upgrade_range["285"] = 720;
this.upgrade_range["320"] = 1100;
this.upgrade_rate = new Array();
this.upgrade_rate["65"] = 30;
this.upgrade_rate["70"] = 75;
this.upgrade_rate["80"] = 180;
this.upgrade_rate["90"] = 300;
this.upgrade_rate["105"] = 450;
this.upgrade_rate["120"] = 600;
this.upgrade_rate["135"] = 800;
this.upgrade_rate["160"] = 900;
this.upgrade_rate["190"] = 1000;
this.upgrade_bullet = new Array();
this.upgrade_bullet["0"] = "LaserBeam";
this.upgrade_bullet["1"] = "LaserBeam2";
this.upgrade_bullet["2"] = "LaserBeam3";
this.upgrade_bullet["3"] = "LaserBeam4";
this.upgrade_bullet["4"] = "LaserBeam5";
this.upgrade_bullet["5"] = "LaserBeam6";
this.upgrade_bullet["6"] = "LaserBeam7";
this.upgrade_bullet["7"] = "LaserBeam8";
this.upgrade_bullet["8"] = "LaserBeam9";
this.upgrade_bullet["9"] = "LaserBeam10";
this.max_bullet = "LaserBeam10";
this.upgradeDone = function () {
this.modifyUpdate();
if (this.upgrade_bullet[upgrade_damage_level]) {
this.weapon_type = this.upgrade_bullet[upgrade_damage_level];
}
this.WeaponController.weapon_range = this.range_effective;
this.linkGetTurretsInRange();
};
this.special_capable = false;
this.special_fired = new Date();
this.special_range = 70;
this.special_rate = 7;
this.mine_locations = new Array();
this.mine_located = false;
this.specialGetInRange = function () {
var _local11 = this._x;
var _local12 = this._y;
this.special_blue = new Array();
this.special_green = new Array();
this.special_red = new Array();
var _local10 = this.special_range;
var _local3 = 0;
while (_local3 < _root.turrets.length) {
the_turret = _root.turrets[_local3];
var _local8 = the_turret._x;
var _local9 = the_turret._y;
var _local5 = _local8 - _local11;
var _local6 = _local9 - _local12;
var _local7 = Math.sqrt((_local6 * _local6) + (_local5 * _local5));
if ((((_local7 < _local10) && (the_turret.special_capable)) && (the_turret != this)) && (the_turret.specialCanFire() == true)) {
var _local4 = the_turret.turret_type;
if (_local4 == "Blue") {
special_blue.push(the_turret);
}
if (_local4 == "Green") {
special_green.push(the_turret);
}
if (_local4 == "Red") {
special_red.push(the_turret);
}
}
_local3++;
}
};
this.specialFireBullet = function (the_type) {
var _local3 = this.weapon_type;
this.weapon_type = the_type;
var _local2 = this.fireAt(this.WeaponController.weapon_target, this.damage_effective);
this.weapon_type = _local3;
return(_local2);
};
this.specialPickOne = function (the_list) {
if (the_list.length <= 1) {
return(the_list);
}
var _local2 = Math.floor(Math.random() * the_list.length);
return(the_list[_local2]);
};
this.specialPickTwo = function (the_list) {
if (the_list.length <= 2) {
return(the_list);
}
var _local2 = the_list.length;
while (_local2-- , _local2) {
var _local3 = Math.floor(Math.random() * (_local2 + 1));
var _local4 = the_list[_local2];
var _local5 = the_list[_local3];
the_list[_local2] = _local5;
the_list[_local3] = _local4;
}
var _local6 = new Array();
_local6.push(the_list[0]);
_local6.push(the_list[1]);
return(_local6);
};
this.specialTake = function (in_list) {
if (typeof(in_list) == "movieclip") {
in_list = new Array(input);
}
var _local4 = 0;
while (_local4 < in_list.length) {
the_turret = in_list[_local4];
the_turret.special_fired = new Date();
var _local7 = "SpecialTake";
var _local6 = _root.getNextHighestDepth();
var _local8 = _local7 + _local6;
var _local3 = _root.attachMovie(_local7, _local8, _local6);
var _local5 = _root.degreesToTarget(the_turret, this);
_local3._rotation = _local5;
_local3._x = the_turret._x;
_local3._y = the_turret._y;
the_turret.Weapon._rotation = _local5;
_local4++;
}
};
this.specialFired = function () {
the_turret = this;
the_turret.special_fired = new Date();
var _local5 = "SpecialFire";
var _local4 = _root.getNextHighestDepth();
var _local6 = _local5 + _local4;
var _local3 = _root.attachMovie(_local5, _local6, _local4);
_local3._rotation = the_turret._rotation;
_local3._x = the_turret._x;
_local3._y = the_turret._y;
};
this.specialPointAtMe = function (the_turret) {
deg = _root.degreesToTarget(the_turret, this);
the_turret.Weapon._rotation = deg;
};
this.specialCanFire = function () {
if (this.special_capable != true) {
return(false);
}
var _local7 = new Date();
var _local2 = _local7.getTime();
var _local9 = this.weapon_fired.getTime();
var _local6 = this.special_fired.getTime();
var _local8 = _local2 - _local9;
var _local4 = 1000 / (this.rate_effective / 60);
if (_local8 < _local4) {
return(false);
}
var _local3 = _local2 - _local6;
var _local5 = 1000 / (this.special_rate / 60);
if (_local3 < _local5) {
return(false);
}
return(true);
};
this.specialFindMinepoints = function () {
this.special_minepoints = new Array();
var _local13 = this.getMax("range");
var _local10 = _root.AttackerPath.getMinePoints();
var _local3 = 0;
while (_local3 < _local10.length) {
var _local4 = _local10[_local3];
var _local5 = _local4._x;
var _local6 = _local4._y;
var _local7 = _local5 - this._x;
var _local8 = _local6 - this._y;
var _local9 = Math.sqrt((_local7 * _local7) + (_local8 * _local8));
if (_local9 <= _local13) {
this.mine_locations.push(new Object({x:_local5, y:_local6}));
}
_local3++;
}
this.mine_located = true;
};
this.specialFindMinepoints();
this.specialFireClusterBomb = function () {
this.specialFired();
var _local3 = "ClusterBomb";
var _local2 = this.specialFireBullet(_local3);
_local2.cluster_qty = 5;
_local2.cluster_holding = true;
_local2.cluster_damage = this.modifyDamage(1000000);
_local2.bullet_damage = this.modifyDamage(1000000);
this.specialTake(this.specialPickOne(this.special_red));
return(_local2);
};
this.specialFireBigClusterBomb = function () {
this.specialFired();
var _local3 = "ClusterBomb";
var _local2 = this.specialFireBullet(_local3);
_local2.cluster_qty = 10;
_local2.cluster_holding = true;
_local2.cluster_damage = this.modifyDamage(2000000);
_local2.bullet_damage = this.modifyDamage(2000000);
_local2.blast = true;
_local2.blast_type = "BlastLarge";
_local2.blast_damage = this.modifyDamage(3000000);
this.specialTake(this.specialPickTwo(this.special_red));
return(_local2);
};
this.specialFireLaserClusterBomb = function () {
this.specialFired();
var _local3 = "ClusterBomb";
var _local2 = this.specialFireBullet(_local3);
_local2.cluster_qty = 5;
_local2.cluster_holding = true;
_local2.cluster_damage = this.modifyDamage(2000000);
_local2.cluster_laser = true;
_local2.bullet_damage = this.modifyDamage(2000000);
_local2.blast = true;
_local2.blast_type = "BlastMedium";
_local2.blast_damage = this.modifyDamage(3000000);
this.specialTake(this.specialPickOne(this.special_red));
this.specialTake(this.specialPickOne(this.special_green));
return(_local2);
};
this.specialFireBigLaserClusterBomb = function () {
this.specialFired();
var _local3 = "ClusterBomb";
var _local2 = this.specialFireBullet(_local3);
_local2.cluster_qty = 10;
_local2.cluster_holding = true;
_local2.cluster_damage = this.modifyDamage(4000000);
_local2.cluster_laser = true;
_local2.bullet_damage = this.modifyDamage(4000000);
_local2.blast = true;
_local2.blast_type = "BlastLarge";
_local2.blast_damage = this.modifyDamage(5000000);
this.specialTake(this.specialPickTwo(this.special_red));
this.specialTake(this.specialPickOne(this.special_green));
return(_local2);
};
this.specialFireLandmine = function () {
this.specialFired();
if (!this.mine_located) {
this.specialFindMinepoints();
this.mine_located = true;
}
this.specialTake(this.specialPickOne(this.special_blue));
var _local4 = "Landmine";
var _local3 = this.specialFireBullet(_local4);
_local3.mine_location = this.specialPickOne(this.mine_locations);
_local3._x = this._x;
_local3._y = this._y;
_local3.blast = true;
_local3.cluster = false;
_local3.bullet_damage = this.modifyDamage(1000000);
_root.mines.push(_local3);
return(_local3);
};
this.specialFireBigLandmine = function () {
this.specialFired();
if (!this.mine_located) {
this.specialFindMinepoints();
this.mine_located = true;
}
var _local4 = "LandmineBig";
var _local3 = this.specialFireBullet(_local4);
_local3.mine_location = this.specialPickOne(this.mine_locations);
_local3.bullet_damage = this.modifyDamage(2000000);
_local3.cluster = false;
_local3.blast = true;
_local3.blast_type = "BlastLarge";
_local3.blast_damage = this.modifyDamage(3000000);
this.specialTake(this.specialPickOne(this.special_red));
this.specialTake(this.specialPickOne(this.special_blue));
_root.mines.push(_local3);
return(_local3);
};
this.specialFireBigClusterLandmine = function () {
this.specialFired();
if (!this.mine_located) {
this.specialFindMinepoints();
this.mine_located = true;
}
var _local4 = "LandmineBigCluster";
var _local3 = this.specialFireBullet(_local4);
_local3.mine_location = this.specialPickOne(this.mine_locations);
_local3.bullet_damage = this.modifyDamage(4000000);
_local3.cluster = true;
_local3.cluster_qty = 10;
_local3.cluster_holding = true;
_local3.cluster_damage = this.modifyDamage(4000000);
_local3.cluster_laser = false;
_local3.bullet_damage = this.modifyDamage(4000000);
_local3.blast = true;
_local3.blast_type = "BlastLarge";
_local3.blast_damage = this.modifyDamage(4000000);
this.specialTake(this.specialPickTwo(this.special_red));
this.specialTake(this.specialPickOne(this.special_blue));
_root.mines.push(_local3);
return(_local3);
};
this.specialFireBigLaserClusterLandmine = function () {
this.specialFired();
if (!this.mine_located) {
this.specialFindMinepoints();
this.mine_located = true;
}
var _local4 = "LandmineBigClusterLaser";
var _local3 = this.specialFireBullet(_local4);
_local3.mine_location = this.specialPickOne(this.mine_locations);
_local3.bullet_damage = this.modifyDamage(5000000);
_local3.cluster = true;
_local3.cluster_qty = 10;
_local3.cluster_holding = true;
_local3.cluster_damage = this.modifyDamage(5000000);
_local3.cluster_laser = true;
_local3.bullet_damage = this.modifyDamage(5000000);
_local3.blast = true;
_local3.blast_type = "BlastLarge";
_local3.blast_damage = this.modifyDamage(5000000);
this.specialTake(this.specialPickTwo(this.special_red));
this.specialTake(this.specialPickOne(this.special_blue));
this.specialTake(this.specialPickOne(this.special_green));
_root.mines.push(_local3);
return(_local3);
};
this.specialFireBFG = function () {
this.specialFired();
var _local3 = this.linkFire(this, 0);
var _local2 = this.specialFireBullet("BFG");
_local2.bullet_damage = this.modifyDamage(5000000 + _local3);
_local2.laser_damage = this.modifyDamage(5000000 + _local3);
_local2.laser_rate = 240;
this.specialTake(this.specialPickOne(this.special_red));
this.specialTake(this.specialPickOne(this.special_blue));
return(true);
};
this.specialFireRocketBFG = function () {
this.specialFired();
var _local3 = this.linkFire(this, 0);
var _local2 = this.specialFireBullet("BFGRocket");
this.specialTake(this.specialPickOne(this.special_blue));
this.specialTake(this.specialPickTwo(this.special_red));
_local2.bullet_damage = this.modifyDamage(5000000 + _local3);
_local2.laser_damage = this.modifyDamage(5000000 + _local3);
_local2.laser_rate = 240;
return(true);
};
this.specialFireLaserRocket = function () {
this.specialFired();
var _local2 = this.fireAt(this.WeaponController.weapon_target, this.damage_effective);
var _local3 = this.specialPickOne(this.special_green);
var _local4 = _local3.linkFire(this, 0);
this.specialTake(_local3);
_local2.laser_capable = true;
_local2.laser_damage = this.modifyDamage(_local4);
_local2.bullet_speed = 100;
return(true);
};
this.specialFirePoisonGas = function () {
this.specialFired();
var _local2 = this.specialFireBullet("RocketPoison");
_local2.bullet_speed = 150;
_local2.holding_pattern = true;
this.specialTake(this.specialPickOne(this.special_green));
this.specialTake(this.specialPickOne(this.special_blue));
return(true);
};
this.specialFireNuke = function () {
this.specialFired();
var _local2 = this.specialFireBullet("RocketNuke");
_local2.bullet_speed = 150;
_local2.holding_pattern = true;
_local2.weapon_damage = this.modifyDamage(5000000);
this.specialTake(this.specialPickTwo(this.special_blue));
return(true);
};
this.specialFire = function () {
this.specialGetInRange();
var _local2 = this.special_blue.length;
var _local4 = this.special_green.length;
var _local3 = this.special_red.length;
if ((_local3 >= 2) && (_local2 >= 1)) {
return(this.specialFireRocketBFG());
}
if ((_local3 >= 1) && (_local2 >= 1)) {
return(this.specialFireBFG());
}
return(false);
};
this.stop();
if (this.active == true) {
this.gotoAndPlay("Fire");
}
this.IndicateDamage.init_val = this.upgradeLevelAsPercent("damage");
this.IndicateRange.init_val = this.upgradeLevelAsPercent("range");
this.IndicateRate.init_val = this.upgradeLevelAsPercent("rate");
_root.profileThis(this);
_root.profileThis(this.WeaponController);
Symbol 485 MovieClip [TurretGreen] Frame 4
this.stop();
var time_now = new Date();
var time_diff = (time_now.getTime() - this.weapon_fired.getTime());
var fire_rate = (1000 / (this.rate_effective / 60));
if (time_diff >= this.fire_rate) {
this.linkOffered(true);
}
if (this.WeaponController.acquire()) {
this.linkWanted(true);
if (this.WeaponController.targetInRange()) {
this.WeaponController.pointAtTarget(this, this.Weapon);
}
if (time_diff >= this.fire_rate) {
if (this.WeaponController.targetInRange()) {
var special_diff = (time_now.getTime() - this.special_fired.getTime());
if ((this.special_capable == true) && (special_diff > this.special_rate)) {
if (this.specialFire()) {
} else {
this.linkFire(this.WeaponController.weapon_target, this.damage_effective);
}
} else {
this.linkFire(this.WeaponController.weapon_target, this.damage_effective);
}
this.linkOffered(false);
}
}
} else {
this.linkWanted(false);
}
this.play();
Symbol 485 MovieClip [TurretGreen] Frame 7
this.gotoAndPlay("Fire");
Symbol 485 MovieClip [TurretGreen] Frame 10
this.stop();
Symbol 497 MovieClip Frame 1
this.play();
Symbol 497 MovieClip Frame 16
this.gotoAndPlay("Start");
Symbol 498 MovieClip Frame 1
this.stop();
Symbol 653 MovieClip [__Packages.JSON] Frame 0
class JSON
{
function JSON () {
}
static function stringify(arg) {
var _local2;
var _local5;
var _local6;
var _local1 = "";
var _local3;
switch (typeof(arg)) {
case "object" :
if (arg) {
if (arg instanceof Array) {
_local5 = 0;
while (_local5 < arg.length) {
_local3 = stringify(arg[_local5]);
if (_local1) {
_local1 = _local1 + ",";
}
_local1 = _local1 + _local3;
_local5++;
}
return(("[" + _local1) + "]");
}
if (typeof(arg.toString) != "undefined") {
for (_local5 in arg) {
_local3 = arg[_local5];
if ((typeof(_local3) != "undefined") && (typeof(_local3) != "function")) {
_local3 = stringify(_local3);
if (_local1) {
_local1 = _local1 + ",";
}
_local1 = _local1 + ((stringify(_local5) + ":") + _local3);
}
}
return(("{" + _local1) + "}");
}
}
return("null");
case "number" :
return((isFinite(arg) ? (String(arg)) : "null"));
case "string" :
_local6 = arg.length;
_local1 = "\"";
_local5 = 0;
while (_local5 < _local6) {
_local2 = arg.charAt(_local5);
if (_local2 >= " ") {
if ((_local2 == "\\") || (_local2 == "\"")) {
_local1 = _local1 + "\\";
}
_local1 = _local1 + _local2;
} else {
switch (_local2) {
case "\b" :
_local1 = _local1 + "\\b";
break;
case "\f" :
_local1 = _local1 + "\\f";
break;
case newline :
_local1 = _local1 + "\\n";
break;
case "\r" :
_local1 = _local1 + "\\r";
break;
case "\t" :
_local1 = _local1 + "\\t";
break;
default :
_local2 = _local2.charCodeAt();
_local1 = _local1 + (("\\u00" + Math.floor(_local2 / 16).toString(16)) + (_local2 % 16).toString(16));
}
}
_local5 = _local5 + 1;
}
return(_local1 + "\"");
case "boolean" :
return(String(arg));
}
return("null");
}
static function parse(text) {
function error(m) {
throw {name:"JSONError", message:m, at:at - 1, text:text};
}
function next() {
ch = text.charAt(at);
at = at + 1;
return(ch);
}
function white() {
if (ch) {
if (ch <= " ") {
this.next();
// unexpected jump
}
if (ch == "/") {
switch (this.next()) {
case "/" :
while ((this.next() && (ch != newline)) && (ch != "\r")) {
}
break;
case "*" :
this.next();
if (ch) {
if (ch == "*") {
if (this.next() == "/") {
next();
}
} else {
this.next();
}
} else {
error("Unterminated comment");
}
break;
default :
this.error("Syntax error");
}
// unexpected jump
}
}
}
function str() {
var _local3;
var _local2 = "";
var _local4;
var _local5;
var _local6 = false;
if (ch == "\"") {
while (this.next()) {
if (ch == "\"") {
this.next();
return(_local2);
}
if (ch == "\\") {
switch (this.next()) {
case "b" :
_local2 = _local2 + "\b";
break;
case "f" :
_local2 = _local2 + "\f";
break;
case "n" :
_local2 = _local2 + newline;
break;
case "r" :
_local2 = _local2 + "\r";
break;
case "t" :
_local2 = _local2 + "\t";
break;
case "u" :
_local5 = 0;
_local3 = 0;
while (_local3 < 4) {
_local4 = parseInt(this.next(), 16);
if (!isFinite(_local4)) {
_local6 = true;
break;
}
_local5 = (_local5 * 16) + _local4;
_local3 = _local3 + 1;
}
if (_local6) {
_local6 = false;
break;
}
_local2 = _local2 + String.fromCharCode(_local5);
break;
default :
_local2 = _local2 + ch;
}
continue;
}
_local2 = _local2 + ch;
}
}
this.error("Bad string");
}
function arr() {
var _local2 = [];
if (ch == "[") {
this.next();
this.white();
if (ch == "]") {
this.next();
return(_local2);
}
while (ch) {
_local2.push(this.value());
this.white();
if (ch == "]") {
this.next();
return(_local2);
}
if (ch != ",") {
break;
}
this.next();
this.white();
}
}
this.error("Bad array");
}
function obj() {
var _local3;
var _local2 = {};
if (ch == "{") {
this.next();
this.white();
if (ch == "}") {
this.next();
return(_local2);
}
while (ch) {
_local3 = this.str();
this.white();
if (ch != ":") {
break;
}
this.next();
_local2[_local3] = this.value();
this.white();
if (ch == "}") {
this.next();
return(_local2);
}
if (ch != ",") {
break;
}
this.next();
this.white();
}
}
this.error("Bad object");
}
function num() {
var _local2 = "";
var _local3;
if (ch == "-") {
_local2 = "-";
this.next();
}
while ((ch >= "0") && (ch <= "9")) {
_local2 = _local2 + ch;
this.next();
}
if (ch == ".") {
_local2 = _local2 + ".";
this.next();
while ((ch >= "0") && (ch <= "9")) {
_local2 = _local2 + ch;
this.next();
}
}
if ((ch == "e") | (ch == "E")) {
_local2 = _local2 + ch;
this.next();
if ((ch == "-") || (ch == "+")) {
_local2 = _local2 + ch;
this.next();
}
while ((ch >= "0") && (ch <= "9")) {
_local2 = _local2 + ch;
this.next();
}
}
_local3 = Number(_local2);
if (!isFinite(_local3)) {
this.error("Bad number");
}
return(_local3);
}
function word() {
switch (ch) {
case "t" :
if (((this.next() == "r") && (this.next() == "u")) && (this.next() == "e")) {
this.next();
return(true);
}
break;
case "f" :
if ((((this.next() == "a") && (this.next() == "l")) && (this.next() == "s")) && (this.next() == "e")) {
this.next();
return(false);
}
break;
case "n" :
if (!(((this.next() == "u") && (this.next() == "l")) && (this.next() == "l"))) {
break;
}
this.next();
return(null);
}
this.error("Syntax error");
}
function value() {
this.white();
switch (ch) {
case "{" :
return(this.obj());
case "[" :
return(this.arr());
case "\"" :
return(this.str());
case "-" :
return(this.num());
}
return((((ch >= "0") && (ch <= "9")) ? (this.num()) : (this.word())));
}
var at = 0;
var ch = " ";
return(value());
}
}
Symbol 516 Button
on (press) {
this.gotoAndPlay("Page2");
}
Symbol 522 Button
on (press) {
TidyUp();
gotoAndPlay ("Page5");
}
Symbol 544 Button
on (press) {
this.gotoAndPlay("Page3");
}
Symbol 546 Button
on (press) {
this.gotoAndPlay("Page1");
}
Symbol 559 Button
on (press) {
this.gotoAndPlay("Page4");
}
Symbol 560 Button
on (press) {
this.gotoAndPlay("Page2");
}
Symbol 582 Button
on (press) {
this.gotoAndPlay("Page3");
}
Symbol 584 Button
on (press) {
TidyUp();
this.gotoAndPlay("Page5");
}
Symbol 586 Button
on (press) {
this.gotoAndPlay("Page4");
}
Symbol 592 Button
on (release) {
TidyUp();
this.game_map = "map1";
gotoAndPlay (44);
}
Symbol 595 Button
on (release) {
TidyUp();
this.game_map = "map2";
gotoAndPlay (44);
}
Symbol 598 Button
on (release) {
TidyUp();
this.game_map = "map3";
gotoAndPlay (44);
}
Symbol 601 Button
on (release) {
TidyUp();
this.game_map = "map4";
gotoAndPlay (44);
}
Symbol 604 Button
on (release) {
TidyUp();
this.game_map = "map5";
gotoAndPlay (44);
}
Symbol 607 Button
on (release) {
TidyUp();
this.game_map = "map6";
gotoAndPlay (44);
}
Symbol 610 Button
on (release) {
TidyUp();
this.game_map = "map7";
gotoAndPlay (44);
}
Symbol 613 Button
on (release) {
TidyUp();
var which = Math.floor((Math.random() * 7) + 1);
this.game_map = "map" + which;
gotoAndPlay (44);
}
Symbol 628 Button
on (press) {
WaveController.SendWave();
}
Symbol 641 Button
on (press) {
_root.view_layout = false;
_root.GotoHomepage();
}