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("Stage2HAYMAWASHInum",GetCommonData("Stage2HAYMAWASHInum")+1);
        SetLife(150);
        SetDamageRate(100,100);
	SetTexture(imgEnemy);
	Initialize_Fairy(7);
	Tmain;
	}

    @MainLoop {
	ascent(let i in -1..2)
	{
	SetSkyCollision(GetX+i*16,GetY,32);
	}
	yield;
    }

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

        @Finalize
        {
		SetCommonData("Stage2HAYMAWASHInum",GetCommonData("Stage2HAYMAWASHInum")-1);
		MagicCircleBreak(GetX,GetY,2,0.3);
		FinalizeItemAndShotnum(3);
        } 

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(GetCenterX-100*num,GetCenterY-120,10,5);
	wait(120);
	loop(3)
	{
		moveToPlayer03(60, 0, 20,4, GetClipMinX+32, GetClipMinY+32, GetClipMaxX-32, GetClipMaxY-32);
		wait(120);
	}
	SetSpeed(1);
	SetAngle(-90);
}

#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 {
	SetX(40*cos(90-num*30));
	SetY(40*sin(90-num*30));
        yield;
    }

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

        @Finalize
        {
		MagicCircleBreak(GetX,GetY,11,0.3);
        } 

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

	AutoErazeTime(890);
    }


task shotM
{
wait(30);
loop(10)
{
	let angle=atan2(GetPlayerY-GetY-15,GetPlayerX-GetX+15*num);
	loop(5)
	{
		SkyCreateShot01(GetX,GetY,4.5,angle,150,0);
		wait(3);
	}
wait(30);
}
}
///////////////////////////////////////////////////////////////
task shotE
{
wait(30);
loop(10)
{
	let angle=atan2(GetPlayerY-GetY-15,GetPlayerX-GetX+15*num);
	loop(5)
	{
		ascent(let i in -1..2)
		{
		SkyCreateShot01(GetX,GetY,4.5,angle+3*i,150,0);
		}
		wait(3);
	}
wait(30);
}
}
//////////////////////////////////////////////////////////////
task shotA
{
wait(30);
loop(10)
{
	let angle=atan2(GetPlayerY-GetY-15,GetPlayerX-GetX+15*num);
	loop(5)
	{
		ascent(let i in -3..4)
		{
			SkyCreateShot01(GetX,GetY,4.5,angle+3*i,150,0);
		}
		wait(3);
	}
wait(30);
}
}

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

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