

  let csd = GetCurrentScriptDirectory;
  let cx=GetCenterX();
  let cy=GetCenterY();
  let minx=GetClipMinX();
  let miny=GetClipMinY();
  let maxx=GetClipMaxX();
  let maxy=GetClipMaxY();
  let limit1 = csd~ "se\limit1.wav"; LoadSE(limit1);
  let limit2 = csd~ "se\limit2.wav"; LoadSE(limit2);
  let seshot4 = csd~ "se\enemyshot04.wav"; LoadSE(seshot4);
  let sevanish = csd~ "se\BossVanish.wav"; LoadSE(sevanish);
  let SpellBack = csd~".\img\NueSpellBack.png"; LoadGraphic(SpellBack);
  SetRateScoreSystemEnable(false);
 SetEffectForZeroLife(120,120,2);
  
  task BombBarrierOnSpell(shot,bomb){
 let difficult = GetCommonDataDefaultEx("","dif",0);
   loop{
   if(OnBomb){SetDamageRate(0,0);}
   else{SetDamageRate(shot,0);}
   yield;
    }
  }  

    task Count{
        while(GetTimer > 10){yield;}
     loop(5){
      PlaySE(limit1); 
        loop(60){yield;}
       }
       loop(5){
          PlaySE(limit2); 
        loop(60){yield;}
       }
    }

  task BombBarrierEffect{
   loop{
  while(!OnBomb){wait(1);}
   imgBOSS = csd~"img\UFG.png";
   LoadGraphic(imgBOSS);
   sgr(0,0);
  while(OnBomb){
    let u = rand(-180,180);
    SetGraphicAngle(0,0,u);
    SetGraphicScale(2,2);
    SetColor(255,0,0);
     wait(1);
    }
   imgBOSS = csd~"img\dot_nue.png";
   sgr(4,2);
   SetColor(255,255,255);
   SetGraphicAngle(0,0,0);
  SetGraphicScale(1,1);
    wait(1);
    }
  }

  task Circle2(size,kill){
           let c= Obj_Create(OBJ_EFFECT);
             Obj_SetX(c,GetX);
             Obj_SetY(c,GetY);
             Obj_SetAngle(c,0);
             ObjEffect_SetAngle(c,0,0,0);
             ObjEffect_SetTexture(c,effect);
             ObjEffect_SetRenderState(c,ADD);
             ObjEffect_SetPrimitiveType(c,PRIMITIVE_TRIANGLEFAN);
             ObjEffect_SetLayer(c,1);
             ObjEffect_CreateVertex(c,62);
             ObjEffect_SetVertexXY(c,0,0,0);
             ObjEffect_SetVertexUV(c,0,128,128);
             ObjEffect_SetVertexColor(c,0,255,255,255,255);
             ObjEffect_SetScale(c,size/10,size/10);
   let r = 242; let g = 0; let b = 0;
            ascent(let i in 0..21){
                ObjEffect_SetVertexXY(c,i+1,cos(i*6)*20,sin(i*6)*20);
                ObjEffect_SetVertexUV(c,i+1,cos(i*6)*128+128,sin(i*6)*128+128);
                ObjEffect_SetVertexColor(c,i+1,255,r,g,b);
        r -= 12;  g += 12;
            }
       ascent(let i in 21..41){
                ObjEffect_SetVertexXY(c,i+1,cos(i*6)*20,sin(i*6)*20);
                ObjEffect_SetVertexUV(c,i+1,cos(i*6)*128+128,sin(i*6)*128+128);
                ObjEffect_SetVertexColor(c,i+1,255,r,g,b);
        g -= 12;  b += 12;
            }
     ascent(let i in 41..61){
                ObjEffect_SetVertexXY(c,i+1,cos(i*6)*20,sin(i*6)*20);
                ObjEffect_SetVertexUV(c,i+1,cos(i*6)*128+128,sin(i*6)*128+128);
                ObjEffect_SetVertexColor(c,i+1,255,r,g,b);
       b -= 12;  r += 12;
            }
      Set; 
     task Set{
   let h = 0;
         while(!Obj_BeDeleted(c)){
            Obj_SetX(c,GetX); Obj_SetY(c,GetY);
       ObjEffect_SetAngle(c,0,0,h);
      h += 1.2;
            yield;
           }
         }
    wait(kill);
    if(kill > 0){Obj_Delete(c);}
    }

 task SpellBackGround(size){
           let c= Obj_Create(OBJ_EFFECT);
             Obj_SetX(c,cx);
             Obj_SetY(c,cy);
             Obj_SetAngle(c,0);
             ObjEffect_SetAngle(c,0,0,0);
             ObjEffect_SetTexture(c,SpellBack);
             ObjEffect_SetRenderState(c,ALPHA);
             ObjEffect_SetPrimitiveType(c,PRIMITIVE_TRIANGLEFAN);
             ObjEffect_SetLayer(c,0);
             ObjEffect_CreateVertex(c,62);
             ObjEffect_SetVertexXY(c,0,0,0);
             ObjEffect_SetVertexUV(c,0,128,128);
             ObjEffect_SetVertexColor(c,0,128,255,255,255);
             ObjEffect_SetScale(c,size/10,size/10);

      /*      ascent(let i in 0..61){
                ObjEffect_SetVertexXY(c,i+1,cos(i*6)*20,sin(i*6)*20);
                ObjEffect_SetVertexUV(c,i+1,cos(i*6)*512+128,sin(i*6)*512+128);
                ObjEffect_SetVertexColor(c,i+1,255,255,255,255);
            } */

  let r = 242; let g = 0; let b = 0;
            ascent(let i in 0..21){
                ObjEffect_SetVertexXY(c,i+1,cos(i*6)*20,sin(i*6)*20);
                ObjEffect_SetVertexUV(c,i+1,cos(i*6)*512+128,sin(i*6)*512+128);
                ObjEffect_SetVertexColor(c,i+1,255,r,g,b);
        r -= 12;  g += 12;
            }
       ascent(let i in 21..41){
                ObjEffect_SetVertexXY(c,i+1,cos(i*6)*20,sin(i*6)*20);
                ObjEffect_SetVertexUV(c,i+1,cos(i*6)*512+128,sin(i*6)*512+128);
                ObjEffect_SetVertexColor(c,i+1,255,r,g,b);
        g -= 12;  b += 12;
            }
     ascent(let i in 41..61){
  ObjEffect_SetVertexXY(c,i+1,cos(i*6)*20,sin(i*6)*20);
                ObjEffect_SetVertexUV(c,i+1,cos(i*6)*512+128,sin(i*6)*512+128);
                ObjEffect_SetVertexColor(c,i+1,255,r,g,b);
       b -= 12;  r += 12;
            } 

      Set; 
     task Set{
   let i = 0;
         while(!Obj_BeDeleted(c)){
            ObjEffect_SetAngle(c,0,0,i/10);
        i++;
            yield;
           }
         }
    }