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


	sfx04 = "t";

	sfx11 = "t";

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

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

	ng_timeset = 45;
	ng_spellcard = 1;

	let frame1 = 0;
	let frame2 = 0;

	let ns_num1 = 0;
	let ns_num2 = 0;
	let ns_num3 = 0;


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





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

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

	SetMovePosition02(GetCenterX, GetClipMinY + 90, 30);
	CutIn(YOUMU, "Wing Esper "\""Wing of Aquamarine"\", BossCutin, BCR_x1, BCR_y1, BCR_x2, BCR_y2);

	Concentration01(60);

	LoadGraphic(BossSprite);

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

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

	}

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

	@MainLoop 
	{
	SFU_GloBossCounter;

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

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

	if (ng_sframe == 1)
	{
	CreateEnemyFromFile(GetCurrentScriptDirectory~"stage1_DropItemBossSpell2.txt", GetCenterX, GetClipMinY+100, 0, 0, 0);
	}

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



//Wing Animate

	if ((ng_start == 1) && (frame1 == 60))
	{
	PlaySE(sfx04);
	CreateLaser01(GetX, GetY-10, 8, 315, 500, 10, BLUE01, 0);
	CreateLaser01(GetX, GetY-10, 8, 225, 500, 10, BLUE01, 0);
	}






//Lunatic
if (GetCommonData("CD_gamemode") == 2)
{
	if ((ng_start == 1) && (frame1 == 75))
	{
	CreateLaser01(GetX+85, GetY-87, 8, 45, 500, 10, BLUE01, 0);

	ns_num1 = 0;
	ns_num2 = 0;
	ns_num3 = 0;
	CreateShotA(ns_num1, GetX+85, GetY-87, 0);
	SetShotDataA(ns_num1, 0, 4, SetShotDirectionType(PLAYER), 0, 0, 0, BLUE21);
	SetShotDirectionType(ABSOLUTE);
		while(ns_num2 < 30) {
		ns_num2++;
		CreateShotA(ns_num2, 0, 0, 0);
		SetShotDataA(ns_num2, 0, 2, 180, -0.2, -0.01, 1, BLUE11);
		AddShot(ns_num2*10, ns_num1, ns_num2, 0);
		}
		while(ns_num3 < 30) {
		ns_num3++;
		CreateShotA(ns_num3, 0, 0, 0);
		SetShotDataA(ns_num3, 0, 2, 0, 0.2, -0.01, 1, BLUE11);
		AddShot(ns_num3*10, ns_num1, ns_num3, 0);
		}
	FireShot(ns_num1);
	CreateShot01(GetX+85, GetY-87, 3.8, SetShotDirectionType(PLAYER), BLUE21, 0);
	CreateShot01(GetX+85, GetY-87, 3.6, SetShotDirectionType(PLAYER), BLUE21, 0);
	CreateShot01(GetX+85, GetY-87, 3.4, SetShotDirectionType(PLAYER), BLUE21, 0);
	CreateShot01(GetX+85, GetY-87, 3.2, SetShotDirectionType(PLAYER), BLUE21, 0);
	CreateShot01(GetX+85, GetY-87, 3.0, SetShotDirectionType(PLAYER), BLUE21, 0);
	CreateShot01(GetX+85, GetY-87, 2.8, SetShotDirectionType(PLAYER), BLUE21, 0);
	SetShotDirectionType(ABSOLUTE);


	CreateLaser01(GetX-85, GetY-87, 8, 135, 500, 10, BLUE01, 0);

	ns_num1 = 0;
	ns_num2 = 0;
	ns_num3 = 0;
	CreateShotA(ns_num1, GetX-85, GetY-87, 0);
	SetShotDataA(ns_num1, 0, 4, SetShotDirectionType(PLAYER), 0, 0, 0, BLUE21);
	SetShotDirectionType(ABSOLUTE);
		while(ns_num2 < 30) {
		ns_num2++;
		CreateShotA(ns_num2, 0, 0, 0);
		SetShotDataA(ns_num2, 0, 2, 180, -0.2, -0.01, 1, BLUE11);
		AddShot(ns_num2*10, ns_num1, ns_num2, 0);
		}
		while(ns_num3 < 30) {
		ns_num3++;
		CreateShotA(ns_num3, 0, 0, 0);
		SetShotDataA(ns_num3, 0, 2, 0, 0.2, -0.01, 1, BLUE11);
		AddShot(ns_num3*10, ns_num1, ns_num3, 0);
		}
	FireShot(ns_num1);
	CreateShot01(GetX-85, GetY-87, 3.8, SetShotDirectionType(PLAYER), BLUE21, 0);
	CreateShot01(GetX-85, GetY-87, 3.6, SetShotDirectionType(PLAYER), BLUE21, 0);
	CreateShot01(GetX-85, GetY-87, 3.4, SetShotDirectionType(PLAYER), BLUE21, 0);
	CreateShot01(GetX-85, GetY-87, 3.2, SetShotDirectionType(PLAYER), BLUE21, 0);
	CreateShot01(GetX-85, GetY-87, 3.0, SetShotDirectionType(PLAYER), BLUE21, 0);
	CreateShot01(GetX-85, GetY-87, 2.8, SetShotDirectionType(PLAYER), BLUE21, 0);
	SetShotDirectionType(ABSOLUTE);

	}
}
else
//normal
{
	if ((ng_start == 1) && (frame1 == 75))
	{
	CreateLaser01(GetX+85, GetY-87, 8, 45, 500, 10, BLUE01, 0);

	ns_num1 = 0;
	ns_num2 = 0;
	ns_num3 = 0;
	CreateShotA(ns_num1, GetX+85, GetY-87, 0);
	SetShotDataA(ns_num1, 0, 4, SetShotDirectionType(PLAYER), 0, 0, 0, BLUE21);
	SetShotDirectionType(ABSOLUTE);
		while(ns_num2 < 15) {
		ns_num2++;
		CreateShotA(ns_num2, 0, 0, 0);
		SetShotDataA(ns_num2, 0, 2, 180, -0.2, -0.01, 1, BLUE11);
		AddShot(ns_num2*15, ns_num1, ns_num2, 0);
		}
		while(ns_num3 < 15) {
		ns_num3++;
		CreateShotA(ns_num3, 0, 0, 0);
		SetShotDataA(ns_num3, 0, 2, 0, 0.2, -0.01, 1, BLUE11);
		AddShot(ns_num3*15, ns_num1, ns_num3, 0);
		}
	FireShot(ns_num1);
	CreateShot01(GetX+85, GetY-87, 3.8, SetShotDirectionType(PLAYER), BLUE21, 0);
	CreateShot01(GetX+85, GetY-87, 3.6, SetShotDirectionType(PLAYER), BLUE21, 0);
	CreateShot01(GetX+85, GetY-87, 3.4, SetShotDirectionType(PLAYER), BLUE21, 0);
	CreateShot01(GetX+85, GetY-87, 3.2, SetShotDirectionType(PLAYER), BLUE21, 0);
	SetShotDirectionType(ABSOLUTE);


	CreateLaser01(GetX-85, GetY-87, 8, 135, 500, 10, BLUE01, 0);

	ns_num1 = 0;
	ns_num2 = 0;
	ns_num3 = 0;
	CreateShotA(ns_num1, GetX-85, GetY-87, 0);
	SetShotDataA(ns_num1, 0, 4, SetShotDirectionType(PLAYER), 0, 0, 0, BLUE21);
	SetShotDirectionType(ABSOLUTE);
		while(ns_num2 < 30) {
		ns_num2++;
		CreateShotA(ns_num2, 0, 0, 0);
		SetShotDataA(ns_num2, 0, 2, 180, -0.2, -0.01, 1, BLUE11);
		AddShot(ns_num2*10, ns_num1, ns_num2, 0);
		}
		while(ns_num3 < 30) {
		ns_num3++;
		CreateShotA(ns_num3, 0, 0, 0);
		SetShotDataA(ns_num3, 0, 2, 0, 0.2, -0.01, 1, BLUE11);
		AddShot(ns_num3*10, ns_num1, ns_num3, 0);
		}
	FireShot(ns_num1);
	CreateShot01(GetX-85, GetY-87, 3.8, SetShotDirectionType(PLAYER), BLUE21, 0);
	CreateShot01(GetX-85, GetY-87, 3.6, SetShotDirectionType(PLAYER), BLUE21, 0);
	CreateShot01(GetX-85, GetY-87, 3.4, SetShotDirectionType(PLAYER), BLUE21, 0);
	CreateShot01(GetX-85, GetY-87, 3.2, SetShotDirectionType(PLAYER), BLUE21, 0);
	SetShotDirectionType(ABSOLUTE);

	}
}







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



//Lunatic
if (GetCommonData("CD_gamemode") == 2)
{
	if ((ng_start == 1) && (frame1 >= 75))
	{
	CreateLaser01(rand_int(GetClipMinX,GetClipMaxX), GetY-87, 2, 90, 50, 5, BLUE11, 0);
	}
}
	if ((ng_start == 1) && (frame1 >= 75) && (frame2%2 == 0))
	{
	CreateLaser01(rand_int(GetClipMinX,GetClipMaxX), GetY-87, 3, 90, 50, 5, BLUE11, 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
	{
	EnemyDropItem(1, 25);
	if(GotSpellCardBonus)
		{	
		PlaySE(GetCurrentScriptDirectory~"..\sfx\SpellBonus.wav");
		AddScore(ng_spellbonus * (GetCommonDataDefault("CD_FeverMultiplyUse",1)-1))
		}
	DeleteGraphic(BossSprite);
	DeleteGraphic(BossBG1);
	SFX_Delete;
    	}
}
