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

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

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

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

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

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

}

task SAutoErazeTime(w)
{
ZakoEnemyLifeDisplay;
loop(w)
{
if(GetCommonDataDefault("VanishSignal",false))
{
	break;
}

if(GetX<GetClipMinX-300 || GetClipMaxX+300<GetX || GetY<GetClipMinY-1200 || GetClipMaxY+100<GetY)
{
	break;
}

yield;
}
VanishEnemy;
}

task move
{
	SetSpeed(GetSpeed);
	SetAngle(GetAngle);
}

task shotM
{
wait(15);
loop(8)
{
if(GetY>=GetClipMinY+8 && GetX<=GetClipMaxX-8 &&GetX>=GetClipMinX+8)
{
GroundCreateShot01(GetX,GetY,3.5,GetAngleToPlayer,9,5);
}
wait(45);
}
}
////////////////////////////////////////////////////////
task shotE
{
wait(17);
loop(12)
{
if(GetY>=GetClipMinY+8 && GetX<=GetClipMaxX-8 &&GetX>=GetClipMinX+8)
{
GroundCreateShot01(GetX,GetY,3.5,GetAngleToPlayer,9,5);
}
wait(30);
}
}
////////////////////////////////////////////////////////
task shotA
{
wait(15);
loop(12)
{
ascent(let i in 0..3)
{
if(GetY>=GetClipMinY+8 && GetX<=GetClipMaxX-8 &&GetX>=GetClipMinX+8)
{
GroundCreateShot01(GetX,GetY,3.5+i*0.5,GetAngleToPlayer,9,5);
}
}
wait(30);
}
}

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

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