
script_enemy_main
{
	#include_script".\..\..\EnemyBossSystem.txt";
	#include_script".\Eiki_AnimeLib.txt";
	
	tex_enemy=filedir~"Eiki_Main.png";
	
	@Initialize
	{
		SetLife(4500);
		SetTimer(61);
		EnemyBossInitialize;
		SetAnimetion(tex_enemy);
	}
	@MainLoop{EnemyBossMainLoopSystem(50,invincible);yield;}
	@DrawLoop{EnemyBossDrawLoop;}
	@Finalize{EnemyBossFinalize;}

	
	
	
	
	task MainThread_Standard{}
	task MainThread_Advanced{}
	
	
	task MainThread_Unlimited
	{
		yield;
		SetMovePositionHermite(cenX,minY+150,0,0,0,0,100);
		SetAction(ACT_MOVE,100);
		wait(180);
		let r=1;
		if(rand_int(0,1)){r=-r;}
		let lp=0;
		loop
		{
			loop(4)
			{
				let p=GetAngleToPlayer+rand(-10,10);
				loop(5)
				{
					let wide=140;
					let way=17;
					let speed=[6,2];
					let angle=p-wide/2;
					let gra=251;
					let delay=10;
					while(angle<=p+wide/2+1)
					{
						ascent(a in 0..length(speed))
						{
							CreateShot01(GetX,GetY,speed[a],angle,gra,delay);
						}
						angle+=wide/(way-1);
					}
					wait(7);
				}
				local
				{
					let wide=10;
					let speed=3.4;
					let angle=GetAngleToPlayer-wide/2;
					let gra=150;
					let delay=10;
					while(angle<=GetAngleToPlayer+wide/2+1)
					{
						CreateShot01(GetX,GetY,speed,angle,gra,delay);
						angle+=2;
					}
				}
				wait(38);
			}
			
			local
			{
				let v=180;
				while(v>-180)
				{
					let sx=cenX+v*r;
					let sy=maxY;
					let angle=rand(-180,0);
					let fam=GetCurrentScriptDirectory~"Eiki_Familier02.txt";
					CreateEnemyFromFile(fam,sx,sy,0,angle,0);
					v-=30;
					wait(3);
				}
			}
			local
			{
				let p=rand(0,360);
				let way=60;
				let speed=[2.5,1];
				let angle=p;
				let gra=251;
				let delay=10;
				while(angle<p+360)
				{
					ascent(a in 0..length(speed))
					{
						CreateShot02(GetX,GetY,0,angle,speed[a]/100,speed[a],gra,delay);
					}
					angle+=360/way;
				}
			}
			
			let wt=160;
			SetMovePositionHermite(cenX+rand(-50,50),minY+rand(130,150),0,0,0,0,wt);
			SetAction(ACT_MOVE,wt);
			wait(wt);
		}
	}
	
}