
script_enemy_main
{
	#include_script".\..\..\EnemyBossSystem.txt";
	#include_script".\Utsuho_AnimeLib.txt";
	
	tex_enemy=filedir~"Utsuho_Main.png";
	tex_spellbg=filedir~"Utsuho_SpellBG.png";
	
	bg_rect=[0,0,800,600];
	
	let f_caution=GetCurrentScriptDirectory~"Utsuho_Caution.txt";
	
	@Initialize
	{
		point=420;
		SetLife(1200);
		SetTimer(57);
		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+120,0,0,0,0,100);
		SetAction(ACT_MOVE,100);
		SetSpellCard("制御「ヘルズヘリカル」",53);
		CreateEnemyFromFile(f_caution,cenX,cenY,0,0,0);
		wait(120);
		let r=1;
		if(rand_int(0,1)){r=-r;}
		loop
		{
			local
			{
				let sx=cenX+200*r;
				let sy=maxY+40;
				let speed=2;
				let angle=-90;
				let size=0.3;
				CreateShotFromScript("Sun",sx,sy,speed,angle,0,size);
				Sub(sx,sy,speed,angle,size);
			}
			task Sub(let sx,let sy,let spd,let ag,let size)
			{
				Shot1;
				Shot2;
				while(sy>minY-70)
				{
					sx+=spd*cos(ag);
					sy+=spd*sin(ag);
					yield;
				}
				task Shot1
				{
					while(sy>minY)
					{
						let speed=4.5;
						let angle=0;
						let gvspeed=0.05;
						let gvangle=180;
						let gra=43;
						let delay=0;
						if(sx>cenX)
						{
							angle=180;
							gvangle=0;
						}
						GravityShot(sx,sy,speed,angle,gvspeed,gvangle,gra,delay);
						wait(4);
					}
				}
				
				task Shot2
				{
					let i=rand(0,360);
					let r=1;
					if(sx<cenX){r=-r;}
					while(sy>minY-60)
					{
						let way=3;
						let ag=i;
						while(ag<i+360)
						{
							let v=175*size;
							let sx_=sx+v*cos(ag);
							let sy_=sy+v*sin(ag);
							let speed=1;
							let angle=ag+rand_int(-15,15);
							let gra=9;
							let delay=10;
							CreateShot02(sx_,sy_,0,angle,speed/60,speed,gra,delay);
							ag+=360/way;
						}
						i+=4*r;
						wait(6);
					}
				}
			}
			wait(110);
			r=-r;
		}
		
	}
	
}
#include_script".\Utsuho_SunShot.txt"
