
#Title[Spell01]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main {let us=0;
  #include_function ".\AnimationLib.dnh"
  #include_function ".\N.txt"
 let yh=0;let yu=0;
  let imgNue = GetCurrentScriptDirectory ~ "KE.png";
  let whe = GetCurrentScriptDirectory ~ "Wheel.jpg";
  let cir = GetCurrentScriptDirectory ~ "circle.png";
  let cir2 = GetCurrentScriptDirectory ~ "circle.png";
  let qwe = GetCurrentScriptDirectory ~ "supershot.txt";
  let co=rand_int(1,5);
  let sp1= GetCurrentScriptDirectory ~ "spbg2.png";
  let sp2q= GetCurrentScriptDirectory ~ "sp2q.png";
  let sp2= GetCurrentScriptDirectory ~ "sp112.png";
  let sp22= GetCurrentScriptDirectory ~ "spbg1.png";
  let spn= GetCurrentScriptDirectory ~ "sn5.png";
  
   let Cut = GetCurrentScriptDirectory ~ "KeCut.png";
 #include_function ".\function_cutin.txt"
 //#include_function ".\fam1.txt"
  #include_function ".\Halo.txt"
   let imagefile4 = GetCurrentScriptDirectory ~ "1q.png";
  @Initialize { 
  
  CreateAura01("RED",0,2);
   LoadUserShotData(qwe);
    SetLife(4500);
	SetTimer(45);
    //SetY(-120);
	
	  Explosion01(GetX,GetY,11,1,60);
 Explosion01(GetX,GetY,11,1,60);
	
	  
	yim;
    LoadGraphic(imgNue);
    LoadGraphic(cir);
    LoadGraphic(cir2);
    LoadGraphic(whe);
    LoadGraphic(Cut);
    LoadGraphic(imagefile4);
    LoadGraphic(sp1);
    LoadGraphic(spn);
    LoadGraphic(sp2);
    LoadGraphic(sp2q);
    LoadGraphic(sp22);
    // SetDurableSpellCard;
	 gro;
    InitializeAnimationData;
	  MagicCircle(false);
  
    Animate("nue", "idle", true);
   mus;d;
    ShowOffNueAnimation;
    // CreateAura01;
  }
  
  task yim{loop{yield;
  
   if(GetTimer<11&&GetTimer>=0){PlaySE(GetCurrentScriptDirectory ~ ".\Sounds\se_timeout.wav");wait(60);}
 
  }}
  
  
 let da=0;
  task d{
  loop{
  
  if(da==0){
  SetDamageRate(0,0);}
   if(da==1){
  SetDamageRate(80,50);}
  
  yield;
  }}
  
  @MainLoop {
  
  SetCollisionA(GetX,GetY,30);
  SetCollisionB(GetX,GetY-40,20);
  SetCollisionB(GetX,GetY,30);
  SetCollisionB(GetX,GetY+10,30);
    yield ;
   
    }
  let wave=0;
  let x=0;
  
  let xx=0;
  let aa=0;
  let yy=0;
  
  task u{
  b;
  c;
  
  
  task c{
  wait(70);
  loop(13){
  yield;
  yy+=7.6;
  }
  
  loop(10){
  yield;
  yy+=4;
  }
  loop(10){
  yield;
  yy+=3;
  }
  
  loop(10){
  yield;
  yy+=2;
  }
  
  
  loop(10){
  yield;
  yy+=1;
  }
  
  
  
  
  
  
  }
  
  
  
  task b{
  
  loop(60){
  yield;
  xx+=6;
  }
  }
  task a{
  loop(60){yield;
  ss+=0.033333;
  }
  }
  
  a;
  loop(90){
  yield;
  aa+=2.8;
  }
  
  
  
  }let ss=0;
  
   let x=0;let al=0;let si=0;
  let al1=0;let si1=0;
  task gro{
  gro2;
  loop(120){
  yield;
  al+=0.6;
  si+=0.003;
  }
  
  }
   task gro2{
  
  loop(190){
  wait(2);
  al1+=0.8;
  si1+=0.0015;
  }
  
  }
  @DrawLoop {
     
   
   
	    SetTexture(cir);SetAlpha(100);
 
	SetGraphicRect(0,0,128,127);
	SetGraphicScale(1.9+sin(wave)*0.2,1.9+sin(wave)*0.2);


	SetGraphicAngle(0, 0, -x);
	DrawGraphic(GetX,GetY);
	
	
	    SetTexture(cir);SetAlpha(100);
 
SetGraphicRect(0,0,128,127);
SetGraphicScale(1.9+sin(wave)*0.2,1.9+sin(wave)*0.2);

wave+=3;x+=2;
	SetGraphicAngle(0, 0, x);
	DrawGraphic(GetX,GetY);
  
  	 
	 
     SetTexture(spn);SetAlpha(aa);
 SetGraphicRect(0,0,648,80);
	
	SetGraphicScale(2.6-ss,2.7-ss);


	SetGraphicAngle(0,-xx, 0);
	DrawGraphic(GetCenterX+5,GetCenterY-yy+30);
	 
	 
  
      
   
	   
  
  
     SetTexture(imgNue);SetAlpha(255);
 SetGraphicRect(0,0,0,0);
	
	SetGraphicScale(0.8,0.8);


	SetGraphicAngle(0, 0, 0);
	DrawGraphic(GetX,GetY);
	
	 DrawAnimatedSprite("nue", GetX, GetY-5*sin(h));
  

   h+=4;
  
  
  
  SetGraphicAngle(0, 0, 0);
SetGraphicScale(0.8,0.8);
   
   DrawText("Tenxka Shin",GetClipMinX,30,15,255);
  }let h=0;let ann=0;
  task mus{PlayMusic(GetCurrentScriptDirectory ~ ".\Sounds\Nue1.mp3");}
  
  
  
   @BackGround{
  
 
	 
	
  
   SetAlpha(255);
   SetTexture(imagefile4);SetColor(255,255,255);
      SetGraphicRect(0, 0, 1111, 1111);
SetGraphicScale(1,1);
      SetGraphicAngle(0, 0,180);
      DrawGraphic(GetCenterX,GetCenterY);
  
      SetTexture(sp1);SetAlpha(255);
 
	SetGraphicRect(0,0,384,448);
	SetGraphicScale(1,1);


	SetGraphicAngle(0, 0, 0);
	DrawGraphic(GetCenterX,GetCenterY);
	
	
	  SetTexture(sp2);SetAlpha(185);
 
	SetGraphicRect(0,0,864,600);
	SetGraphicScale(1,1);


	SetGraphicAngle(0, 0, 0);
	DrawGraphic(GetCenterX-77,GetCenterY);
	
	
	 SetTexture(sp2q);SetAlpha(65);
 
	SetGraphicRect(0,0,-684,848+cx);
	SetGraphicScale(1,1);

cx+=0.5;
	SetGraphicAngle(0, 0, 0);
	DrawGraphic(GetCenterX,GetCenterY);
	
	
	
  
   SetAlpha(137);
   SetTexture(sp22);SetColor(255,255,255);
      SetGraphicRect(0, 0, 1111, 1111);
SetGraphicScale(1.7,1.7);
      SetGraphicAngle(0, 0,x/24);
      DrawGraphic(GetCenterX-133,GetCenterY-133);
	  
	  
	  SetTexture(whe);SetAlpha(70);
      SetGraphicRect(0, 0, 670, 859);
SetGraphicScale(0.64+0.02*sin(dor),0.64+0.02*sin(dor));
      SetGraphicAngle(0, 0,0);
      DrawGraphic(GetCenterX,GetCenterY);
	  dor+=3;
	
  }
  let dor=0;
  let cx=0;
  let cx2=0;
  
  
  @Finalize {
    DeleteGraphic(imgNue);
   
  }
  
  
 
  

  let ax=0;
  let ay=0;
  let aan=0;
  let co=0;
  task ShowOffNueAnimation {
  PlaySE(GetCurrentScriptDirectory ~ ".\Sounds\se_fault.wav");
  
  
  
  
  
  
  
  
  //wait(60);
   if(GetX>GetCenterX){
	SetMovePosition03(GetCenterX, GetCenterY-40, 13, 3);
      SetNueMoveAnimation("left");}
	   if(GetX<GetCenterX){
	SetMovePosition03(GetCenterX, GetCenterY-40, 13, 3);
      SetNueMoveAnimation("right");}
	    if(GetX==GetCenterX){
	SetMovePosition03(GetCenterX, GetCenterY-40, 13, 3);
      SetNueMoveAnimation("right");}
      yield ;
      while(GetSpeed>0.1){yield;}
wait(90);
      Animate("nue", "start cast", false);
	  wait(20);
	  
	  SetScore(22250);
	  u;
	   cutin("NAZRIN", "",Cut,0,0,568,558);
	  //PlaySE(GetCurrentScriptDirectory ~ ".\Sounds\se_boon01.wav");
	    
  PlaySE(GetCurrentScriptDirectory ~ ".\Sounds\se_cat00.wav");
		
		 wait(20); 
		  Animate("nue", "stop cast", false);
	  wait(20);
	   Animate("nue", "idle", true);
	   
	   PlaySE(GetCurrentScriptDirectory ~ ".\Sounds\se_ch02.wav");
fir2;
	 Concentration02(30);
 Concentration02(40);
 Concentration02(30);let fg=0;
 Concentration02(40);
 Concentration02(30);let anga=0;
 Concentration02(40);
	 wait(100);
	
    loop{ 

	Animate("nue", "start cast", false);
	  wait(20);
	  ////////////
	  da=1;
fir;
	 
	  
	  
	  ////////////////////
	  wait(30); 
		  Animate("nue", "stop cast", false);
	 wait(20);
	   Animate("nue", "idle", true);
	 wait(120);
	  PlaySE(GetCurrentScriptDirectory ~ ".\Sounds\se_ch02.wav");

	 Concentration02(30);
 Concentration02(40);
 Concentration02(30);let fg=0;
 Concentration02(40);
 Concentration02(30);let anga=0;
 Concentration02(40);
	 wait(100);
	 
	 
	 }
  
  }
  
  let gg=0;let ggg=0;
  let wan=0;let wan2=0;
 
  task SetNueMoveAnimation(direction) {
  
     if(direction == "left"){ann=180;
      Animate("nue", "start move right", false);
      yield ;
      while(GetSpeed>0.1){
        yield ;
      }
      Animate("nue", "stop move right", false);
    }
   
   
   
    if(direction == "right"){ann=0;
      Animate("nue", "start move right", false);
      yield ;
      while(GetSpeed>0.1){
        yield ;
      }
      Animate("nue", "stop move right", false);
    }
    wait(18);ann=0;
    Animate("nue", "idle", true);
  }
  
  function wait(t){
    loop(t){yield;}
  }
  
  let frame2=0;
  let a=0;
  let a2=0;
  
 
 let as=50;
 let as22=0;
 let as2=0;
 let f=0;
 let as222=0;
 
 let as255=0;
 let as25=0;
 task fir2{wait(120);fir3;
 loop{PlaySE(GetCurrentScriptDirectory ~ ".\Sounds\se_tan01.wav");
 loop(5){
  
  
  
  CreateShot01(GetX, GetY,0.8,as255+a,36,10);
 
  as255+=360/5;
  
  }a+=16.23423;
  wait(60);
  
  }
 }
 
 
 task fir3{wait(240);
 loop{
 loop(5){
  
  
  
  CreateShot01(GetX, GetY,0.8,as25-a,36,10);
 
  as25+=360/5;
  
  }a+=16.23423;
  wait(60);
  
  }
 }
 task fir{
 
 let as=50;
 let as22=0;
 let as2=0;
 let f=0;
 let as222=0;
 //as22=rand(110,360);
loop(30){
  
  PlaySE(GetCurrentScriptDirectory ~ ".\Sounds\se_tan01.wav");
  loop(5){
  
  
  //
  CreateShot01(GetPlayerX+as*cos(as22), GetPlayerY-50+as*sin(as22),1+as222,as2+f,188,10);
  //
  as2+=360/5;
  
  }
  
  if(GetPlayerY<GetCenterY){
  as+=1;}
  if(GetPlayerY>GetCenterY){
  as+=5;}
  
   if(GetPlayerY<GetCenterY){
  
  as22+=1-as222*10;}
  if(GetPlayerY>GetCenterY){
  
  as22+=7-as222*10;}
  
  
  as222-=0.01;
  wait(1);
  f+=8.736456;
  }
  
  loop(30){
  
  PlaySE(GetCurrentScriptDirectory ~ ".\Sounds\se_tan01.wav");
  loop(10){
  
  
  //
  CreateShot01(GetPlayerX+as*cos(as22), GetPlayerY-50+as*sin(as22),1+as222,as2+f,183,10);
  //
  as2+=360/10;
  
  }
  as+=1;
  as22+=7+as222*10;
  
  as222-=0.01;
  wait(1);
  f+=1.436456;
  }
  
  loop(50){
  
  PlaySE(GetCurrentScriptDirectory ~ ".\Sounds\se_tan01.wav");
  loop(2){
  
  
  //
  CreateShot01(GetPlayerX+as*cos(as22), GetPlayerY-50+as*sin(as22),1,as2+f,209,10);
  //
  as2+=360/2;
  
  }
  as+=1.5;
  as22+=7+as222*11;
  
  as222-=0.01;
  wait(1);
  f+=12.436456;
  }
  
  as22=0;as=0;
  
  
  
  
  
  
  
  
  as222=0;
  as=0;as22=0;
	

 
 }
 
 
 
  sub InitializeAnimationData {
     CreateAnimation("nue", "idle", 4);
    SetAnimationFrame("nue", "idle", 0, imgNue, rand_int(60,180),15, 10, 138, 176);

    SetAnimationFrame("nue", "idle", 1, imgNue, 12, 148,7, 272, 174);
    SetAnimationFrame("nue", "idle", 2, imgNue, 12, 283, 5, 410, 172);
     SetAnimationFrame("nue", "idle", 3, imgNue, 12, 148,7, 272, 174);
    
	
	
    CreateAnimation("nue", "start move right", 2);
    SetAnimationFrame("nue", "start move right", 0, imgNue, 8, 22, 185, 142, 351);
    SetAnimationFrame("nue", "start move right", 1, imgNue, 8, 156, 184, 277, 351);
   
    
    CreateAnimation("nue", "stop move right", 2);
    SetAnimationFrame("nue", "stop move right", 0,  imgNue, 8, 156, 184, 277, 351);
    SetAnimationFrame("nue", "stop move right", 1,  imgNue,8, 22, 185, 142, 351);
   
    
	
	
	
    CreateAnimation("nue", "start move left", 2);
    SetAnimationFrame("nue", "start move left", 0, imgNue, 8, 6, 285, 127, 408);
    SetAnimationFrame("nue", "start move left", 1, imgNue, 8, 141, 286, 259, 407);
   
    
    CreateAnimation("nue", "stop move left", 2);
    SetAnimationFrame("nue", "stop move left", 0,imgNue, 8, 141, 286, 259, 407);
    SetAnimationFrame("nue", "stop move left", 1,imgNue, 8, 6, 285, 127, 408);
   
    
    CreateAnimation("nue", "start cast", 2);
   
    SetAnimationFrame("nue", "start cast", 0, imgNue, 12, 148,7, 272, 174);
    SetAnimationFrame("nue", "start cast", 1, imgNue, 12, 283, 5, 410, 172);
   
    
    CreateAnimation("nue", "stop cast",2);
    SetAnimationFrame("nue", "stop cast", 0,imgNue, 12, 283, 5, 410, 172);
    SetAnimationFrame("nue", "stop cast", 1,imgNue, 12, 148,7, 272, 174);
    
  } let wa=500;
 let yt=0;
  
  
  let waw=3;
  
  let ana=0;
  let ana2=0;
  let ana3=0;
  
   waw=3;
  
   ana=0;
   ana2=0;
   ana3=0;
  
  
  
  
  
  
  
  let anga=0;
let anga2=0;



}
  
  
  
  
  








////////////////////////////


