
script_enemy_main
{
	#include_script".\..\..\EnemyBossSystem.txt";
	#include_script".\Sakuya_AnimeLib.txt";
	
	tex_enemy=filedir~"Sakuya_Main.png";
	tex_spellbg=filedir~"Sakuya_SpellBG.png";
	
	bg_rect=[0,0,768,512];
	
	boss_bgposx=cenX-90;
	boss_bgposy=cenY+30;
	
	@Initialize
	{
		point=390;
		SetLife(700);
		SetTimer(55);
		EnemyBossInitialize;
		SetAnimetion(tex_enemy);
	}
	@MainLoop{EnemyBossMainLoopSystem(50,invincible);yield;}
	@DrawLoop{EnemyBossDrawLoop;}
	@Finalize{EnemyBossFinalize;}
	
	
	
	task MainThread_Standard
	{
		yield;
		SetMovePositionHermite(cenX,minY+120,0,0,0,0,100);
		SetAction(ACT_MOVE,100);
		SetSpellCard("時亘「トワイライトウォーカー」",62);
		wait(120);
		let r=1;
		if(rand_int(0,1)){r=-r;}
		loop
		{
			SetAction(ACT_SHOT_B,100);
			local
			{
				let L=60;
				let p=GetAngleToPlayer;
				loop(L)
				{
					let speed=2.5;
					let angle=p;
					let gra=175;
					let delay=10;
					while(speed>=2)
					{
						ReflectShot(GetX,GetY,speed,angle,1,true,true,true,false,gra,delay);
						speed/=1.05;
					}
					wait(2);
					p+=360/L*r;
				}
			}
			Concentration01(30);
			wait(30);
			local
			{
				let wt=40;
				MotionBlurEx(SHOT,wt,120,ADD);
				Slow(2);
				TimeStop(wt,1,0,1);
				SetMovePosition02(cenX+rand(70,100)*r,minY+rand(120,140),wt);
				SetAction(ACT_MOVE,wt);
				let L=10;
				let p=GetAngleToPlayer;
				loop(L)
				{
					let way=4;
					let wide=160;
					let angle=p-wide/2;
					let gra=174;
					let delay=10;
					while(angle<=p+wide/2+1)
					{
						let speed=2;
						if(angle!=p){speed=1.2;}
						ReflectShot(GetX,GetY,speed,angle,1,true,true,true,false,gra,delay);
						angle+=wide/(way-1);
					}
					wait(wt/L)
				}
				Slow(0);
			}
			wait(100);
			r=-r;
		}
		
	}
	
	task MainThread_Advanced{}
	task MainThread_Unlimited{}
	
}