
#Title[大妖精通常]
#Text[]
#Image[.]
#BackGround[User]
#Player[FREE]
#ScriptVersion[2]
script_enemy_main {
let csd = GetCurrentScriptDirectory;
    let imgBoss =csd ~ "..\lib/dot_alice.png"; 
   let imgNuclear =csd~"..\img\s_shot.png"; 
    // 初期位置
    let xIni    = GetCenterX;
    let yIni    = GetClipMinY + 128;
	let Step2=false;
	let wIni=60;
let TimeCounter=180*60;
let StandardTimeCounter=TimeCounter;
let BarrierByEraseFlag=false;
    @Initialize {
	SetCommonData("TrueBossLastAttack",true);
	if(GetCommonDataDefault("ExclusiveBoss",false)==true)
	{
		BossTimer(TimeCounter);
	}
	else
	{
		SetTimer(TimeCounter/60);
	}
//	SetShotAutoDeleteClip(4,4,4,4);
	SetShotAutoDeleteClip(0,0,0,0);
	SetCommonData("BossLastAttackColor",[255,255,0]);
	SetCommonData("BossLastAttack",true);
        SetLife(9500);
	InitializeAction();
	SetEnemyMarker(true);
	SetX(GetCommonDataDefault("BossX",0));
	SetY(GetCommonDataDefault("BossY",0));
        TMainGrobal;
    }

    @MainLoop {
	SetCommonData("BossX",GetX);
	SetCommonData("BossY",GetY);
	SetCommonData("BossLife",GetLife);
	BulletNum=GetEnemyShotCount;
	TimeCounter-=1;
        yield;
    }

    @DrawLoop {
//DrawText(GetLife,120,382,12,255);//起動時間の表示
	DrawBoss( imgBoss );
    }

    @Finalize {
	DeleteAllEnemyWithoutBoss;
	SetCommonData("BossX",GetX);
	SetCommonData("BossY",GetY);
	SetCommonData("BossLife",GetLife);
	DeleteEnemyShotToItem(ALL);
		if(!IsTimeOut)
		{
		SetCommonData("DeleteBulletNum",BulletNum);
		SetCommonData("DeleteBulletX",GetX);
		SetCommonData("DeleteBulletY",GetY);
		}

	SetCommonData("VanishSignal",false);
	SetCommonData("TimeBonus",TimeCounter/StandardTimeCounter);
	SetCommonData("BossRate",50000);

    }

    // メインタスク
task TMainGrobal
{
	yield;
	GetDamege;
	OutDamageRateZero;
	Collision;
	//Lissajous(0,250,154);
	BossShadowAnimation(imgBoss2,0,255,255,0);
	standBy;
	if(GetCommonDataDefault("MSDPlayer",false)==false)
	{
	EraseCheckMain;
	}
	BombOffSet;
	BombBarrier;
	shotA;

}

sub standBy//初期位置へ
{
	SetAction(ACT_MOVE, 60);
	SetMovePosition03(xIni, yIni, 20,5);
	wait(60);
//	summon;
	Concentration01(30);
	//Concentration03(GetX,GetY,60,0,64,255);
}

task Collision
{
	wait(90);

	loop
	{
        SetCollisionA(GetX, GetY, 64);
        MSDSetCollisionB(GetX, GetY, 21.3);
	yield;
	}
}

task EraseCheckMain
{
let EraseBarrierCount=0;
let CheckFlag1=true;
let CheckFlag2=true;  
loop
{
	if(CheckFlag1==true)
	{
		CheckFlag1=false;
		CheckShot1;
	}
	if(CheckFlag2==true)
	{
		CheckFlag2=false;
		CheckShot2;
	}
	yield;
}

task CheckShot1
{
	let obj = Obj_Create(OBJ_SHOT);
	Obj_SetPosition(obj, GetPlayerX, GetPlayerY);
	//Obj_SetSpeed(obj, speed);
	//Obj_SetAngle(obj, angle);
	ObjShot_SetGraphic(obj, 9);
	//ObjShot_SetDelay(obj, delay);
	//ObjShot_SetBombResist(obj,true);

	//Obj_SetAutoDelete(obj,false);
	Obj_SetCollisionToPlayer(obj,false);
	Obj_SetAlpha(obj,0);
	ObjShot_ToItem(obj,false);
	while(!Obj_BeDeleted(obj))
	{
		Obj_SetPosition(obj, GetPlayerX, GetPlayerY);
		yield;
	}
	EraseBarrierCount=30;
	BarrierByEraseFlag=true;
	CheckFlag1=true;

	while(EraseBarrierCount>0)
	{
		EraseBarrierCount-=1;
		yield;
	}
	BarrierByEraseFlag=false;
}

task CheckShot2
{
	let obj = Obj_Create(OBJ_SHOT);
	Obj_SetPosition(obj, GetX, GetY);
	//Obj_SetSpeed(obj, speed);
	//Obj_SetAngle(obj, angle);
	ObjShot_SetGraphic(obj, 9);
	//ObjShot_SetDelay(obj, delay);
	//ObjShot_SetBombResist(obj,true);

	//Obj_SetAutoDelete(obj,false);
	Obj_SetCollisionToPlayer(obj,false);
	Obj_SetAlpha(obj,0);
	ObjShot_ToItem(obj,false);
	while(!Obj_BeDeleted(obj))
	{
		Obj_SetPosition(obj, GetX, GetY);
		yield;
	}
	EraseBarrierCount=30;
	BarrierByEraseFlag=true;
	CheckFlag2=true;

	while(EraseBarrierCount>0)
	{
		EraseBarrierCount-=1;
		yield;
	}
	BarrierByEraseFlag=false;
}


}

task BombOffSet
{
loop
{
	while(!GetCommonDataDefault("OnDtypeBomb",false)){yield;}
	if(GetCommonDataDefault("OnDtypeBomb",false))
	{
		SetCommonDataEx(NsScore,NsAchievement[82],1);
		ArtfulSacrifice;
		SpellDraw(45,135);
	}
	while(GetCommonDataDefault("OnDtypeBomb",false)){yield;}
}
}

task ArtfulSacrifice
{
	let OpX=[GetPlayerX-24,GetPlayerX+24,GetPlayerX-48,GetPlayerX+48];
	let OpY=[GetPlayerY,GetPlayerY,GetPlayerY+5,GetPlayerY+5];
	let TargetX=GetCommonDataDefault("TargetX",[0,0,0,0]);
	let TargetY=GetCommonDataDefault("TargetY",[0,0,0,0]);

	ascent(i in 0..4)
	{
	ArtfulSacrificeEffect(i);
	}


task ArtfulSacrificeEffect(num)
{
	let ShotAngleAdjust=atan2(TargetY[num]-GetPlayerY,TargetX[num]-GetPlayerX);
	let BombStartX=OpX[num];
	let BombEndX=TargetX[num];
	let BombStartY=OpY[num];
	let BombEndY=TargetY[num];

	if(BombEndX==-1)
	{
		BombEndX=BombStartX;
	}
	if(BombEndY==-1)
	{
		BombEndY=BombStartY-150;
	}
	let EndX=(BombEndX+BombStartX)/2;
	let EndY=(BombEndY+BombStartY)/2;

	let obj = Obj_Create(OBJ_EFFECT);
	ObjEffect_SetTexture(obj, imgBoss);
	ObjEffect_SetRenderState(obj, ADD);
	ObjEffect_SetLayer(obj,3);
	ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLEFAN);
	ObjEffect_CreateVertex(obj, 4);

	ObjEffect_SetVertexXY(obj, 0, -16, -16);
	ObjEffect_SetVertexXY(obj, 1, 16,  -16);
	ObjEffect_SetVertexXY(obj, 2, 16, 16);
	ObjEffect_SetVertexXY(obj, 3,  -16,  16);

	ObjEffect_SetVertexUV(obj, 0,  768,  0);
	ObjEffect_SetVertexUV(obj, 1,  800, 0);
	ObjEffect_SetVertexUV(obj, 2, 800,  32);
	ObjEffect_SetVertexUV(obj, 3, 768, 32);

	let speed=15;
	let angle=atan2(EndY-GetY,EndX-GetX);
	Obj_SetSpeed(obj,speed);
	Obj_SetAngle(obj,angle);
	ObjEffect_SetScale(obj,1.5,1.5);
	Obj_SetPosition(obj, GetX, GetY);
	let count=0;
	let Zangle=0;
	while(!Obj_BeDeleted(obj))
	{
		ObjEffect_SetAngle(obj,0,0,Zangle);
		Zangle+=30;
	//	if(TargetX[num]==-1 && count>=10){break;}
		if(count%3==0)
		{
	//	BorderEffect(Obj_GetX(obj),Obj_GetY(obj));
		}
		if(((Obj_GetX(obj)-EndX)^2+(Obj_GetY(obj)-EndY)^2)^0.5<=48)
		{
			break;
		}
		if(Obj_GetY(obj)<GetClipMinY)
		{
			break;
		}
		if(Obj_GetY(obj)>GetClipMaxY)
		{
			break;
		}
		count+=1;
		yield;
	}

	DollExplode(Obj_GetX(obj),Obj_GetY(obj));
	Obj_Delete(obj);
}

task DollExplode(x,y)
{
		let sc=0.0;

  		let obj = Obj_Create(OBJ_EFFECT);
		Obj_SetPosition(obj,x,y);
		ObjEffect_SetTexture(obj,imgNuclear);
		ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLEFAN);
		ObjEffect_SetRenderState(obj, ADD);
		ObjEffect_SetScale(obj, sc,sc);
		ObjEffect_CreateVertex(obj, 4);
		ObjEffect_SetVertexXY(obj, 0, -128, -128);
		ObjEffect_SetVertexXY(obj, 1,  128, -128);
		ObjEffect_SetVertexXY(obj, 2,  128,  128);
		ObjEffect_SetVertexXY(obj, 3, -128,  128);
		
		ObjEffect_SetVertexUV(obj, 0,  0,  0);
		ObjEffect_SetVertexUV(obj, 1,  128, 0);
		ObjEffect_SetVertexUV(obj, 2, 128,  128);
		ObjEffect_SetVertexUV(obj, 3, 0, 128);

		ObjEffect_SetLayer(obj,5);

		loop(90)
		{	
			if(sc<0.75)
			{
			sc+=0.75/15;
			}
		//	Obj_SetPosition(obj,GetX,GetY);
			ObjEffect_SetScale(obj, sc,sc);
			wait(1);
		}
		loop(30)
		{	
			if(sc>0)
			{
			sc-=0.75/30;
			}
		//	Obj_SetPosition(obj,GetX,GetY);
			ObjEffect_SetScale(obj, sc,sc);
			wait(1);
		}
}
}


task BombBarrier
{
loop
{
	while(!OnBomb && GetTimeOfPlayerInvincibility==0 && BarrierByEraseFlag==false){yield;}
	DamageRate=0;
	BombDamageRate=0;
	BarrierEffect(1);
	BarrierEffect(0);	
	ReturnShotJudg;
	while(OnBomb || GetTimeOfPlayerInvincibility>0 || BarrierByEraseFlag==true){yield;}
	wait(30);
	DamageRate=100;
	BombDamageRate=100;
}

task ReturnShotJudg
{
	let AkiShotCount=0;
	let ReturnShotCount=0;
	while(OnBomb || GetTimeOfPlayerInvincibility>0 || BarrierByEraseFlag==true)
	{
		if(GetHitCount!=0)
		{
			ReturnShot;
		}
		else
		{
			if(AkiShotCount>0)
			{
			AkiShotCount-=1;
			}
		}
		yield;
	}

	loop(1)
	{
		if(GetHitCount!=0)
		{
			ReturnShot;
		}
		yield;
	}

	task ReturnShot
	{
		ReturnShotCount=15;
		while(ReturnShotCount>0)
		{
			AkiShot;
			ReturnShotCount-=1;
			yield;
		}
	}
	

	task AkiShot
	{
		AkiShotCount+=1;
		if(AkiShotCount%60==0)
		{
		let angle=rand(0,360);
		ascent(i in 0..64)
		{
			CreateShot01(GetX,GetY,4.5,angle+i*360/64,9,0);
		}
		AkiShotCount=0;
		}
	}
}

task BarrierEffect(type)
{
		let obj = Obj_Create(OBJ_EFFECT);
		ObjEffect_SetTexture(obj,csd~"..\img\CircleLine.png");
		ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLEFAN);
		ObjEffect_SetRenderState(obj, ADD); 
		ObjEffect_CreateVertex(obj, 4);
		ObjEffect_SetVertexXY(obj, 0, -64, -64);
		ObjEffect_SetVertexXY(obj, 1,64,  -64);
		ObjEffect_SetVertexXY(obj, 2,64, 64);
		ObjEffect_SetVertexXY(obj, 3,  -64,  64);
		
		ObjEffect_SetVertexUV(obj, 0,  0, 0);
		ObjEffect_SetVertexUV(obj, 1,  128, 0);
		ObjEffect_SetVertexUV(obj, 2, 128, 128);
		ObjEffect_SetVertexUV(obj, 3, 0, 128);

		let Alpha=30;
		let R=255;let G=255;let B=255;

		alternative(GetPlayerInfo(PLAYER_SPEED_HIGH))
		case(4){R=100;G=100;B=255;}
		case(4/2){R=100;G=100;B=255;}
		case(5/2){R=255;G=100;B=100;}
		case(5){R=255;G=100;B=100;}
		case(5.5){R=255;G=100;B=255;}
		case(5.5/5){R=255;G=100;B=255;}
		case(4.5){R=50;G=205;B=50;}
		case(4.5/2){R=50;G=205;B=50;}

		let color;
		color=AnimeHueDifine(GlobalHueCount);
		R=color[0];G=color[1];B=color[2];
		ascent(i in 0..4)
		{
			ObjEffect_SetVertexColor(obj,i,Alpha,R,G,B);
		}

		ObjEffect_SetLayer(obj,4);

		let X=GetCenterX;
		let Y=GetCenterY;
		Obj_SetPosition(obj,GetX,GetY);

		let Scale=0;

		let Xangle=0;
		let Yangle=0;
		let Zangle=0;

		if(type)
		{
		}
		else
		{
			Yangle+=90;
		}

		while(OnBomb || GetTimeOfPlayerInvincibility>0 || BarrierByEraseFlag==true)
		{
		color=AnimeHueDifine(GlobalHueCount);
		R=color[0];G=color[1];B=color[2];
		ascent(i in 0..4)
		{
			ObjEffect_SetVertexColor(obj,i,Alpha,R,G,B);
		}
			Obj_SetPosition(obj,GetX,GetY);
			if(Scale<1)
			{
			Scale+=1/30;
			}
			if(type)
			{
			if(Xangle%90>5 && Xangle%90<85)
			{
			BombEffectBlur(X,Y,Alpha,Scale,Xangle,Yangle,Zangle,R,G,B);
			}
			}
			else
			{
			if(Yangle%90>5 && Yangle%90<85)
			{
			BombEffectBlur(X,Y,Alpha,Scale,Xangle,Yangle,Zangle,R,G,B);
			}
			}
			ObjEffect_SetAngle(obj,Xangle,Yangle,Zangle);
			ObjEffect_SetScale(obj, Scale,Scale);
			if(type)
			{
			Xangle+=3;
			}
			else
			{
			Yangle+=3;
			}
			if(GetTimeOfPlayerInvincibility==0)
			{
				if(((GetPlayerY-GetY)^2+(GetPlayerX-GetX)^2)^0.5<=64)
				{
					SetPlayerX(GetPlayerX+4*cos(GetAngleToPlayer));
					SetPlayerY(GetPlayerY+4*sin(GetAngleToPlayer));
				}
			}
			yield;
		}

		loop(30)
		{
		color=AnimeHueDifine(GlobalHueCount);
		R=color[0];G=color[1];B=color[2];
		ascent(i in 0..4)
		{
			ObjEffect_SetVertexColor(obj,i,Alpha,R,G,B);
		}
			Scale-=1/30;
			BombEffectBlur(X,Y,Alpha,Scale,Xangle,Yangle,Zangle,R,G,B);
			ObjEffect_SetAngle(obj,Xangle,Yangle,Zangle);
			ObjEffect_SetScale(obj, Scale,Scale);
			if(type)
			{
			Xangle+=3;
			}
			else
			{
			Yangle+=3;
			}
			yield;
		}
		Obj_Delete(obj);
}

task BombEffectBlur(X,Y,Alpha,Scale,Xangle,Yangle,Zangle,R,G,B)
{
		let obj = Obj_Create(OBJ_EFFECT);

		ObjEffect_SetTexture(obj, csd~"..\img\CircleLine.png");
		ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLEFAN);
		ObjEffect_SetRenderState(obj, ADD); 
		ObjEffect_CreateVertex(obj, 4);
		ObjEffect_SetVertexXY(obj, 0, -64, -64);
		ObjEffect_SetVertexXY(obj, 1,64,  -64);
		ObjEffect_SetVertexXY(obj, 2,64, 64);
		ObjEffect_SetVertexXY(obj, 3,  -64,  64);
		
		ObjEffect_SetVertexUV(obj, 0,  0, 0);
		ObjEffect_SetVertexUV(obj, 1,  128, 0);
		ObjEffect_SetVertexUV(obj, 2, 128, 128);
		ObjEffect_SetVertexUV(obj, 3, 0, 128);

		ObjEffect_SetLayer(obj,4);

		Obj_SetPosition(obj,GetX,GetY);

		ObjEffect_SetScale(obj, Scale,Scale);
		ObjEffect_SetAngle(obj,Xangle,Yangle,Zangle);

		let BAlpha=Alpha;

		loop(60)
		{
			ascent(i in 0..4)
			{
				ObjEffect_SetVertexColor(obj,i,Alpha,R,G,B);
			}
			ObjEffect_SetAngle(obj,Xangle,Yangle,Zangle);
			ObjEffect_SetScale(obj, Scale,Scale);
			Alpha-=BAlpha/60;
			yield;
		}
		Obj_Delete(obj);
}

}

task TMove
{
loop
{
//	SetMovePosition03(GetX+rand(-10,10), GetY+rand(-10,10), 20,5);
	wait(60);
}
}


task shotM
{

}
/////////////////////////////////////////////////////////////////////////////
task shotE
{

}
//////////////////////////////////////////////////////////////////////
task shotA
{
wait(60);
SpellDraw(44,60000);
SetAction(ACT_SHOT_B, 60000);
Shot4;

	task Shot4
	{
		let Pangle=rand(0,360);
		let way=7;
		ascent(i in 0..way)
		{
		RingShot(0,i*360/way,Pangle,1,81);
		RingShot(0,i*360/way,Pangle,-1,86);
		}
		ascent(i in 0..36)
		{
		RingShot2(0,i*10,Pangle*0,-1,87);
		}

		task RingShot(num,angle,Pangle,dir,gra)
		{
		let R1Max=100*0;
		let R1Theta=0;
		let R1=R1Max*sin(R1Theta);
		let R2Max=70*0;
		let R2Theta=0;
		let R2=R2Max*sin(R2Theta);
		let speed=2;
			let obj = Obj_Create(OBJ_SHOT);
			//Obj_SetPosition(obj, x,y);
			//Obj_SetSpeed(obj, speed);
			Obj_SetAngle(obj, angle);
			ObjShot_SetGraphic(obj, gra);
			//ObjShot_SetDelay(obj, delay);
			ObjShot_SetBombResist(obj,true);
			Obj_SetAutoDelete(obj,false);
			let x=0;
			let y=0;
			Shot;
			loop
			{

				ObjShot_SetDelay(obj,2);
				x=GetX+R1*cos(Pangle*dir+num*180)*cos(angle)-R2*sin(Pangle*dir+num*180)*sin(angle);
				y=GetY+R1*sin(Pangle*dir+num*180)*cos(angle)+R2*cos(Pangle*dir+num*180)*sin(angle);
				Obj_SetX(obj,x);
				Obj_SetY(obj,y);
				Pangle+=0.44;
				angle+=3.3;
				if(R1Max<100)
				{
					R1Max+=100/60;
					R2Max+=70/60;
				}
				R1=R1Max*sin(R1Theta);
				R2=R2Max*sin(R2Theta);
				R1=absolute(R1)+17;
				R2=absolute(R2)+17;
				R1Theta+=0.55;
				R2Theta+=0.33;
				speed=2.5+0.5*absolute(sin(Pangle*2));
				yield;
			}

			task Shot
			{
				wait(60);
				let speed=1.5;
				if(gra==87){speed=2.0;}
				loop
				{
				let sangle=atan2(GetY-y,GetX-x);
				
				CreateShot01(x,y,speed,angle,gra,0);
				wait(3);
				}
			}
		}

		task RingShot2(num,angle,Pangle,dir,gra)
		{
		let R1Max=35;
		let R1Theta=0;
		let R1=0;
		let R2Max=35;
		let R2Theta=0;
		let R2=0;
		let speed=2;
			let obj = Obj_Create(OBJ_SHOT);
			//Obj_SetPosition(obj, x,y);
			//Obj_SetSpeed(obj, speed);
			Obj_SetAngle(obj, angle);
			ObjShot_SetGraphic(obj, gra);
			//ObjShot_SetDelay(obj, delay);
			ObjShot_SetBombResist(obj,true);
			Obj_SetAutoDelete(obj,false);
			let x=0;
			let y=0;
			Shot;
			loop
			{
				ObjShot_SetDelay(obj,2);
				x=GetX+R1*cos(Pangle+num*180)*cos(angle)-R2*sin(Pangle+num*180)*sin(angle);
				y=GetY+R1*sin(Pangle+num*180)*cos(angle)+R2*cos(Pangle+num*180)*sin(angle);
				Obj_SetX(obj,x);
				Obj_SetY(obj,y);
				angle+=3.3*dir;
				if(R1<R1Max)
				{
					R1+=R1Max/60;
					R2+=R2Max/60;
				}
				speed=2.5+0.5*absolute(sin(Pangle*2));
				yield;
			}

			task Shot
			{
				wait(180);
				let speed=2;
				loop
				{
				let sangle=atan2(GetY-y,GetX-x);
				
				CreateShot01(x,y,speed,sangle+180+60*dir,gra,0);
				speed+=0.05;
				if(speed>4){speed=2;dir*=-1;}
				wait(10);
				}
			}
		}
	}
}

#include_function ".\..\txt\data.txt"
#include_function ".\..\lib/lib_anime_Alice.txt"
}
/*
script_enemy Familiar1 {
    let csd     = GetCurrentScriptDirectory;
    let imgDoll  = csd ~ "..\lib/dot_alice.png"; 

	let num = GetArgument[0];
	let DollDir=GetArgument[1];
	let color=rand_int(9,15);
    @Initialize {
	BombDamageRate=10;
	InitializeActionWithDoll;
	//SetCoordinateType(COODINATE_TYPE_PARENT);
        SetLife(50000);
        SetDamageRateEx(100,100,0,0);
	TMain;
    }

    @MainLoop {
        SetCollisionA(GetX, GetY, 32);
        MSDSetCollisionB(GetX, GetY, 10);
        yield;
    }

    @DrawLoop {
     DrawDoll( imgDoll, GetX, GetY );
    }

        @Finalize
        {
	MagicCircleBreak(GetX,GetY,10,0.3);

	if(GetCommonDataDefault("BossLife",0)>0)
	{
		loop(5)
		{
			FinalizeItemSet(1);
		}
	}
	}

    task TMain {
        yield;
	GetDamege;
	OutDamageRateZero;
//	ZakoEnemyLifeDisplay;
	move;

	shotA;

    }

task move
{
	let R=0;
	let angle=GetAngle;
	let anglePlusAngle=0;
	let dir=DollDir;
	loop(600)
	{
		if(R<30)
		{
			R+=0.5;
		}
		SetX(GetCommonData("BossX")+R*cos(angle));
		SetY(GetCommonData("BossY")+R*sin(angle));
		angle+=2.5*sin(anglePlusAngle);
		SetAngle(angle);
		anglePlusAngle+=0.5*dir;
		yield;
	}

	VanishEnemy;
}

////////////////////////////////////////////////////////////
task shotA
{
wait(60);
loop(180)
{
	ascent(i in -1..2)
	{
	CreateShot01(GetX,GetY,2.5,GetAngle+5.0*i,9,5);
	}
	wait(3);
}
}

#include_function ".\..\txt/StageEnemydata.txt"
#include_function ".\..\lib/lib_anime_Alice.txt"
#include_function ".\..\lib/lib_anime_doll.txt"
}


script_enemy Familiar2 {
    let csd     = GetCurrentScriptDirectory;
    let imgDoll  = csd ~ "..\lib/dot_alice.png"; 
	let num = GetArgument;
	let color=rand_int(9,15);
    @Initialize {
	BombDamageRate=10;
	InitializeActionWithDoll;
	//SetCoordinateType(COODINATE_TYPE_PARENT);
	let num = GetArgument;
        SetLife(50000);
        SetDamageRateEx(100,100,50,0);
	TMain;
    }

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

    @DrawLoop {
     DrawDoll( imgDoll, GetX, GetY );
    }

        @Finalize
        {
	MagicCircleBreak(GetX,GetY,10,0.3);

	if(GetCommonDataDefault("BossLife",0)>0)
	{
		loop(5)
		{
			FinalizeItemSet(1);
		}
	}
	}

    task TMain {
        yield;
	GetDamege;
	OutDamageRateZero;
	//ZakoEnemyLifeDisplay;
	move;

	shotA;
    }

task move
{
	let speed=3;
	loop(60)
	{
		SetSpeed(speed);
		speed-=3/60;
		yield;
	}
	SetAngle(GetAngleToPlayer);
	loop(180)
	{
		SetSpeed(speed);
		if(speed<5)
		{
		speed+=0.055;
		}
		yield;
	}
	VanishEnemy;
}

task shotM
{

}
/////////////////////////////////////////////////////////
task shotE
{
wait(30);

}
////////////////////////////////////////////////////////////
task shotA
{
Straw;
wait(90);
//ExplodeShot;
Shot;
Shot2;
	task Shot
	{
	let count=0;
	loop(2)
	{
		ascent(i in -10..10)
		{
			CreateShot01(GetX,GetY,1.75,GetAngle+i*12,10,5);
		}
		wait(60);
	}
	}

	task Shot2
	{
	wait(30);
	let angle=GetAngleToPlayer+rand(-3,3);
	let way=30;
	if(absolute(GetAngle-GetAngleToPlayer)<15)
	{
		way=10;
	}
		ascent(i in -way..way)
		{
			CreateShot01(GetX,GetY,1.25,angle+i*6,18,5);
		}
	}

	task Straw
	{
	wait(90);
		loop
		{
			CreateShot02(GetX,GetY,0,GetAngle+rand(-5,5),0.04,2,167,5);
			wait(20);
		}
	}
}

#include_function ".\..\txt/StageEnemydata.txt"
#include_function ".\..\lib/lib_anime_Alice.txt"
#include_function ".\..\lib/lib_anime_doll.txt"
}

script_enemy Familiar3 {
    let csd     = GetCurrentScriptDirectory;
    let imgDoll  = csd ~ "..\lib/dot_alice.png"; 
	let num = GetArgument;
	let color=rand_int(9,15);
    @Initialize {
	BombDamageRate=10;
	InitializeActionWithDoll;
	//SetCoordinateType(COODINATE_TYPE_PARENT);
	let num = GetArgument;
        SetLife(50000);
        SetDamageRateEx(100,100,50,0);
	TMain;
    }

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

    @DrawLoop {
     DrawDoll( imgDoll, GetX, GetY );
    }

        @Finalize
        {
	MagicCircleBreak(GetX,GetY,10,0.3);

	if(GetCommonDataDefault("BossLife",0)>0)
	{
		loop(5)
		{
			FinalizeItemSet(1);
		}
	}
	}

    task TMain {
        yield;
	GetDamege;
	OutDamageRateZero;
	//ZakoEnemyLifeDisplay;
	move;

	shotA;
    }

task move
{
	SetMovePosition03(GetX+100*num,GetY-50,10,5);
	wait(600);
	SetMovePosition02(GetCommonData("BossX"),GetCommonData("BossY"),60);
	wait(60);
	VanishEnemy;
}

task shotM
{

}
/////////////////////////////////////////////////////////
task shotE
{
wait(30);

}
////////////////////////////////////////////////////////////
task shotA
{
wait(180);
if(num==1)
{
wait(60);
}

Shot;
	task Shot
	{
	let speed=4;
	loop(3)
	{
		let angle=GetAngleToPlayer;
		loop(25)
		{
		ascent(i in -2..3)
		{
			CreateShot01(GetX,GetY,speed,angle+i*15,9,5);
		}
		angle+=0.5*num;
		wait(3);
		}
		wait(45);
	}
	}

}

#include_function ".\..\txt/StageEnemydata.txt"
#include_function ".\..\lib/lib_anime_Alice.txt"
#include_function ".\..\lib/lib_anime_doll.txt"
}

script_enemy Familiar4 {
    let csd     = GetCurrentScriptDirectory;
    let imgDoll  = csd ~ "..\lib/dot_alice.png"; 
	let num = GetArgument;
	let color=rand_int(9,15);
    @Initialize {
	BombDamageRate=10;
	InitializeActionWithDoll;
	//SetCoordinateType(COODINATE_TYPE_PARENT);
	let num = GetArgument;
        SetLife(50000);
        SetDamageRateEx(100,100,50,0);
	TMain;
    }

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

    @DrawLoop {
     DrawDoll( imgDoll, GetX, GetY );
    }

        @Finalize
        {
	MagicCircleBreak(GetX,GetY,10,0.3);

	if(GetCommonDataDefault("BossLife",0)>0)
	{
		loop(5)
		{
			FinalizeItemSet(1);
		}
	}
	}

    task TMain {
        yield;
	GetDamege;
	OutDamageRateZero;
	//ZakoEnemyLifeDisplay;
	move;

	shotA;
    }

task move
{
	SetMovePosition03(GetCenterX,GetCenterY-50,10,5);
	wait(780);
	SetMovePosition02(GetCommonData("BossX"),GetCommonData("BossY"),60);
	wait(60);
	VanishEnemy;
}

task shotM
{

}
/////////////////////////////////////////////////////////
task shotE
{
wait(30);

}
////////////////////////////////////////////////////////////
task shotA
{
wait(60);

Shot;
	task Shot
	{
	let speed=4.5;
	let angle=0;
	let anglePlus=0;
	loop(20)
	{
		ascent(i in -5..6)
		{
		CreateShot01(GetX,GetY,speed,angle+i*25,9,5);
		CreateShot01(GetX,GetY,speed,180-angle+i*25,9,5);
		}
		
	//	angle+=3.3;
		speed-=0.100;
		wait(3);

	}
	loop(200)
	{
		ascent(i in -5..6)
		{
		CreateShot01(GetX,GetY,speed,angle+i*25,9,5);
		CreateShot01(GetX,GetY,speed,180-angle+i*25,9,5);
		}
		
		angle+=anglePlus;
		if(anglePlus<3.3)
		{
		anglePlus+=0.1;
		}
		wait(3);
		speed+=0.005;

	}
	}

}

#include_function ".\..\txt/StageEnemydata.txt"
#include_function ".\..\lib/lib_anime_Alice.txt"
#include_function ".\..\lib/lib_anime_doll.txt"
}
*/
#include_script ".\..\txt/EnemyShotData.txt"
