task missiles(){
  if(ObjEnemy_GetInfo(objBoss, INFO_LIFE) <= 0){return;} //Default kill to prevent (0,0) spawning
	//{
		let aux;

    real r = 0, s = 0, wvel = 0.3; int v = -1; 
    int gr = SHOT_BALL_RED;
	//}
	
  leggies();
  while(ObjEnemy_GetInfo(objBoss, INFO_LIFE) > 0){
    if(Obj_IsDeleted(objBoss)){break;}

    ascent(int t in 0..10){

      s = Interpolate_Linear(5, 3, t/9);
      loop(10){
        if(Obj_IsDeleted(objBoss)){break;}
        ascent(int i in 0..8){
          let a = r + 360/8*i;

          aux = CShotA1(bx, by, s, a, gr+1+26, 11); sub_01(aux, [30, 20]);
          ObjMove_AddPatternA3(aux, 30, -0.5, a, 1/20, wvel, 5, gr);
        }

        PlaySFXV(SFX_SHOT00, 30);
        r += 360/16 + (0.8*v); 
        wait(60*1/22);
      }

      v *= -1; r += 360/16 + rand(-4, 4);
      if(v > 0){gr = SHOT_BALL_ORANGE;} else{gr = SHOT_BALL_RED;}

      wvel *= -1; 
      wait(60*1/6);
    }

    wait(60*1);
  }
}

task sub_01(obj, time){wait(time[0]); grow(obj, time[1]);}

task leggies(){
  if(ObjEnemy_GetInfo(objBoss, INFO_LIFE) <= 0){return;} //Default kill to prevent (0,0) spawning
	//{
		let aux; real[] pos = [0, 0];

    real r = 0, wvel = 0.5, temp = 0; int v = 1;
	//}
	
  while(ObjEnemy_GetInfo(objBoss, INFO_LIFE) > 0){
    ascent(int i in 0..5+1){
      if(Obj_IsDeleted(objBoss)){break;}
      pos[0] = Interpolate_Linear(bx-100, bx+100, i/5);
      pos[1] = Interpolate_Overshoot(by-20, by-20, -10, i/5);
      
      PlaySFXV(SFX_HUGESHOT, 80);
      r = GetAngleFromTo(px, py, pos[0], pos[1]);
      ascent(int j in 0..10){
        aux = CustomCLaser(pos[0], pos[1], 2, r + 360/10*j, SHOT_DIAMOND_INVERT_DRED, [3, 3.5, 1, 3], BLEND_ALPHA);
        snakeu(aux, 12, 6*v); ObjMove_AddPatternA2(aux, 15, 2, NO_CHANGE, 1/20, NO_CHANGE, 5);
      }

      v *= -1;
      wait(60);
    }

    wait(30); r = rand(0,360); temp = 0;
    descent(int j in 0..40){
      if(Obj_IsDeleted(objBoss)){break;}

      PlaySFXV(SFX_SHOT01, 40);
      ascent(int i in 0..14){
        aux = CScaledShotA1(pos[0], pos[1], 2 + j/8, r + 360/temp*i, SHOT_FIREBALL_RED, 6, 1.15);
      }

      temp += 6; temp = (temp > 14) ? 14 : temp;
      r += 360/28 + rand(-3.25, 3.25);
      wait(5);
    }

    wait(50);

    descent(int i in 0..5+1){
      if(Obj_IsDeleted(objBoss)){break;}
      pos[0] = Interpolate_Linear(bx-100, bx+100, i/5);
      pos[1] = Interpolate_Overshoot(by-20, by-20, -10, i/5);
      
      PlaySFXV(SFX_HUGESHOT, 80);
      r = GetAngleFromTo(px, py, pos[0], pos[1]);
      ascent(int j in 0..10){
        aux = CustomCLaser(pos[0], pos[1], 2, r + 360/10*j, SHOT_DIAMOND_INVERT_DRED, [3, 3.5, 1, 3], BLEND_ALPHA);
        snakeu(aux, 12, 6*v); ObjMove_AddPatternA2(aux, 15, 2, NO_CHANGE, 1/20, NO_CHANGE, 5);
      }

      v *= -1;
      wait(60);
    }

    wait(30); r = rand(0,360); temp = 0;
    descent(int j in 0..40){
      if(Obj_IsDeleted(objBoss)){break;}
      
      PlaySFXV(SFX_SHOT01, 40);
      ascent(int i in 0..14){
        aux = CScaledShotA1(pos[0], pos[1], 2 + j/8, r + 360/temp*i, SHOT_FIREBALL_RED, 6, 1.15);
      }

      temp += 6; temp = (temp > 14) ? 14 : temp;
      r += 360/28 + rand(-3.25, 3.25);
      wait(6);
    }

    wait(50);
  }
}