script_enemy_main
{
        let csd     = GetCurrentScriptDirectory;
	let speed = GetSpeed;
	let angle = GetAngle;
	let num = GetArgument;
	let imgEnemy;
	if(num==1)
	{
		imgEnemy=csd~"..\lib\fairy_red.png";
	}
	if(num==2)
	{
		imgEnemy=csd~"..\lib\fairy_blue.png";
	}
	let SelectedDifficult=GetCommonDataDefault("SELECTEDDIFFICULT","Normal");

    @Initialize {
        SetLife(5);
        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);

	}

        @Finalize
        {
		MagicCircleBreak(GetX,GetY,10,0.3);
		FinalizeItemAndShotnum(0);
		alternative(GetCommonDataDefault("SELECTEDDIFFICULT","None"))
		case("Moderate")
		{
			CreateShotA(0,GetX,GetY,5);
			SetShotDataA(0,0,0,GetAngleToPlayer,0,0.10,6,9);
			FireShot(0);
		}
		case("Extream")
		{
			CreateShotA(0,GetX,GetY,5);
			CreateShotA(1,GetX,GetY,5);
			SetShotDataA(0,0,0,GetAngleToPlayer,0,0.10,6,9);
			SetShotDataA(1,0,0,GetAngleToPlayer,0,0.125,6,9);
			FireShot(0);
			FireShot(1);
		
		}
		case("Apocalypse")
		{	
			CreateShotA(0,GetX,GetY,5);
			CreateShotA(1,GetX,GetY,5);
			CreateShotA(2,GetX,GetY,5);
			SetShotDataA(0,0,0,GetAngleToPlayer,0,0.10,6,9);
			SetShotDataA(1,0,0,GetAngleToPlayer,0,0.125,6,9);
			SetShotDataA(2,0,0,GetAngleToPlayer,0,0.15,6,9);
			FireShot(0);	
			FireShot(1);
			FireShot(2);	
		}

        } 

task Tmain
{
yield;
ElementalEffect(255,0,0,0.5);
OutDamageRateZero;
AutoErazeTime(900);
GetDamege;
LifeSteal;
move;

}

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

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

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

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