script_enemy_main
{

	#include_function".\..\function\glo_enemydrop.txt";
	#include_function".\stage1_Boss_Info.txt";

	sfx02 = "t";

	sfx04 = "t";

	sfx50 = "t";
	sfx51 = "t";

	#include_function".\..\function\soundfx.txt";

	ng_timeset = 40;
	ng_spellcard = 1;

	let frame1 = 0;
	let frame2 = 0;

	let ns_num1 = 0;
	let ns_num2 = 0;
	let ns_num3 = 0;
	let ns_angle1 = 0;
	let ns_angle2 = 0;

//-------------------------------------------------------------------------------------------------
// Any Task





//---------------------------------------------------------------

	@Initialize
	{
	SetInvincibility(60);
	SetLife(300);
	SetDamageRate(0,0);
	SetTimer(ng_timeset);
	SetScore(400000);

	SetMovePosition02(GetCenterX, GetClipMinY + 90, 30);
	CutIn(YOUMU, "Wing Type "\""Starry Sky"\", BossCutin, BCR_x1, BCR_y1, BCR_x2, BCR_y2);


	LoadGraphic(BossSprite);

	// Fever score decrease if this is not survival card.
	SetCommonData("ng_feverdecrease", 1);

	Concentration01(60);
	PlaySE(GetCurrentScriptDirectory~"..\sfx\Charge.wav");

	}

//---------------------------------------------------------------

	@MainLoop 
	{
	SFU_GloBossCounter;

	SetCollisionA(GetX, GetY, 32);
	SetCollisionB(GetX, GetY, 16);

	SetShotDirectionType(ABSOLUTE);

//----------------------
// Attack script below
//----------------------

	if (ng_sframe == 60)
	{
	ng_start = 1;
	frame1 = 0;
	frame2 = 0;
	}







	// Lunatic
	if (GetCommonData("CD_gamemode") == 2)
{
	if (frame1 == 4 && (ng_start == 1))
	{
	CreateShotA(1, rand_int(GetClipMinX, GetClipMaxX), rand_int(0, 100), 30);
	SetShotDataA(1, 0, 0, 90, 0, 0, 0, BLUE04);
	SetShotDataA(1, 60, 0, 90, 0, 0.2, rand(1.5,2.5), BLUE04);
	FireShot(1);
	frame1 = 0;
	}

	if ((frame2 == 6) && (ng_start == 1))
	{
	CreateShotA(2, rand_int(GetClipMinX, GetClipMaxX), rand_int(0, 100), 30);
	SetShotDataA(2, 0, 0, 90, 0, 0, 0, BLUE04);
	SetShotDataA(2, 60, 0, SetShotDirectionType(PLAYER), 0, 0.2, rand(3.5,4.5), RED04);
	SetShotDirectionType(ABSOLUTE);
	FireShot(2);
	frame2 = 0;
	}
}
// Normal
else
{
	if (frame1 == 6 && (ng_start == 1))
	{
	CreateShotA(1, rand_int(GetClipMinX, GetClipMaxX), rand_int(0, 100), 30);
	SetShotDataA(1, 0, 0, 90, 0, 0, 0, BLUE04);
	SetShotDataA(1, 60, 0, 90, 0, 0.2, 2, BLUE04);
	FireShot(1);
	frame1 = 0;
	}

	if ((frame2 == 9) && (ng_start == 1))
	{
	CreateShotA(2, rand_int(GetClipMinX, GetClipMaxX), rand_int(0, 100), 30);
	SetShotDataA(2, 0, 0, 90, 0, 0, 0, RED04);
	SetShotDataA(2, 60, 0, SetShotDirectionType(PLAYER), 0, 0.2, 4, RED04);
	SetShotDirectionType(ABSOLUTE);
	FireShot(2);
	frame2 = 0;
	}
}


	if (ng_bossmframe == 120)
	{
	SetMovePositionRandom01(rand_int(25,75),5,15,GetClipMinX+100,75,GetClipMaxX-100,125);
	ng_bossmframe = 0;
	}



	frame1++;
	frame2++;


//----------------------
// Attack script above
//----------------------

	#include_function".\..\function\glo_timernotice.txt";
	yield;
	}

//---------------------------------------------------------------

	@DrawLoop
	{
	SetTexture(BossSprite);
	SetGraphicAngle(0, 0, 0);
	SetGraphicScale(1, 1);
	#include_function".\..\function\boss_draw.txt";
	}

//---------------------------------------------------------------

	@BackGround
	{
	LoadGraphic(BossBG2);
	SetTexture(BossBG2);
	SetGraphicRect( 0, 0, 256, 256);
	SetGraphicScale(2, 2);
	SetGraphicAngle(0, 0, 0);
	SetAlpha(255);
	DrawGraphic(GetCenterX, GetCenterY);
	}

//---------------------------------------------------------------

	@Finalize
	{
	loop (30)	{	EnemyDropItem(1, 25);	}
	if(GotSpellCardBonus)
		{	
		PlaySE(GetCurrentScriptDirectory~"..\sfx\SpellBonus.wav");
		AddScore(ng_spellbonus * (GetCommonDataDefault("CD_FeverMultiplyUse",1)-1))
		}
	DeleteGraphic(BossSprite);
	DeleteGraphic(BossBG2);
	SFX_Delete;
    	}
}
