
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=360;
		SetLife(800);
		SetTimer(57);
		EnemyBossInitialize;
		SetShotAutoDeleteClip(96,96,96,32);
		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("灼滅「核ダイナミック」",47);
		CreateEnemyFromFile(f_caution,cenX,cenY,0,0,0);
		wait(120);
		let r=1;
		if(rand_int(0,1)){r=-r;}
		loop
		{
			SetAction(ACT_SHOT_A,120);
			local
			{
				Explosion01(GetX,GetY,2,0.4,120);
				let p=GetAngleToPlayer;
				let way=5;
				let speed=2;
				let angle=p;
				let size=0.75;
				while(angle<p+360-1)
				{
					CreateShotFromScript("Sun",GetX,GetY,speed,angle,0,size);
					Sub(speed,angle,size);
					angle+=360/way;
				}
				
				way=9;
				p=rand(0,360);
				speed=0.7;
				angle=p;
				size=0.35;
				while(angle<p+360-1)
				{
					CreateShotFromScript("Sun",GetX,GetY,speed,angle,0,size);
					angle+=360/way;
				}
				
				task Sub(let spd,let ag,let size)
				{
					let wt=40;
					let px=GetX;
					let py=GetY;
					loop(wt)
					{
						px+=spd*cos(ag);
						py+=spd*sin(ag);
						yield;
					}
					let way=100;
					let p=0;
					let gra=14;
					let delay=5;
					while(p<360)
					{
						let speed=rand(0.5,1.8);
						let v=175*size;
						let angle=p+rand_int(-60,60);
						let sx=px+v*cos(p);
						let sy=py+v*sin(p);
						CreateShot02(sx,sy,0,angle,speed/180,speed,gra,delay);
						p+=360/way;
					}
				}
			}
			wait(120);
			/*
			let speed=4;
			let p=rand(0,360);
			loop(12)
			{
				let way=40;
				let sy=GetY-30;
				let angle=p;
				let gra=43;
				let delay=10;
				while(angle<p+360)
				{
					CreateShot01(GetX,sy,speed,angle,gra,delay);
					angle+=360/way;
				}
				wait(10);
				speed/=1.1;
			}*/
			wait(120);
			SetMovePositionHermite(cenX+rand(-80,80),minY+rand(110,130),0,0,0,0,100);
			SetAction(ACT_MOVE,100);
			wait(190);
		}
		
	}
	
}

#include_script".\Utsuho_SunShot.txt"
