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

    @MainLoop {
	ascent(let i in -1..2)
	{
	SetCollisionA(GetX()+i*50,GetY(),48);
        SetCollisionB(GetX()+i*50,GetY(),8);
	}
	yield;
    }

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

        @Finalize
        {
		FinalizeItemSet(3);
		alternative(GetCommonDataDefault("SELECTEDDIFFICULT","None"))
		case("Moderate")
		{

		}
		case("Extream")
		{

		}
		case("Apocalypse")
		{

		}
        } 

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);
	SetSpeed(0.5);
	SetAngle(90-num*80);
}

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

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

    @DrawLoop {
        DrawGraphic(GetX, GetY);
    }

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

	AutoErazeTime(890);
    }


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

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

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


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

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