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

    @MainLoop {
	BulletNum=GetEnemyShotCount;
	ascent(let i in -1..2)
	{
	SetGroundCollision(GetX+i*16,GetY,32);
	}
	yield;
    }

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

        @Finalize
        {
		MagicCircleBreak(GetX,GetY,1,0.5);
		FinalizeItemAndShotnumWithDelete(2);
        } 

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

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

}


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

task shotM
{
wait(60);
loop(2)
{
loop(3)
{
let angle=rand(0,360);
	ascent(i in 0..20)
	{
		GroundCreateShot01(GetX,GetY,3,angle+i*18,9,5);
		GroundCreateShot01(GetX,GetY,3.5,angle+i*18+9,9,5);
	}
wait(30);
}
loop(5)
{
	loop(5)
	{
	let angle=GetAngleToPlayer;
	ascent(i in -1..2)
	{
		GroundCreateShot01(GetX,GetY,5,angle+i*3,9,5);
	}
	wait(3)
	}
}
wait(45);
}
}
///////////////////////////////////////////////
task shotE
{
wait(60);
loop(2)
{
loop(3)
{
let angle=rand(0,360);
	ascent(i in 0..9)
	{
		GroundCreateShot01(GetX,GetY,4.0,angle+i*40,9,5);
	}
	ascent(i in 0..9)
	{
		GroundCreateShot01(GetX,GetY,3.5,angle+i*40+10.0,9,5);
		GroundCreateShot01(GetX,GetY,3.5,angle+i*40-10.0,9,5);
	}
	ascent(i in 0..36)
	{
		GroundCreateShot01(GetX,GetY,3.0,angle+i*10+5,9,5);
	}
wait(30);
}
loop(5)
{
	loop(5)
	{
	let angle=GetAngleToPlayer;
	ascent(i in -2..3)
	{
		GroundCreateShot01(GetX,GetY,4.5,angle+i*3,9,5);
	}
	wait(3)
	}
}
wait(45);
}
}
/////////////////////////////////////////////////
task shotA
{
wait(60);
loop(2)
{
loop(3)
{
let angle=rand(0,360);
	ascent(i in 0..9)
	{
		GroundCreateShot01(GetX,GetY,5.0,angle+i*40,9,5);
	}
	ascent(i in 0..9)
	{
		GroundCreateShot01(GetX,GetY,4.5,angle+i*40+10.0,9,5);
		GroundCreateShot01(GetX,GetY,4.5,angle+i*40-10.0,9,5);
	}
	ascent(i in 0..36)
	{
		GroundCreateShot01(GetX,GetY,3.5,angle+i*10+5,9,5);
	}
	ascent(i in 0..72)
	{
		GroundCreateShot01(GetX,GetY,3.0,angle+i*5+2.5,9,5);
	}
wait(30);
}
loop(5)
{
	loop(5)
	{
	let angle=GetAngleToPlayer;
	ascent(i in -4..5)
	{
		GroundCreateShot01(GetX,GetY,4.5,angle+i*3,9,5);
	}
	wait(3)
	}
}
wait(45);
}
}
#include_function ".\..\txt/StageEnemydata.txt"
#include_function ".\..\lib\lib_anime_fairy.txt"
}

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