
script_enemy_main
{
	#include_script".\..\..\EnemyBossSystem.txt";
	#include_script".\Aya_AnimeLib.txt";
	
	tex_enemy=filedir~"Aya_Main.png";
	
	@Initialize
	{
		SetLife(3200);
		SetTimer(35);
		EnemyBossInitialize;
		SetAnimetion(tex_enemy);
	}
	@MainLoop{EnemyBossMainLoopSystem(50,invincible);yield;}
	@DrawLoop{EnemyBossDrawLoop;}
	@Finalize{EnemyBossFinalize;}
	
	task MainThread_Standard
	{
		yield;
		SetMovePositionHermite(cenX,minY+120,0,0,0,0,100);
		SetAction(ACT_MOVE,100);
		wait(180);
		
		let r=1;
		if(rand_int(0,1)){r=-r;}
		loop
		{
			SetAction(ACT_SHOT_A,90);
			loop(2)
			{
				let length=[14,25];
				let i=0;
				let j=0;
				let s=0;
				loop(20)
				{
					let num=12;
					let ag=0;
					while(ag<360)
					{
						let way=3;
						
						let speed=[5-s,2.5+s/2];
						let angle=0;
						let ad=[-i,60+i];
						let gra=[25,30];
						let delay=0;
						while(angle<360)
						{
							ascent(a in 0..2)
							{
								let sx=GetX+length[a]*cos(ag+j);
								let sy=GetY+length[a]*sin(ag+j);
								CreateShot01(sx,sy,speed[a],angle+ad[a],gra[a],delay);
							}
							angle+=360/way;
						}
						ag+=360/num;
					}
					i+=27*r;
					j+=4*r;
					s+=0.1;
					wait(7);
				}
				r=-r;
				wait(20);
				SetMove(cenX+rand(-100,100),minY+rand(110,130),70);
			}
			SetAction(ACT_SHOT_B,60);
			let length=0;
			let i=0;
			loop(80)
			{
				let wide=90;
				let way=3;
				SetShotDirectionType(PLAYER);
				let sx=GetX+(length*2)*cos(i);
				let sy=GetY+(length/2)*sin(i);
				let speed=5;
				let gra=67;
				let delay=20;
				while(speed>=1.5)
				{
					let angle=-wide/2;
					while(angle<=wide/2+1)
					{
						CreateShot01(sx,sy,speed,angle,gra,delay);
						angle+=wide/(way-1);
					}
					speed=speed/1.1;
				}
				length+=2;
				i+=12*r;
				wait(2);
			}
			wait(50);
			r=-r;
		}
	}
	
	
	
	
	task MainThread_Advanced
	{
		yield;
		SetMovePositionHermite(cenX,minY+120,0,0,0,0,100);
		SetAction(ACT_MOVE,100);
		wait(180);
		
		let r=1;
		if(rand_int(0,1)){r=-r;}
		loop
		{
			SetAction(ACT_SHOT_A,90);
			loop(2)
			{
				let num=12;
				let length=[20,15];
				let i=0;
				let j=0;
				let s=0;
				loop(20)
				{
					let ag=0;
					while(ag<360)
					{
						let way=4;
						let speed=[4-s,1+s];
						let angle=0;
						let ad=[-i,i];
						let gra=[27,31];
						let delay=0;
						while(angle<360)
						{
							ascent(a in 0..2)
							{
								let sx=GetX+length[a]*cos(ag+j);
								let sy=GetY+length[a]*sin(ag+j);
								CreateShot01(sx,sy,speed[a],angle+ad[a],gra[a],delay);
							}
							angle+=360/way;
						}
						ag+=360/num;
					}
					i+=19*r;
					j+=4*r;
					s+=0.14;
					wait(10);
				}
				r=-r;
				wait(20);
				SetMove(cenX+rand(-100,100),minY+rand(110,130),70);
			}
			SetAction(ACT_SHOT_B,60);
			let length=0;
			let i=0;
			loop(40)
			{
				SetShotDirectionType(PLAYER);
				let sx=GetX+length*cos(90+i);
				let sy=GetY+(length/4)*sin(90+i);
				let speed=4;
				let angle=0;
				let gra=68;
				let delay=20;
				while(speed>=1.5)
				{
					CreateShot01(sx,sy,speed,angle,gra,delay);
					speed=speed/1.1;
				}
				length+=6;
				i+=360/30;
				wait(2);
			}
			r=-r;
		}
	}
	
	
	
	
	task MainThread_Unlimited
	{
		yield;
		SetMovePositionHermite(cenX,minY+120,0,0,0,0,100);
		SetAction(ACT_MOVE,100);
		wait(180);
		
		let r=1;
		if(rand_int(0,1)){r=-r;}
		loop
		{
			SetAction(ACT_SHOT_A,90);
			let i=rand(0,360);
			loop(2)
			{
				let length=[18,15];
				let j=0;
				let s=0;
				let lp=0;
				loop(50)
				{
					let ag=0;
					while(ag<360)
					{
						let speed=[6.5-s,3+s/2];
						let angle=0;
						let ad=[-i,60+i];
						let gra=[25,30];
						let delay=3;
						while(angle<360)
						{
							ascent(a in 0..2)
							{
								let sx=GetX+length[a]*cos(ag+j);
								let sy=GetY+length[a]*sin(ag+j);
								CreateShot01(sx,sy,speed[a],angle+ad[a],gra[a],delay);
							}
							angle+=180;
						}
						ag+=30;
					}
					i+=24*r;
					j+=4*r;
					s+=0.07;
					lp++;
					wait(3);
					if(lp%30==15){SetMove(cenX+rand(-30,30),minY+rand(110,130),120);}
				}
				r=-r;
				SetMove(cenX+rand(-100,100),minY+rand(110,130),70);
			}
			wait(70);
			let i=0;
			let p=GetAngleToPlayer;
			loop(34)
			{
				let way=36;
				let speed=7;
				let angle=p;
				let gra=137;
				let delay=10;
				while(angle<p+360)
				{
					CreateShot01(GetX,GetY,speed,angle+i,gra,delay);
					angle+=360/way;
				}
				i+=(360/way)/2;
				wait(3);
			}
			wait(20);
		}
	}
	
}