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(1000);
        SetDamageRate(100,100);
	SetTexture(imgEnemy);
	Initialize_Fairy(7);
	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(10);
        } 

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

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

}


task move
{
let Speed=GetSpeed;
	//SetSpeed(2.5);
	//SetAngle(270);
	SetMovePosition03(GetX,GetCenterY-120,10,3.0);
	wait(180);
	loop(200)
	{
	SetSpeed(0.8);
	SetAngle(180);
	yield;
	}
	SetAngle(90);
	SetSpeed(1.1);
}

task shotM
{
wait(75);
let angle=90;
while(GetLife>500)
{
	GroundCreateShot01(GetX+50,GetY,3.5,angle,9,5);
	GroundCreateShot01(GetX-50,GetY,3.5,-angle+90,9,5);
	GroundCreateShot01(GetX+50,GetY,3.5,angle+180,9,5);
	GroundCreateShot01(GetX-50,GetY,3.5,-angle+180+90,9,5);
	angle-=10;
	wait(3);
}
Concentration01(30);
loop
{
	let angle=rand(0,360);
	ascent(let i in 0..24)
	{
		GroundCreateShot01(GetX,GetY,3.5,angle+i*15,9,5);
	}
	wait(15);
}

}
/////////////////////////////////////////////
task shotE
{
wait(75);
let angle=90;
while(GetLife>500)
{
	ascent(i in 0..5)
	{
	GroundCreateShot01(GetX+50,GetY,3.0,angle+72*i,9,5);
	GroundCreateShot01(GetX-50,GetY,3.0,-angle+72*i,9,5);
	}
	angle+=10;
	wait(3);
}
Concentration01(30);
loop
{
	let angle=rand(0,360);
	ascent(let i in 0..36)
	{
		GroundCreateShot01(GetX,GetY,3.0,angle+i*10,9,5);
	}
	wait(15);
}
}
////////////////////////////////////////////////
task shotA
{
wait(75);
let angle=90;
while(GetLife>500)
{
	ascent(i in 0..7)
	{
	GroundCreateShot01(GetX+50,GetY,4.0,angle+360/7*i,9,5);
	GroundCreateShot01(GetX-50,GetY,4.0,-angle+360/7*i+180/7,9,5);
	GroundCreateShot01(GetX+50,GetY,3.75,angle+360/7*i,9,5);
	GroundCreateShot01(GetX-50,GetY,3.75,-angle+360/7*i+180/7,9,5);
	}
	angle+=11;
	wait(3);
}
Concentration01(30);
loop
{
	let angle=rand(0,360);
	ascent(let i in 0..36)
	{
		GroundCreateShot01(GetX,GetY,4.0,angle+i*10,9,5);
		GroundCreateShot01(GetX,GetY,3.75,angle+i*10,9,5);
	}
	wait(10);
}

}

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

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