script_enemy_main
{

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

	sfx01 = "t";

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

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

	ng_timeset = 35;
	ng_spellcard = 1;

	let frame1 = 0;
	let frame2 = 0;



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


	function bird(xpos,ypos)
	{
	let Yadd = 0;
	let Yadd2 = 0;
	let sub_delay = 0;
	let ns_colorran = 0;
	let ns_color;

	PlaySE(sfx01);
	ascent (j in 0..9)
		{
		CreateShotA(j+31, xpos+40-(j*10), ypos+0+(Yadd*10), 5);
		SetShotDataA(j+31, 0, 0, 90, 0, 0.05, 4, AQUA21);
		ascent (i in 0..15)
			{
			ns_colorran = rand_int(0,7);
			alternative(ns_colorran)
			case(1)	{   ns_color = RED12;	}
			case(2)	{   ns_color = ORANGE12;	}
			case(3)	{   ns_color = PURPLE12;	}
			case(4)	{   ns_color = BLUE12;	}
			case(5)	{   ns_color = AQUA12;	}
			case(6)	{   ns_color = WHITE12;	}
			case(7)	{   ns_color = YELLOW12;	}
			others	{   ns_color = GREEN12;	}
			CreateShotA(i, 0, 0, 30);
			SetShotDataA(i, 0, 0, 90, 0, 0.05, 4, ns_color);
			AddShot((i*10)+sub_delay, j+31, i, 0);
			sub_delay = rand_int(30,50);
			}
		FireShot(j+31);
		if (Yadd2 == 0)	{	Yadd++;	}
		else	{	Yadd--;	}
		if (Yadd == 4)	{	Yadd2 = 1;	}
		}
	}


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

	@Initialize
	{
	SetInvincibility(90);
	SetLife(300);
	SetDamageRate(0,0);
	SetTimer(ng_timeset);
	SetScore(300000);

	SetMovePosition02(GetCenterX, GetClipMinY + 90, 30);
	CutIn(YOUMU, "Wing Esper "\""Bird of Paradise"\", 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(120);
//	PlaySE(GetCurrentScriptDirectory~"..\sfx\Charge.wav");

	}

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

	@MainLoop 
	{
	SFU_GloBossCounter;

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

	SetShotDirectionType(ABSOLUTE);

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



	if (frame1 == 30)
	{
		Concentration01(60);
	}

	if (frame1 == 90)
	{	
		if (GetCommonData("CD_gamemode") == 2)
		{
		bird(GetPlayerX, 0);
		}
		else
		{
		bird(rand_int(GetClipMinX+50, GetClipMaxX-50), 0);
		}
		frame1 = 0;
	}


	if (frame2 == 270)
	{
		PlaySE(GetCurrentScriptDirectory~"..\sfx\Charge.wav");
	}

	if (frame2 == 300)
	{
		Concentration01(60);
	}

	if (frame2 == 360)
	{
		if (GetCommonData("CD_gamemode") == 2)
		{
		bird(GetClipMinX+40, 0);
		bird(GetClipMinX+140, 0);
		bird(GetClipMaxX-140, 0);
		bird(GetClipMaxX-40, 0);
		}
		else
		{
		bird(GetClipMinX+75, 0);
		bird(GetCenterX, 0);
		bird(GetClipMaxX-75, 0);
		}
		frame2 = 0;
	}


	if (ng_bossmframe == 120)
	{
		SetMovePositionRandom01(rand_int(25,100),10,5,GetClipMinX+100,50,GetClipMaxX-100,100);
		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(BossBG1);
	SetTexture(BossBG1);
	SetGraphicRect( 0, 0, 256, 256);
	SetGraphicScale(2, 2);
	SetGraphicAngle(0, 0, 0);
	SetAlpha(255);
	DrawGraphic(GetCenterX, GetCenterY);
	}

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

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