script_enemy_main
{
        let csd     = GetCurrentScriptDirectory;
	let speed = GetSpeed;
	let angle = GetAngle;
	let num = GetArgument;
	let imgEnemy;

	imgEnemy=csd~"..\lib\fairy_red.png";


	let SelectedDifficult=GetCommonDataDefault("SELECTEDDIFFICULT","Normal");

    @Initialize {
        SetLife(55);
        SetDamageRate(100,100);
	SetTexture(imgEnemy);
	Initialize_Fairy(2);
	Tmain;
	}

    @MainLoop {
	SetGroundCollision(GetX,GetY,32);
	yield;
    }

        @DrawLoop {
		SetColor(ZakoColor[0],ZakoColor[1],ZakoColor[2]);
		DrawFairy(imgEnemy);
		DrawMagicCircle("WHITE",0.30);
	}

        @Finalize
        {
		MagicCircleBreak(GetX,GetY,1,0.3);
		FinalizeItemAndShotnum(2);
        } 

task Tmain
{
yield;
OutDamageRateZero;
AutoErazeTime(900);
GetDamege;
MagicColor;
move;

alternative(GetCommonDataDefault("SELECTEDDIFFICULT","None"))
case("Moderate")
{
shotM;
}
case("Extream")
{
shotE;
}
case("Apocalypse")
{
shotA;
}

}

task move
{
	SetSpeed(GetSpeed);
	SetAngle(GetAngle);
	let speed=GetSpeed;
	let Bspeed=GetSpeed;
	while(GetCommonDataDefault("Stage3Enemy11aStop",false)==false){yield;}
	loop(60)
	{
		SetSpeed(speed);
		speed-=Bspeed/60;
		yield;
	}
	SetAngle(90);
	SetSpeed(0);
	loop(60)
	{
		SetSpeed(speed);
		speed+=Bspeed/60;
		yield;
	}
	SetSpeed(Bspeed);
	SetAngle(90);
}

task shotM
{
wait(45);
loop(3)
{
	ascent(let i in -2..3)
	{
		GroundCreateShot01(GetX,GetY,3.5,GetAngleToPlayer+i*30,9,5);
		GroundCreateShot01(GetX,GetY,3.25,GetAngleToPlayer+i*30,9,5);
		GroundCreateShot01(GetX,GetY,3.0,GetAngleToPlayer+i*30,9,5);
	}
	wait(10);
	ascent(let i in -2..2)
	{
		GroundCreateShot01(GetX,GetY,3.5,GetAngleToPlayer+i*30+15,9,5);
		GroundCreateShot01(GetX,GetY,3.25,GetAngleToPlayer+i*30+15,9,5);
		GroundCreateShot01(GetX,GetY,3.0,GetAngleToPlayer+i*30+15,9,5);
	}
	wait(60);
}
}
////////////////////////////////////////////////////////
task shotE
{
wait(45);
loop(3)
{
	ascent(let i in -3..4)
	{
		GroundCreateShot01(GetX,GetY,3.5,GetAngleToPlayer+i*25,9,5);
		GroundCreateShot01(GetX,GetY,3.75,GetAngleToPlayer+i*25,9,5);
		GroundCreateShot01(GetX,GetY,4.0,GetAngleToPlayer+i*25,9,5);
	}
	wait(10);
	ascent(let i in -3..3)
	{
		GroundCreateShot01(GetX,GetY,3.5,GetAngleToPlayer+i*25+12.5,9,5);
		GroundCreateShot01(GetX,GetY,3.75,GetAngleToPlayer+i*25+12.5,9,5);
		GroundCreateShot01(GetX,GetY,4.0,GetAngleToPlayer+i*25+12.5,9,5);
	}
	wait(60);
}
}
////////////////////////////////////////////////////////
task shotA
{
wait(45);
loop(3)
{
	ascent(let i in -4..5)
	{
		GroundCreateShot01(GetX,GetY,4.0,GetAngleToPlayer+i*20,9,5);
		GroundCreateShot01(GetX,GetY,4.25,GetAngleToPlayer+i*20,9,5);
		GroundCreateShot01(GetX,GetY,4.5,GetAngleToPlayer+i*20,9,5);
	}
	wait(10);
	ascent(let i in -4..4)
	{
		GroundCreateShot01(GetX,GetY,4.0,GetAngleToPlayer+i*20+10,9,5);
		GroundCreateShot01(GetX,GetY,4.25,GetAngleToPlayer+i*20+10,9,5);
		GroundCreateShot01(GetX,GetY,4.5,GetAngleToPlayer+i*20+10,9,5);
	}
	wait(60);
}
}

#include_function ".\..\txt/StageEnemydata.txt"
#include_function ".\..\lib\lib_anime_fairy.txt"
}

#include_script ".\..\txt/EnemyShotData.txt"