script_enemy_main
{

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

	sfx01 = "t";

	sfx11 = "t";

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

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





	ng_timeset = 45;
	ng_spellcard = 1;




	let frame1 = 0;
	let frame2 = 0;


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




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

	@Initialize
	{
	SetInvincibility(150);
	SetLife(400);
	SetDamageRate(0,0);
	SetTimer(ng_timeset);
	SetScore(600000);

	SetMovePosition02(GetCenterX, GetClipMinY + 90, 60);
	CutIn(YOUMU, "Fire Esper "\""Volcano Fall"\", BossCutin, BCR_x1, BCR_y1, BCR_x2, BCR_y2);


	LoadGraphic(BossSprite);

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


	}

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

	@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;
	frame2 = 0;
	}



if (GetCommonData("CD_gamemode") == 2)
{
	if ((ng_start == 1) && (frame1 == 5))
	{
	CreateShot02(rand(GetClipMinX, GetClipMaxX), GetClipMinY+10, 0, 90, 0.05, rand(1.5,4), RED01, 30);
	CreateShot02(rand(GetClipMinX, GetClipMaxX), GetClipMinY+10, 0, 90, 0.05, rand(1.5,4), RED02, 30);
	CreateShot02(rand(GetClipMinX, GetClipMaxX), GetClipMinY+10, 0, 90, 0.05, rand(1.5,4), RED05, 30);
	frame1 = 0;
	}
}
else
{
	if ((ng_start == 1) && (frame1 == 7))
	{
	CreateShot02(rand(GetClipMinX, GetClipMaxX), GetClipMinY+10, 0, 90, 0.05, rand(1.5,4), RED01, 30);
	CreateShot02(rand(GetClipMinX, GetClipMaxX), GetClipMinY+10, 0, 90, 0.05, rand(1.5,4), RED02, 30);
	CreateShot02(rand(GetClipMinX, GetClipMaxX), GetClipMinY+10, 0, 90, 0.05, rand(1.5,4), RED05, 30);
	frame1 = 0;
	}
}



	if ((ng_start == 1) && (frame2 == 120))
	{
	PlaySE(GetCurrentScriptDirectory~"..\sfx\Charge.wav");
	}

	if ((ng_start == 1) && (frame2 == 150))
	{
	Concentration01(90);
	}

	if ((ng_start == 1) && (frame2 == 240))
	{
//	Slow(1);
	MotionBlur(SHOT, 120, 200);
	}

	if ((ng_start == 1) && (frame2 == 300))
	{
	PlaySE(sfx01);
if (GetCommonData("CD_gamemode") == 2)
{
	ascent (i in 0..90)
		{
		CreateShot02(GetX, GetY, 0, GetAngleToPlayer+i*4, 0.05, 3, RED04, 30);
		}
}
else
{
	ascent (i in 0..36)
		{
		CreateShot02(GetX, GetY, 0, GetAngleToPlayer+i*10, 0.05, 3, RED04, 30);
		}
}
//	Slow(0);
	frame2 = 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++;
	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(1.8, 1.8);
	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(BossBG1);
	SFX_Delete;
    	}
}
