home *** CD-ROM | disk | FTP | other *** search
/ 600 Games / 600games.iso / Estrategia / tactics_core.swf / scripts / frame_68 / DoAction.as < prev   
Encoding:
Text File  |  2007-03-20  |  20.2 KB  |  853 lines

  1. function cell_x(row, col)
  2. {
  3.    return 400 + (col - row) * 44;
  4. }
  5. function cell_y(row, col)
  6. {
  7.    return (col + row) * 22 - 206;
  8. }
  9. function hidecells()
  10. {
  11.    cells._visible = false;
  12.    pointer._visible = false;
  13.    pointer.stop();
  14. }
  15. function showcells()
  16. {
  17.    cells._visible = true;
  18. }
  19. function cancelaction()
  20. {
  21.    canceltext._visible = false;
  22.    if(cells.movecells != null)
  23.    {
  24.       cells.movecells.removeMovieClip();
  25.    }
  26.    if(cells.attackcells != null)
  27.    {
  28.       cells.attackcells.removeMovieClip();
  29.    }
  30.    menu.gotoAndPlay("ShowMenu");
  31. }
  32. function endaction()
  33. {
  34.    targetstats.showstats();
  35.    var count = 0;
  36.    var i = 0;
  37.    while(i < NUM_UNITS)
  38.    {
  39.       if(unit[i].control && unit[i].team == PLAYER && unit[i].unitcell != null)
  40.       {
  41.          count++;
  42.          break;
  43.       }
  44.       i++;
  45.    }
  46.    if(count == 0)
  47.    {
  48.       gotoAndPlay(116);
  49.    }
  50.    else
  51.    {
  52.       count = 0;
  53.       var i = 0;
  54.       while(i < NUM_UNITS)
  55.       {
  56.          if(unit[i].team == ENEMY && unit[i].unitcell != null)
  57.          {
  58.             count++;
  59.          }
  60.          i++;
  61.       }
  62.       if(count == 0)
  63.       {
  64.          gotoAndPlay(79);
  65.       }
  66.       else if(unit[1].unitcell == null && unit[2].unitcell == null && unit[3].unitcell == null && unit[4].unitcell == null && unit[5].unitcell == null && unit[6].unitcell == null && unit[0].unit == "Healer")
  67.       {
  68.          allystats._visible = queue._visible = activestats._visible = targetstats._visible = false;
  69.          unit[0].attachMovie("Transform","fx",99);
  70.       }
  71.       else if(currentunit.control)
  72.       {
  73.          menu.gotoAndPlay("ShowMenu");
  74.       }
  75.       else
  76.       {
  77.          ai.endact();
  78.       }
  79.    }
  80. }
  81. function doattack(direction, row, col, area)
  82. {
  83.    hidecells();
  84.    targetstats.posdmg = targetstats.negdmg = targetstats.posvary = targetstats.negvary = "";
  85.    indicator._visible = false;
  86.    indicator.stop();
  87.    cells.attackcells.removeMovieClip();
  88.    currentunit.attack(direction,row,col,area);
  89. }
  90. function domove(row, col)
  91. {
  92.    hidecells();
  93.    indicator._visible = false;
  94.    indicator.stop();
  95.    cells.movecells.removeMovieClip();
  96.    dbuffer = new Array(ROWS);
  97.    var i = 0;
  98.    while(i < ROWS)
  99.    {
  100.       dbuffer[i] = new Array(COLS);
  101.       i++;
  102.    }
  103.    currentunit.movepath(getmovepath(currentunit.row,currentunit.col,row,col,currentunit.movedistance,0));
  104.    delete dbuffer;
  105. }
  106. function getmovepath(row1, col1, row2, col2, maxsteps, steps)
  107. {
  108.    if(steps >= maxsteps)
  109.    {
  110.       return false;
  111.    }
  112.    if(dbuffer[row1][col1] != undefined && dbuffer[row1][col1] <= steps)
  113.    {
  114.       return false;
  115.    }
  116.    dbuffer[row1][col1] = steps;
  117.    if(row1 == row2 && col1 + 1 == col2)
  118.    {
  119.       return "1";
  120.    }
  121.    if(row1 + 1 == row2 && col1 == col2)
  122.    {
  123.       return "2";
  124.    }
  125.    if(row1 == row2 && col1 - 1 == col2)
  126.    {
  127.       return "3";
  128.    }
  129.    if(row1 - 1 == row2 && col1 == col2)
  130.    {
  131.       return "4";
  132.    }
  133.    var temp1;
  134.    var temp2;
  135.    var tempd = "";
  136.    if(map[row1][col1 + 1] != -1 && map[row1][col1 + 1].team != currentunit.team)
  137.    {
  138.       temp1 = false;
  139.    }
  140.    else
  141.    {
  142.       temp1 = getmovepath(row1,col1 + 1,row2,col2,maxsteps,steps + 1);
  143.       if(temp1 != false)
  144.       {
  145.          tempd = "1";
  146.       }
  147.    }
  148.    if(map[row1 + 1][col1] == -1 || map[row1 + 1][col1].team == currentunit.team)
  149.    {
  150.       temp2 = getmovepath(row1 + 1,col1,row2,col2,maxsteps,steps + 1);
  151.       if(temp2 != false)
  152.       {
  153.          if(temp1 == false)
  154.          {
  155.             tempd = "2";
  156.             temp1 = temp2;
  157.          }
  158.          else if(temp2.length < temp1.length)
  159.          {
  160.             tempd = "2";
  161.             temp1 = temp2;
  162.          }
  163.       }
  164.    }
  165.    if(map[row1][col1 - 1] == -1 || map[row1][col1 - 1].team == currentunit.team)
  166.    {
  167.       temp2 = getmovepath(row1,col1 - 1,row2,col2,maxsteps,steps + 1);
  168.       if(temp2 != false)
  169.       {
  170.          if(temp1 == false)
  171.          {
  172.             tempd = "3";
  173.             temp1 = temp2;
  174.          }
  175.          else if(temp2.length < temp1.length)
  176.          {
  177.             tempd = "3";
  178.             temp1 = temp2;
  179.          }
  180.       }
  181.    }
  182.    if(map[row1 - 1][col1] == -1 || map[row1 - 1][col1].team == currentunit.team)
  183.    {
  184.       temp2 = getmovepath(row1 - 1,col1,row2,col2,maxsteps,steps + 1);
  185.       if(temp2 != false)
  186.       {
  187.          if(temp1 == false)
  188.          {
  189.             tempd = "4";
  190.             temp1 = temp2;
  191.          }
  192.          else if(temp2.length < temp1.length)
  193.          {
  194.             tempd = "4";
  195.             temp1 = temp2;
  196.          }
  197.       }
  198.    }
  199.    if(!temp1)
  200.    {
  201.       return false;
  202.    }
  203.    return tempd + temp1;
  204. }
  205. function endturn()
  206. {
  207.    indicator._visible = false;
  208.    indicator.stop();
  209.    currentunit.unitcell.gotoAndStop("Enable");
  210.    beginnextturn();
  211. }
  212. function beginnextturn()
  213. {
  214.    var mincnt = 99999;
  215.    var i = 0;
  216.    while(i < unit.length)
  217.    {
  218.       if(unit[i].unitcell != null)
  219.       {
  220.          if(unit[i].cnt < mincnt)
  221.          {
  222.             mincnt = unit[i].cnt;
  223.          }
  224.       }
  225.       i++;
  226.    }
  227.    if(mincnt == 99999)
  228.    {
  229.       var i = 0;
  230.       while(i < QSIZE)
  231.       {
  232.          eval("queue.q" + i).showpic();
  233.          i++;
  234.       }
  235.       activestats.showstats();
  236.       return undefined;
  237.    }
  238.    var currentcntoff = -1;
  239.    var i = 0;
  240.    while(i < unit.length)
  241.    {
  242.       if(unit[i].unitcell != null)
  243.       {
  244.          unit[i].cnt -= mincnt;
  245.          if(unit[i].cnt <= 0 && unit[i].cntoff > currentcntoff)
  246.          {
  247.             currentcntoff = unit[i].cntoff;
  248.             currentindex = i;
  249.          }
  250.       }
  251.       i++;
  252.    }
  253.    currentunit = unit[currentindex];
  254.    currentunit.cnt = 100 / currentunit.spd;
  255.    currentunit.unitcell.gotoAndStop("Disable");
  256.    queue.q0.showpic(currentunit.unit);
  257.    calcqueue();
  258.    calcqueue(true);
  259.    showqueue();
  260.    activestats.showstats(currentunit);
  261.    currentunit.moved = currentunit.attacked = false;
  262.    if(currentunit.control)
  263.    {
  264.       currentunit.undorow = currentunit.row;
  265.       currentunit.undocol = currentunit.col;
  266.       currentunit.undodirection = currentunit.direction;
  267.       menu.gotoAndPlay("ShowMenu");
  268.    }
  269.    else
  270.    {
  271.       ai.act();
  272.    }
  273. }
  274. function calcqueue(wait)
  275. {
  276.    var Qtemp;
  277.    var fullcnt;
  278.    if(wait == true)
  279.    {
  280.       fullcnt = currentunit.cnt;
  281.       currentunit.cnt /= 2;
  282.       Qtemp = Qhalf;
  283.    }
  284.    else
  285.    {
  286.       Qtemp = Qfull;
  287.    }
  288.    var j = 1;
  289.    while(j < QSIZE)
  290.    {
  291.       Qtemp[j].cnt = 99999;
  292.       j++;
  293.    }
  294.    var i = 0;
  295.    while(i < unit.length)
  296.    {
  297.       if(unit[i].unitcell != null)
  298.       {
  299.          var j = 1;
  300.          while(j < QSIZE)
  301.          {
  302.             if(unit[i].cnt < Qtemp[j].cnt || unit[i].cnt == Qtemp[j].cnt && unit[i].cntoff > Qtemp[j].cntoff)
  303.             {
  304.                var k = QSIZE - 1;
  305.                while(k > j)
  306.                {
  307.                   var l = k - 1;
  308.                   Qtemp[k].cnt = Qtemp[l].cnt;
  309.                   Qtemp[k].cntoff = Qtemp[l].cntoff;
  310.                   Qtemp[k].interval = Qtemp[l].interval;
  311.                   Qtemp[k].unit = Qtemp[l].unit;
  312.                   k--;
  313.                }
  314.                Qtemp[j].cnt = unit[i].cnt;
  315.                Qtemp[j].cntoff = unit[i].cntoff;
  316.                Qtemp[j].interval = 100 / unit[i].spd;
  317.                Qtemp[j].unit = unit[i].unit;
  318.                break;
  319.             }
  320.             j++;
  321.          }
  322.       }
  323.       i++;
  324.    }
  325.    var i = 1;
  326.    while(i < QSIZE - 1)
  327.    {
  328.       var nextcnt = Qtemp[i].cnt + Qtemp[i].interval;
  329.       var j = i + 1;
  330.       while(j < QSIZE)
  331.       {
  332.          if(nextcnt < Qtemp[j].cnt || nextcnt == Qtemp[j].cnt && Qtemp[i].cntoff > Qtemp[j].cntoff)
  333.          {
  334.             var k = QSIZE - 1;
  335.             while(k > j)
  336.             {
  337.                var l = k - 1;
  338.                Qtemp[k].cnt = Qtemp[l].cnt;
  339.                Qtemp[k].cntoff = Qtemp[l].cntoff;
  340.                Qtemp[k].interval = Qtemp[l].interval;
  341.                Qtemp[k].unit = Qtemp[l].unit;
  342.                k--;
  343.             }
  344.             Qtemp[j].cnt = nextcnt;
  345.             Qtemp[j].cntoff = Qtemp[i].cntoff;
  346.             Qtemp[j].interval = Qtemp[i].interval;
  347.             Qtemp[j].unit = Qtemp[i].unit;
  348.             break;
  349.          }
  350.          j++;
  351.       }
  352.       i++;
  353.    }
  354.    if(wait == true)
  355.    {
  356.       currentunit.cnt = fullcnt;
  357.    }
  358. }
  359. function showqueue(wait)
  360. {
  361.    var Qtemp;
  362.    if(wait == true)
  363.    {
  364.       Qtemp = Qhalf;
  365.    }
  366.    else
  367.    {
  368.       Qtemp = Qfull;
  369.    }
  370.    var j = 1;
  371.    while(j < QSIZE)
  372.    {
  373.       eval("queue.q" + j).showpic(Qtemp[j].unit);
  374.       j++;
  375.    }
  376. }
  377. function addprop(row, col, prop)
  378. {
  379.    units.attachMovie(prop,prop + row + "x" + col,(row + col + 1) * 100 + 70 - col * 2);
  380.    var temp = eval("units." + prop + row + "x" + col);
  381.    temp._x = cell_x(row,col);
  382.    temp._y = cell_y(row,col);
  383. }
  384. function copyunit(i, j)
  385. {
  386.    unit[i].unit = unittype[j].unit;
  387.    unit[i].name = unittype[j].name;
  388.    unit[i].hp = unit[i].hpmax = unittype[j].hp;
  389.    unit[i].hpsecret = unittype[j].hpsecret;
  390.    unit[i].movedistance = unittype[j].movedistance;
  391.    unit[i].ap = unittype[j].ap;
  392.    unit[i].df = unittype[j].df;
  393.    unit[i].mdf = unittype[j].mdf;
  394.    unit[i].ag = unittype[j].ag;
  395.    unit[i].spd = unittype[j].spd;
  396.    unit[i].cnt = 100 / unit[i].spd;
  397.    unit[i].cntoff = unittype[j].cntoff;
  398.    unit[i].bloodtype = unittype[j].bloodtype;
  399.    unit[i].damage = unittype[j].damage;
  400.    unit[i].attacktype = unittype[j].attacktype;
  401.    unit[i].range = unittype[j].range;
  402.    unit[i].spread = unittype[j].spread;
  403.    unit[i].attackface = unittype[j].attackface;
  404.    unit[i].attackbump = unittype[j].attackbump;
  405.    unit[i].showfxalways = unittype[j].showfxalways;
  406.    unit[i].attackrecover = unittype[j].attackrecover;
  407. }
  408. _quality = "MEDIUM";
  409. ROWS = COLS = 23;
  410. QSIZE = 14;
  411. Qfull = new Array(QSIZE);
  412. Qhalf = new Array(QSIZE);
  413. var i = 1;
  414. while(i < QSIZE)
  415. {
  416.    Qfull[i] = new Object();
  417.    Qhalf[i] = new Object();
  418.    i++;
  419. }
  420. PLAYER = 0;
  421. ENEMY = 1;
  422. unit = new Array(14);
  423. unittype = new Array(14);
  424. var i = 0;
  425. while(i < 14)
  426. {
  427.    unittype[i] = new Object();
  428.    i++;
  429. }
  430. unittype[0].unit = "Archer";
  431. unittype[0].name = "Hunter";
  432. unittype[0].hp = 2650;
  433. unittype[0].movedistance = 4;
  434. unittype[0].ap = 16;
  435. unittype[0].df = 6;
  436. unittype[0].mdf = 4;
  437. unittype[0].ag = 14;
  438. unittype[0].spd = 15;
  439. unittype[0].cntoff = 9;
  440. unittype[0].bloodtype = "RedBlood";
  441. unittype[0].damage = "physical";
  442. unittype[0].attacktype = "projectile";
  443. unittype[1].unit = "Fighter";
  444. unittype[1].name = "Shadowfist Fighter";
  445. unittype[1].hp = 3200;
  446. unittype[1].movedistance = 5;
  447. unittype[1].ap = 18;
  448. unittype[1].df = 9;
  449. unittype[1].mdf = 0;
  450. unittype[1].ag = 18;
  451. unittype[1].spd = 13;
  452. unittype[1].cntoff = 11;
  453. unittype[1].bloodtype = "RedBlood";
  454. unittype[1].damage = "physical";
  455. unittype[1].attacktype = "normal";
  456. unittype[1].range = 1;
  457. unittype[1].spread = 0;
  458. unittype[1].attackface = true;
  459. unittype[2].unit = "Knight";
  460. unittype[2].name = "Ironclad Sentinel";
  461. unittype[2].hp = 4095;
  462. unittype[2].movedistance = 3;
  463. unittype[2].ap = 17;
  464. unittype[2].df = 15;
  465. unittype[2].mdf = 5;
  466. unittype[2].ag = 6;
  467. unittype[2].spd = 10;
  468. unittype[2].cntoff = 14;
  469. unittype[2].bloodtype = "RedBlood";
  470. unittype[2].damage = "physical";
  471. unittype[2].attacktype = "normal";
  472. unittype[2].range = 1;
  473. unittype[2].spread = 0;
  474. unittype[2].attackface = true;
  475. unittype[3].unit = "Mage";
  476. unittype[3].name = "Templar Mage";
  477. unittype[3].hp = 2405;
  478. unittype[3].movedistance = 3;
  479. unittype[3].ap = 20;
  480. unittype[3].df = 7;
  481. unittype[3].mdf = 9;
  482. unittype[3].ag = 3;
  483. unittype[3].spd = 10;
  484. unittype[3].cntoff = 5;
  485. unittype[3].bloodtype = "RedBlood";
  486. unittype[3].damage = "magic";
  487. unittype[3].attacktype = "line";
  488. unittype[3].range = 4;
  489. unittype[3].showfxalways = true;
  490. unittype[3].attackrecover = false;
  491. unittype[4].unit = "Wizard";
  492. unittype[4].name = "Red Wizard";
  493. unittype[4].hp = 2500;
  494. unittype[4].movedistance = 3;
  495. unittype[4].ap = 30;
  496. unittype[4].df = 4;
  497. unittype[4].mdf = 14;
  498. unittype[4].ag = 0;
  499. unittype[4].spd = 9;
  500. unittype[4].cntoff = 3;
  501. unittype[4].bloodtype = "RedBlood";
  502. unittype[4].damage = "magic";
  503. unittype[4].attacktype = "normal";
  504. unittype[4].range = 3;
  505. unittype[4].spread = 1;
  506. unittype[4].showfxalways = true;
  507. unittype[4].attackrecover = false;
  508. unittype[5].unit = "Healer";
  509. unittype[5].name = "Mystical Healer";
  510. unittype[5].hp = 2170;
  511. unittype[5].movedistance = 4;
  512. unittype[5].ap = 13;
  513. unittype[5].df = 5;
  514. unittype[5].mdf = 10;
  515. unittype[5].ag = 8;
  516. unittype[5].spd = 11;
  517. unittype[5].cntoff = 2;
  518. unittype[5].bloodtype = "RedBlood";
  519. unittype[5].damage = "heal";
  520. unittype[5].attacktype = "normal";
  521. unittype[5].range = 1;
  522. unittype[5].spread = 0;
  523. unittype[5].attackbump = false;
  524. unittype[6].unit = "Assassin";
  525. unittype[6].name = "Shadowblade Assassin";
  526. unittype[6].hp = 2410;
  527. unittype[6].movedistance = 5;
  528. unittype[6].ap = 15;
  529. unittype[6].df = 5;
  530. unittype[6].mdf = 5;
  531. unittype[6].ag = 20;
  532. unittype[6].spd = 18;
  533. unittype[6].cntoff = 10;
  534. unittype[6].bloodtype = "RedBlood";
  535. unittype[6].damage = "physical";
  536. unittype[6].attacktype = "normal";
  537. unittype[6].range = 1;
  538. unittype[6].spread = 0;
  539. unittype[6].attackface = true;
  540. unittype[7].unit = "GateKeeper";
  541. unittype[7].name = "Talon Guard";
  542. unittype[7].hp = 2705;
  543. unittype[7].movedistance = 4;
  544. unittype[7].ap = 18;
  545. unittype[7].df = 6;
  546. unittype[7].mdf = 8;
  547. unittype[7].ag = 11;
  548. unittype[7].spd = 14;
  549. unittype[7].cntoff = 8;
  550. unittype[7].bloodtype = "RedBlood";
  551. unittype[7].damage = "magic";
  552. unittype[7].attacktype = "projectile";
  553. unittype[8].unit = "DarkSoldier";
  554. unittype[8].name = "Talon Soldier";
  555. unittype[8].hp = 3170;
  556. unittype[8].movedistance = 4;
  557. unittype[8].ap = 22;
  558. unittype[8].df = 8;
  559. unittype[8].mdf = 8;
  560. unittype[8].ag = 8;
  561. unittype[8].spd = 14;
  562. unittype[8].cntoff = 12;
  563. unittype[8].bloodtype = "RedBlood";
  564. unittype[8].damage = "physical";
  565. unittype[8].attacktype = "normal";
  566. unittype[8].range = 1;
  567. unittype[8].spread = 0;
  568. unittype[8].attackface = true;
  569. unittype[9].unit = "Cleric";
  570. unittype[9].name = "Cleric";
  571. unittype[9].hp = 2505;
  572. unittype[9].movedistance = 3;
  573. unittype[9].ap = 16;
  574. unittype[9].df = 7;
  575. unittype[9].mdf = 7;
  576. unittype[9].ag = 2;
  577. unittype[9].spd = 11;
  578. unittype[9].cntoff = 1;
  579. unittype[9].bloodtype = "RedBlood";
  580. unittype[9].damage = "heal";
  581. unittype[9].attacktype = "normal";
  582. unittype[9].range = 4;
  583. unittype[9].spread = 0;
  584. unittype[9].attackbump = false;
  585. unittype[9].showfxalways = true;
  586. unittype[10].unit = "Angel";
  587. unittype[10].name = "Daemon";
  588. unittype[10].hp = 5000;
  589. unittype[10].hpsecret = true;
  590. unittype[10].movedistance = 6;
  591. unittype[10].ap = 250;
  592. unittype[10].df = 0;
  593. unittype[10].mdf = 0;
  594. unittype[10].ag = 20;
  595. unittype[10].spd = 11;
  596. unittype[10].cntoff = 7;
  597. unittype[10].bloodtype = "RedBlood";
  598. unittype[10].damage = "magic";
  599. unittype[10].attacktype = "normal";
  600. unittype[10].range = 4;
  601. unittype[10].spread = 0;
  602. unittype[10].showfxalways = true;
  603. unittype[11].unit = "Swordsman";
  604. unittype[11].name = "Macabre Swordsman";
  605. unittype[11].hp = 2660;
  606. unittype[11].movedistance = 3;
  607. unittype[11].ap = 19;
  608. unittype[11].df = 8;
  609. unittype[11].mdf = 3;
  610. unittype[11].ag = 14;
  611. unittype[11].spd = 15;
  612. unittype[11].cntoff = 13;
  613. unittype[11].bloodtype = "RedBlood";
  614. unittype[11].damage = "physical";
  615. unittype[11].attacktype = "normal";
  616. unittype[11].range = 1;
  617. unittype[11].spread = 0;
  618. unittype[11].attackface = true;
  619. unittype[11].attackrecover = false;
  620. unittype[12].unit = "Striker";
  621. unittype[12].name = "Templar Striker";
  622. unittype[12].hp = 2400;
  623. unittype[12].movedistance = 4;
  624. unittype[12].ap = 15;
  625. unittype[12].df = 7;
  626. unittype[12].mdf = 7;
  627. unittype[12].ag = 4;
  628. unittype[12].spd = 10;
  629. unittype[12].cntoff = 6;
  630. unittype[12].bloodtype = "RedBlood";
  631. unittype[12].damage = "magic";
  632. unittype[12].attacktype = "line";
  633. unittype[12].range = 2;
  634. unittype[12].showfxalways = true;
  635. unittype[12].attackrecover = false;
  636. unittype[13].unit = "Sorceress";
  637. unittype[13].name = "Mystical Sorceress";
  638. unittype[13].hp = 2240;
  639. unittype[13].movedistance = 2;
  640. unittype[13].ap = 21;
  641. unittype[13].df = 0;
  642. unittype[13].mdf = 20;
  643. unittype[13].ag = 0;
  644. unittype[13].spd = 8;
  645. unittype[13].cntoff = 4;
  646. unittype[13].bloodtype = "RedBlood";
  647. unittype[13].damage = "magic";
  648. unittype[13].attacktype = "normal";
  649. unittype[13].range = 5;
  650. unittype[13].spread = 2;
  651. unittype[13].showfxalways = true;
  652. unittype[13].attackrecover = false;
  653. bloodcount = 0;
  654. bloods = new Array(ROWS);
  655. map = new Array(ROWS);
  656. var row = 0;
  657. while(row < ROWS)
  658. {
  659.    bloods[row] = new Array(COLS);
  660.    map[row] = new Array(COLS);
  661.    var col = 0;
  662.    while(col < COLS)
  663.    {
  664.       bloods[row][col] = 0;
  665.       if(row > 6 && row < 18 && col > 6 && col < 18)
  666.       {
  667.          map[row][col] = -1;
  668.       }
  669.       else
  670.       {
  671.          map[row][col] = null;
  672.       }
  673.       col++;
  674.    }
  675.    row++;
  676. }
  677. map[16][7] = map[17][7] = map[17][8] = map[7][16] = map[7][17] = map[8][17] = null;
  678. var i = 9;
  679. while(i < 14)
  680. {
  681.    map[7][i] = -2;
  682.    i++;
  683. }
  684. map[8][7] = -2;
  685. var i = 10;
  686. while(i < 15)
  687. {
  688.    map[8][i] = -2;
  689.    i++;
  690. }
  691. map[9][7] = map[9][8] = -2;
  692. var i = 10;
  693. while(i < 14)
  694. {
  695.    map[9][i] = -2;
  696.    i++;
  697. }
  698. map[10][7] = map[10][8] = map[11][8] = map[11][9] = map[12][17] = map[13][15] = -2;
  699. var i = 14;
  700. while(i < 17)
  701. {
  702.    map[14][i] = -2;
  703.    i++;
  704. }
  705. var i = 11;
  706. while(i < 17)
  707. {
  708.    map[15][i] = -2;
  709.    i++;
  710. }
  711. var i = 10;
  712. while(i < 18)
  713. {
  714.    map[16][i] = -2;
  715.    i++;
  716. }
  717. var i = 11;
  718. while(i < 18)
  719. {
  720.    map[17][i] = -2;
  721.    i++;
  722. }
  723. addprop(8,12,"FireHole");
  724. addprop(16,12,"FireHole");
  725. addprop(8,10,"SmokeHole");
  726. cells.attachMovie("Blank","grid",60);
  727. cells.attachMovie("Blank","unitcells",90);
  728. var row = 0;
  729. while(row < ROWS)
  730. {
  731.    var col = 0;
  732.    while(col < COLS)
  733.    {
  734.       if(map[row][col] != null)
  735.       {
  736.          var tempname = "g" + row + "x" + col;
  737.          cells.grid.attachMovie("GridCell",tempname,100 * row + col);
  738.          var tempcell = eval("cells.grid." + tempname);
  739.          tempcell.row = row;
  740.          tempcell.col = col;
  741.       }
  742.       col++;
  743.    }
  744.    row++;
  745. }
  746. NUM_UNITS = 13;
  747. allystatcount = 0;
  748. var i = 0;
  749. while(i < NUM_UNITS)
  750. {
  751.    units.attachMovie("Unit","unit" + i,i);
  752.    cells.unitcells.attachMovie("UnitCell","cell" + i,i);
  753.    unit[i] = eval("units.unit" + i);
  754.    unit[i].unitcell = eval("cells.unitcells.cell" + i);
  755.    unit[i].unitcell.unit = unit[i];
  756.    unit[i].control = i < 7;
  757.    if(i > 6)
  758.    {
  759.       unit[i].direction = 1;
  760.       unit[i].team = ENEMY;
  761.    }
  762.    else
  763.    {
  764.       unit[i].direction = 3;
  765.       unit[i].team = PLAYER;
  766.    }
  767.    switch(i)
  768.    {
  769.       case 0:
  770.          j = 5;
  771.          unit[i].row = 10;
  772.          unit[i].col = 17;
  773.          break;
  774.       case 1:
  775.          j = 0;
  776.          unit[i].row = 13;
  777.          unit[i].col = 17;
  778.          break;
  779.       case 2:
  780.          j = 3;
  781.          unit[i].row = 11;
  782.          unit[i].col = 16;
  783.          break;
  784.       case 3:
  785.          j = 4;
  786.          unit[i].row = 12;
  787.          unit[i].col = 16;
  788.          break;
  789.       case 4:
  790.          j = 6;
  791.          unit[i].row = 10;
  792.          unit[i].col = 16;
  793.          break;
  794.       case 5:
  795.          j = 1;
  796.          unit[i].row = 11;
  797.          unit[i].col = 15;
  798.          break;
  799.       case 6:
  800.          j = 2;
  801.          unit[i].row = 12;
  802.          unit[i].col = 15;
  803.          break;
  804.       case 7:
  805.          j = 7;
  806.          unit[i].row = 12;
  807.          unit[i].col = 10;
  808.          break;
  809.       case 8:
  810.          j = 8;
  811.          unit[i].row = 11;
  812.          unit[i].col = 10;
  813.          break;
  814.       case 9:
  815.          j = 9;
  816.          unit[i].row = 12;
  817.          unit[i].col = 8;
  818.          break;
  819.       case 10:
  820.          j = 13;
  821.          unit[i].row = 12;
  822.          unit[i].col = 9;
  823.          break;
  824.       case 11:
  825.          j = 11;
  826.          unit[i].row = 10;
  827.          unit[i].col = 9;
  828.          break;
  829.       case 12:
  830.          j = 12;
  831.          unit[i].row = 13;
  832.          unit[i].col = 9;
  833.    }
  834.    copyunit(i,j);
  835.    map[unit[i].row][unit[i].col] = unit[i];
  836.    if(unit[i].team == PLAYER)
  837.    {
  838.       allystats.attachMovie("AllyStat",unit[i].name,allystatcount++);
  839.       var tempallystat = eval("allystats." + unit[i].name);
  840.       tempallystat._y = 0;
  841.       tempallystat._x = (- tempallystat._width) * allystatcount * 1.4;
  842.       tempallystat.pic.gotoAndStop(unit[i].unit);
  843.       tempallystat.unit = unit[i];
  844.    }
  845.    i++;
  846. }
  847. hidecells();
  848. if(muted != true)
  849. {
  850.    BGM.gotoAndStop("On");
  851. }
  852. allystats._visible = queue._visible = activestats._visible = targetstats._visible = false;
  853.