script_enemy_main
{
        let csd     = GetCurrentScriptDirectory;
	let speed = GetSpeed;
	let angle = GetAngle;
	let num = GetArgument;
	let imgEnemy;
	if(num==1)
	{
		imgEnemy=csd~"..\lib\fairy_red.png";
	}
	if(num==2)
	{
		imgEnemy=csd~"..\lib\fairy_blue.png";
	}
	let SelectedDifficult=GetCommonDataDefault("SELECTEDDIFFICULT","Normal");

    @Initialize {
        SetLife(150);
        SetDamageRate(100,100);
	SetTexture(imgEnemy);
	Initialize_Fairy(3);
	Tmain;
	}

    @MainLoop {
	SetCollisionA(GetX(),GetY(),40);
	MSDSetCollisionB(GetX(),GetY(),8);
	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(900);
GetDamege;
move;
summon;
}

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



task move
{
	SetMovePosition03(GetX,GetCenterY-100,50,5);
	wait(150);
	SetMovePosition02(GetX,GetClipMinY-80,300);
}

#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(50000);
        SetDamageRateEx(100,100,100,100);
        SetTexture(imgFam);
        setGraphic;
	TMain;
    }

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

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

    task TMain {
        yield;
	ElementalEffect(0,0,255,0.6);
alternative(GetCommonDataDefault("SELECTEDDIFFICULT","None"))
case("Moderate")
{
shotM;
}
case("Extream")
{
shotE;
}
case("Apocalypse")
{
shotA;
}

	eraze;
    }


task shotM
{
wait(37.5+num*-7.5);
loop(3)
{
let angle=GetAngleToPlayer+rand(-1,1);
loop(2)
{
ascent(let i in -1..2)
{
	SkyCreateShot01(GetX,GetY,3.5,angle+i*15,150,5);
}
wait(5);
}
wait(90);
}
}
///////////////////////////////////////////////////////////
task shotE
{
wait(37.5+num*-7.5);
loop(3)
{
let angle=GetAngleToPlayer+rand(-1,1);
loop(2)
{
ascent(let i in -2..3)
{
	SkyCreateShot01(GetX,GetY,3.5,angle+i*10,150,5);
}
wait(5);
}
wait(90);
}
}
////////////////////////////////////////////////////////////////
task shotA
{
wait(37.5+num*-7.5);
loop(3)
{
let angle=GetAngleToPlayer+rand(-1,1);
loop(2)
{
ascent(let i in -6..7)
{
	SkyCreateShot01(GetX,GetY,4,angle+i*2.5,150,5);
}
wait(5);
}
wait(90);
}
}

task eraze
{
while(!BeVanished)
{

yield;
}
}

    // グラフィックの設定
sub setGraphic{ SetGraphicRect( 0, 48, 48, 96); }
#include_function ".\..\txt/StageEnemydata.txt"
}

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