script_enemy_main
{
	#include_function ".\System\CommonFunctions.dnh"
	#include_function ".\System\EnemyFunctions.dnh"
	let frame = 0;
	let runEnemy = csd~"LWhiteDie.txt";
	SetLife(GetCommonData("LWhiteLife"));
	MaxLife = 1000;
	
	@Initialize
	{
		Init;
		SetDamageRate(100, 0);
		MoveTask(90);
	}
	
	@MainLoop
	{
		SetCommonData("LWhiteLife", GetLife);
		SetCollisionA(GetX, GetY, 24);
		SetCollisionB(GetX, GetY, 12);
		if(GetEnemyNum == 2)
		{
			SetDamageRate(50, 0);
		}
		CheckForDamage;
		yield;
	}
	
	@DrawLoop
	{
		DrawLilyWhite;
	}
	
	@Finalize
	{
		CreateEnemyFromFile(runEnemy, GetX, GetY, 0, 0, 0);
		DeleteEnemyShot(CHILD);
	}
	
	task MoveTask(let cosAng)
	{
		let count = 0;
		shooting = true;
		while(GetY < GetClipMaxY + 40){
			SetX(GetCenterX - 70 + (GetClipMaxX - GetCenterX -140)*cos(cosAng));
			SetY(GetY + 3);
			FakeShot(GetX, GetY);
			if(count % 4 == 0)
			{
				if(GetEnemyNum == 2)
				{
					Flower(GetX, GetY, 5);
				} else if(count % 16 == 0)
				{
					Flower(GetX, GetY, 5);
				}
			}
			count ++;
			cosAng += 5.5;
			yield;
		}
		loop(40)
		{
			yield;
		}
		count = 0;
		SetX(GetClipMinX - 30);
		SetY(GetClipMinY + 30);
		while(GetX < GetClipMaxX + 30)
		{
			SetX(GetX + 5);
			FakeShot(GetX, GetY);
			if(count % 4 == 0)
			{
				if(GetEnemyNum == 2)
				{
					Flower(GetX, GetY, 6);
				} else if(count % 16 == 0)
				{
					Flower(GetX, GetY, 6);
				}
			}
			count ++;
			yield;
		}
		loop(40)
		{
			yield;
		}
		count = 0;
		SetX(GetClipMaxX + 30);
		SetY(GetClipMinY + 90);
		while(GetX > GetClipMinX - 30)
		{
			SetX(GetX - 5);
			FakeShot(GetX, GetY);
			if(count % 4 == 0)
			{
				if(GetEnemyNum == 2)
				{
					Flower(GetX, GetY, 8);
				} else if(count % 16 == 0)
				{
					Flower(GetX, GetY, 8);
				}
			}
			count ++;
			yield;
		}
		shooting = false;
		loop(20){
			yield;
		}
		Concentration01(60);
		PlaySE(charge);
		loop(60)
		{
			yield;
		}
		warping = true;
		loop(60)
		{
			yield;
		}
		warping = false;
		SetX(GetCenterX);
		SetY(GetClipMinY-40);
		MoveTask(cosAng);
	}
	
	task FakeShot(let X, let Y)
	{
		let obj = Obj_Create(OBJ_SHOT);
		Obj_SetPosition(obj, X, Y);
		Obj_SetAngle(obj, 0);
		ObjShot_SetGraphic(obj, GREEN05);
		loop(160)
		{
			yield;
		}
		ObjShot_FadeDelete(obj);
	}
}