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

    @MainLoop {
	SetSkyCollision(GetX,GetY,32);
	yield;
    }

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

        @Finalize
        {
		MagicCircleBreak(GetX,GetY,2,0.3);
		FinalizeItemAndShotnum(1);
        } 

task Tmain
{
yield;
OutDamageRateZero;
AutoErazeTime(600);
GetDamege;
move;
summon;
}

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



task move
{
	let dir=num;
	let Pangle=90*(1-dir);
	loop(60)
	{
		SetAngle(Pangle);
		SetSpeed(5.5);
		Pangle-=0.75*dir;
		if(GetY<GetClipMinY+16){break;}
		yield;
	}

	let X=GetX;
	let XAmp=20;
	let Xangle=90;
	loop
	{
		SetX(X+XAmp*cos(Xangle));
		SetY(GetY+speed);
		Xangle+=1;
		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,100,100,100);
	TMain;
    }

    @MainLoop {
	SetX(20*num);
	SetY(0);
        yield;
    }

    @DrawLoop {
      //  DrawGraphic(GetX, GetY);
    }
	@Finalize
	{
		MagicCircleBreak(GetX,GetY,11,0.3);
	}
    task TMain {
        yield;
	ElementalEffect(0,0,255,0.6);
AutoErazeTime(590);
alternative(GetCommonDataDefault("SELECTEDDIFFICULT","None"))
case("Moderate")
{
shotM;
}
case("Extream")
{
shotE;
}
case("Apocalypse")
{
shotA;
}

	eraze;
    }


task shotM
{
wait(30);
loop(3)
{
ascent(let i in 0..5)
{
	let angle=atan2(GetPlayerY-GetY,GetPlayerX-GetX+30*num);
	SkyCreateShot01(GetX,GetY,4.5+0.25*i,angle,150,5);
	wait(3);
}
wait(60);
}
}
///////////////////////////////////////////////////////////
task shotE
{
wait(30);
loop(3)
{
ascent(let i in 0..5)
{
	let angle=atan2(GetPlayerY-GetY,GetPlayerX-GetX+30*num);
	ascent(j in -1..2)
	{
	SkyCreateShot01(GetX,GetY,4.0+0.25*i,angle+j*1.5,150,5);
	}
	wait(3);
}
wait(60);
}
}
////////////////////////////////////////////////////////////////
task shotA
{
wait(30);
loop(5)
{
ascent(let i in 0..5)
{
	let angle=atan2(GetPlayerY-GetY,GetPlayerX-GetX+30*num);
	ascent(j in -1..2)
	{
		SkyCreateShot01(GetX,GetY,5.0+0.25*i,angle+j*2.0,150,5);
	}
	wait(3);
}
wait(30);
}
}

task eraze
{
while(!BeVanished)
{

yield;
}
}

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

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