
script_enemy_main
{
	#include_script".\..\..\EnemyBossSystem.txt";
	#include_script".\Chen_AnimeLib.txt";
	
	tex_enemy=filedir~"Chen_Main.png";
	
	@Initialize
	{
		SetLife(4300);
		SetTimer(43);
		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);
		wait(120);
		let r=1;
		if(rand_int(0,1)){r=-r;}
		loop
		{
			SetAction(ACT_SHOT_A,240);
			let lp=0;
			loop(2)
			{
				let p=GetAngleToPlayer;
				let i=0;
				let s=0;
				loop(10)
				{
					let way=6;
					let speed=0.5+s;
					let angle=0;
					let gvspeed=[0.015,0.025];
					let gvangle=p+(90*r)-i;
					let gra=[118,113];
					let delay=10;
					while(angle<360)
					{
						ascent(a in 0..2)
						{
							GravityShot(GetX,GetY,speed,angle,gvspeed[a],gvangle,gra[lp%length(gra)],delay);
						}
						angle+=360/way;
					}
					s+=0.05;
					wait(5);
					i+=20*r;
				}
				wait(60);
				lp++;
				r=-r;
			}
			SetMovePositionHermite(cenX+rand(-60,60),minY+rand(110,140),0,0,0,0,80);
			SetAction(ACT_MOVE,80);
			SetRoll(80);
			wait(80);
			let p=-90+100*r;
			SetAction(ACT_SHOT_B,72);
			loop(20)
			{
				let wide=150;
				let way=31;
				let speed=2;
				let angle=p-wide/2;
				let gvspeed=[0.04,0.02];
				let gvangle=90;
				let gra=67;
				let delay=10;
				while(angle<=p+wide/2+1)
				{
					ascent(a in 0..length(gvspeed))
					{
						GravityShot(GetX,GetY,speed,angle,gvspeed[a],gvangle,gra,delay);
					}
					angle+=wide/(way-1);
				}
				wait(3);
				p+=-10*r;
			}
			wait(40);
			r=-r;
		}
	}
	
	task MainThread_Advanced{}
	task MainThread_Unlimited{}
	
}