
script_enemy_main
{
	#include_script".\..\..\EnemyBossSystem.txt";
	#include_script".\Eiki_AnimeLib.txt";
	
	tex_enemy=filedir~"Eiki_Main.png";
	tex_spellbg=filedir~"Eiki_SpellBG.png";
	
	bg_rect=[0,0,768,512];
	
	@Initialize
	{
		point=480;
		SetLife(1300);
		SetTimer(59);
		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);
		SetSpellCard("審理「五七日の引導」",84);
		wait(120);
		local
		{
			let ag=rand(0,360);
			let way=60;
			let angle=ag;
			let gra=251;
			let delay=10;
			while(angle<ag+360)
			{
				let speed=5.8;
				while(speed>=1)
				{
					CreateShot01(GetX,GetY,speed,angle,gra,delay);
					speed/=1.2;
				}
				angle+=360/way;
			}
		}
		JudgmentLaser;
		wait(100);
		let r=1;
		if(rand_int(0,1)){r=-r;}
		let i=90;
		let lp=0;
		loop
		{
			let p=[GetAngleToPlayer+i,GetAngleToPlayer-i];
			let delay=0;
			let wide=80;
			let way=4;
			ascent(a in 0..2)
			{
				let gra=[49,54];
				let ag=p[a];
				while(ag<p[a]+360)
				{
					let speed=4.5+1*cos(lp*15+ag);
					let angle=ag-wide/2;
					while(angle<=ag+wide/2+1)
					{
						CreateShot02(GetX,GetY,0,angle,speed/100,speed,gra[a],delay);
						angle+=wide/(way-1);
					}
					ag+=180;
				}
			}
			
			i+=10.7;
			lp++;
			wait(19);
			
			if(!(lp%16)){JudgmentLaser;}
		}
		
		
		task JudgmentLaser
		{
			let p=GetAngleToPlayer;
			local
			{
				let wide=0;
				while(wide<=150)
				{
					let sx=GetX;
					let sy=GetY-15;
					let leng=1000;
					let width=14;
					let del=160;
					let delay=40;
					if(wide==0)
					{
						let ag=[p-90,p+90];
						let gra=[41,46];
						ascent(a in 0..2)
						{
							SetLaserObject(sx,sy,leng,width,ag[a],255,gra[a],delay,del);
						}
					}
					else
					{
						let ag=[p-90,p+90];
						let gra=[41,46];
						ascent(a in 0..2)
						{
							let angle=ag[a]-wide/2;
							while(angle<=ag[a]+wide/2+1)
							{
								SetLaserObject(sx,sy,leng,width,angle,255,gra[a],delay,del);
								angle+=wide;
							}
						}
					}
					wide+=30;
					wait(2);
				}
				let leng=0;
				while(leng<500)
				{
					let angle=p;
					let width=50;
					let delay=10;
					let gra=47;
					let del=3;
					SetLaserObject(GetX,GetY,leng,width,angle,255,gra,delay,del);
					yield;
					leng+=10;
				}
				loop(50)
				{
					let angle=p;
					let width=80;
					let delay=0;
					let gra=47;
					let del=10;
					SetLaserObject(GetX,GetY,leng,width,angle,192,gra,delay,del);
					wait(2);
					leng+=10;
				}
			}
		}
	}
	
}