
script_enemy_main
{
	#include_script".\..\..\EnemyBossSystem.txt";
	#include_script".\Ran_AnimeLib.txt";
	
	tex_enemy=filedir~"Ran_Main.png";
	
	@Initialize
	{
		SetLife(3500);
		SetTimer(50);
		EnemyBossInitialize;
		SetAnimetion(tex_enemy);
	}
	@MainLoop{EnemyBossMainLoopSystem(50,invincible);yield;}
	@DrawLoop{EnemyBossDrawLoop;}
	@Finalize{EnemyBossFinalize;}
	
	
	
	task MainThread_Standard{}
	
	task MainThread_Advanced
	{
		yield;
		SetMovePositionHermite(cenX,minY+100,0,0,0,0,100);
		SetAction(ACT_MOVE,100);
		SetRoll(100);
		wait(120);
		let r=1;
		if(rand_int(0,1)){r=-r;}
		loop
		{
			let sp=0;
			let way=rand_int(6,7);
			let wide=60;
			loop(8)
			{
				let p=GetAngleToPlayer;
				let speed=3+sp;
				let angle=p-wide/2;
				let gra=151;
				let delay=10;
				while(angle<=p+wide/2+1)
				{
					CreateShot02(GetX,GetY,0,angle,speed/30,speed,gra,delay);
					angle+=wide/(way-1);
				}
				sp+=0.3;
				wide+=10;
				wait(15);
			}
			Sub;
			let lp=0;
			loop(30)
			{
				let p=GetAngleToPlayer;
				let way=9+lp%2;
				let speed=3+sp;
				let angle=p-wide/2;
				let gra=151;
				let delay=10;
				while(angle<=p+wide/2+1)
				{
					CreateShot02(GetX,GetY,0,angle,speed/30,speed,gra,delay);
					angle+=wide/(way-1);
				}
				lp++;
				sp+=0.05;
				wait(15);
			}
			let wt=100;
			SetMovePositionHermite(cenX+rand(-60,60),minY+rand(90,120),0,0,0,0,wt);
			SetAction(ACT_MOVE,wt);
			SetRoll(wt);
			wait(wt);
			task Sub
			{
				let speed=2.5;
				let gra=135;
				let delay=10;
				loop(9)
				{
					let px=GetPlayerX;
					let py=GetPlayerY;
					let i=0;
					loop(5)
					{
						let wide=120;
						let way=6;
						let sx=GetX+60*r;
						let sy=GetY;
						let p=atan2(py-sy,px-sx)+i;
						let angle=p-wide/2;
						while(angle<=p+wide/2+1)
						{
							CreateShot01(sx,sy,speed,angle,gra,delay);
							angle+=wide/(way-1);
						}
						i+=1.5*r;
						wait(5);
					}
					wait(10);
					r=-r;
				}
				wait(40);
				local
				{
					let px=GetPlayerX;
					let py=GetPlayerY;
					let i=0;
					loop(3)
					{
						let wide=180;
						let wideB=30;
						let way=5;
						let sx=[GetX+60,GetX-60];
						let sy=GetY;
						let speed=2;
						ascent(a in 0..2)
						{
							let p=atan2(py-sy,px-sx[a]);
							let angle=p-wide/2;
							while(angle<=p+wide/2+1)
							{
								let angleB=angle-wideB/2;
								while(angleB<=angle+wideB/2)
								{
									CreateShot01(sx[a],sy,speed,angleB,gra,delay);
									angleB+=3;
								}
								angle+=wide/(way-1);
							}
						}
						wait(5);
					}
				}
			}
		}
	}
	task MainThread_Unlimited{}
	
}