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(15);
        SetDamageRate(100,100);
	SetTexture(imgEnemy);
	Initialize_Fairy(0);
	Tmain;
	}

    @MainLoop {
	SetSkyCollision(GetX,GetY,24);
	yield;

    }

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

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

task Tmain
{
yield;
OutDamageRateZero;
AutoErazeTime(300);
GetDamege;
move;

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

}

task move
{
SetAngle(GetAngleToPlayer);
loop(90)
{
	SetSpeed(4.5);
	if(OnPlayerMissed || GetPlayerLife==0)
	{

	}
	else
	{
	if(sin(GetAngleToPlayer-GetAngle)>0)
	{
		if(GetAngleToPlayer-GetAngle<5)
		{
			SetAngle(GetAngleToPlayer);
		}
		else
		{
			SetAngle(GetAngle+5);
		}
	}
	}
yield;
}
}

task shotM
{
wait(10);
loop(5)
{
SkyCreateShot01(GetX,GetY,6.0,GetAngleToPlayer+rand(-2,2),9,5);
wait(20);
}
}
///////////////////////////////////////////////////////////
task shotE
{
wait(10);
loop(7)
{
SkyCreateShot01(GetX,GetY,6.0,GetAngleToPlayer+rand(-2,2),9,5);
wait(15);
}
}
///////////////////////////////////////////////////////////
task shotA
{
wait(10);
loop(7)
{
let angle=GetAngleToPlayer+rand(-2,2);
ascent(let i in -1..2)
{
SkyCreateShot01(GetX,GetY,7.0+i*0.5,angle,9,5);
}
wait(15);
}
}

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

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