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

    @MainLoop {
	BulletNum=GetEnemyShotCount;
	SetSkyCollision(GetX,GetY,48);
	SetDummySkyCollision(GetX+60,GetY,48);
	SetDummySkyCollision(GetX+120,GetY,48);
	SetDummySkyCollision(GetX-60,GetY,48);
	SetDummySkyCollision(GetX-120,GetY,48);
	yield;
    }

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

        @Finalize
        {
		SetCommonData("STAGE4HAYAMAWASHI1",true);
		MagicCircleBreak(GetX,GetY,2,0.3);
		FinalizeItemAndShotnumWithDelete(5);
        } 

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

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

}

task shotM
{
/*
wait(60);
let angle=0;
loop(50)
{
	ascent(i in 0..8)
	{
		//SkyCreateShot01(GetX,GetY,4,angle+i*45,9,5);
	}
wait(15);
}
*/
}

task shotE
{
/*
wait(60);
let angle=0;
loop(50)
{
	ascent(i in 0..15)
	{
		SkyCreateShot01(GetX,GetY,4,angle+i*24,9,5);
	}
wait(15);
}
*/
}

task shotA
{
/*
wait(60);
let angle=0;
loop(50)
{
	ascent(i in 0..20)
	{
		SkyCreateShot01(GetX,GetY,4.5,angle+i*18,9,5);
	}
wait(15);
}
*/
}

task summon
{
        CreateEnemyFromScript("Familiar", GetX, GetY,
                              0, 0, 1);
        CreateEnemyFromScript("Familiar", GetX, GetY,
                              0, 0, -1);
        CreateEnemyFromScript("Familiar", GetX, GetY,
                              0, 0, 2);
        CreateEnemyFromScript("Familiar", GetX, GetY,
                              0, 0, -2);
}

task move
{
	let speed=GetSpeed;
	SetSpeed(GetSpeed);
	SetAngle(GetAngle);
	wait(210);
	loop(60)
	{
		SetSpeed(GetSpeed-speed/60);
		yield;
	}
	SetAngle(180-GetAngle);
	loop(60)
	{
		SetSpeed(GetSpeed+speed/60);
		yield;
	}
	wait(15);
	loop(60)
	{
		SetSpeed(GetSpeed-speed/60);
		yield;
	}
	SetAngle(180-GetAngle);
	loop(60)
	{
		SetSpeed(GetSpeed+speed/60);
		yield;
	}
}

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

script_enemy Familiar {
    let csd     = GetCurrentScriptDirectory;
	let num = GetArgument;
    @Initialize {
	SetCoordinateType(COODINATE_TYPE_PARENT);
	let num = GetArgument;
        SetLife(50000);
        SetDamageRateEx(100,0,100,0);
	TMain;
    }

    @MainLoop {
	SetServantSkyCollision(GetX,GetY,48);
	SetX(60*num);
	SetY(0);
        yield;
    }

    @DrawLoop {
      //  DrawGraphic(GetX, GetY);
    }
        @Finalize
        {
		MagicCircleBreak(GetX,GetY,11,0.3);
		FinalizeItemAndShotnum(1);
        } 
    task TMain {
        yield;
	ElementalEffect(0,0,255,0.75);
	GetDamege;
	OutDamageRateZero;
	alternative(GetCommonDataDefault("SELECTEDDIFFICULT","None"))
	case("Moderate")
	{
		if(absolute(num)==1)
		{
		shotM1;
		}
		if(absolute(num)==2)
		{
		shotM2;
		}
	}
	case("Extream")
	{
		if(absolute(num)==1)
		{
		shotE1;
		}
		if(absolute(num)==2)
		{
		shotE2;
		}
	}
	case("Apocalypse")
	{
		if(absolute(num)==1)
		{
		shotA1;
		}
		if(absolute(num)==2)
		{
		shotA2;
		}
	}

	ElementalAutoErazeTime(890);
    }

task shotM1
{
wait(60);
let angle=90;
loop(50)
{
angle=90+rand(-10,10);
	ascent(i in -1..2)
	{
		SkyCreateShot01(GetX,GetY,2.5,angle+20*i,14,5);
	}
wait(20);
}
}

task shotM2
{
wait(60);
let angle=90;
loop(50)
{
	ascent(j in 0..4)
	{
		ascent( i in 0..5)
		{
			SkyCreateShot01(GetX,GetY,3+j*0.25,angle+i*72+j*2,9,5);
		}
	wait(3);
	}
wait(6);
angle+=12;
}
}
///////////////////////////////////////////////////////////////
task shotE1
{
wait(60);
let angle=90;
loop(50)
{
angle=90+rand(-10,10);
	ascent(i in -1..2)
	{
		SkyCreateShot01(GetX,GetY,2.5,angle+20*i,14,5);
	}
wait(12);
}
}

task shotE2
{
wait(60);
let angle=90;
loop(50)
{
	ascent(j in 0..4)
	{
		ascent(i in 0..8)
		{
			SkyCreateShot01(GetX,GetY,2.5+j*0.25,angle+i*45+j*2,9,5);
		}
	wait(3);
	}
wait(9);
angle+=12;
}
}
//////////////////////////////////////////////////////////////
task shotA1
{
wait(60);
let angle=90;
loop(50)
{
angle=90+rand(-10,10);
ascent(i in -2..2)
{
SkyCreateShot01(GetX,GetY,3.5,angle+i*20+10,14,5);
}
wait(11);
}
}

task shotA2
{
wait(60);
let angle=90;
loop(50)
{
	ascent(j in 0..4)
	{
		ascent(i in 0..8)
		{
			SkyCreateShot01(GetX,GetY,3+j*0.25,angle+i*45+j*2,9,5);
		}
	wait(3);
	}
wait(6);
angle+=12;
}
}

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

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