script_enemy_main
{

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

	sfx01 = "t";

	sfx11 = "t";

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

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

	ng_timeset = 32;
	ng_spellcard = 1;

	let ng_angle = 0;

	let frame1 = 0;
	let frame2 = 0;


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





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

	@Initialize
	{
	SetInvincibility(150);
	SetLife(200);
	SetDamageRate(0,0);
	SetTimer(ng_timeset);
	SetScore(400000);

	SetMovePosition02(GetCenterX, GetClipMinY + 90, 60);
	CutIn(YOUMU, "Mechanism Type "\""Circular Shot"\", 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(90);
	PlaySE(GetCurrentScriptDirectory~"..\sfx\Charge.wav");

	}

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

	@MainLoop 
	{
	SFU_GloBossCounter;

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

	SetShotDirectionType(ABSOLUTE);

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


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



//Lunatic
if (GetCommonData("CD_gamemode") == 2)
{
	if ((ng_start == 1) && (frame1 == 45))
	{
	PlaySE(sfx01);
	ng_angle = rand_int(0,360);
		ascent(loopnum in 0..36)
		{
		CreateShotA(0, GetX, GetY, 0);
		SetShotDataA(0, 0, 2, ng_angle+(loopnum*10), 0.4, 0, 0, RED04);
		FireShot(0);
		CreateShotA(0, GetX, GetY, 0);
		SetShotDataA(0, 0, 2, ng_angle+(loopnum*10), -0.4, 0, 0, RED04);
		FireShot(0);
		}
	frame1 = 0;
	}
}
else
{
	if ((ng_start == 1) && (frame1 == 45))
	{
	PlaySE(sfx01);
	ng_angle = rand_int(0,360);
		ascent(loopnum in 0..36)
		{
		CreateShotA(0, GetX, GetY, 0);
		SetShotDataA(0, 0, 2, ng_angle+(loopnum*10), 0.2, 0, 0, RED04);
		FireShot(0);
		CreateShotA(0, GetX, GetY, 0);
		SetShotDataA(0, 0, 2, ng_angle+(loopnum*10), -0.2, 0, 0, RED04);
		FireShot(0);
		}
	frame1 = 0;
	}
}


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

	frame1++;

//----------------------
// 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(BossBG1);
	SetTexture(BossBG1);
	SetGraphicRect( 0, BossBGscroll, 550, BossBGscroll+550);
	SetGraphicScale(1, 1);
	SetGraphicAngle(0, 0, 0);
	SetAlpha(255);
	DrawGraphic(GetCenterX, GetCenterY);
	BossBGscroll -= 1;
	}

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

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