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

    @MainLoop {
	BulletNum=GetEnemyShotCount;
	SetCollisionA(GetX()-16,GetY(),32);
	SetCollisionA(GetX(),GetY(),32);
	SetCollisionA(GetX()+16,GetY(),32);
	//MSDSetCollisionAForBigEnemy(GetX(),GetY(),64);
	yield;
    }

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

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

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

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

}


task move
{
//	SetMovePosition02(GetCenterX,GetCenterY-64,480);
//	wait(241);
	SetSpeed(0.5);
	SetAngle(90);
}

task shotM
{
wait(120);
loop(5)
{
let angle=GetAngleToPlayer;
let Bullet=3;
descent(let k in 0..6)
{
ascent(let i in 0..6)
{
	ascent(let j in -k..k+1)
	{
	GroundCreateShot01(GetX,GetY,8-k*0.8,angle+60*i+j*3,9,5);
	}
}
wait(5);
}
wait(60);
}
}
/////////////////////////////////////////////////////
task shotE
{
wait(120);
loop(5)
{
let angle=GetAngleToPlayer;
let Bullet=3;
descent(let k in 0..8)
{
ascent(let i in 0..8)
{
	ascent(let j in -k..k+1)
	{
	GroundCreateShot01(GetX,GetY,6-k*0.5,angle+45*i+j*2.75,9,5);
	}
}
wait(5);
}
wait(60);
}
}
/////////////////////////////////////////////////////////
task shotA
{
wait(120);
loop(5)
{
let angle=GetAngleToPlayer;
let Bullet=3;
descent(let k in 0..10)
{
ascent(let i in 0..6)
{
	ascent(let j in -k..k+1)
	{
	GroundCreateShot01(GetX,GetY,9-k*0.8,angle+60*i+j*2.75,9,5);
	}
}
wait(5);
}
wait(60);
}
}

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

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