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 {
	SetCommonData("Stage5Enemy6aNum",GetCommonDataDefault("Stage5Enemy6aNum",0)+1);
        SetLife(165);
        SetDamageRate(100,100);
	SetTexture(imgEnemy);
	Initialize_Fairy(7);
	Tmain;
	BombDamageRate=20;
	}

    @MainLoop {
	SetSkyCollision(GetX,GetY,32);
	SetDummySkyCollision(GetX-50,GetY,32);
	SetDummySkyCollision(GetX+50,GetY,32);
	yield;
    }

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

        @Finalize
        {
		SetCommonData("Stage5Enemy6aNum",GetCommonDataDefault("Stage5Enemy6aNum",0)-1);
		MagicCircleBreak(GetX,GetY,2,0.3);
		FinalizeItemAndShotnum(3);
        } 

task Tmain
{
yield;
OutDamageRateZero;
AutoErazeTime(900);
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
{

	SetMovePosition03(GetX,GetCenterY-80-num*20,10,5);
	wait(80);
loop
{
	SetSpeed(1);
	SetAngle(90);
yield;
}
}

task shotM
{
wait(60);
loop(4)
{
	SubShot;
	wait(15);
	let angle=GetAngleToPlayer+rand(-5,5);
	loop(3)
	{
		SkyCreateShot01(GetX,GetY,4,angle,9,5);
		wait(3);
	}
wait(60);
}

	task SubShot
	{
	let angle=GetAngleToPlayer;
	loop(5)
	{
		SkyCreateShot01(GetX-50,GetY,3.5,atan2(GetPlayerY-GetY,GetPlayerX-GetX+50),150,0);
		SkyCreateShot01(GetX+50,GetY,3.5,atan2(GetPlayerY-GetY,GetPlayerX-GetX-50),150,0);
		wait(3);
	}
	}
}

task shotE
{
wait(60);
loop(4)
{
	SubShot;
	wait(15);
	let angle=GetAngleToPlayer+rand(-5,5);
	loop(3)
	{
		ascent(i in -1..2)
		{
		SkyCreateShot01(GetX,GetY,4,angle+i*15,9,5);
		}
		wait(3);
	}
wait(60);
}

	task SubShot
	{
	let angle=GetAngleToPlayer;
	loop(5)
	{
		ascent(i in -1..2)
		{
		SkyCreateShot01(GetX-50,GetY,3.5,atan2(GetPlayerY-GetY,GetPlayerX-GetX+50)+i*2,150,0);
		SkyCreateShot01(GetX+50,GetY,3.5,atan2(GetPlayerY-GetY,GetPlayerX-GetX-50)+i*2,150,0);
		}
		wait(3);
	}
	}
}

task shotA
{
wait(60);
loop(4)
{
	SubShot;
	wait(15);
	let angle=GetAngleToPlayer+rand(-5,5);
	loop(8)
	{
		ascent(i in -2..3)
		{
		SkyCreateShot01(GetX,GetY,4,angle+i*12,9,5);
		}
		wait(2);
	}
wait(60);
}

	task SubShot
	{
	let angle=GetAngleToPlayer;
	loop(8)
	{
		ascent(i in -1..2)
		{
		SkyCreateShot01(GetX-50,GetY,3.5,atan2(GetPlayerY-GetY,GetPlayerX-GetX+50)+i*2,150,0);
		SkyCreateShot01(GetX+50,GetY,3.5,atan2(GetPlayerY-GetY,GetPlayerX-GetX-50)+i*2,150,0);
		}
		wait(2);
	}
	}
}
#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);
	TMain;
    }

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

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

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


task shotM
{
wait(30);
	loop(6)
	{
	let angle=GetAngleToPlayer;
	loop(5)
	{
		SkyCreateShot01(GetX,GetY,4.5,angle,150,0);
		wait(3);
	}
	wait(30);
	}
}
///////////////////////////////////////////////////////////////
task shotE
{
wait(30);
loop(3)
{
loop(2)
{
let angle=GetAngleToPlayer;
loop(5)
{
ascent(let i in -1..2)
{
SkyCreateShot01(GetX,GetY,4.5,angle+i*15,150,0);
}
wait(3);
}
wait(15);
}
wait(30);
let angle=GetAngleToPlayer;
ascent(let i in -3..4)
{
SkyCreateShot01(GetX,GetY,3.5,angle+12*i,9,0);
SkyCreateShot01(GetX,GetY,4.5,angle+12*i,9,0);
SkyCreateShot01(GetX,GetY,4,angle+12*i,9,0);
}
wait(120);
}
}
//////////////////////////////////////////////////////////////
task shotA
{
wait(30);
loop(3)
{
loop(2)
{
let angle=GetAngleToPlayer;
loop(5)
{

SkyCreateShot01(GetX,GetY,4.5,angle+3,150,0);
SkyCreateShot01(GetX,GetY,4.5,angle-3,150,0);
SkyCreateShot01(GetX,GetY,4.5,angle+6,150,0);
SkyCreateShot01(GetX,GetY,4.5,angle-6,150,0);
ascent(let i in -1..2)
{
SkyCreateShot01(GetX,GetY,4.5,angle+i*25,150,0);
SkyCreateShot01(GetX,GetY,4.5,angle+i*25+3,150,0);
SkyCreateShot01(GetX,GetY,4.5,angle+i*25-3,150,0);
SkyCreateShot01(GetX,GetY,4.5,angle+i*25+6,150,0);
SkyCreateShot01(GetX,GetY,4.5,angle+i*25-6,150,0);
}
wait(3);
}

wait(15);
}
wait(30);
let angle=GetAngleToPlayer;
ascent(let i in -7..8)
{
SkyCreateShot01(GetX,GetY,5,angle+5*i,9,0);
SkyCreateShot01(GetX,GetY,4.5,angle+5*i,9,0);
SkyCreateShot01(GetX,GetY,4,angle+5*i,9,0);
}
wait(120);
}
}

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

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