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(900);
        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;
	SetMovePosition03(GetX,GetCenterY-110,20,2);
	wait(150);
	SetSpeed(0.5);
	SetAngle(GetAngle+180);
	wait(120);
	SetAngle(90);
	SetSpeed(1);
}

task shotM
{
wait(75);
let angle=90;
while(GetLife>450)
{
	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>450)
{
	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);
}
/*
wait(75);
while(GetLife>450)
{
let angle=GetAngleToPlayer;
ascent(let i in 0..18)
{
	GroundCreateShot01(GetX,GetY,3.5,angle+i*20,9,5);
}
	ascent( i in -3..4)
	{
		GroundCreateShot01(GetX,GetY,3.5,angle+3*i,9,5);
	}
wait(30);
}
Concentration01(30);
loop
{
	let angle=rand(0,360);
	ascent(let i in 0..30)
	{
		GroundCreateShot01(GetX,GetY,3.5,angle+i*12,9,5);
	}
	wait(10);
}
*/
}
////////////////////////////////////////////////
task shotA
{
wait(75);
let angle=90;
while(GetLife>450)
{
	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"