Waves = new Array;

// Enemy assault. This function puts the ass in assault
function Assault (timecount, asstype, assdir, assseverity) {
  this.count = timecount;
  this.type = asstype;
  this.dir = assdir;
  this.severity = assseverity;
}

// The various cruel implements of your untimely and fiery death are spawned below
// Also powerups, but you're still doomed.
Assault.prototype.generate = function() {
  if (this.type == "Wait Clear") {
    wait_clear = 1;
  }
  else if (this.type == "Triangle") {
    for (var i = 0; i < this.severity; i++) {
      if (this.dir == "Left") {
        Enemies.push (new Enemy ("Triangle", 160 - (i * 9), 0 - (i * 25), 0, 0 - (i / 3)));
      }
      else if (this.dir == "Right") {
        Enemies.push (new Enemy ("Triangle", 320 + (i * 9), 0 - (i * 25), 0, 0 - (i / 3)));
      }
      else if (this.dir == "Center") {
        Enemies.push (new Enemy ("Triangle", (i + 0.5) * (480 / this.severity), -100));
      }
    }
  }
  else if (this.type == "Cross") {
    if (this.dir == "Random") this.dir = 120 * Math.floor (Math.random() * 3) + 120;
    Enemies.push (new Enemy ("Cross", this.dir, -30));
  }
  else if (this.type == "Wyvern") {
    for (var i = 0; i < this.severity; i++) {
      if (this.dir == "Center") {
        Enemies.push (new Enemy ("Wyvern", 240, -40 - (i * 15)));
      }
      else if (this.dir == "Pair") {
        Enemies.push (new Enemy ("Wyvern", 40, -40 - (i * 15)));
        Enemies.push (new Enemy ("Wyvern", 440, -40 - (i * 15)));
      }
    }
  }
  else if (this.type == "Fireball") {
    for (var i = 0; i < this.severity; i++) {
      if (this.dir == "Random") Enemies.push (new Enemy ("Fireball", Math.random() * 480, -50, 0, 0));
      else Enemies.push (new Enemy ("Fireball", this.dir, -25 - i * 25, 0, 0));
    }
  }
  else if (this.type == "Roid" || this.type == "Bigroid") {
    var base_speed = 6;
    var randomization = 4;
    if (this.type == "Bigroid") {
      base_speed = 3;
      randomization = 2;
    }
    for (var i = 0; i < this.severity; i++) {
      Enemies.push (new Enemy (this.type, Math.random() * 480, -10 - (Math.random() * this.dir), 0, base_speed + Math.random() * randomization));
    }
  }
  else if (this.type == "Flak") {
    if (this.dir == "First") {
      ontarget (0, -50, shipx, shipy, 10);
      Enemies.push (new Enemy ("Bomb", 0, -50, shotx, shoty));
      ontarget (480, -50, shipx, shipy, 10);
      Enemies.push (new Enemy ("Bomb", 480, -50, shotx, shoty));
    }
    else if (this.dir == "Second") {
      for (var i = -3; i <= 3; i++) {
        Enemies.push (new Enemy ("Bomb", 240, -50, i, 10 - Math.abs(i)));
      }
    }
    else if (this.dir == "Third") {
      for (var i = 6; i <= 12; i++) {
        Enemies.push (new Enemy ("Bomb", 240, -70, 0, i));
      }
    }
    else if (this.dir == "Fourth") {
      for (var i = 40; i <= 460; i+= 80) {
        Enemies.push (new Enemy ("Bomb", i, -50, 0, 11));
        Enemies.push (new Enemy ("Bomb", i, -50, 0, 6));
      }
    }
  }
  else if (this.type == "Turret") {
    // Severity in this case means x position
    Enemies.push (new Enemy ("Turret", this.severity, -20));
    if (this.dir == "Mirror") Enemies.push (new Enemy ("Turret", 480 - this.severity, -20));
  }
  else if (this.type == "Sweeper") {
    Enemies.push (new Enemy ("Sweeper", this.dir, -50));
  }
  else if (this.type == "Powerup") {
    var whichpower = Math.floor (Math.random() * 2);
    if (whichpower == 0) Enemies.push (new Enemy ("Power1", 240, -20, 0, 0));
    else Enemies.push (new Enemy ("Power2", 240, -20, 0, 0));
  }
  else if (this.type == "Wall") {
    // Severity in this case means the height of the wall segment
    if (this.dir == "Left") {
      Enemies.push (new Enemy ("Wall", 50, -20 - this.severity, 0, 0, 50, this.severity));
    }
    else if (this.dir == "Right") {
      Enemies.push (new Enemy ("Wall", 430, -20 - this.severity, 0, 0, 50, this.severity));
    }
    else if (this.dir == "Corridor") {
      Enemies.push (new Enemy ("Wall", 50, -20 - this.severity, 0, 0, 50, this.severity));
      Enemies.push (new Enemy ("Wall", 430, -20 - this.severity, 0, 0, 50, this.severity));
    }
    else if (this.dir == "Left Half") {
      Enemies.push (new Enemy ("Wall", 120, -20 - this.severity, 0, 0, 120, this.severity));
    }
    else if (this.dir == "Right Half") {
      Enemies.push (new Enemy ("Wall", 360, -20 - this.severity, 0, 0, 120, this.severity));
    }
    else Enemies.push (new Enemy ("Wall", this.dir, -20 - (this.severity / 2), 0, 0, 25, this.severity));
  }
  else if (this.type == "Background") {
    background_type = this.dir;
    if (background_type == "Planet Approach" || background_type == "Planet Surface") approach_count = 0;
  }
  else if (this.type == "Background2") {
    background_type2 = this.dir;
  }
  else if (this.type == "Spiderboss") Enemies.push (new Enemy ("Spiderboss", 240, -60));
  else if (this.type == "Crossfire") Enemies.push (new Enemy ("Crossfire", 240, -60));
  else if (this.type == "Old Boss") Enemies.push (new Enemy ("Old Boss", 240, -60));
  else if (this.type == "New Boss") Enemies.push (new Enemy ("New Boss", 240, -60));
  else if (this.type == "Swarm") {
    Enemies.push (new Enemy ("Squad Leader", 240, -60));
    for (var i = 0; i < 21; i++) {
      Enemies.push (new Enemy ("Wing", 240, -60));
    }
  }
  else if (this.type == "Title") {
    life_state = "Invincible";
    state_counter = 0;
    lives = 3;
    current_score = 0;
    free_life = 1000;
    power1 = 0;
    power2 = 0;
    Enemies.push (new Enemy ("Title", this.dir, this.severity)); // Title screen
  }
  else if (this.type == "Challenge") {
    if (challenge_mode != 1) {
      challenge_mode = 1;
      challenge_mode_unlocked = 1;
      Enemies.push (new Enemy ("Challenge mode activated!", this.dir, this.severity));
    }
    else Enemies.push (new Enemy ("You have mastered the game!", this.dir, this.severity));
  }
  else if (this.type == "Music") {
    if (!is_safari) {
      if (this.dir == "Pause") {
        if (bg_music != 0) tunez[bg_music].pause();
        bg_music = 0;
      }
      else if (this.dir != bg_music) {
        if (bg_music != 0) tunez[bg_music].pause();
        bg_music = this.dir;
        tunez[bg_music].currentTime = 0;
        tunez[bg_music].play();
      }
    }
  }
  else Enemies.push (new Enemy (this.type, this.dir, this.severity)); // Text to appear onscreen
}

// Generating the waves. On purpose this time instead of random
Waves[0] = new Array;

Waves[0].push (new Assault (1, "Background", "Stars", 1));
Waves[0].push (new Assault (1, "Background2", "", 1));
Waves[0].push (new Assault (1, "Music", 1, 1));
Waves[0].push (new Assault (40, "We will have our revenge.", 50, 50));
Waves[0].push (new Assault (45, "The aliens' base of operations is on a", 50, 90));
Waves[0].push (new Assault (50, "planet in the Rigel system, and we're", 50, 110));
Waves[0].push (new Assault (55, "almost there. ETA 3 minutes.", 50, 130));
Waves[0].push (new Assault (57, "Wait Clear", "", 1));
Waves[0].push (new Assault (60, "ALERT!", 50, 50));
Waves[0].push (new Assault (65, "We're compromised!", 50, 90));
Waves[0].push (new Assault (70, "Alien spacecraft are moving to intercept.", 50, 110));
Waves[0].push (new Assault (75, "Ready weapons. We're all counting on you.", 50, 130));
Waves[0].push (new Assault (80, "Wait Clear", "", 1));
Waves[0].push (new Assault (100, "Triangle", "Left", 4));
Waves[0].push (new Assault (160, "Triangle", "Right", 4));
Waves[0].push (new Assault (210, "Powerup", "", 1));
Waves[0].push (new Assault (220, "Triangle", "Left", 5));
Waves[0].push (new Assault (280, "Triangle", "Right", 5));
Waves[0].push (new Assault (340, "Triangle", "Left", 6));
Waves[0].push (new Assault (400, "Triangle", "Right", 6));
Waves[0].push (new Assault (460, "Triangle", "Left", 7));
Waves[0].push (new Assault (520, "Triangle", "Right", 7));
Waves[0].push (new Assault (700, "Triangle", "Center", 6));
Waves[0].push (new Assault (730, "Triangle", "Center", 3));
Waves[0].push (new Assault (760, "Triangle", "Center", 7));
// Minibosses lol
Waves[0].push (new Assault (815, "Wyvern", "Pair", 2));
Waves[0].push (new Assault (850, "Wyvern", "Center", 1));
Waves[0].push (new Assault (860, "Wait Clear", "", 1));
// K back to your regularly scheduled DOOM
Waves[0].push (new Assault (865, "Powerup", "", 1));
Waves[0].push (new Assault (870, "Triangle", "Center", 1));
Waves[0].push (new Assault (890, "Triangle", "Center", 3));
Waves[0].push (new Assault (920, "Triangle", "Center", 5));
Waves[0].push (new Assault (930, "Sweeper", 150, 1));
Waves[0].push (new Assault (1000, "Fireball", "Random", 3));
Waves[0].push (new Assault (1100, "Fireball", 240, 3));
Waves[0].push (new Assault (1200, "Fireball", 120, 2));
Waves[0].push (new Assault (1225, "Fireball", 360, 2));
Waves[0].push (new Assault (1350, "Sweeper", 260, 1));
Waves[0].push (new Assault (1370, "Fireball", "Random", 5));
Waves[0].push (new Assault (1700, "UNKNOWN ENERGY SIGNATURE DETECTED", 50, 200));
Waves[0].push (new Assault (1730, "Music", 2, 1));
Waves[0].push (new Assault (1780, "Spiderboss", "", 1));


// WAVE TWO (numbering starts at 0. deal with it)
Waves[1] = new Array;

Waves[1].push (new Assault (1, "Background", "Stars", 1));
Waves[1].push (new Assault (1, "Music", 1, 1));

Waves[1].push (new Assault (15, "There's a large enemy space station ahead.", 50, 90));
Waves[1].push (new Assault (20, "You'll need to blast the core to disable the", 50, 110));
Waves[1].push (new Assault (25, "planetary defense shield", 50, 130));
Waves[1].push (new Assault (30, "Wait Clear", "", 1));

Waves[1].push (new Assault (40, "Powerup", "", 1));
Waves[1].push (new Assault (70, "Fireball", 10, 4));
Waves[1].push (new Assault (120, "Fireball", 470, 4));
for (var i = 0; i < 9; i++) {
  Waves[1].push (new Assault (240 + (i * 10), "Fireball", (i + 1) * 20, 2));
}
for (var i = 0; i < 8; i++) {
  Waves[1].push (new Assault (420 + (i * 10), "Fireball", 480 - (i + 1) * 20, 2));
}
Waves[1].push (new Assault (580, "Fireball", 240, 1));
// Too many fireballs? Naaaah, most of 'em will probably just orbit you harmlessly anyway.
// I'll be nice and give you time to take care of the stragglers.
Waves[1].push (new Assault (750, "Wall", "Left", 200));
Waves[1].push (new Assault (770, "Turret", "One", 50));
Waves[1].push (new Assault (790, "Wall", "Right", 200));
Waves[1].push (new Assault (810, "Turret", "One", 430));

Waves[1].push (new Assault (850, "Wall", "Corridor", 720));
Waves[1].push (new Assault (860, "Turret", "Mirror", 50));
Waves[1].push (new Assault (870, "Wall", "Right Half", 20));
Waves[1].push (new Assault (895, "Wall", "Left Half", 20));
Waves[1].push (new Assault (910, "Turret", "Mirror", 50));
Waves[1].push (new Assault (920, "Wall", "Right Half", 20));
Waves[1].push (new Assault (955, "Wall", "Left Half", 20));
Waves[1].push (new Assault (980, "Wall", 240, 50));
Waves[1].push (new Assault (981, "Turret", "One", 240));
Waves[1].push (new Assault (985, "Turret", "One", 240));

Waves[1].push (new Assault (1000, "Triangle", "Center", 5));
Waves[1].push (new Assault (1020, "Triangle", "Left", 4));
Waves[1].push (new Assault (1021, "Triangle", "Right", 4));

Waves[1].push (new Assault (1100, "Music", "Pause", 1));
Waves[1].push (new Assault (1140, "Wall", "Corridor", 1500));
Waves[1].push (new Assault (1145, "Music", 3, 1));
Waves[1].push (new Assault (1150, "Wyvern", "Pair", 1));
Waves[1].push (new Assault (1300, "Background", "Station", 1));

Waves[1].push (new Assault (1500, "Wyvern", "Pair", 1));

Waves[1].push (new Assault (1550, "Cross", "Random", 1));
Waves[1].push (new Assault (1650, "Cross", "Random", 1));
Waves[1].push (new Assault (1750, "Cross", "Random", 1));

Waves[1].push (new Assault (1850, "Powerup", "", 5));

Waves[1].push (new Assault (1950, "Background", "Hangar", 1));

for (var i = 0; i < 15; i++) {
  Waves[1].push (new Assault (i * 65 + 2010, "Cross", 120, 1));
  Waves[1].push (new Assault (i * 65 + 2025, "Cross", 240, 1));
  Waves[1].push (new Assault (i * 65 + 2040, "Cross", 360, 1));
}

Waves[1].push (new Assault (3100, "Crossfire", 1, 1));
Waves[1].push (new Assault (3105, "Wait Clear", "", 1));

Waves[1].push (new Assault (3106, "Music", "Pause", 1));

Waves[1].push (new Assault (3110, "Powerup", "", 1));

Waves[1].push (new Assault (3115, "Planetary defense shield is down", 50, 90));
Waves[1].push (new Assault (3120, "You are clear to proceed to the planet", 50, 110));

Waves[1].push (new Assault (3150, "Background2", "Blue Giant", 1));
Waves[1].push (new Assault (3170, "Background", "Station", 1));
Waves[1].push (new Assault (3320, "Background", "Stars", 1));

// WAVE THREE - now shit gets real
Waves[2] = new Array;

Waves[2].push (new Assault (1, "Background2", "Blue Giant", 1));
Waves[2].push (new Assault (1, "Background", "Stars", 1));
Waves[2].push (new Assault (1, "Music", 4, 1));

Waves[2].push (new Assault (15, "Approaching Rigel.", 50, 90));
Waves[2].push (new Assault (20, "Watch out. More enemies converging on", 50, 110));
Waves[2].push (new Assault (25, "your location. Maybe you can lose them", 50, 130));
Waves[2].push (new Assault (30, "in the asteroid belt.", 50, 150));
Waves[2].push (new Assault (35, "Wait Clear", "", 1));

Waves[2].push (new Assault (70, "Triangle", "Right", 4));
Waves[2].push (new Assault (85, "Triangle", "Left", 4));
Waves[2].push (new Assault (100, "Triangle", "Right", 4));
Waves[2].push (new Assault (115, "Triangle", "Left", 4));
Waves[2].push (new Assault (125, "Triangle", "Center", 6));

Waves[2].push (new Assault (180, "Roid", 400, 30));
Waves[2].push (new Assault (390, "Roid", 400, 30));
Waves[2].push (new Assault (600, "Roid", 800, 60));
Waves[2].push (new Assault (680, "Roid", 800, 50));
Waves[2].push (new Assault (690, "Powerup", "", 1));
Waves[2].push (new Assault (760, "Roid", 800, 60));

Waves[2].push (new Assault (800, "Bigroid", 200, 3));

Waves[2].push (new Assault (850, "Triangle", "Right", 10));

Waves[2].push (new Assault (900, "Background", "Planet Approach", 1));
Waves[2].push (new Assault (980, "There it is.", 50, 90));
Waves[2].push (new Assault (985, "Reduce speed to subluminal and prepare to", 50, 130));
Waves[2].push (new Assault (990, "encounter heavy resistance.", 50, 150));
Waves[2].push (new Assault (1280, "Triangle", "Center", 5));
Waves[2].push (new Assault (1300, "Cross", 240, 1));
Waves[2].push (new Assault (1300, "Cross", 120, 1));
Waves[2].push (new Assault (1300, "Cross", 360, 1));
Waves[2].push (new Assault (1380, "Triangle", "Center", 5));
Waves[2].push (new Assault (1400, "Cross", 240, 1));
Waves[2].push (new Assault (1400, "Cross", 120, 1));
Waves[2].push (new Assault (1400, "Cross", 360, 1));
Waves[2].push (new Assault (1500, "Cross", 200, 1));
Waves[2].push (new Assault (1500, "Cross", 280, 1));
Waves[2].push (new Assault (1650, "Roid", 350, 20));
Waves[2].push (new Assault (1900, "Cross", 240, 1));
Waves[2].push (new Assault (1900, "Cross", 360, 1));
Waves[2].push (new Assault (1900, "Cross", 120, 1));
Waves[2].push (new Assault (2150, "Roid", 350, 20));
Waves[2].push (new Assault (2200, "Bigroid", 400, 6));
Waves[2].push (new Assault (2400, "Cross", 160, 1));
Waves[2].push (new Assault (2401, "Cross", 320, 1));

Waves[2].push (new Assault (2450, "Sweeper", 240, 1));

// Big asteroids + fireballs = aim carefully
Waves[2].push (new Assault (2450, "Bigroid", 100, 4));
Waves[2].push (new Assault (2510, "Bigroid", 100, 5));
Waves[2].push (new Assault (2570, "Bigroid", 100, 4));
Waves[2].push (new Assault (2600, "Fireball", "Random", 4));
Waves[2].push (new Assault (2640, "Bigroid", 100, 5));
Waves[2].push (new Assault (2700, "Bigroid", 200, 7));
Waves[2].push (new Assault (2780, "Fireball", "Random", 5));
Waves[2].push (new Assault (2800, "Roid", 450, 40));
Waves[2].push (new Assault (2900, "Bigroid", 100, 5));
Waves[2].push (new Assault (3000, "Fireball", "Random", 3));
Waves[2].push (new Assault (3050, "Bigroid", 250, 15));
Waves[2].push (new Assault (3125, "Triangle", "Center", 7));
Waves[2].push (new Assault (3175, "Bigroid", 250, 10));

Waves[2].push (new Assault (3300, "Powerup", "", 1));

Waves[2].push (new Assault (3400, "Triangle", "Left", 4));
Waves[2].push (new Assault (3450, "Triangle", "Left", 3));
Waves[2].push (new Assault (3500, "Triangle", "Left", 2));
Waves[2].push (new Assault (3550, "Triangle", "Left", 1));

Waves[2].push (new Assault (3650, "You're about to run into an old friend...", 50, 90));
Waves[2].push (new Assault (3655, "You know how to handle this one.", 50, 110));
Waves[2].push (new Assault (3660, "Nothing to worry about.", 50, 130));

Waves[2].push (new Assault (3905, "Background2", "", 1));
Waves[2].push (new Assault (3905, "Background", "Planet Surface", 1));

// Blast from the past
Waves[2].push (new Assault (3950, "Old Boss", "Center", 1));
Waves[2].push (new Assault (3955, "Wait Clear", "", 1));
// Meet the new boss, same as the old boss. But this one come some special surprises. YEAAAAAAAAAAHHHHH
Waves[2].push (new Assault (4000, "New Boss", "Center", 1));
Waves[2].push (new Assault (4000, "Music", 2, 1));

// WAVE FOUR - planetary rather than intergalactic
Waves[3] = new Array;
Waves[3].push (new Assault (1, "Background", "Planet Surface", 1));
Waves[3].push (new Assault (1, "Music", 1, 1));
Waves[3].push (new Assault (100, "Flak", "First", 1));
Waves[3].push (new Assault (300, "Flak", "Second", 1));
Waves[3].push (new Assault (500, "Flak", "Third", 1));
Waves[3].push (new Assault (700, "Flak", "Fourth", 1));
Waves[3].push (new Assault (850, "Powerup", "", 1));
Waves[3].push (new Assault (1000, "Triangle", "Left", 4));

Waves[3].push (new Assault (1104, "Wall", "Right", 60));
Waves[3].push (new Assault (1105, "Bigroid", 600, 5));
Waves[3].push (new Assault (1110, "Turret", "One", 430));
Waves[3].push (new Assault (1154, "Wall", "Left", 60));
Waves[3].push (new Assault (1160, "Turret", "One", 50));
Waves[3].push (new Assault (1204, "Wall", "Right", 60));
Waves[3].push (new Assault (1210, "Turret", "One", 430));
Waves[3].push (new Assault (1254, "Wall", "Left", 60));
Waves[3].push (new Assault (1260, "Turret", "One", 50));
Waves[3].push (new Assault (1300, "Wall", "Corridor", 220));
Waves[3].push (new Assault (1310, "Turret", "Mirror", 50));
Waves[3].push (new Assault (1320, "Turret", "Mirror", 50));
Waves[3].push (new Assault (1330, "Turret", "Mirror", 50));
Waves[3].push (new Assault (1340, "Turret", "Mirror", 50));
Waves[3].push (new Assault (1341, "Bigroid", 600, 5));
Waves[3].push (new Assault (1400, "Wall", 240, 100));
Waves[3].push (new Assault (1404, "Turret", "One", 240));
Waves[3].push (new Assault (1410, "Turret", "One", 240));
Waves[3].push (new Assault (1480, "Wall", "Left Half", 50));
Waves[3].push (new Assault (1480, "Wall", "Right", 50));
Waves[3].push (new Assault (1500, "Background2", "Stop Craters", 1));
Waves[3].push (new Assault (1501, "Bigroid", 300, 3));
Waves[3].push (new Assault (1510, "Wall", "Right Half", 50));
Waves[3].push (new Assault (1510, "Wall", "Left", 50));
Waves[3].push (new Assault (1540, "Wall", "Corridor", 60));
Waves[3].push (new Assault (1540, "Wall", 240, 100));
Waves[3].push (new Assault (1546, "Turret", "Mirror", 50));
Waves[3].push (new Assault (1546, "Turret", "One", 240));
Waves[3].push (new Assault (1600, "Background", "Rift", 1));
Waves[3].push (new Assault (1600, "Background2", "", 1));

// Into the rift
Waves[3].push (new Assault (1700, "Sweeper", 200, 1));
Waves[3].push (new Assault (1750, "Triangle", "Right", 4));
Waves[3].push (new Assault (1800, "Triangle", "Left", 4));
Waves[3].push (new Assault (1900, "Triangle", "Right", 12));
Waves[3].push (new Assault (2000, "Sweeper", 280, 1));
Waves[3].push (new Assault (2050, "Fireball", 60, 2));
Waves[3].push (new Assault (2100, "Triangle", "Center", 7));
Waves[3].push (new Assault (2200, "Sweeper", 240, 1));
Waves[3].push (new Assault (2300, "Triangle", "Left", 6));
Waves[3].push (new Assault (2350, "Fireball", 200, 3));
Waves[3].push (new Assault (2450, "Triangle", "Center", 4));
Waves[3].push (new Assault (2500, "Triangle", "Center", 4));
Waves[3].push (new Assault (2550, "Triangle", "Center", 4));
Waves[3].push (new Assault (2600, "Triangle", "Center", 4));
Waves[3].push (new Assault (2605, "Background", "Riftoff", 1));
Waves[3].push (new Assault (2650, "Wyvern", "Pair", 1));
Waves[3].push (new Assault (2650, "Wyvern", "Center", 1));
Waves[3].push (new Assault (2750, "Triangle", "Center", 4));
Waves[3].push (new Assault (2850, "Triangle", "Center", 3));
Waves[3].push (new Assault (2950, "Triangle", "Center", 2));
Waves[3].push (new Assault (3040, "Music", "Pause", 1));
Waves[3].push (new Assault (3050, "Triangle", "Center", 1));

// WAVE FIVE - Congraturation! This story is happy end
Waves[4] = new Array;
Waves[4].push (new Assault (1, "Background", "Horizon", 1));
Waves[4].push (new Assault (1, "Background2", "", 1));
Waves[4].push (new Assault (1, "Music", 2, 1));

Waves[4].push (new Assault (2, "Powerup", "", 1));
Waves[4].push (new Assault (20, "UNKNOWN ENERGY SIGNATURE DETECTED", 50, 200));
Waves[4].push (new Assault (210, "Wait Clear", "", 1));

Waves[4].push (new Assault (214, "Swarm", "", 1));
Waves[4].push (new Assault (750, "Background", "Warp Two", 1));
Waves[4].push (new Assault (751, "Wait Clear", "", 1));
Waves[4].push (new Assault (755, "Music", "Pause", 1));

Waves[4].push (new Assault (770, "Background", "Stars", 1));

Waves[4].push (new Assault (780, "Congratulations!", 50, 120));
Waves[4].push (new Assault (785, "You have destroyed the alien invasion", 50, 140));
Waves[4].push (new Assault (790, "fleet and turned the tide of the war.", 50, 160));
Waves[4].push (new Assault (791, "Wait Clear", "", 1));
Waves[4].push (new Assault (795, "THE END", 200, 310));
Waves[4].push (new Assault (910, "Challenge", 130, 310));

// WAVE SIX - attract mode
Waves[5] = new Array;
Waves[5].push (new Assault (1, "Background", "Stars", 1));
Waves[5].push (new Assault (1, "Background2", "Stars", 1));
Waves[5].push (new Assault (2, "Title", "", 1));
