
script_enemy_main
{
	#include_script".\..\..\EnemyBossSystem.txt";
	#include_script".\Chen_AnimeLib.txt";
	
	tex_enemy=filedir~"Chen_Main.png";
	tex_spellbg=filedir~"Chen_SpellBG.png";
	
	bg_rect=[0,0,512,768];
	
	@Initialize
	{
		point=300;
		SetLife(500);
		SetTimer(50);
		EnemyBossInitialize;
		SetAnimetion(tex_enemy);
	}
	@MainLoop{EnemyBossMainLoopSystem(50,invincible);yield;}
	@DrawLoop{EnemyBossDrawLoop;}
	@Finalize{EnemyBossFinalize;}
	
	
	
	task MainThread_Standard
	{
		yield;
		SetMovePositionHermite(cenX,minY+120,0,0,0,0,100);
		SetAction(ACT_MOVE,100);
		SetRoll(100);
		SetSpellCard("xpu̒nՁv",27);
		wait(120);
		let r=1;
		if(rand_int(0,1)){r=-r;}
		loop
		{
			SetAction(ACT_SHOT_B,150);
			loop(2)
			{
				let i=rand(0,360);
				let ip=1.4;
				let w=18;
				let s=0;
				let leng=90;
				loop(ceil(360/w/ip))
				{
					let g=0;
					let way=2;
					let ag=i;
					while(ag<i+360-1)
					{
						let sx=GetX+leng*cos(ag);
						let sy=GetY+leng*sin(ag);
						let speed=4-s;
						let angle=ag;
						let gra=[129,131,133,135];
						let delay=9;
						while(angle<ag+360)
						{
							CreateShot01(sx,sy,speed,angle+(360/way)/2,gra[g%length(gra)],delay);
							angle+=360/way;
						}
						g++;
						ag+=360/w;
					}
					i+=ip*r;
					s+=0.18;
					wait(4);
				}
				wait(60);
				r=-r;
			}
			SetMovePositionHermite(cenX+rand(-60,60),minY+rand(110,140),0,0,0,0,100);
			SetAction(ACT_MOVE,100);
			SetRoll(100);
			loop(3)
			{
				let way=40;
				let p=rand(0,360);
				
				let speed=2.5;
				let angle=p;
				let gra=148;
				let delay=10;
				while(angle<p+360)
				{
					CreateShot02(GetX,GetY,0,angle,speed/60,speed,gra,delay);
					angle+=360/way;
				}
				wait(40);
			}
		}
	}
	
	task MainThread_Advanced{}
	task MainThread_Unlimited{}
	
}