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

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

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

        @Finalize
        {
		MagicCircleBreak(GetX,GetY,2,0.3);
		FinalizeItemAndShotnumWithDelete(5);
        } 

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

summon;

}

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
{
	SetSpeed(GetSpeed);
	SetAngle(GetAngle);
	wait(90);
	SetSpeed(GetSpeed/4);
	wait(480);
	SetSpeed(GetSpeed*6);
}

#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,32);
	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)
		{
		shotM1;
		}
	}
	case("Extream")
	{
		if(absolute(num)==1)
		{
		shotE1;
		}
		if(absolute(num)==2)
		{
		shotE1;
		}
	}
	case("Apocalypse")
	{
		if(absolute(num)==1)
		{
		shotA1;
		}
		if(absolute(num)==2)
		{
		shotA1;
		}
	}

	ElementalAutoErazeTime(1490);
    }

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

task shotM2
{
wait(30);
	loop
	{
	let angle=GetAngleToPlayer;
		loop(10)
		{
			SkyCreateShot01(GetX,GetY,5.0,angle+2,9,5);
			SkyCreateShot01(GetX,GetY,5.0,angle-2,9,5);
			wait(3);
		}
		wait(60);
	}

}
///////////////////////////////////////////////////////////////
task shotE1
{
wait(90);
shotE2;
let angle=90;
loop(50)
{
angle=90;
	ascent(i in -1..2)
	{
		SkyCreateShot01(GetX,GetY,2.0,angle+15*i,14,5);
	}
wait(20);
}
}

task shotE2
{
wait(30);
	loop
	{
	let angle=GetAngleToPlayer;
		loop(10)
		{
			SkyCreateShot01(GetX,GetY,5.0,angle+2,9,5);
			SkyCreateShot01(GetX,GetY,5.0,angle-2,9,5);
			SkyCreateShot01(GetX,GetY,5.0,angle+4,9,5);
			SkyCreateShot01(GetX,GetY,5.0,angle-4,9,5);
			wait(3);
		}
		wait(60);
	}

}
//////////////////////////////////////////////////////////////
task shotA1
{
wait(90);
shotA2;
let angle=90;
loop(50)
{
angle=90;
	ascent(i in -2..3)
	{
		SkyCreateShot01(GetX,GetY,2.5,angle+15*i,14,5);
	}
wait(30);
}
}

task shotA2
{
wait(30);
	loop
	{
	let angle=GetAngleToPlayer;
		loop(10)
		{
			SkyCreateShot01(GetX,GetY,5.0,angle+2,9,5);
			SkyCreateShot01(GetX,GetY,5.0,angle-2,9,5);
			SkyCreateShot01(GetX,GetY,5.0,angle+4,9,5);
			SkyCreateShot01(GetX,GetY,5.0,angle-4,9,5);
			SkyCreateShot01(GetX,GetY,5.0,angle+6,9,5);
			SkyCreateShot01(GetX,GetY,5.0,angle-6,9,5);
			wait(3);
		}
		wait(60);
	}

}

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

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