Frame 1
function create_yiffingField() {
this.createEmptyMovieClip("yiff", 0);
yiff._x = game_location_x;
yiff._y = game_location_y;
yiff.createEmptyMovieClip("corpse_shell", _root.corpse_shell_depth);
yiff.createEmptyMovieClip("shooting_shell", _root.shooting_shell_depth);
}
function place_destination(cell_num_x, cell_num_y) {
_root.yiff.attachMovie("destination", "destination", _root.destination_depth);
_root.yiff.destination._x = (cell_num_x - 1) * spacing;
_root.yiff.destination._y = (cell_num_y - 1) * spacing;
}
function place_character(cell_num_x, cell_num_y) {
_root.yiff.attachMovie("character", "character", _root.character_depth);
trgt = _root.yiff.character;
xx = (cell_num_x - 1) * spacing;
yy = (cell_num_y - 1) * spacing;
trgt._x = xx;
trgt._y = yy;
trgt.xx = xx;
trgt.yy = yy;
trgt.speed = _root.character_speed;
trgt.radius = _root.character_radius;
trgt.initiative = _root.character_initiative;
trgt.movepoints = _root.character_movepoints;
trgt.movepoints_max = trgt.movepoints;
trgt.actpoints_max = _root.character_actpoints;
trgt.actpoints = trgt.actpoints_max;
trgt.visibility_radius = _root.character_visibility_radius;
trgt.hp = _root.character_hp;
trgt.dmg = 0;
trgt.dmg_min = _root.character_dmg_min;
trgt.dmg_max = _root.character_dmg_max;
trgt.team = _root.character_team;
trgt.attack_radius = _root.character_attack_radius;
}
function initialize_enemies() {
_root.enemy_depth_local = _root.enemy_depth;
skolko_bragov = map_enemy_array_1.length;
i = 0;
while (i < skolko_bragov) {
cellx = map_enemy_array_1[i][1];
celly = map_enemy_array_1[i][2];
en_id = map_enemy_array_1[i][0];
cellname = (("cell" + cellx) + "_") + celly;
enemy_loc_x = _root.yiff[cellname]._x;
enemy_loc_y = _root.yiff[cellname]._y;
_root.yiff.attachMovie("enemy_type_" + en_id, "enemy_" + i, ++_root.enemy_depth_local);
trgt = _root.yiff["enemy_" + i];
trgt.en_id = en_id;
trgt._x = enemy_loc_x;
trgt._y = enemy_loc_y;
trgt._rotation = random(360);
trgt.hp_max = _root["enemy_hp_" + en_id];
trgt.speed = _root["enemy_speed_" + en_id];
trgt.initiative = _root["enemy_initiative_" + en_id] + (random(9999) / 10000);
trgt.movepoints_max = _root["enemy_movepoints_" + en_id];
trgt.movepoints = trgt.movepoints_max;
trgt.actpoints_max = _root["enemy_actpoints_" + en_id];
trgt.actpoints = trgt.actpoints_max;
trgt.visibility_radius = _root["enemy_visibility_radius_" + en_id];
trgt.hp = _root["enemy_hp_" + en_id];
trgt.dmg = 0;
trgt.dmg_min = _root["enemy_dmg_min_" + en_id];
trgt.dmg_max = _root["enemy_dmg_max_" + en_id];
trgt.team = _root["enemy_team_" + en_id];
trgt.attack_radius = _root["enemy_attack_radius_" + en_id];
trgt.fogreduce_radius = _root["enemy_fogreduce_radius_" + en_id];
trgt.command = 2;
i++;
}
}
function build_fogofwar() {
_root.attachMovie("fogofwar", "fogofwar", _root.fogofwar_depth);
_root.fogofwar._x = _root.yiff._x;
_root.fogofwar._y = _root.yiff._y;
var _local4 = 1;
while (_local4 <= _root.field_height) {
var _local3 = 1;
while (_local3 <= _root.field_length) {
var _local2 = (("fog" + _local3) + "_") + _local4;
var _local6 = ((_local3 - 1) * spacing) + (spacing / 2);
var _local5 = ((_local4 - 1) * spacing) + (spacing / 2);
ifogofwar = _root.fogofwar.core.getNextHighestDepth();
_root.fogofwar.core.attachMovie("black_cell", _local2, ifogofwar);
_root.fogofwar.core[_local2]._x = _local6;
_root.fogofwar.core[_local2]._y = _local5;
_root.fogofwar.core[_local2].xx = _local6;
_root.fogofwar.core[_local2].yy = _local5;
_root.fogofwar.core[_local2].cellname = _local2;
_root.fogofwar.core[_local2]._type_ = _type_;
_root.fogofwar.core[_local2].clip = _root.fogofwar.core[_local2];
_local3++;
}
_local4++;
}
}
function fogofwarIntegrity() {
var _local2 = 1;
while (_local2 <= _root.field_height) {
var _local3 = 1;
while (_local3 <= _root.field_length) {
var _local4 = (("fog" + _local3) + "_") + _local2;
_root.fogofwar.core[_local4]._visible = true;
_local3++;
}
_local2++;
}
var _local3 = 0;
while (_local3 < enemy_ammount) {
trgten = _root.yiff["enemy_" + _local3];
if (trgten and (trgten.team eq 1)) {
center_x = cell_name_calculation(trgten._x, trgten._y)[0];
center_y = cell_name_calculation(trgten._x, trgten._y)[1];
clearfogarray = create_area_array3(center_x, center_y, trgten.fogreduce_radius);
yifflengtharre56 = clearfogarray.length;
trace(yifflengtharre56);
_local2 = 0;
while (_local2 < yifflengtharre56) {
xxx = clearfogarray[_local2][0];
yyy = clearfogarray[_local2][1];
var _local4 = (("fog" + xxx) + "_") + yyy;
_root.fogofwar.core[_local4]._visible = false;
_local2++;
}
}
_local3++;
}
}
function buildGrid() {
var _local4 = 1;
while (_local4 <= _root.field_height) {
var _local3 = 1;
while (_local3 <= _root.field_length) {
var _local2 = (("cell" + _local3) + "_") + _local4;
var _local7 = ((_local3 - 1) * spacing) + (spacing / 2);
var _local6 = ((_local4 - 1) * spacing) + (spacing / 2);
var _local5 = map_array_1[_local4 - 1][_local3 - 1];
if (_local5 eq 1) {
whichtile = "tile_block";
} else {
whichtile = "tile_empty";
}
_root.yiff.attachMovie(whichtile, _local2, ++_root.cells_depth);
_root.yiff[_local2]._x = _local7;
_root.yiff[_local2]._y = _local6;
_root.yiff[_local2].xx = _local7;
_root.yiff[_local2].yy = _local6;
_root.yiff[_local2].cellname = _local2;
_root.yiff[_local2]._type_ = _local5;
_root.yiff[_local2].clip = _root.yiff[_local2];
_local3++;
}
_local4++;
}
}
function character_movement(dir) {
trgt = _root.yiff.character;
if (dir == "right") {
var _local6 = (trgt.xx + trgt.radius) + trgt.speed;
var _local5 = trgt.yy;
var _local7 = Math.ceil(_local6 / spacing);
var _local2 = Math.ceil(_local5 / spacing);
trgt.current_cell = [_local7, _local2];
dontgo = 0;
if (_local7 > 28) {
dontgo = 1;
}
var _local4 = _root.yiff[(("cell" + _local7) + "_") + _local2];
if ((_local4._type_ != 1) and (dontgo != 1)) {
trgt.xx = trgt.xx + trgt.speed;
trgt._x = trgt.xx;
// unexpected jump
}
return(undefined);
}
if (dir == "left") {
var _local6 = (trgt.xx - trgt.radius) - trgt.speed;
var _local5 = trgt.yy;
var _local7 = Math.ceil(_local6 / spacing);
var _local2 = Math.ceil(_local5 / spacing);
var _local4 = _root.yiff[(("cell" + _local7) + "_") + _local2];
dontgo = 0;
if (_local7 < 1) {
dontgo = 1;
}
if ((_local4._type_ != 1) and (dontgo != 1)) {
trgt.xx = trgt.xx - trgt.speed;
trgt._x = trgt.xx;
// unexpected jump
}
return(undefined);
}
if (dir == "up") {
var _local6 = trgt.xx;
var _local5 = (trgt.yy - trgt.radius) - trgt.speed;
var _local7 = Math.ceil(_local6 / spacing);
var _local2 = Math.ceil(_local5 / spacing);
var _local4 = _root.yiff[(("cell" + _local7) + "_") + _local2];
dontgo = 0;
if (_local2 < 1) {
dontgo = 1;
}
if ((_local4._type_ != 1) and (dontgo != 1)) {
trgt.yy = trgt.yy - trgt.speed;
trgt._y = trgt.yy;
// unexpected jump
}
return(undefined);
}
if (dir == "down") {
var _local6 = trgt.xx;
var _local5 = (trgt.yy + trgt.radius) + trgt.speed;
var _local7 = Math.ceil(_local6 / spacing);
var _local2 = Math.ceil(_local5 / spacing);
var _local4 = _root.yiff[(("cell" + _local7) + "_") + _local2];
dontgo = 0;
if (_local2 > 17) {
dontgo = 1;
}
if ((_local4._type_ != 1) and (dontgo != 1)) {
trgt.yy = trgt.yy + trgt.speed;
trgt._y = trgt.yy;
} else {
return(undefined);
}
}
}
spacing = 26;
field_length = 28;
field_height = 21;
_root.idlingmode = 1;
_root.do_surrounded_check = 0;
game_location_x = 40;
game_location_y = 20;
_root.cells_depth = 1;
_root.corpse_shell_depth = 999;
_root.destination_depth = 1000;
_root.character_depth = 5200;
_root.pathpointer_depth = 1500;
_root.enemy_depth = 4000;
_root.shooting_shell_depth = 6000;
_root.fogofwar_depth = 1000;
_root.idle_time_max = 0.04;
dotrace = 0;
_root.character_visibility_radius = 100;
_root.character_speed = 3;
_root.character_radius = 3;
_root.character_attack_radius = 1.4 * spacing;
_root.character_movepoints = 5;
_root.character_initiative = 2;
_root.character_hp = 300;
_root.character_team = 1;
_root.character_actpoints = 2;
_root.character_dmg_min = 5;
_root.character_dmg_max = 10;
_root.enemy_hp_1 = 150;
_root.enemy_speed_1 = 5;
_root.enemy_initiative_1 = 1;
_root.enemy_movepoints_1 = 6;
_root.enemy_actpoints_1 = 2;
_root.enemy_visibility_radius_1 = 200;
_root.enemy_team_1 = 2;
_root.enemy_attack_radius_1 = 1.6 * spacing;
_root.enemy_dmg_min_1 = 50;
_root.enemy_dmg_max_1 = 80;
_root.enemy_fogreduce_radius_1 = 2;
_root.enemy_hp_2 = 140;
_root.enemy_speed_2 = 5;
_root.enemy_initiative_2 = 1;
_root.enemy_movepoints_2 = 6;
_root.enemy_actpoints_2 = 2;
_root.enemy_visibility_radius_2 = 200;
_root.enemy_team_2 = 1;
_root.enemy_attack_radius_2 = 1.6 * spacing;
_root.enemy_dmg_min_2 = 20;
_root.enemy_dmg_max_2 = 55;
_root.enemy_fogreduce_radius_2 = 2;
_root.enemy_hp_3 = 150;
_root.enemy_speed_3 = 5;
_root.enemy_initiative_3 = 1;
_root.enemy_movepoints_3 = 5;
_root.enemy_actpoints_3 = 1;
_root.enemy_visibility_radius_3 = 10 * spacing;
_root.enemy_team_3 = 1;
_root.enemy_attack_radius_3 = (6 * spacing) + (0.6 * spacing);
_root.enemy_dmg_min_3 = 60;
_root.enemy_dmg_max_3 = 100;
_root.enemy_fogreduce_radius_3 = 5;
_root.docharactermovement = 0;
_root.lockcharcontrolz = 1;
fogofwaryifftimer = 0;
roundprogress_step1 = "done";
row1 = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0];
row2 = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0];
row3 = [1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
row4 = [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
row5 = [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
row6 = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0];
row7 = [1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0];
row8 = [1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0];
row9 = [1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0];
row10 = [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0];
row11 = [1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0];
row12 = [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0];
row13 = [1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0];
row14 = [1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0];
row15 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1];
row16 = [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1];
row17 = [0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1];
row18 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1];
row19 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1];
row20 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1];
row21 = [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
var map_array_1 = new Array();
i = 1;
while (i <= field_height) {
map_array_1.push(this["row" + i]);
i++;
}
var map_enemy_array_1 = new Array();
_root.enemy_ammount_map_1 = 112;
_root.enemy_ammount_map = _root.enemy_ammount_map_1;
var base_array_1 = new Array();
i = 1;
while (i <= 8) {
j = 15;
while (j <= 21) {
base_array_1.push([i, j]);
j++;
}
i++;
}
var base_array_2 = new Array();
i = 21;
while (i <= 28) {
j = 1;
while (j <= 7) {
base_array_2.push([i, j]);
j++;
}
i++;
}
i = 1;
while (i <= 56) {
this["map_1_enemy_" + i] = [random(2) + 2, base_array_1[i - 1][0], base_array_1[i - 1][1]];
i++;
}
i = 57;
while (i <= 112) {
this["map_1_enemy_" + i] = [1, base_array_2[(i - 1) - 56][0], base_array_2[(i - 1) - 56][1]];
i++;
}
i = 1;
while (i <= _root.enemy_ammount_map_1) {
if (random(3) eq 1) {
map_enemy_array_1.push(this["map_1_enemy_" + i]);
}
i++;
}
function enemyIntegrity() {
i = 0;
while (i < enemy_ammount) {
trgten = _root.yiff["enemy_" + i];
if (trgten) {
with (trgten) {
if (gfgfg != 1) {
gfgfg = 1;
widthres = hpbar._width;
timeryiff1 = 0;
timeryiff2 = 0;
}
hhh.gotoAndStop(command + 1);
timeryiff1 = timeryiff1 + 0.0333333333333333;
if (timeryiff1 > (0.3 + (random(9999) / 100000))) {
timeryiff1 = 0;
rememberrotation = hpbar._rotation;
hpbar._rotation = 0;
hpbar._width = widthres * ((hp - dmg) / hp);
hpbar._rotation = rememberrotation;
}
timeryiff2 = timeryiff2 + 0.0333333333333333;
if (timeryiff2 > (0.1 + (random(9999) / 100000))) {
timeryiff2 = 0;
hpbar._rotation = -_rotation;
hpbar._visible = true;
}
}
if ((trgten.dmg > trgten.hp) or (trgten.dmg eq trgten.hp)) {
iyiff = _root.yiff.corpse_shell.getNextHighestDepth();
_root.yiff.corpse_shell.attachMovie("dead_enemy_type_" + trgten.en_id, "enemy_" + iyiff, iyiff);
trgtrtrt = _root.yiff.corpse_shell["enemy_" + iyiff];
trgtrtrt._x = trgten._x;
trgtrtrt._y = trgten._y;
removeMovieClip(trgten);
}
}
i++;
}
}
function recalcHPindicatoretc(trgten) {
with (trgten) {
rememberrotation = hpbar._rotation;
hpbar._rotation = 0;
hpbar._width = widthres * ((hp - dmg) / hp);
hpbar._rotation = rememberrotation;
}
}
function initialize_obstacles() {
yy = 0;
var _local2 = 1;
while (_local2 <= _root.field_length) {
name_ = (("node" + _local2) + "_") + yy;
_root.astar.nodes[name_] = _root.astar.solidOb;
_local2++;
}
yy = 22;
_local2 = 1;
while (_local2 <= _root.field_length) {
name_ = (("node" + _local2) + "_") + yy;
_root.astar.nodes[name_] = _root.astar.solidOb;
_local2++;
}
xx = 0;
_local2 = 1;
while (_local2 <= _root.field_height) {
name_ = (("node" + xx) + "_") + _local2;
_root.astar.nodes[name_] = _root.astar.solidOb;
_local2++;
}
xx = 29;
_local2 = 1;
while (_local2 <= _root.field_height) {
name_ = (("node" + xx) + "_") + _local2;
_root.astar.nodes[name_] = _root.astar.solidOb;
_local2++;
}
var _local3 = 1;
while (_local3 <= _root.field_height) {
_local2 = 1;
while (_local2 <= _root.field_length) {
var _local4 = map_array_1[_local3 - 1][_local2 - 1];
if (_local4 eq 1) {
name_ = (("node" + _local2) + "_") + _local3;
_root.astar.nodes[name_] = _root.astar.solidOb;
}
_local2++;
}
_local3++;
}
_local2 = 0;
while (_local2 < enemy_ammount) {
trgt1 = _root.yiff["enemy_" + _local2];
if (trgt1 and (trgt1.dmg < trgt1.hp)) {
xx = cell_name_calculation(trgt1._x, trgt1._y)[0];
yy = cell_name_calculation(trgt1._x, trgt1._y)[1];
name_ = (("node" + xx) + "_") + yy;
_root.astar.nodes[name_] = _root.astar.solidOb;
}
_local2++;
}
trgt1 = _root.yiff.character;
if (trgt1 and (trgt1.dmg < trgt1.hp)) {
xx = cell_name_calculation(trgt1._x, trgt1._y)[0];
yy = cell_name_calculation(trgt1._x, trgt1._y)[1];
name_ = (("node" + xx) + "_") + yy;
_root.astar.nodes[name_] = _root.astar.solidOb;
}
}
function obstacle_exclude(trgt1) {
xx = cell_name_calculation(trgt1._x, trgt1._y)[0];
yy = cell_name_calculation(trgt1._x, trgt1._y)[1];
name_ = (("node" + xx) + "_") + yy;
_root.astar.nodes[name_] = _root.astar.passableFloor;
}
function delete_shownpath() {
var _local2 = 0;
while (_local2 <= 500) {
trgt = _root.yiff["pathpointer" + _local2];
if (trgt) {
removeMovieClip(trgt);
}
_local2++;
}
}
function showpath(path_array) {
delete_shownpath();
pathlength = path_array.length;
_root.pathpointer_depth_local = _root.pathpointer_depth;
var _local2 = 0;
while (_local2 <= pathlength) {
xx = path_array[_local2][0];
yy = path_array[_local2][1];
var _local4 = ((xx - 1) * spacing) + (spacing / 2);
var _local3 = ((yy - 1) * spacing) + (spacing / 2);
if (_local4 and _local3) {
_root.yiff.attachMovie("pathpointer", "pathpointer" + _local2, ++_root.pathpointer_depth_local);
_root.yiff["pathpointer" + _local2]._x = _local4;
_root.yiff["pathpointer" + _local2]._y = _local3;
}
_local2++;
}
}
function astarCalcAndShowPath(start_x, start_y, end_x, end_y, doshowpath) {
xx = cell_name_calculation(start_x, start_y)[0];
yy = cell_name_calculation(start_x, start_y)[1];
astar.s.x = xx;
astar.s.y = yy;
xx = cell_name_calculation(end_x, end_y)[0];
yy = cell_name_calculation(end_x, end_y)[1];
astar.g.x = xx;
astar.g.y = yy;
thepath = astar.search();
if ((_root.astarfailed != 1) and (doshowpath eq "true")) {
showpath(thepath);
}
if (_root.astarfailed eq 1) {
thepath = "none";
}
return(thepath);
}
astar = {};
astar.initialize = function () {
this.solidOb = {solid:true, exists:true};
this.passableFloor = {solid:false, exists:false};
this.maxSearchTime = 333;
this.s = {};
this.g = {};
this.open = [];
this.closed = [];
this.nodes = {};
this.preventClipping = true;
};
astar.findHeuristic = function (x, y) {
var _local3 = Math.abs(x - this.g.x);
var _local2 = Math.abs(y - this.g.y);
var _local5 = Math.min(_local3, _local2) * 1.41;
var _local4 = Math.max(_local3, _local2) - Math.min(_local3, _local2);
return(_local5 + _local4);
};
astar.cost = function (who, newx, newy) {
var _local3 = 1;
if (((who.x - newx) != 0) && ((who.y - newy) != 0)) {
_local3 = 1.41;
if (this.preventClipping) {
var _local4 = (who.x - newx) / Math.abs(who.x - newx);
var _local5 = (who.y - newy) / Math.abs(who.y - newy);
var _local9 = who.x - _local4;
var _local7 = who.y;
var _local12 = this.nodes[(("node" + _local9) + "_") + _local7];
var _local8 = who.x;
var _local6 = who.y - _local5;
var _local10 = this.nodes[(("node" + _local8) + "_") + _local6];
if (_local12.solid || (_local10.solid)) {
_local3 = 100000 /* 0x0186A0 */;
}
}
}
return(_local3);
};
astar.checkNode = function (newx, newy, whoName) {
var _local7 = this.nodes[whoName];
var _local4 = (("node" + newx) + "_") + newy;
var _local8 = _local7.g + this.cost(_local7, newx, newy);
if ((_local7.x == this.g.x) && (_local7.y == this.g.y)) {
this.keepSearching = false;
}
if (!this.nodes[_local4].exists) {
this.addOpen(newx, newy, _local8, whoName);
} else if (!this.nodes[_local4].solid) {
if (_local8 < this.nodes[_local4].g) {
var _local5 = this.nodes[_local4];
_local5.parent = whoName;
_local5.g = _local8;
_local5.f = _local5.h + _local8;
var _local6 = _local5.f;
if (this.nodes[_local4].where == "open") {
var _local3 = 0;
while (_local3 < this.open.length) {
if (this.open[_local3].name == _local4) {
this.open.splice(_local3, 1);
}
_local3++;
}
var _local2 = 0;
while (_local2 < this.open.length) {
if (_local6 < this.open[_local2].f) {
this.open.splice(_local2, 0, _local5);
this.nodes[_local4] = this.open[_local2];
break;
}
if (_local2 == (this.open.length - 1)) {
this.open.push(_local5);
this.nodes[_local4] = astar.open[_local2 + 1];
break;
}
_local2++;
}
}
if (this.nodes[_local4].where == "closed") {
var _local3 = 0;
while (_local3 < this.closed.length) {
if (this.closed[_local3].name == _local4) {
this.closed.splice(_local3, 1);
}
_local3++;
}
}
}
}
};
astar.buildPath = function (name) {
name = (("node" + this.g.x) + "_") + this.g.y;
var _local2 = this.nodes[name].parent;
this.path = [];
while (_local2 != null) {
this.path.push([this.nodes[_local2].x, this.nodes[_local2].y]);
_local2 = this.nodes[_local2].parent;
}
this.path.reverse();
this.path.shift();
this.path.push([this.g.x, this.g.y]);
};
astar.expandNode = function (index) {
var _local6 = this.open[index];
var _local3 = _local6.x;
var _local2 = _local6.y;
var _local4 = (("node" + _local3) + "_") + _local2;
this.checkNode(_local3 + 1, _local2, _local4);
this.checkNode(_local3 + 1, _local2 - 1, _local4);
this.checkNode(_local3, _local2 - 1, _local4);
this.checkNode(_local3 - 1, _local2 - 1, _local4);
this.checkNode(_local3 - 1, _local2, _local4);
this.checkNode(_local3 - 1, _local2 + 1, _local4);
this.checkNode(_local3, _local2 + 1, _local4);
this.checkNode(_local3 + 1, _local2 + 1, _local4);
var _local5 = this.open[index];
_local5.where = "closed";
this.open.splice(index, 1);
this.closed.push(_local5);
if (!this.keepSearching) {
this.buildPath();
}
};
astar.addOpen = function (x, y, g, parent) {
var _local9 = this.findHeuristic(x, y);
var _local5 = g + _local9;
var _local3 = (("node" + x) + "_") + y;
var _local4 = {x:x, y:y, g:g, h:_local9, f:_local5, name:_local3, parent:parent, exists:true, where:"open"};
if (parent == null) {
this.open.push(_local4);
this.nodes[_local3] = open[0];
}
var _local2 = 0;
while (_local2 < this.open.length) {
if (_local5 < this.open[_local2].f) {
this.open.splice(_local2, 0, _local4);
this.nodes[_local3] = this.open[_local2];
break;
}
if (_local2 == (this.open.length - 1)) {
this.open.push(_local4);
this.nodes[_local3] = astar.open[_local2 + 1];
break;
}
_local2++;
}
};
astar.search = function () {
delete this.path;
this.now = getTimer();
this.addOpen(astar.s.x, astar.s.y, 0, null);
this.keepSearching = true;
while (this.keepSearching) {
this.expandNode(0);
_root.astarfailed = 0;
if ((getTimer() - this.now) > this.maxSearchTime) {
trace("no solution");
this.keepSearching = false;
_root.astarfailed = 1;
}
}
st.text = getTimer() - this.now;
this.initialize();
return(this.path);
};
function check_for_obstacle_between_2_points(x1, y1, x2, y2) {
shag = spacing * 0.95;
yiffdgdfg = CALC_Dist_Xv_Yv(x2, y2, x1, y1);
xmod = yiffdgdfg[1];
ymod = yiffdgdfg[2];
xmod_ = xmod;
ymod_ = ymod;
distance = yiffdgdfg[0];
aaayiff = distance;
var _local2 = 1;
while (_local2 < 990) {
checkx = x1 + ((xmod_ * shag) * _local2);
checky = y1 + ((ymod_ * shag) * _local2);
cellname = cell_name_calculation(checkx, checky)[2];
walldetected = 0;
if (_root.yiff[cellname]._type_ eq 1) {
walldetected = 1;
break;
}
distcheck = CALC_Dist_Xv_Yv(checkx, checky, x1, y1)[0];
if (aaayiff < distcheck) {
break;
}
_local2++;
}
return(walldetected);
}
function cell_name_calculation(xx, yy) {
var _local2 = Math.ceil(xx / spacing);
var _local1 = Math.ceil(yy / spacing);
cellname = (("cell" + _local2) + "_") + _local1;
return([_local2, _local1, cellname]);
}
function CALC_Dist_Xv_Yv(x1, y1, x2, y2) {
A = {};
B = {};
A.xx = x1;
A.yy = y1;
B.xx = x2;
B.yy = y2;
dx = A.xx - B.xx;
dy = A.yy - B.yy;
distance = Math.sqrt((dx * dx) + (dy * dy));
dx_a = Math.abs(dx);
dy_a = Math.abs(dy);
if ((dx > 0) or (dx eq 0)) {
xmod = 1;
} else {
xmod = -1;
}
if ((dy > 0) or (dy eq 0)) {
ymod = 1;
} else {
ymod = -1;
}
if (dx_a > dy_a) {
spdmod = dy_a / dx_a;
x_modifier = xmod;
y_modifier = ymod * spdmod;
} else if (dx_a < dy_a) {
spdmod = dx_a / dy_a;
x_modifier = xmod * spdmod;
y_modifier = ymod;
} else {
x_modifier = xmod;
y_modifier = ymod;
}
return([distance, x_modifier, y_modifier, dx, dy]);
}
function rotation_towards_movement(trg, xspeed, yspeed) {
speedpovorota = 0.4;
dx = xspeed;
dy = yspeed;
angle1 = Math.atan2(dy, dx) * 57.2957795130823;
angle2 = trg._rotation;
if (angle2 < 0) {
angle2 = angle2 + 360;
}
if (angle1 < 0) {
angle1 = angle1 + 360;
}
aa = angle2 - angle1;
if (aa > 180) {
aa = aa - 360;
} else if (aa < -180) {
aa = aa + 360;
}
aa = aa * speedpovorota;
if (Math.abs(aa) > 0.01) {
trg._rotation = trg._rotation - aa;
} else {
trg._rotation = angle1;
}
}
function rotation_face_target(trgt1, trgt2) {
mewmewmewmewmewmew = CALC_Dist_Xv_Yv(trgt2._x, trgt2._y, trgt1._x, trgt1._y);
speedpovorota = 1;
trg = trgt1;
dx = mewmewmewmewmewmew[3];
dy = mewmewmewmewmewmew[4];
angle1 = Math.atan2(dy, dx) * 57.2957795130823;
angle2 = trg._rotation;
if (angle2 < 0) {
angle2 = angle2 + 360;
}
if (angle1 < 0) {
angle1 = angle1 + 360;
}
aa = angle2 - angle1;
if (aa > 180) {
aa = aa - 360;
} else if (aa < -180) {
aa = aa + 360;
}
aa = aa * speedpovorota;
if (Math.abs(aa) > 0.01) {
trg._rotation = trg._rotation - aa;
} else {
trg._rotation = angle1;
}
}
function recheck_cell_occupation() {
var _local2 = 1;
while (_local2 <= _root.field_height) {
var _local3 = 1;
while (_local3 <= _root.field_length) {
cellname = _root.yiff[(("cell" + _local3) + "_") + _local2];
cellname.occupied = 0;
_local3++;
}
_local2++;
}
var _local3 = 0;
while (_local3 <= _root.enemy_ammount_map) {
trtrgt = _root.yiff["enemy_" + _local3];
if (trtrgt) {
sdgsdfg = cell_name_calculation(trtrgt._x, trtrgt._y)[2];
_root.yiff[sdgsdfg].occupied = trtrgt;
}
_local3++;
}
}
function create_area_array(center_x, center_y, radius, sector) {
areaCellsArray = [];
if (sector eq 1) {
xstart = center_x;
xfinish = center_x + radius;
ystart = center_y;
yfinish = center_y + radius;
} else if (sector eq 2) {
xstart = center_x - radius;
xfinish = center_x + radius;
ystart = center_y + (radius - 1);
yfinish = center_y + radius;
} else if (sector eq 3) {
xstart = center_x - radius;
xfinish = center_x;
ystart = center_y;
yfinish = center_y + radius;
} else if (sector eq 4) {
xstart = center_x + (radius - 1);
xfinish = center_x + radius;
ystart = center_y - radius;
yfinish = center_y + radius;
} else if (sector eq 5) {
xstart = center_x - radius;
xfinish = center_x - (radius - 1);
ystart = center_y - radius;
yfinish = center_y + radius;
} else if (sector eq 6) {
xstart = center_x;
xfinish = center_x + radius;
ystart = center_y - radius;
yfinish = center_y;
} else if (sector eq 7) {
xstart = center_x - radius;
xfinish = center_x + radius;
ystart = center_y - radius;
yfinish = center_y - (radius - 1);
} else if (sector eq 8) {
xstart = center_x - radius;
xfinish = center_x;
ystart = center_y - radius;
yfinish = center_y;
} else if (sector eq 0) {
xstart = center_x - 1;
xfinish = center_x + 1;
ystart = center_y - 1;
yfinish = center_y + 1;
} else {
xstart = center_x - radius;
xfinish = center_x + radius;
ystart = center_y - radius;
yfinish = center_y + radius;
}
i = xstart;
while (i <= xfinish) {
j = ystart;
while (j <= yfinish) {
if ((((i > 0) and (j > 0)) and (i < (field_length + 1))) and (j < (field_height + 1))) {
cellnam6e = _root.yiff[(("cell" + i) + "_") + j];
if (cellnam6e._type_ != 1) {
if (cellnam6e.occupied eq 0) {
areaCellsArray.push([i, j]);
}
}
}
j++;
}
i++;
}
return(areaCellsArray);
}
function create_area_array2(x_min, x_max, y_min, y_max) {
areaCellsArray2 = [];
i = x_min;
while (i <= x_max) {
j = y_min;
while (j <= y_max) {
if ((((i > 0) and (j > 0)) and (i < (field_length + 1))) and (j < (field_height + 1))) {
cellnam6e = _root.yiff[(("cell" + i) + "_") + j];
if (cellnam6e._type_ != 1) {
if (cellnam6e.occupied eq 0) {
areaCellsArray2.push([i, j]);
}
}
}
j++;
}
i++;
}
return(areaCellsArray2);
}
function create_area_array3(center_x, center_y, radius) {
areaCellsArray3 = [];
xstart = center_x - radius;
xfinish = center_x + radius;
ystart = center_y - radius;
yfinish = center_y + radius;
trace((((((xstart + " ") + xfinish) + " ") + ystart) + " ") + yfinish);
i = xstart;
while (i <= xfinish) {
j = ystart;
while (j <= yfinish) {
if ((((i > 0) and (j > 0)) and (i < (field_length + 1))) and (j < (field_height + 1))) {
areaCellsArray3.push([i, j]);
}
j++;
}
i++;
}
return(areaCellsArray3);
}
function doSplashDMGnineCells(cur_dmg, who_fired, center_cell_x, center_cell_y) {
recheck_cell_occupation();
cellx = center_cell_x;
celly = center_cell_y;
cellname = _root.yiff[(("cell" + cellx) + "_") + celly];
cellname.occupied.dmg = cellname.occupied.dmg + cur_dmg;
recalcHPindicatoretc(cellname.occupied);
cellx = center_cell_x - 1;
celly = center_cell_y - 1;
cellname = _root.yiff[(("cell" + cellx) + "_") + celly];
if (cellname.occupied != who_fired) {
cellname.occupied.dmg = cellname.occupied.dmg + (cur_dmg * 0.5);
recalcHPindicatoretc(cellname.occupied);
}
cellx = center_cell_x;
celly = center_cell_y - 1;
cellname = _root.yiff[(("cell" + cellx) + "_") + celly];
if (cellname.occupied != who_fired) {
cellname.occupied.dmg = cellname.occupied.dmg + (cur_dmg * 0.5);
recalcHPindicatoretc(cellname.occupied);
}
cellx = center_cell_x + 1;
celly = center_cell_y - 1;
cellname = _root.yiff[(("cell" + cellx) + "_") + celly];
if (cellname.occupied != who_fired) {
cellname.occupied.dmg = cellname.occupied.dmg + (cur_dmg * 0.5);
recalcHPindicatoretc(cellname.occupied);
}
cellx = center_cell_x - 1;
celly = center_cell_y;
cellname = _root.yiff[(("cell" + cellx) + "_") + celly];
if (cellname.occupied != who_fired) {
cellname.occupied.dmg = cellname.occupied.dmg + (cur_dmg * 0.5);
recalcHPindicatoretc(cellname.occupied);
}
cellx = center_cell_x + 1;
celly = center_cell_y;
cellname = _root.yiff[(("cell" + cellx) + "_") + celly];
if (cellname.occupied != who_fired) {
cellname.occupied.dmg = cellname.occupied.dmg + (cur_dmg * 0.5);
recalcHPindicatoretc(cellname.occupied);
}
cellx = center_cell_x - 1;
celly = center_cell_y + 1;
cellname = _root.yiff[(("cell" + cellx) + "_") + celly];
if (cellname.occupied != who_fired) {
cellname.occupied.dmg = cellname.occupied.dmg + (cur_dmg * 0.5);
recalcHPindicatoretc(cellname.occupied);
}
cellx = center_cell_x;
celly = center_cell_y + 1;
cellname = _root.yiff[(("cell" + cellx) + "_") + celly];
if (cellname.occupied != who_fired) {
cellname.occupied.dmg = cellname.occupied.dmg + (cur_dmg * 0.5);
recalcHPindicatoretc(cellname.occupied);
}
cellx = center_cell_x + 1;
celly = center_cell_y + 1;
cellname = _root.yiff[(("cell" + cellx) + "_") + celly];
if (cellname.occupied != who_fired) {
cellname.occupied.dmg = cellname.occupied.dmg + (cur_dmg * 0.5);
recalcHPindicatoretc(cellname.occupied);
}
}
function poisk_blijaishei_vidimoi_celi(watcher) {
skolko_bragov = map_enemy_array_1.length;
var _local4 = new Array();
i = 0;
while (i < skolko_bragov) {
trgt = _root.yiff["enemy_" + i];
if (trgt and (trgt != watcher)) {
tr1 = trgt;
tr2 = watcher;
distance = CALC_Dist_Xv_Yv(tr1._x, tr1._y, tr2._x, tr2._y)[0];
tr1.tempvar_distance = distance;
if ((distance < watcher.visibility_radius) and (tr1.team != tr2.team)) {
_local4.push(trgt);
}
}
i++;
}
if (_local4.length eq 0) {
return("none");
}
thelengthyiff666 = _local4.length;
var _local5 = new Array();
i = 0;
while (i < thelengthyiff666) {
trgt1 = _local4[i];
this["targetobj" + i] = {};
this["targetobj" + i].distance = trgt1.tempvar_distance;
this["targetobj" + i].id_absolute = trgt1;
_local5.push(this["targetobj" + i]);
i++;
}
_local5.sortOn("distance", Array.NUMERIC);
thelengthyiff666 = _local5.length;
returnresult = "none";
i = 0;
while (i < thelengthyiff666) {
trgt1 = _local5[i];
chk = check_for_obstacle_between_2_points(watcher._x, watcher._y, trgt1.id_absolute._x, trgt1.id_absolute._y);
if (chk eq 0) {
returnresult = trgt1.id_absolute;
break;
}
i++;
}
return(returnresult);
}
function set_character_movement_disabled() {
cell_clicked = cell_name_calculation(_root.yiff._xmouse, _root.yiff._ymouse)[2];
if (_root.yiff[cell_clicked].being_targeted_by_char eq 1) {
_root.docharactermovement = 1;
_root.lockcharcontrolz = 1;
delete_shownpath();
var _local4 = 1;
while (_local4 <= _root.field_height) {
var _local2 = 1;
while (_local2 <= _root.field_length) {
var _local3 = (("cell" + _local2) + "_") + _local4;
_root.yiff[_local3].being_targeted_by_char = 0;
_local2++;
}
_local4++;
}
} else {
var _local4 = 1;
while (_local4 <= _root.field_height) {
var _local2 = 1;
while (_local2 <= _root.field_length) {
var _local3 = (("cell" + _local2) + "_") + _local4;
_root.yiff[_local3].being_targeted_by_char = 0;
_local2++;
}
_local4++;
}
_root.yiff[cell_clicked].being_targeted_by_char = 1;
trgt1 = _root.yiff.character;
trgt2 = _root.yiff[cell_clicked];
trgt1.path = "none";
trgt1.path = astarCalcAndShowPath(trgt1._x, trgt1._y, trgt2._x, trgt2._y, "true");
}
}
function charatcer_movement() {
if (movement_step_0 != "done") {
movement_step_0 = "done";
trgt = _root.yiff.character;
if (trgt.movepoints > 0) {
} else {
trgt.movepoints = trgt.movepoints_max;
trace("movepoints maxedup character");
_root.lockcharcontrolz = 0;
_root.docharactermovement = 0;
return(undefined);
}
cellarray = trgt.path.shift();
trgt.gowhere = _root.yiff[(("cell" + cellarray[0]) + "_") + cellarray[1]];
}
if (movement_step_1 != "done") {
movement_step_1 = "done";
movement_step_2 = 0;
trgt1 = trgt;
trgt2 = trgt1.gowhere;
yiffdgdfg = CALC_Dist_Xv_Yv(trgt2._x, trgt2._y, trgt1._x, trgt1._y);
trgt1.xmod = yiffdgdfg[1];
trgt1.ymod = yiffdgdfg[2];
}
if (movement_step_2 != "done") {
trgt1 = trgt;
trgt2 = trgt1.gowhere;
yiffdgdfg = CALC_Dist_Xv_Yv(trgt2._x, trgt2._y, trgt1._x, trgt1._y);
trgt1.distance = yiffdgdfg[0];
if (trgt1.distance <= trgt1.speed) {
trgt1._x = trgt2._x;
trgt1._y = trgt2._y;
movement_step_2 = "done";
movement_step_0 = "0";
movement_step_1 = "0";
trgt.movepoints--;
} else {
trgt1._x = trgt1._x + (trgt1.speed * trgt1.xmod);
trgt1._y = trgt1._y + (trgt1.speed * trgt1.ymod);
}
}
}
function AIdonefn() {
alreadyIdled = 1;
roundprogress_AIdone = "done";
roundprogress_step2 = "go";
roundprogress_step1 = "done";
roundprogress_step3 = "done";
roundprogress_step4 = "done";
roundprogress_step5 = "done";
roundprogress_step6 = "done";
roundprogress_step7 = "done";
roundprogress_step8 = "done";
roundprogress_step9 = "done";
roundprogress_step10 = "done";
roundprogress_step11 = "done";
roundprogress_step12 = "done";
roundprogress_step12_5 = "done";
roundprogress_step13 = "done";
roundprogress_step14 = "done";
roundprogress_step15 = "done";
roundprogress_step16 = "done";
}
function roundProgressing_integrity() {
if (roundprogress_RoundEnd eq "go") {
roundprogress_RoundEnd = "done";
roundprogress_step1 = "go";
roundprogress_step2 = "done";
roundprogress_step3 = "done";
roundprogress_step4 = "done";
roundprogress_step5 = "done";
roundprogress_step6 = "done";
roundprogress_step7 = "done";
roundprogress_step8 = "done";
roundprogress_step9 = "done";
roundprogress_step10 = "done";
roundprogress_step11 = "done";
roundprogress_step12 = "done";
roundprogress_step12_5 = "done";
roundprogress_step13 = "done";
roundprogress_step14 = "done";
roundprogress_step15 = "done";
roundprogress_step16 = "done";
}
if (roundprogress_AIdone eq "go") {
AIdonefn();
}
if (roundprogress_step1 eq "go") {
roundprogress_step1 = "done";
enemy_ammount = _root.enemy_ammount_map_1;
initial_participants = [];
i = 0;
while (i < enemy_ammount) {
trgt1 = _root.yiff["enemy_" + i];
if (trgt1 and (trgt1.dmg < trgt1.hp)) {
this["enemy_identificator" + i] = {};
this["enemy_identificator" + i].initiative = trgt1.initiative;
this["enemy_identificator" + i].id = "enemy_" + i;
_root.initial_participants.push(this["enemy_identificator" + i]);
}
i++;
}
i = current_participants.length;
this["enemy_identificator" + i] = {};
this["enemy_identificator" + i].initiative = _root.yiff.character.initiative;
this["enemy_identificator" + i].id = "character";
_root.initial_participants.push(this["enemy_identificator" + i]);
_root.initial_participants.sortOn("initiative", Array.NUMERIC);
_root.initial_participants.reverse();
roundprogress_step2 = "go";
}
if (roundprogress_step2 eq "go") {
roundprogress_step2 = "done";
if (_root.initial_participants.length > 0) {
current_participant = _root.initial_participants.shift();
} else {
roundprogress_RoundEnd = "go";
}
current_participant = current_participant.id;
trtrgt = _root.yiff[current_participant];
if (trtrgt.dmg < trtrgt.hp) {
roundprogress_step2_4 = "go";
} else {
roundprogress_step2 = "go";
}
}
if (roundprogress_step2_4 eq "go") {
roundprogress_step2_4 = "done";
roundprogress_step2_5 = "go";
}
if (roundprogress_step2_5 eq "go") {
roundprogress_step2_5 = "done";
trtrgt.actpoints = trtrgt.actpoints_max;
trtrgt.movepoints = trtrgt.movepoints_max;
roundprogress_step3 = "go";
if (zeromovepoints eq 1) {
zeromovepoints = 0;
trtrgt.movepoints = 0;
}
}
if (roundprogress_step3 eq "go") {
trtrgt = _root.yiff[current_participant];
trgt = trtrgt;
if (trtrgt eq _root.yiff.character) {
roundprogress_step3 = "done";
roundprogress_step2 = "go";
} else if (_root.idlingmode != 1) {
roundprogress_step3 = "done";
roundprogress_step4 = "go";
} else {
if (!trgt.idletime) {
trgt.idletime = 0;
}
trgt.idletime = trgt.idletime + 0.0333333333333333;
if (trgt.idletime > _root.idle_time_max) {
trgt.idletime = 0;
roundprogress_step3 = "done";
roundprogress_step4 = "go";
trgt.ring._visible = false;
} else {
trgt.ring._visible = true;
}
}
}
if (roundprogress_step4 eq "go") {
roundprogress_step4 = "done";
current_participant = trgt;
tempvaryiff665 = poisk_blijaishei_vidimoi_celi(trgt);
current_participant.current_target = tempvaryiff665;
if (current_participant.current_target eq "none") {
roundprogress_step12 = "go";
if (dotrace eq 1) {
trace(("step4 :" + current_participant) + " goto step 12");
}
} else {
roundprogress_step5 = "go";
if (dotrace eq 1) {
trace(("step4 :" + current_participant) + " goto step 5");
}
}
}
if (roundprogress_step5 eq "go") {
roundprogress_step5 = "done";
tr1 = current_participant.current_target;
tr2 = current_participant;
yiffdgdfg6786 = CALC_Dist_Xv_Yv(tr1._x, tr1._y, tr2._x, tr2._y);
distance = yiffdgdfg6786[0];
if (distance < tr2.attack_radius) {
roundprogress_step8 = "go";
if (dotrace eq 1) {
trace(((((("step5 :" + current_participant) + " distance: ") + distance) + " attackradius: ") + tr2.attack_radius) + " goto step 8");
}
} else {
roundprogress_step6 = "go";
if (dotrace eq 1) {
trace(((((("step5 :" + current_participant) + " distance: ") + distance) + " attackradius: ") + tr2.attack_radius) + " goto step 6");
}
}
}
if (roundprogress_step6 eq "go") {
roundprogress_step6 = "done";
if (current_participant.movepoints > 0) {
roundprogress_step6_5 = "go";
} else {
roundprogress_AIdone = "go";
current_participant.movepoints = current_participant.movepoints_max;
if (zeromovepoints eq 1) {
zeromovepoints = 0;
current_participant.movepoints = 0;
}
}
}
if (roundprogress_step6_5 eq "go") {
roundprogress_step6_5 = "done";
ourtrg = current_participant.current_target;
yifxxx = cell_name_calculation(ourtrg._x, ourtrg._y)[0];
yifyyy = cell_name_calculation(ourtrg._x, ourtrg._y)[1];
trgtcell = _root.yiff[(("cell" + yifxxx) + "_") + yifyyy];
recalculate_map_obstacles();
astar.initialize();
initialize_obstacles();
obstacle_exclude(current_participant);
obstacle_exclude(ourtrg);
tr1 = current_participant;
tr2 = trgtcell;
thepath = "none";
thepath = astarCalcAndShowPath(tr1._x, tr1._y, tr2._x, tr2._y, "true");
current_participant.thepath = thepath;
if (thepath eq "none") {
roundprogress_step12 = "go";
} else {
roundprogress_step7 = "go";
rndstep7_sidestep1 = "go";
}
}
if (roundprogress_step7 eq "go") {
if (rndstep7_sidestep1 eq "go") {
rndstep7_sidestep1 = "done";
trgt1 = current_participant;
rndstep7_sidestep4 = "go";
rndstep7_sidestep2 = "done";
if (trgt1.thepath.length > 0) {
rndstep7_sidestep2 = "go";
} else {
rndstep7_sidestep2 = "done";
roundprogress_step7 = "done";
roundprogress_step4 = "go";
}
cellarray = trgt1.thepath.shift();
trgt1.gowhere = _root.yiff[(("cell" + cellarray[0]) + "_") + cellarray[1]];
trgt2 = trgt1.gowhere;
yiffdgdfg = CALC_Dist_Xv_Yv(trgt2._x, trgt2._y, trgt1._x, trgt1._y);
trgt1.xmod = yiffdgdfg[1];
trgt1.ymod = yiffdgdfg[2];
}
if (rndstep7_sidestep2 eq "go") {
yiffdgdfg = CALC_Dist_Xv_Yv(trgt2._x, trgt2._y, trgt1._x, trgt1._y);
trgt1.distance = yiffdgdfg[0];
if (trgt1.distance <= trgt1.speed) {
trgt1._x = trgt2._x;
trgt1._y = trgt2._y;
trgt1.movepoints--;
roundprogress_step7 = "done";
rndstep7_sidestep2 = "done";
roundprogress_step5 = "go";
trgt1.gotoAndStop(1);
} else {
if (rndstep7_sidestep4 eq "go") {
rndstep7_sidestep4 = "done";
trgt1.gotoAndStop(2);
}
xspeed = trgt1.speed * trgt1.xmod;
yspeed = trgt1.speed * trgt1.ymod;
trgt1._x = trgt1._x + xspeed;
trgt1._y = trgt1._y + yspeed;
rotation_towards_movement(trgt1, xspeed, yspeed);
}
}
}
if (roundprogress_step8 eq "go") {
roundprogress_step8 = "done";
if (current_participant.actpoints > 0) {
roundprogress_step9 = "go";
step9_part_1 = "go";
} else {
current_participant.actpoints = current_participant.actpoints_max;
roundprogress_AIdone = "go";
}
}
if (roundprogress_step9 eq "go") {
trgth = current_participant;
if (step9_part_1 eq "go") {
step9_part_1 = "done";
ranged_att = "done";
melee_att = "done";
if (trgth.attack_radius > (spacing * 2)) {
ranged_att = "go";
ranged_p1 = "go";
} else {
melee_att = "go";
}
}
if (ranged_att eq "go") {
if (ranged_p1 eq "go") {
ranged_p1 = "done";
ranged_p2 = "go";
trgth.gotoAndStop(3);
rotation_face_target(current_participant, current_participant.current_target);
trgt1 = trgth;
trgt2 = current_participant.current_target;
yiffdgdfg = CALC_Dist_Xv_Yv(trgt2._x, trgt2._y, trgt1._x, trgt1._y);
xmod = yiffdgdfg[1];
ymod = yiffdgdfg[2];
distancetomuzzle = 12;
bulletspeed = 5;
iyiff = _root.yiff.shooting_shell.getNextHighestDepth();
_root.yiff.shooting_shell.attachMovie("projectile_1", "cur_proj", iyiff);
trgt3 = _root.yiff.shooting_shell.cur_proj;
trgt3._x = trgth._x;
trgt3._y = trgth._y;
trgt3.xmod = xmod;
trgt3.ymod = ymod;
trgt3._x = trgt3._x + (distancetomuzzle * trgt3.xmod);
trgt3._y = trgt3._y + (distancetomuzzle * trgt3.ymod);
}
if (ranged_p2 eq "go") {
trgt2 = current_participant.current_target;
yiffdgdf1g = CALC_Dist_Xv_Yv(trgt2._x, trgt2._y, trgt3._x, trgt3._y);
distance = yiffdgdf1g[0];
if (distance <= bulletspeed) {
removeMovieClip(trgt3);
ranged_p2 = "done";
ranged_p3 = "go";
iyiff = _root.yiff.shooting_shell.getNextHighestDepth();
_root.yiff.shooting_shell.attachMovie("explosion_1", "cur_expl", iyiff);
_root.yiff.shooting_shell.cur_expl._x = trgt2._x;
_root.yiff.shooting_shell.cur_expl._y = trgt2._y;
} else {
xspeed = bulletspeed * trgt3.xmod;
yspeed = bulletspeed * trgt3.ymod;
trgt3._x = trgt3._x + xspeed;
trgt3._y = trgt3._y + yspeed;
}
}
if (ranged_p3 eq "go") {
if (_root.yiff.shooting_shell.cur_expl) {
} else {
ranged_p3 = "done";
ranged_p4 = "go";
}
}
if (ranged_p4 eq "go") {
ranged_p4 = "done";
ranged_att = "done";
roundprogress_step9 = "done";
roundprogress_step10 = "go";
current_participant.gotoAndStop(1);
current_participant.actpoints--;
tr1 = current_participant;
tr2 = current_participant.current_target;
cur_dmg = (tr1.dmg_min + 1) + random(tr1.dmg_max - tr1.dmg_min);
center_cell_x = cell_name_calculation(tr2._x, tr2._y)[0];
center_cell_y = cell_name_calculation(tr2._x, tr2._y)[1];
who_fired = current_participant;
doSplashDMGnineCells(cur_dmg, who_fired, center_cell_x, center_cell_y);
}
}
if (melee_att eq "go") {
trgth.current_target.gotoAndStop(1);
trgth.current_target.idle.play();
trgth.gotoAndStop(3);
rotation_face_target(current_participant, current_participant.current_target);
if (trgth.animation.ended eq 1) {
melee_att = "done";
roundprogress_step9 = "done";
roundprogress_step10 = "go";
current_participant.gotoAndStop(1);
current_participant.actpoints--;
tr1 = current_participant;
tr2 = current_participant.current_target;
tr2.dmg = tr2.dmg + ((tr1.dmg_min + 1) + random(tr1.dmg_max - tr1.dmg_min));
recalcHPindicatoretc(tr2);
}
}
}
if (roundprogress_step10 eq "go") {
roundprogress_step10 = "done";
ttrtr = current_participant.current_target;
if (ttrtr.dmg < ttrtr.hp) {
roundprogress_step5 = "go";
} else {
roundprogress_step4 = "go";
}
}
if (roundprogress_step12 eq "go") {
roundprogress_step12 = "done";
gttr = current_participant;
step12_p0 = "go";
if (step12_p0 eq "go") {
step12_p0 = "done";
if (gttr.command eq 1) {
step12_p1 = "go";
if (gttr.team eq 1) {
dest_loc_xmin = 1;
dest_loc_xmax = 8;
dest_loc_ymin = 15;
dest_loc_ymax = 21;
recheck_cell_occupation();
dest_loc_array = create_area_array2(dest_loc_xmin, dest_loc_xmax, dest_loc_ymin, dest_loc_ymax);
} else {
step12_p1 = "go";
dest_loc_xmin = 21;
dest_loc_xmax = 28;
dest_loc_ymin = 1;
dest_loc_ymax = 7;
recheck_cell_occupation();
dest_loc_array = create_area_array2(dest_loc_xmin, dest_loc_xmax, dest_loc_ymin, dest_loc_ymax);
}
} else if (gttr.command eq 2) {
step12_p1 = "go";
if (gttr.team eq 1) {
dest_loc_xmin = 21;
dest_loc_xmax = 28;
dest_loc_ymin = 1;
dest_loc_ymax = 7;
recheck_cell_occupation();
dest_loc_array = create_area_array2(dest_loc_xmin, dest_loc_xmax, dest_loc_ymin, dest_loc_ymax);
} else {
dest_loc_xmin = 1;
dest_loc_xmax = 8;
dest_loc_ymin = 15;
dest_loc_ymax = 21;
recheck_cell_occupation();
dest_loc_array = create_area_array2(dest_loc_xmin, dest_loc_xmax, dest_loc_ymin, dest_loc_ymax);
}
} else {
step12_p2 = "go";
}
}
if (step12_p1 eq "go") {
step12_p1 = "done";
ylength = dest_loc_array.length;
randomcellu = random(ylength);
yifxxx = dest_loc_array[randomcellu][0];
yifyyy = dest_loc_array[randomcellu][1];
trgtcell = _root.yiff[(("cell" + yifxxx) + "_") + yifyyy];
recalculate_map_obstacles();
astar.initialize();
initialize_obstacles();
obstacle_exclude(current_participant);
if (starttrace eq 1) {
trace(current_participant);
}
tr1 = current_participant;
tr2 = trgtcell;
thepath = "none";
thepath = astarCalcAndShowPath(tr1._x, tr1._y, tr2._x, tr2._y, "true");
current_participant.thepath = thepath;
if (thepath eq "none") {
step12_p3 = "go";
} else {
roundprogress_step12_5 = "go";
}
}
if (step12_p3 eq "go") {
step12_p3 = "done";
xxx = cell_name_calculation(gttr._x, gttr._y)[0];
yyy = cell_name_calculation(gttr._x, gttr._y)[1];
if ((xxx < dest_loc_xmin) and (yyy < dest_loc_ymin)) {
sector = 1;
trace("sector 1");
} else if (((xxx > dest_loc_xmin) and (xxx < dest_loc_xmax)) and (yyy < dest_loc_ymin)) {
sector = 2;
trace("sector 2");
} else if ((xxx > dest_loc_xmax) and (yyy < dest_loc_ymin)) {
sector = 3;
trace("sector 3");
} else if (((xxx < dest_loc_xmin) and (yyy > dest_loc_ymin)) and (yyy < dest_loc_ymax)) {
sector = 4;
trace("sector 4");
} else if (((xxx > dest_loc_xmax) and (yyy > dest_loc_ymin)) and (yyy < dest_loc_ymax)) {
sector = 5;
trace("sector 5");
} else if ((xxx < dest_loc_xmin) and (yyy > dest_loc_ymax)) {
sector = 6;
trace("sector 6");
} else if (((xxx > dest_loc_xmin) and (xxx < dest_loc_xmax)) and (yyy > dest_loc_ymax)) {
sector = 7;
trace("sector 7");
} else if ((xxx > dest_loc_xmax) and (yyy > dest_loc_ymax)) {
sector = 8;
trace("sector 8");
} else {
gttr.movepoints = 1;
zeromovepoints = 1;
sector = 0;
trace("sector 0");
}
recheck_cell_occupation();
ycellarrayzz = create_area_array(xxx, yyy, gttr.movepoints_max, sector);
ylength = ycellarrayzz.length;
randomcellu = random(ylength);
yifxxx = ycellarrayzz[randomcellu][0];
yifyyy = ycellarrayzz[randomcellu][1];
trgtcell = _root.yiff[(("cell" + yifxxx) + "_") + yifyyy];
recalculate_map_obstacles();
astar.initialize();
initialize_obstacles();
obstacle_exclude(current_participant);
if (starttrace eq 1) {
trace(current_participant);
}
tr1 = current_participant;
tr2 = trgtcell;
thepath = "none";
thepath = astarCalcAndShowPath(tr1._x, tr1._y, tr2._x, tr2._y, "true");
current_participant.thepath = thepath;
if (thepath eq "none") {
roundprogress_AIdone = "go";
} else {
roundprogress_step12_5 = "go";
}
}
if (step12_p2 eq "go") {
step12_p2 = "done";
xxx = cell_name_calculation(gttr._x, gttr._y)[0];
yyy = cell_name_calculation(gttr._x, gttr._y)[1];
recheck_cell_occupation();
ycellarrayzz = create_area_array(xxx, yyy, gttr.movepoints_max, "none");
ylength = ycellarrayzz.length;
randomcellu = random(ylength);
yifxxx = ycellarrayzz[randomcellu][0];
yifyyy = ycellarrayzz[randomcellu][1];
trgtcell = _root.yiff[(("cell" + yifxxx) + "_") + yifyyy];
recalculate_map_obstacles();
astar.initialize();
initialize_obstacles();
obstacle_exclude(current_participant);
if (starttrace eq 1) {
trace(current_participant);
}
tr1 = current_participant;
tr2 = trgtcell;
thepath = "none";
thepath = astarCalcAndShowPath(tr1._x, tr1._y, tr2._x, tr2._y, "true");
current_participant.thepath = thepath;
if (thepath eq "none") {
roundprogress_AIdone = "go";
} else {
roundprogress_step12_5 = "go";
}
}
}
if (roundprogress_step12_5 eq "go") {
roundprogress_step12_5 = "done";
if (current_participant.movepoints > 0) {
roundprogress_step13 = "go";
rndstep13_sidestep1 = "go";
rndstep13_sidestep2 = "done";
} else {
current_participant.movepoints = current_participant.movepoints_max;
roundprogress_AIdone = "go";
}
}
if (roundprogress_step13 eq "go") {
roundprogress_step12_5 = "done";
roundprogress_step12 = "done";
if (rndstep13_sidestep1 eq "go") {
rndstep13_sidestep1 = "done";
trgt1 = current_participant;
rndstep13_sidestep3_5 = "go";
if (trgt1.thepath.length > 0) {
rndstep13_sidestep2 = "go";
} else {
roundprogress_step12 = "go";
rndstep13_sidestep2 = "done";
}
cellarray = trgt1.thepath.shift();
trgt1.gowhere = _root.yiff[(("cell" + cellarray[0]) + "_") + cellarray[1]];
trgt2 = trgt1.gowhere;
yiffdgdfg = CALC_Dist_Xv_Yv(trgt2._x, trgt2._y, trgt1._x, trgt1._y);
trgt1.xmod = yiffdgdfg[1];
trgt1.ymod = yiffdgdfg[2];
}
if (rndstep13_sidestep2 eq "go") {
yiffdgdfg = CALC_Dist_Xv_Yv(trgt2._x, trgt2._y, trgt1._x, trgt1._y);
trgt1.distance = yiffdgdfg[0];
if (trgt1.distance <= trgt1.speed) {
trgt1._x = trgt2._x;
trgt1._y = trgt2._y;
trgt1.movepoints--;
roundprogress_step13 = "done";
st13_5_p1 = "go";
roundprogress_step13_5 = "go";
rndstep13_sidestep2 = "done";
trgt1.gotoAndStop(1);
} else {
trgt = current_participant;
rndstep13_sidestep3_5 = "done";
rndstep13_sidestep4 = "go";
if (rndstep13_sidestep4 eq "go") {
rndstep13_sidestep4 = "done";
trgt1.gotoAndStop(2);
}
xspeed = trgt1.speed * trgt1.xmod;
yspeed = trgt1.speed * trgt1.ymod;
trgt1._x = trgt1._x + xspeed;
trgt1._y = trgt1._y + yspeed;
rotation_towards_movement(trgt1, xspeed, yspeed);
}
}
}
if (roundprogress_step13_5 eq "go") {
trgt1 = current_participant;
if (st13_5_p1 eq "go") {
st13_5_p1 eq "done";
if (trgt1.actpoints > 0) {
st13_5_p2 = "go";
} else {
roundprogress_step13_5 = "done";
roundprogress_step12_5 = "go";
}
}
if (st13_5_p2 eq "go") {
st13_5_p2 eq "done";
roundprogress_step13_5 = "done";
tempvaryiff78787 = poisk_blijaishei_vidimoi_celi(trgt1);
current_participant.current_target = tempvaryiff78787;
if (current_participant.current_target eq "none") {
roundprogress_step12_5 = "go";
} else {
roundprogress_step5 = "go";
}
}
}
}
create_yiffingField();
buildGrid();
astar.initialize();
initialize_walls();
initialize_enemies();
onMouseDown = function () {
if (_root.lockcharcontrolz != 1) {
if (set_character_movement_FNACTIVE != 1) {
set_character_movement_FNACTIVE = 1;
set_character_movement();
}
}
};
onMouseUp = function () {
set_character_movement_FNACTIVE = 0;
};
onEnterFrame = function () {
enemy_ammount = enemy_ammount_map_1;
if (fogofwaryifftimer > 1) {
} else {
fogofwaryifftimer = fogofwaryifftimer + 0.0333333333333333;
}
if (_root.docharactermovement eq 1) {
charatcer_movement();
}
enemyIntegrity();
roundProgressing_integrity();
if (_root.lockcharcontrolz eq 1) {
}
};
Symbol 12 Button
on (release) {
roundprogress_step1 = "go";
}
Symbol 18 MovieClip Frame 1
stop();
Symbol 32 Button
on (release) {
command++;
if (command > 2) {
command = 0;
}
}
Symbol 36 MovieClip Frame 9
gotoAndPlay (2);
Symbol 37 MovieClip Frame 2
ended = 0;
Symbol 37 MovieClip Frame 10
ended = 1;
Symbol 38 MovieClip [enemy_type_2] Frame 1
stop();
Instance of Symbol 20 MovieClip "hpbar" in Symbol 38 MovieClip [enemy_type_2] Frame 1
onClipEvent (load) {
_visible = false;
}
Instance of Symbol 35 MovieClip "ring" in Symbol 38 MovieClip [enemy_type_2] Frame 1
onClipEvent (load) {
_visible = false;
}
Symbol 41 MovieClip Frame 1
stop();
Symbol 43 Button
on (release) {
trace(_name);
}
Symbol 60 MovieClip Frame 2
ended = 0;
Symbol 60 MovieClip Frame 10
ended = 1;
Symbol 61 MovieClip [enemy_type_1] Frame 1
stop();
stop();
Instance of Symbol 35 MovieClip "ring" in Symbol 61 MovieClip [enemy_type_1] Frame 1
onClipEvent (load) {
_visible = false;
}
Instance of Symbol 20 MovieClip "hpbar" in Symbol 61 MovieClip [enemy_type_1] Frame 1
onClipEvent (load) {
_visible = false;
}
Symbol 64 MovieClip [dead_enemy_type_1] Frame 40
stop();
Symbol 67 MovieClip [dead_enemy_type_2] Frame 59
stop();
Symbol 77 MovieClip [enemy_type_3] Frame 1
stop();
Instance of Symbol 20 MovieClip "hpbar" in Symbol 77 MovieClip [enemy_type_3] Frame 1
onClipEvent (load) {
_visible = false;
}
Instance of Symbol 35 MovieClip "ring" in Symbol 77 MovieClip [enemy_type_3] Frame 1
onClipEvent (load) {
_visible = false;
}
Symbol 103 MovieClip [explosion_1] Frame 20
removeMovieClip(this);
Symbol 108 MovieClip [dead_enemy_type_3] Frame 16
stop();
Instance of Symbol 110 MovieClip in Symbol 111 MovieClip Frame 1
onClipEvent (load) {
_visible = false;
}