let imgBIGCIRCLE = GetCurrentScriptDirectory~ "img\Circle_Hex.png";

sub boss_magic_circle
{
	effect_circle(imgBIGCIRCLE, 255, 255, 0, 0);
}

task effect_circle(graphic, c_alpha, c_red, c_green, c_blue)
{
	//初期設定
	let obj = Obj_Create(OBJ_EFFECT);
	ObjEffect_SetTexture(obj, graphic);
	ObjEffect_SetRenderState(obj, ADD);
	ObjEffect_SetLayer(obj, 2);
	ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLEFAN);
	ObjEffect_CreateVertex(obj, 4);
	ObjEffect_SetVertexUV(obj, 0,   0,   0);
	ObjEffect_SetVertexUV(obj, 1, 256,   0);
	ObjEffect_SetVertexUV(obj, 2, 256, 256);
	ObjEffect_SetVertexUV(obj, 3,   0, 256);
	ObjEffect_SetVertexXY(obj, 0,-75,-75);
	ObjEffect_SetVertexXY(obj, 1, 75,-75);
	ObjEffect_SetVertexXY(obj, 2, 75, 75);
	ObjEffect_SetVertexXY(obj, 3,-75, 75);
	ascent (let n in 0 .. 4)
	{
		ObjEffect_SetVertexColor(obj, n, c_alpha, c_red, c_green, c_blue);
	}

	
	//ずっとループのターン
	let t = 0;
	let angle = 0; let scale = 0;
	
	loop(20)
	{
		scale += 0.05;
		ObjEffect_SetScale(obj, scale, scale);
		Obj_SetPosition(obj, GetX, GetY);
		
		yield;
	}
	loop
	{
		ObjEffect_SetScale(obj, scale, scale);
		ObjEffect_SetAngle(obj, 0, 0, angle);
		Obj_SetPosition(obj, GetX, GetY);
		
		scale += sin(t)/60;
		angle -= 5;
		
		t+=3; angle %= 360;
		yield;
	}
	Obj_Delete(obj);
}

function wait(w){
		loop(w){ yield; }
	}

task kotonoha(x,y,speed,speed2,angle,angle2,type,delay){
let obj1 = Obj_Create(OBJ_SHOT);
let i=0;
Obj_SetX(obj1, x);
Obj_SetY(obj1, y);
Obj_SetSpeed(obj1, speed);
Obj_SetAngle(obj1, angle);
ObjShot_SetDelay(obj1, delay);
ObjShot_SetGraphic(obj1, type);
wait(55);
PlaySE(suzuSE);
Obj_SetSpeed(obj1, speed2);
Obj_SetAngle(obj1, angle2);
loop(2){
Child1(Obj_GetX(obj1),Obj_GetY(obj1),5,90,91,30,120-i);
wait(10);
i+=10;
Child1(Obj_GetX(obj1),Obj_GetY(obj1),5,90,92,30,120-i);
wait(10);
i+=10;
}
Obj_Delete(obj1);
}

task kotonoha2(x,y,speed,speed2,angle,angle2,type,delay){
let obj1 = Obj_Create(OBJ_SHOT);
let i=0;
Obj_SetX(obj1, x);
Obj_SetY(obj1, y);
Obj_SetSpeed(obj1, speed);
Obj_SetAngle(obj1, angle);
ObjShot_SetDelay(obj1, delay);
ObjShot_SetGraphic(obj1, type);
wait(55);
PlaySE(suzuSE);
Obj_SetSpeed(obj1, speed2);
Obj_SetAngle(obj1, angle2);
loop(3){
loop(2){
Child1(Obj_GetX(obj1),Obj_GetY(obj1),5,90,91,30,120-i);
}
wait(7.5);
i+=7.5;
loop(2){
Child1(Obj_GetX(obj1),Obj_GetY(obj1),5,90,92,30,120-i);
}
wait(7.5);
i+=7.5;
}
Obj_Delete(obj1);
}

task kotonoha3(x,y,speed,speed2,angle,angle2,type,delay){
let obj1 = Obj_Create(OBJ_SHOT);
let i=0;
Obj_SetX(obj1, x);
Obj_SetY(obj1, y);
Obj_SetSpeed(obj1, speed);
Obj_SetAngle(obj1, angle);
ObjShot_SetDelay(obj1, delay);
ObjShot_SetGraphic(obj1, type);
wait(55);
PlaySE(suzuSE);
Obj_SetSpeed(obj1, speed2);
Obj_SetAngle(obj1, angle2);
loop(4){
Child3(Obj_GetX(obj1),Obj_GetY(obj1),5,90,91,30,120-i);
wait(5);
i+=5;
Child3(Obj_GetX(obj1),Obj_GetY(obj1),5,90,92,30,120-i);
wait(5);
i+=5;
}
Obj_Delete(obj1);
}

task Child1(x,y,speed,angle,type,delay,time){
let obj1 = Obj_Create(OBJ_SHOT);
let i=0;
let j=rand(0,360);
let k=rand(0,360);
Obj_SetX(obj1, x);
Obj_SetY(obj1, y);
Obj_SetSpeed(obj1, 0);
Obj_SetAngle(obj1, angle);
ObjShot_SetDelay(obj1, delay);
ObjShot_SetGraphic(obj1, type);
wait(time);
PlaySE(suzuSE);
Obj_SetSpeed(obj1, speed);
loop(5){
Child2(Obj_GetX(obj1),Obj_GetY(obj1),0.5,j,91,0,120-i);
wait(10);
i+=10;
Child2(Obj_GetX(obj1),Obj_GetY(obj1),0.5,k,92,0,120-i);
wait(10);
i+=10;
}
Obj_Delete(obj1);
}

task Child2(x,y,speed,angle,type,delay,time){
let obj1 = Obj_Create(OBJ_SHOT);
let i=0;
Obj_SetX(obj1, x);
Obj_SetY(obj1, y);
Obj_SetSpeed(obj1, 0);
Obj_SetAngle(obj1, angle);
ObjShot_SetDelay(obj1, delay);
ObjShot_SetGraphic(obj1, type);
wait(time);
PlaySE(suzuSE);
Obj_SetSpeed(obj1, speed);
}

task Child3(x,y,speed,angle,type,delay,time){
let obj1 = Obj_Create(OBJ_SHOT);
let i=0;
let j=rand(0,360);
let k=rand(0,360);
Obj_SetX(obj1, x);
Obj_SetY(obj1, y);
Obj_SetSpeed(obj1, 0);
Obj_SetAngle(obj1, angle);
ObjShot_SetDelay(obj1, delay);
ObjShot_SetGraphic(obj1, type);
wait(time);
PlaySE(suzuSE);
Obj_SetSpeed(obj1, speed);
loop(10){
Child2(Obj_GetX(obj1),Obj_GetY(obj1),0.5,j,91,0,120-i);
wait(5);
i+=5;
Child2(Obj_GetX(obj1),Obj_GetY(obj1),0.5,k,92,0,120-i);
wait(5);
i+=5;
}
Obj_Delete(obj1);
}

task Setkotonoha(x,y,speed,speed2,angle,angle2,type,delay,judge,time){
let obj1 = Obj_Create(OBJ_SHOT);
let i=0;
Obj_SetX(obj1, x);
Obj_SetY(obj1, y);
Obj_SetSpeed(obj1, speed);
Obj_SetAngle(obj1, angle);
ObjShot_SetDelay(obj1, delay);
ObjShot_SetGraphic(obj1, type);
ObjShot_SetBombResist(obj1,true);
wait(92.5);
PlaySE(suzuSE);
Obj_SetSpeed(obj1, speed2);
Obj_SetAngle(obj1, angle2);
loop(5){
SetChild2(Obj_GetX(obj1),Obj_GetY(obj1),0,0,90,30,judge,time,120-i);
wait(10);
i+=10;
}
Obj_Delete(obj1);
}

task Setkotonoha2(x,y,speed,speed2,angle,angle2,type,delay,judge,time){
let obj1 = Obj_Create(OBJ_SHOT);
let i=0;
Obj_SetX(obj1, x);
Obj_SetY(obj1, y);
Obj_SetSpeed(obj1, speed);
Obj_SetAngle(obj1, angle);
ObjShot_SetDelay(obj1, delay);
ObjShot_SetGraphic(obj1, type);
ObjShot_SetBombResist(obj1,true);
wait(92.5);
PlaySE(suzuSE);
Obj_SetSpeed(obj1, speed2);
Obj_SetAngle(obj1, angle2);
loop(5){
SetChild1(Obj_GetX(obj1),Obj_GetY(obj1),0,180,93,30,judge,time,120-i);
wait(10);
i+=10;
}
Obj_Delete(obj1);
}

task SetChild1(x,y,speed,angle,type,delay,judge,time,i){
let obj1 = Obj_Create(OBJ_SHOT);
Obj_SetX(obj1, x);
Obj_SetY(obj1, y);
Obj_SetSpeed(obj1, 0);
Obj_SetAngle(obj1, angle);
ObjShot_SetDelay(obj1, delay);
ObjShot_SetGraphic(obj1, type);
ObjShot_SetBombResist(obj1,true);
wait(i);
loop{
PlaySE(shotSE);
if(judge==1){fudashotE(Obj_GetX(obj1),Obj_GetY(obj1),1,rand(-45,45),93,0);}
if(judge==2){loop(2){fudashotE(Obj_GetX(obj1),Obj_GetY(obj1),1,rand(-45,45),93,0);}}
if(judge==3){fudashotH(Obj_GetX(obj1),Obj_GetY(obj1),1,rand(-45,45),93,0);}
if(judge==4){fudashotL(Obj_GetX(obj1),Obj_GetY(obj1),1,rand(-45,45),93,0);}
wait(time);
}
}

task SetChild2(x,y,speed,angle,type,delay,judge,time,i){
let obj1 = Obj_Create(OBJ_SHOT);
Obj_SetX(obj1, x);
Obj_SetY(obj1, y);
Obj_SetSpeed(obj1, 0);
Obj_SetAngle(obj1, angle);
ObjShot_SetDelay(obj1, delay);
ObjShot_SetGraphic(obj1, type);
ObjShot_SetBombResist(obj1,true);
wait(i);
loop{
PlaySE(shotSE);
if(judge==1){fudashotE(Obj_GetX(obj1),Obj_GetY(obj1),1,rand(135,225),90,0);}
if(judge==2){loop(2){fudashotE(Obj_GetX(obj1),Obj_GetY(obj1),1,rand(135,225),90,0);}}
if(judge==3){fudashotH(Obj_GetX(obj1),Obj_GetY(obj1),1,rand(135,225),90,0);}
if(judge==4){fudashotL(Obj_GetX(obj1),Obj_GetY(obj1),1,rand(135,225),90,0);}
wait(time);
}
}

task fudashotE(x,y,speed,angle,type,delay){
let obj1 = Obj_Create(OBJ_SHOT);
Obj_SetX(obj1, x);
Obj_SetY(obj1, y);
Obj_SetSpeed(obj1, speed);
Obj_SetAngle(obj1, angle);
ObjShot_SetDelay(obj1, delay);
ObjShot_SetGraphic(obj1, type);
}

task fudashotH(x,y,speed,angle,type,delay){
let obj1 = Obj_Create(OBJ_SHOT);
Obj_SetX(obj1, x);
Obj_SetY(obj1, y);
Obj_SetSpeed(obj1, speed);
Obj_SetAngle(obj1, angle);
ObjShot_SetDelay(obj1, delay);
ObjShot_SetGraphic(obj1, type);
loop{
Obj_SetAngle(obj1, angle);
wait(90);
Obj_SetAngle(obj1, angle+45);
wait(90);
}
}

task fudashotL(x,y,speed,angle,type,delay){
let obj1 = Obj_Create(OBJ_SHOT);
let i=0;
let j=0;
Obj_SetX(obj1, x);
Obj_SetY(obj1, y);
Obj_SetSpeed(obj1, speed);
Obj_SetAngle(obj1, angle);
ObjShot_SetDelay(obj1, delay);
ObjShot_SetGraphic(obj1, type);
loop{
loop(60){
Obj_SetAngle(obj1, angle+i);
wait(1);
i+=1.5;
}
loop(60){
Obj_SetAngle(obj1, angle+i-j);
wait(1);
j+=1.5;
}
i=0;
j=0;
}
}
#include_function ".\変数集.txt"