task missiles(){
  if(ObjEnemy_GetInfo(objBoss, INFO_LIFE) <= 0){return;} //Default kill to prevent (0,0) spawning
	//{
		let aux; let ang = 90; let ant = 90;
    
    let r = 0; let s = 0;
    let yt; let v = 7.5;
	//}
	
  Obj_SetValue(objBoss, "cast", 1); move(); bubs();
  while(ObjEnemy_GetInfo(objBoss, INFO_LIFE) > 0){
   
    r = rand(200, 210);
    ascent(j in 0..90){
      
      PlaySFXV(SFX_SHOT00, 16);
      ascent(count in 0..4){
        ascent(i in 0..2){
          aux = CShotA2(gx + r, 20, 2, ang + 360/2*i, 1/10, 3+count/4, ICE_RED, 5); shell(aux);
          aux = CShotA2(gx - r, 20, 2, ant + 360/2*i, 1/10, 3+count/4, ICE_BLUE, 5); shell(aux);
        }
      }

      ang += v; ant -= v;
      wait(4);
    }

    ang = NormalizeAngle(ang); ant = NormalizeAngle(ant);
    v *= -1;
    wait(60);
  }
}

task bubs(){
  //{
    let r = 45; let aux;
  //}

  let objID = GetCommonData("objScene", 0);
  while(ObjEnemyBossScene_GetInfo(objID, INFO_TIMER) > 20){yield;}
  loop{
    if(Obj_IsDeleted(objBoss)){break;}

    PlaySFXV(SFX_SHOT01, 46);
    ascent(i in 0..8){
      let a = r + 360/8*i;

      aux = CScaledShotA2(bx, by, 4, a, -1/12, 2, BUBBLE_BLUE, 19, 1);
    }

    r += 360/16 + rand(-10,10); r = NormalizeAngle(r);
    wait(60*1);
  }

}

task move(){
  //{
    let a = -90; let aux;
  //}

  aux = CScaledShotA1(gx + 400*cos(-90), (gy-25) + 21*sin(-90), 0, 0, ORB_PURPLE, 21, 4.0); 
  ObjShot_SetSpellResist(aux, true); ObjShot_SetAutoDelete(aux, false); PlaySFXV(SFX_FAMILIAR, 56);
  Lerp_SetDestAtFrame(objBoss, gx + 400*cos(-90), (gy-25) + 21*sin(-90), 15); wait(21);
  fadeN(aux, 60, 100);
  loop{
    if(Obj_IsDeleted(objBoss)){break;}
    setpos(objBoss, gx + 400*cos(a), (gy-25) + 21*sin(a)); setpos(aux, bx, by); a+=0.8; a = NormalizeAngle(a); yield;
  }

  Obj_Delete(aux);
}

task fadeN(obj, ram, alpha){
  ascent(i in 0..ram+1){
    ObjRender_SetAlpha(obj, Interpolate_Smooth(255, alpha, i/ram)); yield;
  }
}

task shell(bot){
  if(ObjEnemy_GetInfo(objBoss, INFO_LIFE) <= 0){return;} //Default kill to prevent (0,0) spawning
	//{
		let ang; 
    
    let r = [0, -5, 5, 0]; 
	//}

  ObjShot_SetSpellResist(bot, true);
  while(GetObjectDistance(bot, objBoss) > 100){yield;}
  if(Obj_IsDeleted(bot)){return;} ang = geta(bot); PlaySFXV(SFX_MAGIC00, 22);
  ObjMove_AddPatternA3(bot, 1, rand(-3, -1), 90 + rand(-90, 90), 1/20, 0, 2.78, CLOUD_INDIGO);
  ObjRender_SetBlendType(bot, BLEND_ADD_ARGB); ObjShot_SetSpellResist(bot, false);
}