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 {
	SetCommonData("Stage1HayamawasiA",0);
        SetLife(200);
        SetDamageRate(100,100);
	SetTexture(imgEnemy);
	Initialize_Fairy(7);
	Tmain;
	}

    @MainLoop {
	BulletNum=GetEnemyShotCount;
	SetGroundCollision(GetX-16,GetY,32);
	SetGroundCollision(GetX,GetY,32);
	SetGroundCollision(GetX+16,GetY,32);

	yield;
    }

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

        @Finalize
        {
		SetCommonData("Stage1HayamawasiA",1);
		if(GetCommonDataDefault("STAGE1HAYAMAWASI",false))
		{
		//SetCommonData("STAGE1HAYAMAWASInum",GetCommonData("STAGE1HAYAMAWASInum")-1);
		}
		MagicCircleBreak(GetX,GetY,1,0.5);
		FinalizeItemAndShotnumWithDelete(3);
        } 

task Tmain
{
yield;
OutDamageRateZero;
AutoErazeTime(900);
GetDamege;
MagicColor;
move;
//summon;

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


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

let ShotRadius=72;

task shotM
{
wait(120);
loop(4)
{
let angle=GetAngleToPlayer;
ascent(let i in 0..18)
{
	GroundCreateShot01(GetX+ShotRadius*cos(angle+i*20),GetY+ShotRadius*sin(angle+i*20),3.5,angle+i*20,9,5);
	GroundCreateShot01(GetX+ShotRadius*cos(angle+i*20),GetY+ShotRadius*sin(angle+i*20),3.25,angle+i*20,9,5);
	GroundCreateShot01(GetX+ShotRadius*cos(angle+i*20),GetY+ShotRadius*sin(angle+i*20),3.0,angle+i*20,9,5);
}
wait(45);
}
}
/////////////////////////////////////////////
task shotE
{
wait(120);
loop(10)
{
let angle=GetAngleToPlayer;
ascent(let i in 0..24)
{
	GroundCreateShot01(GetX+ShotRadius*cos(angle+i*15),GetY+ShotRadius*sin(angle+i*15),3.5,angle+i*15,9,5);
	GroundCreateShot01(GetX+ShotRadius*cos(angle+i*15),GetY+ShotRadius*sin(angle+i*15),3.75,angle+i*15,9,5);
	GroundCreateShot01(GetX+ShotRadius*cos(angle+i*15),GetY+ShotRadius*sin(angle+i*15),4.0,angle+i*15,9,5);
}
wait(20);
}
}
////////////////////////////////////////////////
task shotA
{
wait(120);
loop(6)
{
let angle=GetAngleToPlayer;
ascent(let j in 0..15)
{
ascent(let i in 0..36)
{
	GroundCreateShot01(GetX+ShotRadius*cos(angle+i*10),GetY+ShotRadius*sin(angle+i*10),4.0+0.5*j,angle+i*10,9,5);
}
wait(2);
}
wait(30);
}

}

task shotG
{
wait(150);
loop(5)
{
let angle=GetAngleToPlayer;
ascent(let i in 0..12)
{
	GroundCreateShot01(GetX+ShotRadius*cos(angle+i*30),GetY+ShotRadius*sin(angle+i*30),2.5,angle+i*30,9,5);
}
wait(30);
}
}

task summon
{
let way=0;
alternative(GetCommonDataDefault("SELECTEDDIFFICULT","None"))
case("Moderate")
{
	way=18;
}
case("Extream")
{
	way=24;
}
case("Apocalypse")
{
	way=36;
}
	loop
	{
	let angle=GetAngleToPlayer;
	ascent(i in 0..way)
	{
	ShotElementalEffect(GetX+ShotRadius*0.9*cos(angle+i*360/way),GetY+ShotRadius*0.9*sin(angle+i*360/way),0,0,255,0.2);
	}
	yield;
	}
}

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


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