task missiles(){
  if(ObjEnemy_GetInfo(objBoss, INFO_LIFE) <= 0){return;} //Default kill to prevent (0,0) spawning
	//{
	  let aux;
    
    const real r = 90;
    const int frame = 10;
    real v = 1, dist, x;
	//}
	
  ascent(int i in 0..30){
    ObjRender_SetAlpha(objBoss, Interpolate_Linear(255, 0, i/29)); 
    ObjMove_SetY(objBoss, gy-Interpolate_Linear(100, 0, i/29));
    yield;
  }
  SetCommonData("tangible", false);

  PlaySFXV(SFX_MAGIC00, 80); PlaySFXVDelay(SFX_WON00, 90, 60);
  ascent(int co in 0..frame){
    dist = Interpolate_Linear(10, 400, co/(frame-1));
    ascent(int i in 0..11){
      let a = 30 + 360/11*i;

      aux = CScaledShotA1(bx + dist*cos(a), by + dist*sin(a), 0, a, SHOT_ORB_YELLOW, 30+11*co, 0.85 + rand(-0.1, 0.1));
      sub00(aux, 30+11*co + 30, dist, a, 360/5.5, 0.35*v);
    }

    v *= -1;
  }
  
  
  while(GetCommonData("Timer", 600) > 40){yield;}
  PlaySFXV(SFX_MAO01, 80);

  v = 0; task02();
  while(ObjEnemy_GetInfo(objBoss, INFO_LIFE) > 0){

    PlaySFXV(SFX_SHOT00, 30);
    ascent(int i in 0..8){
      x = Interpolate_Linear(0-20, stgw-20, i/7);

      aux = CScaledShotA2(x, 10, 5, r + sin(v)*16, -1/24, 2, SHOT_BILL_INVERT_DRED, 8, 1.85);
    }

    v += 360/50;
    wait(18);
  }
}

task task02(){
  while(GetCommonData("Timer", 600) > 27){yield;}
  PlaySFXV(SFX_WON01, 70);

  real r = 30, dist = 0; let aux; 
  int k = 0, j = 0, frame = 36; task03(frame);
  while(ObjEnemy_GetInfo(objBoss, INFO_LIFE) > 0){
    PlaySFXV(SFX_SHOT04, 26);

    dist = Interpolate_Smoother(180, 16, as_real(j)/frame);
    ascent(int i in -1..2){
      if(i == 0){continue;}

      r = GetAngleFromTo(px, py, stx[0], gy - 200); real a = r + dist*i;
      aux = CScaledShotA1(stx[0], gy - 200, 8, a, SHOT_DIAMOND_RED+k, 5, 2.5);
      ObjMove_AddPatternA3(aux, 20, -1, NO_CHANGE, 1/7, 0, 5.5, SHOT_DIAMOND_INVERT_RED+k); 
      ObjShot_SetSpellResist(aux, true);

      r = GetAngleFromTo(px, py, stx[1], gy - 200); a = r + dist*i;
      aux = CScaledShotA1(stx[1], gy - 200, 8, a, SHOT_DIAMOND_RED+k, 5, 2.5);
      ObjMove_AddPatternA3(aux, 20, -1, NO_CHANGE, 1/7, 0, 5.5, SHOT_DIAMOND_INVERT_RED+k); 
      ObjShot_SetSpellResist(aux, true);
    }

    j++; j = clamp(j, 0, frame);

    k += 2; k = (k > 22) ? 0 : k;
    wait(60*1/11);
  }
}

task task03(int fr){
  wait(fr);

  real r = 0; 
  while(ObjEnemy_GetInfo(objBoss, INFO_LIFE) > 0){
    PlaySFXV(SFX_SHOT01, 60);

    ascent(i in 0..23){
      CScaledShotA2(bx, by, 5, r + 360/23*i, -1/11, 0.7, SHOT_BALL_INVERT_DYELLOW, 8, 1);
    }

    r += 360/40 + rand(-10, 10);
    wait(60*1.75);
  }
}
task sub00(obj, waitTime, dist, start, range, increment){
  real a = start, o = 0, i = 0;
  ObjShot_SetSpellResist(obj, true); ObjShot_SetAutoDelete(obj, false);

  wait(waitTime);
  loop{
    if(Obj_IsDeleted(obj)){return;}

    setpos(obj, bx + dist*cos(a), by + dist*sin(a));

    a = start + sin(o)*range; o += increment; 
    i += 1/15; i = (i > increment) ? increment : i;

    a = NormalizeAngle(a); o = NormalizeAngle(o);
    yield;
  }
}