#TouhouDanmakufu
#Title[Aya Spellcard 1 easy]
#Text[.]
#Player[FREE]
#ScriptVersion[2]


script_enemy_main
{
#include_function ".\1Config.txt"
let CSD = GetCurrentScriptDirectory;
let movelol = 0;
#include_function ".\function_cutin.txt"
#include_function ".\newsfx.txt" // Non ZUN sfx
#include_function ".\Obj_hpb.txt" // TLC Lifebar, no lags :)
#include_function ".\Cutin_Eff.txt"
#include_function ".\lib_anime_Aya.txt"
#include_function ".\system\Aura_Effects.dnh"
let SpellBG1 = CSD~"system/1.png";
let SpellBG2 = CSD~"system/Spellbgoverlay.png";
let shot = GetCurrentScriptDirectory() ~ "kshotData.txt" ; // TLC shots
let frame = 0 ;
let cut = CSD ~ "system\Raymoo.png";
//let minx = GetClipMinX ;
//let maxx = GetClipMaxX ;
//let miny = GetClipMinY ;
//let maxy = GetClipMaxY ;
 let MinX	  = GetClipMinX;
    let MaxX	  = GetClipMaxX;
    let CenX	  = GetCenterX;
    let MinY	  = GetClipMinY;
    let MaxY	  = GetClipMaxY;
    let CenY	  = GetCenterY;
let powerl    = GetCurrentScriptDirectory~".\enm4se\power_logo.wav";
let bgalpha = 0;	//We create a new variable so that the background can fade in smoothly.
let bgangle = 0;	//Angle for the overlayed BG. 
let imgBoss =  GetCurrentScriptDirectory ~ "system\Aya_Main.png" ;


@Initialize
{
LoadUserShotData( shot ) ;
if(Cutin_Activate==2){
cutin("NAZRIN", "Wind Sign "\""Wind Coming From All Sides"\" ,cut,0,0,384,520);
SetScore(8000000);
}
if(Cutin_Activate==1){
CutinSP("ORIGI1",20,-50,8000000,60,cut,0,0,384,512);
CutinSP2(-275,-10,GetCurrentScriptDirectory~".\spell\1.png",0,0,384,32,255,255,255);
}
if(Cutin_Activate==0){
CutIn(YOUMU, "Wind Sign "\""Wind Coming From All Sides"\" ,cut,0,0,384,520);
SetScore(8000000);
}
LoadGraphic(imgBoss);
LoadGraphic(SpellBG1);
LoadGraphic(SpellBG2);
LoadGraphic(cut);
SetMovePosition01(GetCenterX,GetClipMinY+130,3);
//SetX( GetCenterX ) ;
//SetY( GetClipMinY + 130 ) ;
SetLife( 400 ) ;
InitializeAction;
SetTimer( 65 ) ;
if(Cutin_Activate==1){
Timer(1,0);
}
SetDamageRate( 15, 10 ) ;
SetInvincibility( 180 ) ;
let frame = 0 ;
if(lifebar_activate ==1){
hpb(1,0,0);
}
if(Aura_Activate ==1){
Aura5;
}
MainTask ;
}

@MainLoop
{
SetCollisionA( GetX, GetY, 24 ) ;
SetCollisionB( GetX, GetY, 24 ) ;
if (movelol ==1 )
  {
  //SetMovePositionRandom01(500,500,20,GetCenterX-80,GetCenterY-120,GetCenterX+80,GetCenterY-100);
//wait(200);
  }
yield ;
frame += 1 ;
}

@DrawLoop
{
DrawText("Aya Shameimaru", 40, 35, 12, 255);
if(GetSpeedX()>0){SetAction(ACT_MOVE,0)}
	if(GetSpeedX()<0){SetAction(ACT_MOVE,0)}
SetGraphicScale(1,1);		
	DrawBoss(imgBoss);
}

@Finalize
{
DeleteGraphic(imgBoss) ;

}

task MainTask
{
loop( 60 ) { yield ; }
PlaySE(charge);
SetColor(255,200,0);
Concentration01(60);
SetColor(255,255,255);
loop( 60 ) { yield ; }
SetShotDirectionType(PLAYER);
shota;
}
task shota{

loop{
ascent(z in 2..7){
ascent(y in 0..7){
CreateShot01(MinX+y*60,MinY,z,0,1,60);
       }
     }
wait(60);
PlaySE(shot5);
wait(30);
ascent(z in 2..7){
ascent(y in 0..8){
CreateShot01(MinX,MinY+y*60,z,0,1,60);
       }
     }
wait(60);
PlaySE(shot5);
wait(30);
ascent(z in 2..7){
ascent(y in 0..7){
CreateShot01(MinX+y*60,MaxY,z,0,1,60);
       }
     }
wait(60);
PlaySE(shot5);
wait(30);
ascent(z in 2..7){
ascent(y in 0..8){
CreateShot01(MaxX,MaxY-y*60,z,0,1,60);
       }
     }
wait(60);
PlaySE(shot5);
wait(30);
SetMovePositionRandom01(500,500,20,GetCenterX-80,GetCenterY-120,GetCenterX+80,GetCenterY-100);
shotB;
loop(120){yield;}
ascent(z in 2..7){
ascent(y in 0..7){
CreateShot01(MinX+y*60,MinY,z,0,1,60);
       }
     }
wait(60);
PlaySE(shot5);
wait(30);
ascent(z in 2..7){
ascent(y in 0..8){
CreateShot01(MinX,MinY+y*60,z,0,1,60);
       }
     }
wait(60);
PlaySE(shot5);
wait(30);
ascent(z in 2..7){
ascent(y in 0..7){
CreateShot01(MinX+y*60,MaxY,z,0,1,60);
       }
     }
wait(60);
PlaySE(shot5);
wait(30);
ascent(z in 2..7){
ascent(y in 0..8){
CreateShot01(MaxX,MaxY-y*60,z,0,1,60);
       }
     }
loop(120){yield;}
shotA;
wait(60);
shotA;
wait(60);
shotA;
wait(60);
shotA;
wait(60);
shotA;
wait(60);
movelol=0;
yield;
  }
}//task
function wait(t){loop(t){yield;}}
task shotA{
PlaySE(shot5);
flowershot(GetX,GetY);
flowershot(GetX+rand(-200,200),GetY+rand(-200,200));
flowershot(GetX+rand(-200,200),GetY+rand(-200,200));
flowershot(GetX+rand(-200,200),GetY+rand(-200,200));
flowershot(GetX+rand(-200,200),GetY+rand(-200,200));
}
task shotB{
loop(30){
ascent(x in 3..7){
CreateShot01(GetX,GetY,x,0,11,0);
}
PlaySE(shot2);
wait(10);
yield;
}
}
function flowershot(x,y){
ascent(a in 0..9){
ascent(b in 2..7){
ascent(i in 0..2){
CreateShot01(x,y,b,a*40,11,30);
      }
    }
  }
}
let bgscroll =0;
let bgalpha=0;
 let bgalpha2=0;
@BackGround{

		//if (bgalpha < 255){bgalpha += 5;}


SetAlpha(bgalpha);
	//The background is scaled up so it can fill the whole screen.

 if(bgalpha<200){bgalpha+=2;}
  if(bgalpha2<150){bgalpha2+=2;}
SetTexture(SpellBG1);
SetGraphicScale(1,1);
SetColor(255,255,255);
SetAlpha(bgalpha);
SetGraphicRect(0,0,384,448);
DrawGraphic(GetCenterX,GetCenterY);

SetTexture(SpellBG2);
  SetGraphicRect(0+bgscroll,0+bgscroll,256+bgscroll,256+bgscroll);
  SetGraphicScale(1.8,1.8);
  SetAlpha(bgalpha2);
  DrawGraphic(GetCenterX,GetCenterY);
bgscroll +=1;
	}

}