
script_enemy_main
{
	#include_script".\..\..\EnemyBossSystem.txt";
	#include_script".\Youmu_AnimeLib.txt";
	
	tex_enemy=filedir~"Youmu_Main.png";
	tex_spellbg=filedir~"Youmu_SpellBG.png";
	
	bg_rect=[0,0,512,768];
	
	@Initialize
	{
		point=360;
		SetLife(1);
		SetTimer(22);
		EnemyBossInitialize;
		MagicCircle(false);
		spell_durableflg=true;
		PlaySE("seUseSpellCard.wav");
		SetAnimetion(tex_enemy);
	}
	@MainLoop{EnemyBossMainLoopSystem(0,invincible);yield;}
	@DrawLoop{EnemyBossDrawLoop;}
	@Finalize{EnemyBossFinalize;}
	
	
	
	task MainThread_Standard
	{
		SetX(cenX);
		SetY(minY-64);
		yield;
		SetSpellCard("랼됗뙐걏랎됓멝갲걐",45);
		
		let r=1;
		if(rand_int(0,1)){r=-r;}
		let wt=160;
		loop
		{
			loop(2)
			{
				let px=cenX+rand(-180,180);
				let py=cenY+rand(-200,200);
				SetTargeting(px,py,0.3,70,2);
				loop(2)
				{
					Set(px,py,rand(0,360));
				}
				wait(15);
			}
			
			task Set(let sx,let sy,let ag)
			{
				let bx=sx;
				let by=sy;
				loop
				{
					let spd=10;
					if(sx<minX||sx>maxX||sy<minY||sy>maxY){break;}
					sx+=spd*cos(ag);
					sy+=spd*sin(ag);
				}
				let angle=ag-180;
				SetShot(sx,sy,angle);
				wait(60);
				loop(25)
				{
					let speed=rand(1,2);
					let angle=rand(0,360);
					let gra=119;
					let delay=10;
					CreateShot02(bx,by,0,angle,speed/60,speed,gra,delay);
				}
				
				task SetShot(let sx,let sy,let angle)
				{
					let leng=600;
					let width=30;
					let gra=191;
					let del=70;
					SetLaserObject(sx,sy,leng,width,angle,224,gra,100,del);
					wait(50);
					let width=12;
					let gra=191;
					let leng=0;
					while(leng<600)
					{
						SetLaserObject(sx,sy,leng,width,angle,224,gra,0,15);
						CherryEffect(sx+leng*cos(angle),sy+leng*sin(angle));
						wait(1);
						leng+=40;
					}
				}
			}
			wait(wt);
			if(wt>50){wt-=15;}
		}
		
	}
	
	
	
	
	task MainThread_Advanced
	{
		SetX(cenX);
		SetY(minY-64);
		yield;
		SetSpellCard("랎됓뙐걏멝갲랼됗걐",46);
		let r=1;
		if(rand_int(0,1)){r=-r;}
		let wt=150;
		let L=1;
		loop
		{
			loop(L)
			{
				let px=cenX+rand(-180,180);
				let py=cenY+rand(-200,200);
				SetTargeting(px,py,0.3,70,2);
				let t=1;
				loop(3)
				{
					Set(px,py,rand(0,360),t);
					t=0;
				}
				wait(15);
			}
			
			task Set(let sx,let sy,let ag,let type)
			{
				let bx=sx;
				let by=sy;
				loop
				{
					let spd=10;
					if(sx<minX||sx>maxX||sy<minY||sy>maxY){break;}
					sx+=spd*cos(ag);
					sy+=spd*sin(ag);
				}
				let angle=ag-180;
				SetShot(sx,sy,angle);
				if(type)
				{
					wait(60);
					local
					{
						let way=20;
						let speed=1;
						let angle=0;
						let gra=119;
						let delay=10;
						while(angle<360)
						{
							CreateShot02(bx,by,0,angle,speed/60,speed,gra,delay);
							angle+=360/way;
						}
					}
				}
				
				
				task SetShot(let sx,let sy,let angle)
				{
					let leng=600;
					let width=30;
					let gra=191;
					let del=70;
					SetLaserObject(sx,sy,leng,width,angle,224,gra,100,del);
					wait(50);
					let width=12;
					let gra=191;
					let leng=0;
					while(leng<600)
					{
						SetLaserObject(sx,sy,leng,width,angle,224,gra,0,15);
						CherryEffect(sx+leng*cos(angle),sy+leng*sin(angle));
						wait(1);
						leng+=40;
					}
				}
			}
			wait(wt);
			if(wt>50){wt-=13;}
			L++;
		}
	}
	
	
	
	
	task MainThread_Unlimited{}
	
}