
script_enemy_main
{
	#include_script".\..\..\EnemyBossSystem.txt";
	#include_script".\Aya_AnimeLib.txt";
	
	tex_enemy=filedir~"Aya_Main.png";
	
	let inv=true;
	
	@Initialize
	{
		SetLife(2800);
		SetTimer(46);
		EnemyBossInitialize;
		SetAnimetion(tex_enemy);
	}
	@MainLoop{EnemyBossMainLoopSystem(50,inv);yield;}
	@DrawLoop{EnemyBossDrawLoop;}
	@Finalize{EnemyBossFinalize;}
	
	task MainThread_Standard
	{
		yield;
		SetX(cenX);SetY(minY+120);
		boss_texscale=0;
		let wt=140;
		SetMovePositionHermite(minX-140,cenY+100,1800,-20,0,0,wt);
		SetAction(ACT_MOVE,wt);
		loop(wt)
		{
			boss_texscale+=1/wt;
			yield;
		}
		inv=false;
		boss_texscale=1;
		
		yield;
		let px=GetPlayerX;
		let py=GetPlayerY;
		SetTargeting(px,py,0.5,100,0);
		wait(30);
		SetMove(maxX+40,minY+60,60);
		let lp=0;
		loop(10)
		{
			let way=15;
			let p=atan2(py-GetY,px-GetX);
			let delay=3;
			let gra=[1,113];
			let speed=9.5;
			while(speed>=1.6)
			{
				let angle=p;
				while(angle<p+360)
				{
					CreateShot01(GetX,GetY,speed,angle,gra[lp%length(gra)],delay);
					angle+=360/way;
				}
				speed/=1.07;
			}
			lp++;
			wait(6);
		}
		wait(60);
		
		SetMove(cenX,minY+120,100);
		wait(100);
		
		let r=1;
		if(rand_int(0,1)){r=-r;}
		loop
		{
			SetAction(ACT_SHOT_A,90);
			loop(2)
			{
				let leng=20;
				let i=rand(0,360);
				let j=0;
				let s=0;
				let l=8;
				loop(l)
				{
					let ag=0;
					while(ag<360)
					{
						let way=4;
						let sx=GetX+leng*cos(ag+j);
						let sy=GetY+leng*sin(ag+j);
						let speed=1.3+s;
						let angle=i;
						let gra=[25,30];
						let g=0;
						let delay=5;
						while(angle<i+360)
						{
							CreateShot01(sx,sy,speed,angle,gra[g%length(gra)],delay);
							angle+=360/way;
							g++;
						}
						ag+=45;
					}
					i+=(180/l)*r;
					j+=15*r;
					s+=0.06;
					leng+=15;
					wait(3);
				}
				r=-r;
				wait(60);
			}
			SetMove(cenX+rand(-100,100),minY+rand(110,130),120);
			wait(120);
			let lp=0;
			let p=rand(0,360);
			let s=0;
			loop(5)
			{
				let leng=60;
				let way=36;
				let speed=4.5-s;
				let angle=p;
				let gra=[137,144];
				let delay=3;
				while(angle<p+360)
				{
					let sx=GetX+leng*cos(angle);
					let sy=GetY+leng*sin(angle);
					CreateShot01(sx,sy,speed,angle,gra[lp%length(gra)],delay);
					angle+=360/way;
				}
				s+=0.3;
				lp++;
				wait(5);
			}
		}
	}
	
	
	
	
	task MainThread_Advanced
	{
		yield;
		SetX(cenX);SetY(minY+120);
		boss_texscale=0;
		let wt=140;
		SetMovePositionHermite(minX-140,cenY,1800,-20,0,0,wt);
		SetAction(ACT_MOVE,wt);
		loop(wt)
		{
			boss_texscale+=1/wt;
			yield;
		}
		inv=false;
		boss_texscale=1;
		
		yield;
		SetMove(maxX+40,minY,60);
		let lp=0;
		let s=0;
		loop(10)
		{
			Explosion01(GetX,GetY,5,0.1,60);
			let way=90;
			let speed=[3,3.4];
			let angle=0;
			let gra=[113,118];
			let delay=3;
			let lp=0;
			while(angle<360)
			{
				let ag=lp*180;
				let lg=25;
				let sx=GetX+lg*cos(angle);
				let sy=GetY+lg*sin(angle);
				let spd=speed[lp%length(speed)]-s;
				CreateShot02(sx,sy,0,angle+ag,spd/120,spd,gra[lp%length(gra)],delay);
				angle+=360/way;
				lp++;
			}
			s+=0.1;
			lp++;
			wait(6);
		}
		wait(60);
		
		SetMove(cenX,minY+120,100);
		wait(100);
		
		let r=1;
		if(rand_int(0,1)){r=-r;}
		loop
		{
			SetAction(ACT_SHOT_A,90);
			loop(2)
			{
				let length=15;
				let i=0;
				let j=0;
				let s=0;
				let L=40;
				loop(L)
				{
					let ag=0;
					while(ag<360)
					{
						let sx=GetX+length*cos(ag+j);
						let sy=GetY+length*sin(ag+j);
						let speed=1.6+s;
						let angle=90+i;
						let gra=28;
						let delay=10;
						CreateShot01(sx,sy,speed,angle,gra,delay);
						ag+=40;
					}
					i+=(360/L)*r;
					j+=(180/L)*r;
					s+=0.02;
					length+=5;
					wait(1);
				}
				wait(30);
				r=-r;
			}
			wait(30);
			SetAction(ACT_SHOT_B,60);
			local
			{
				let wide=30;
				let way=8;
				let p=GetAngleToPlayer;
				let gra=137;
				let delay=10;
				let angle=p-wide/2;
				while(angle<=p+wide/2+1)
				{
					let speed=3;
					while(speed>=2)
					{
						CreateShot01(GetX,GetY,speed,angle,gra,delay);
						speed/=1.1;
					}
					angle+=wide/(way-1);
				}
			}
			wait(60);
			SetMove(cenX+rand(-100,100),minY+rand(110,130),70);
			wait(70);
			r=-r;
		}
	}
	
	
	
	
	task MainThread_Unlimited
	{
		yield;
		SetX(cenX);SetY(minY+120);
		boss_texscale=0;
		let wt=140;
		SetMovePositionHermite(minX-140,minY+20,1800,40,0,0,wt);
		SetAction(ACT_MOVE,wt);
		loop(wt)
		{
			boss_texscale+=1/wt;
			yield;
		}
		inv=false;
		boss_texscale=1;
		
		yield;
		let px=GetPlayerX;
		let py=GetPlayerY;
		SetTargeting(px,py,0.5,100,0);
		wait(30);
		SetMove(maxX+40,cenY,60);
		let lp=0;
		local
		{
			let wt=60;
			let L=20;
			loop(L)
			{
				let way=15;
				let gra=137;
				let delay=5;
				
				let i=0;
				let speed=5.5;
				while(speed>=1.2)
				{
					let p=atan2(py-GetY,px-GetX)+30-i;
					let angle=p;
					while(angle<p+360)
					{
						CreateShot01(GetX,GetY,speed,angle,gra,delay);
						angle+=360/way;
					}
					speed/=1.2;
					i+=3.5;
				}
				wait(wt/L);
			}
		}
		wait(60);
		
		SetMove(cenX,minY+120,100);
		wait(100);
		
		
		let r=1;
		if(rand_int(0,1)){r=-r;}
		loop
		{
			SetAction(ACT_SHOT_A,90);
			local
			{
				let leng=15;
				let i=GetAngleToPlayer+90;
				let j=0;
				let s=0;
				let L=28;
				loop(L)
				{
					let ag=0;
					while(ag<360)
					{
						let way=2;
						let sx=GetX+leng*cos(ag+j);
						let sy=GetY+leng*sin(ag+j);
						let speed=1.2+s;
						let angle=i;
						let gra=[31,30];
						let delay=10;
						let g=0;
						while(angle<i+360)
						{
							CreateShot01(sx,sy,speed,angle,gra[g%length(gra)],delay);
							angle+=360/way;
							g++;
						}
						ag+=30;
					}
					i+=(360/L)*r;
					j+=(360/L)*r;
					s+=0.02;
					leng+=8.5;
					wait(1);
				}
				wait(30);
				r=-r;
			}
			wait(120);
			SetAction(ACT_SHOT_B,60);
			local
			{
				let wide=160;
				let way=13;
				let p=GetAngleToPlayer;
				let gra=137;
				let delay=10;
				let angle=p-wide/2;
				while(angle<=p+wide/2+1)
				{
					let speed=5.5;
					while(speed>=2)
					{
						CreateShot01(GetX,GetY,speed,angle,gra,delay);
						speed/=1.1;
					}
					angle+=wide/(way-1);
				}
			}
			wait(60);
			SetMove(cenX+rand(-100,100),minY+rand(110,130),70);
			wait(70);
		}
	}
	
}