
script_enemy_main
{
	#include_script".\..\..\EnemyBossSystem.txt";
	#include_script".\Yuka_AnimeLib.txt";
	
	tex_enemy=filedir~"Yuka_Main.png";
	
	@Initialize
	{
		SetLife(3500);
		SetTimer(47);
		EnemyBossInitialize;
		SetAnimetion(tex_enemy);
	}
	@MainLoop{EnemyBossMainLoopSystem(50,invincible);yield;}
	@DrawLoop{EnemyBossDrawLoop;}
	@Finalize{EnemyBossFinalize;}
	
	task MainThread_Standard
	{
		yield;
		SetMovePositionHermite(cenX,minY+150,0,0,0,0,100);
		SetAction(ACT_MOVE,100);
		wait(120);
		
		let r=1;
		if(rand_int(0,1)){r=-r;}
		loop
		{
			SetAction(ACT_SHOT_B,150);
			let i=0;
			let bs=rand(0,360);
			let sp=0;
			loop(23)
			{
				let way=10;
				let p=[bs+i,bs-i];
				ascent(a in 0..2)
				{
					let speed=[3-sp,2.9-sp];
					let angle=p[a];
					let gra=87;
					let delay=10;
					while(angle<p[a]+360)
					{
						ascent(b in 0..length(speed))
						{
							CreateShot01(GetX,GetY+20,speed[b],angle,gra,delay);
						}
						angle+=360/way;
					}
				}
				sp+=0.11;
				i+=4.1;
				wait(3);
			}
			wait(60);
			SetMove(cenX+rand(-100,100),minY+rand(130,160),120);
			let i=rand(0,360);
			loop(60)
			{
				let p=[i,180+i];
				ascent(a in 0..2)
				{
					let gra=28;
					let delay=10;
					
					let j=0;
					let speed=3.4;
					while(speed>=2.2)
					{
						let v=45;
						let sx=GetX+v*cos(p[a]);
						let sy=GetY+v*sin(p[a]);
						let angle=p[a]+j;
						CreateShot01(sx,sy,speed,angle,gra,delay);
						speed/=1.2;
						j+=1.7*r;
					}
				}
				wait(3);
				i+=7*r;
			}
			wait(60);
			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
		{
			SetAction(ACT_SHOT_A,100);
			let sp=0;
			let pl=0.15;
			let p=GetAngleToPlayer;
			loop(50)
			{
				let way=48;
				let speed=0.4+sp;
				let angle=p;
				let gra=31;
				let delay=10;
				while(angle<p+360)
				{
					let v=30;
					let sx=GetX+v*cos(angle);
					let sy=GetY+v*sin(angle);
					CreateShot01(sx,sy,speed,angle,gra,delay);
					angle+=360/way;
				}
				sp+=pl;
				pl*=1.06;
				wait(1);
			}
			wait(100);
			SetAction(ACT_SHOT_B,400);
			let sp=3;
			loop(12)
			{
				let px=GetPlayerX;let py=GetPlayerY;
				let way=11;
				let wide=160;
				let L=5;
				let wd=6;
				let i=-wd/2*r;
				let s=0;
				loop(L)
				{
					let speed=sp+s;
					let p=atan2(py-(GetY+20),px-GetX)+i;
					let angle=p-wide/2;
					let gra=83;
					let delay=10;
					while(angle<=p+wide/2+1)
					{
						CreateShot01(GetX,GetY+20,speed,angle,gra,delay);
						angle+=wide/(way-1);
					}
					wait(3);
					s+=0.14;
					i+=(wd/(L-1))*r
				}
				wait(12);
				sp+=0.15;
				r=-r;
			}
			SetMove(cenX+rand(-100,100),minY+rand(100,130),120);
			wait(120);
		}
	}
	
	
	
	
	task MainThread_Unlimited
	{
		yield;
		SetMovePositionHermite(cenX,minY+150,0,0,0,0,100);
		SetAction(ACT_MOVE,100);
		wait(120);
		
		let r=1;
		if(rand_int(0,1)){r=-r;}
		loop
		{
			SetMove(cenX+rand(-100,100),minY+rand(130,160),120);
			let i=rand(0,360);
			loop(60)
			{
				let p=[i,120+i,240+i];
				ascent(a in 0..3)
				{
					let gra=27;
					let delay=10;
					
					let j=0;
					let speed=4.5;
					while(speed>=2.5)
					{
						let v=45;
						let sx=GetX+v*cos(p[a]);
						let sy=GetY+v*sin(p[a]);
						let angle=p[a]+j;
						CreateShot01(sx,sy,speed,angle,gra,delay);
						speed/=1.1;
						j+=1*r;
					}
				}
				wait(3);
				i+=6.7*r;
			}
			wait(60);
			SetAction(ACT_SHOT_A,100);
			local
			{
				let way=40;
				let sp=0;
				let pl=0.15;
				let p=GetAngleToPlayer;
				loop(50)
				{
					let speed=0.4+sp;
					let angle=p;
					let gra=82;
					let delay=10;
					while(angle<p+360)
					{
						let v=30;
						let sx=GetX+v*cos(angle);
						let sy=GetY+v*sin(angle);
						CreateShot01(sx,sy,speed,angle,gra,delay);
						angle+=360/way;
					}
					sp+=pl;
					pl*=1.05;
					wait(1);
				}
				
				let ag=p+(360/way)/2;
				local
				{
					let angle=ag;
					let gra=9;
					let delay=0;
					while(angle<ag+360)
					{
						let speed=7;
						while(speed>=2.5)
						{
							CreateShot01(GetX,GetY,speed,angle,gra,delay);
							speed/=1.2;
						}
						angle+=360/way;
					}
				}
			}
			wait(120);
			r=-r;
		}
	}
	
}