
script_enemy_main
{
	#include_script".\..\..\EnemyBossSystem.txt";
	#include_script".\Yuka_AnimeLib.txt";
	
	tex_enemy=filedir~"Yuka_Main.png";
	
	@Initialize
	{
		SetLife(3200);
		SetTimer(30);
		EnemyBossInitialize;
		SetAnimetion(tex_enemy);
	}
	@MainLoop{EnemyBossMainLoopSystem(50,invincible);yield;}
	@DrawLoop{EnemyBossDrawLoop;}
	@Finalize{EnemyBossFinalize;}
	
	task MainThread_Standard
	{
		yield;
		SetMovePositionHermite(cenX,minY+110,0,0,0,0,100);
		SetAction(ACT_MOVE,100);
		wait(120);
		
		let r=1;
		if(rand_int(0,1)){r=-r;}
		loop
		{
			let i=rand(0,360);
			let lp=0;
			loop(2)
			{
				SetAction(ACT_SHOT_B,150);
				loop(60)
				{
					let way=9;
					let sx=GetX;
					let sy=GetY+20;
					let speed=[3,4];
					let gra=[65,70];
					let delay=10;
					ascent(a in 0..length(speed))
					{
						let angle=i;
						while(angle<i+360)
						{
							if(lp%10<6){CreateShot01(sx,sy,speed[a],angle,gra[0],delay);}
							if(lp%6<3){CreateShot01(sx,sy,speed[a]-1,-angle,gra[1],delay);}
							angle+=360/way;
						}
					}
					i+=1*r;
					lp++;
					wait(2);
				}
				r=-r;
				wait(30);
			}
			wait(40);
			SetMove(cenX+rand(-100,100),minY+rand(90,120),90);
			let i=0;
			let leng=120;
			loop(90)
			{
				let way=2;
				let wide=45;
				let speed=[3,1];
				let gra=12;
				let delay=10;
				ascent(a in 0..length(speed))
				{
					let angleA=0+i;
					while(angleA<360+i)
					{
						let sx=GetX+leng*cos(angleA);
						let sy=GetY+leng*sin(angleA);
						let angleB=angleA-wide/2;
						while(angleB<=angleA+wide/2+1)
						{
							CreateShot01(sx,sy,speed[a],angleB,gra,delay);
							angleB+=wide;
						}
						angleA+=360/way;
					}
				}
				leng-=1;
				i+=8.4*r;
				wait(1);
			}
			wait(60);
			SetAction(ACT_SHOT_A,90);
			let i=0;
			let p=GetAngleToPlayer+180;
			let L=15;
			loop(L+1)
			{
				let angle=[p-i,p+i];
				let gra=115;
				let delay=10;
				let speed=5;
				while(speed>=1.2)
				{
					ascent(a in 0..2)
					{
						CreateShot01(GetX,GetY,speed,angle[a],gra,delay);
					}
					speed/=1.15;
				}
				i+=180/L;
				lp++;
				wait(1);
			}
			wait(160);
			r=-r;
		}
	}
	
	
	
	
	task MainThread_Advanced
	{
		yield;
		SetMovePositionHermite(cenX,minY+120,0,0,0,0,100);
		SetAction(ACT_MOVE,100);
		wait(120);
		
		let r=1;
		if(rand_int(0,1)){r=-r;}
		loop
		{
			let i=0;
			let lp=0;
			SetAction(ACT_SHOT_B,400);
			loop(4)
			{
				let p=GetAngleToPlayer+rand(-50,50);
				let sx=GetX;
				let sy=GetY+20;
				let speed=1.4;
				let angle=p;
				let gra=148;
				let delay=10;
				CreateShotA(1,sx,sy,delay);
				SetShotDataA(1,0,speed,angle,0,0,0,gra);
				let count=0;
				let i=rand(0,360);
				while(count<250)
				{
					let wide=100;
					let way=2;
					let speedB=1.6;
					let angleB=i-wide/2;
					let graB=30;
					let delayB=12;
					while(angleB<i+wide/2+1)
					{
						CreateShotA(2,0,0,delayB);
						SetShotDataA(2,0,0,angleB,0,speedB/100,speedB,graB);
						AddShot(count,1,2,0);
						angleB+=wide/(way-1);
					}
					i+=8.5*r;
					count+=11;
				}
				FireShot(1);
				r=-r;
				wait(60);
			}
			local
			{
				let p=GetAngleToPlayer+rand(-20,20);
				let speed=1;
				let angle=p;
				let gra=148;
				let delay=10;
				CreateShotA(1,GetX,GetY+20,delay);
				SetShotDataA(1,0,speed,angle,0,0,0,gra);
				
				
				SetShotDirectionType(PLAYER);
				let way=5;
				let count=0;
				let i=(360/way)/2+rand(-30,-20)*r;
				while(count<300)
				{
					let speedB=1.6;
					let angleB=i;
					let graB=30;
					let delayB=12;
					while(angleB<i+360)
					{
						CreateShotA(2,0,0,delayB);
						SetShotDataA(2,0,0,angleB,0,speedB/100,speedB,graB);
						AddShot(count,1,2,0);
						angleB+=360/way;
					}
					i+=1*r;
					count+=5;
				}
				FireShot(1);
			}
			wait(280);
			SetMove(cenX+rand(-100,100),minY+rand(110,140),90);
			let i=rand(0,360);
			let wide=1;
			let leng=150;
			loop(90)
			{
				let way=4;
				let speed=1.5;
				let gra=12;
				let delay=10;
				let angleA=i;
				while(angleA<i+360)
				{
					let sx=GetX+leng*cos(angleA);
					let sy=GetY+leng*sin(angleA);
					let angleB=angleA-wide/2;
					while(angleB<=angleA+wide/2+1)
					{
						CreateShot01(sx,sy,speed,angleB,gra,delay);
						angleB+=wide;
					}
					angleA+=360/way;
				}
				i+=8.9*r;
				wait(1);
				wide+=1;
				leng+=-1.5;
			}
			wait(50);
			r=-r;
		}
	}
	
	
	
	
	task MainThread_Unlimited
	{
		yield;
		SetMovePositionHermite(cenX,minY+120,0,0,0,0,100);
		SetAction(ACT_MOVE,100);
		wait(120);
		
		let r=1;
		if(rand_int(0,1)){r=-r;}
		loop
		{
			
			loop(2)
			{
				let lp=0;
				SetAction(ACT_SHOT_B,150);
				loop(33)
				{
					let p=GetAngleToPlayer;
					let way=[2,2,3,4,5,4,3,2];
					let wide=[0.5,5,10,15,20,15,10,5];
					let wayB=6;
					let sx=GetX;
					let sy=GetY+20;
					let speed=[3.5,1];
					let gra=[15,7];
					let delay=10;
					ascent(a in 0..length(speed))
					{
						let angleA=p;
						while(angleA<p+360)
						{
							let angleB=angleA-wide[lp%length(wide)]/2;
							while(angleB<=angleA+wide[lp%length(wide)]/2+0.1)
							{
								CreateShot01(sx,sy,speed[a],angleB,gra[a],delay);
								angleB+=wide[lp%length(wide)]/(way[lp%length(way)]-1);
							}
							angleA+=360/wayB;
						}
					}
					lp++;
					wait(6);
				}
				r=-r;
				wait(70);
			}
			wait(100);
			SetMove(cenX+rand(-100,100),minY+rand(110,140),90);
			wait(90);
			SetAction(ACT_SHOT_A,100);
			local
			{
				let lp=0;
				let speed=3;
				let p=rand(0,360);
				loop(9)
				{
					let way=36;
					let limit=60;
					let leng=20;
					let sch=[4,-4];
					let angle=p;
					let gra=[34,35];
					let delay=10;
					while(angle<p+360)
					{
						let sx=GetX+leng*cos(angle);
						let sy=GetY+leng*sin(angle);
						ascent(a in 0..length(sch))
						{
							CreateShotA(1,sx,sy,delay);
							SetShotDataA(1,0,0,angle+90*r,sch[a],speed/limit,speed,gra[a]);
							SetShotDataA(1,limit,NULL,NULL,0,0,0,NULL);
							FireShot(1);
						}
						angle+=360/way;
					}
					speed/=1.2;
					r=-r;
				}
			}
			wait(200);
			
			let i=0;
			let px=GetPlayerX;let py=GetPlayerY;
			loop(30)
			{
				let sx=[GetX-40,GetX+40];
				ascent(a in 0..2)
				{
					let p=atan2(py-GetY,px-sx[a]);
					let speed=5;
					let gra=25;
					let delay=5;
					let j=0;
					while(speed>=1)
					{
						let angle=[p+i+j,p-i-j];
						CreateShot01(sx[a],GetY,speed,angle[a],gra,delay);
						speed/=1.1;
						j+=0.5;
					}
				}
				i+=8;
				wait(2);
			}
			wait(120);
		}
	}
	
}