script_enemy_main
{
        let csd     = GetCurrentScriptDirectory;
	let speed = GetSpeed;
	let angle = GetAngle;
	let num = GetArgument;
	let imgEnemy;

		imgEnemy=csd~"..\lib\fairy_red.png";
	let imgFam  = csd ~ "..\img\familiar.png";

	let SelectedDifficult=GetCommonDataDefault("SELECTEDDIFFICULT","Normal");

    @Initialize {
        SetLife(520);
        SetDamageRate(100,100);
	SetTexture(imgEnemy);
	Initialize_Fairy(7);
	Tmain;
	}

    @MainLoop {
	SetCollisionA(GetX,GetY,48);
	MSDSetCollisionB(GetX,GetY,8);
	yield;
    }

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

        @Finalize
        {
		MagicCircleBreak(GetX,GetY,2,0.5);
		FinalizeItemAndShotnum(3);
        } 

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

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

}

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

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


task shotM
{
wait(45);
let angle=45;
loop(60)
{
	ascent(let i in 0..2)
	{
		CreateShot01(GetX+50,GetY,3,180*i+angle,9,5);
		CreateShot01(GetX-50,GetY,3,180*i-angle,9,5);
	}
	wait(10);
	angle+=5;
}
}
///////////////////////////////////////////////////////////////
task shotE
{
wait(45);
let angle=45;
loop(120)
{
	ascent(let i in 0..4)
	{
		CreateShot01(GetX+50,GetY,3,90*i+angle,9,5);
		CreateShot01(GetX-50,GetY,3,90*i-angle,9,5);
	}
	wait(5);
	angle+=5;
}
}
//////////////////////////////////////////////////////////////
task shotA
{
wait(45);
let angle=45;
loop(120)
{
	ascent(let i in 0..6)
	{
		CreateShot01(GetX+50,GetY,3,60*i+angle,9,5);
		CreateShot01(GetX-50,GetY,3,60*i-angle,9,5);
		CreateShot01(GetX+50,GetY,3.5,60*i+angle,9,5);
		CreateShot01(GetX-50,GetY,3.5,60*i-angle,9,5);
		CreateShot01(GetX+50,GetY,3.25,60*i+angle,9,5);
		CreateShot01(GetX-50,GetY,3.25,60*i-angle,9,5);
	}
	wait(5);
	angle+=5;
}
}

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

script_enemy Familiar {
    let csd     = GetCurrentScriptDirectory;
    let imgFam  = csd ~ "..\img\familiar.png";
	let num = GetArgument;
    @Initialize {
	SetCoordinateType(COODINATE_TYPE_PARENT);
	let num = GetArgument;
        SetLife(1000);
        SetScore(10000);
        SetDamageRateEx(100,100,100,100);
	TMain;
    }

    @MainLoop {
	SetCollisionA(GetX,GetY,48);
	MSDSetCollisionB(GetX,GetY,8);
	SetX(50*num);
	SetY(0);
        yield;
    }

    @DrawLoop {
    //    DrawGraphic(GetX, GetY);
    }

    task TMain {
        yield;
	ElementalEffect(0,0,255,0.8);
	OutDamageRateZero;
	GetDamege;
	ElementalAutoErazeTime(1490);
    }

    // グラフィックの設定
#include_function ".\..\txt/StageEnemydata.txt"
}

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