
script_enemy_main
{
	#include_script".\..\..\EnemyBossSystem.txt";
	#include_script".\Yuka_AnimeLib.txt";
	
	tex_enemy=filedir~"Yuka_Main.png";
	tex_spellbg=filedir~"Yuka_SpellBG.png";
	
	bg_rect=[0,0,768,512];
	
	@Initialize
	{
		point=420;
		SetLife(1200);
		SetTimer(59);
		EnemyBossInitialize;
		SetAnimetion(tex_enemy);
	}
	@MainLoop{EnemyBossMainLoopSystem(50,invincible);yield;}
	@DrawLoop{EnemyBossDrawLoop;}
	@Finalize{EnemyBossFinalize;}
	
	
	
	task MainThread_Standard
	{
		yield;
		SetMovePositionHermite(cenX,minY+100,0,0,0,0,100);
		SetAction(ACT_MOVE,100);
		SetSpellCard("랼됗걏랎됓궻뿚걐",70);
		wait(100);
		
		let r=1;
		if(rand_int(0,1)){r=-r;}
		let lp=0;
		loop
		{
			SetAction(ACT_SHOT_B,120);
			
			loop(2)
			{
				SetShot(GetX,GetY+20,r);
				wait(160);
				r=-r;
			}
			
			task SetShot(let bx,let by,let r)
			{
				let rot=rand(0,360);
				
				let way=5;
				let ag=rot;
				while(ag<rot+360)
				{
					let v=20;
					let sx=bx+v*cos(ag);
					let sy=by+v*sin(ag);
					let speed=5;
					Set(sx,sy,speed,ag);
					ag+=360/way;
				}
				
				task Set(let sx,let sy,let spd,let rot)
				{
					let i=rand(0,360);
					let rp=5;
					loop(160)
					{
						let graA=219;
						let delay=20;
						CreateShotA(1,sx,sy,delay);
						SetShotDataA(1,0,0,rot,0,0,0,graA);
						let cnt=120;
						local
						{
							let wayB=1;
							let speed=1.5;
							let angle=i;
							let graB=87;
							let delayB=10;
							while(angle<i+360)
							{
								CreateShotA(2,0,0,delayB);
								SetShotDataA(2,0,0,angle,0,speed/160,speed,graB);
								AddShot(cnt,1,2,0);
								angle+=360/wayB;
							}
						}
						SetShotKillTime(1,cnt+1);
						FireShot(1);
						sx+=spd*cos(rot);
						sy+=spd*sin(rot);
						rot+=rp*r;
						i+=6*r;
						if(rp>0){rp-=0.01;}
						yield;
					}
					
				}
			}
			wait(200);
			SetMovePositionHermite(cenX+rand(-70,70),minY+rand(90,120),0,0,0,0,120);
			SetAction(ACT_MOVE,120);
			wait(120);
			r=-r;
		}
	}
	
	
	
	
	task MainThread_Advanced{}
	
	
	
	
	task MainThread_Unlimited{}
	
}
