
script_enemy_main
{
	#include_script".\..\..\EnemyBossSystem.txt";
	#include_script".\Aya_AnimeLib.txt";
	
	tex_enemy=filedir~"Aya_Main.png";
	
	@Initialize
	{
		SetLife(4500);
		SetTimer(55);
		EnemyBossInitialize;
		SetAnimetion(tex_enemy);
	}
	@MainLoop{EnemyBossMainLoopSystem(50,invincible);yield;}
	@DrawLoop{EnemyBossDrawLoop;}
	@Finalize{EnemyBossFinalize;}
	
	
	
	task MainThread_Standard{}
	
	
	
	
	task MainThread_Advanced
	{
		yield;
		SetMovePosition02(cenX,minY+140,200);
		wait(200);
		let r=1;
		if(rand_int(0,1)){r=-r;}
		loop
		{
			SetAction(ACT_SHOT_A,160);
			loop(2)
			{
				let leng=10;
				let i=GetAngleToPlayer;
				let j=0;
				let s=0;
				let l=12;
				loop(l)
				{
					let ag=0;
					while(ag<360)
					{
						let way=6;
						let sx=GetX+leng*cos(ag+j);
						let sy=GetY+leng*sin(ag+j);
						let speed=0.9+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+=(270/l)*r;
					j+=15*r;
					s+=0.2;
					leng+=12;
					wait(2);
				}
				r=-r;
				wait(140);
			}
			SetAction(ACT_SHOT_B,60);
			let leng=0;
			let i=0;
			loop(80)
			{
				let wide=160;
				let way=5;
				SetShotDirectionType(PLAYER);
				let sx=GetX+(leng*2)*cos(i);
				let sy=GetY+(leng/2)*sin(i);
				let speed=2.5;
				let gra=116;
				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.2;
				}
				leng+=2;
				i+=12*r;
				wait(2);
			}
			let wt=30;
			let my=GetY;
			loop(2)
			{
				my+=25;
				let mx=cenX+(maxX-cenX)*r;
				SetMovePositionHermite(mx,my,0,0,0,0,wt);
				SetAction(ACT_MOVE,wt);
				wait(wt);
				SetShot;
				r=-r;
			}
			SetMovePositionHermite(cenX+rand(-70,70),minY+rand(130,150),0,0,0,0,wt);
			SetAction(ACT_MOVE,wt);
			wait(wt);
			SetShot;
			task SetShot
			{
				Explosion01(GetX,GetY,5,0.1,60);
				let random=rand(0,360);
				let way=90;
				let speedA=[2,2.5];
				let angle=random;
				let gra=[113,118];
				let delay=10;
				let lp=0;
				while(angle<random+360)
				{
					let ag=lp*180;
					let lg=25;
					let sx=GetX+lg*cos(angle);
					let sy=GetY+lg*sin(angle);
					let spd=speedA[lp%length(speedA)];
					let speedB=[spd,spd+1];
					ascent(a in 0..2)
					{
						CreateShot02(sx,sy,0,angle+ag,speedB[a]/60,speedB[a],gra[lp%length(gra)],delay);
					}
					angle+=360/way;
					lp++;
				}
			}
			r=-r;
			wait(160);
		}
	}
	
	
	
	
	task MainThread_Unlimited{}
	
}