
script_shot BurstReturnShot{//バースト反応弾
        let csd     = GetCurrentScriptDirectory;
	let R=0;
	let G=255;
	let B=0;
	let ColorType=100;
       let out=false;
	let Speed=rand(3,6);
	let StandradSpeed=Speed;
	let TimeCounter=0;
	let TimeCounterPlus=0;
	let TimeLimit=720;
	//let SRange=GetCommonData("MagicAbsorbShortRange");
	//let LRange=GetCommonData("MagicAbsorbLongRange");
	let SRange=50;
	let LRange=120;
	let StandardSRange=50;
	let StandardLRange=120;
       @Initialize{
	SetCommonData("BurstBulletNum",GetCommonDataDefault("BurstBulletNum",0)+1);
	SetDefault(5);
	SetBombResist;
	SetSpeed(Speed);
	SetAngle(GetAngleToPlayer-180+rand(-45,45));
	Tmain;
       }
	@MainLoop
	{
		ShotEffect(GetX,GetY,1,128,R,G,B);		
		SRange=StandardSRange*(1+0.5*GetCommonData("BURSTRANK")/10000);
		LRange=StandardLRange*(1+0.5*GetCommonData("BURSTRANK")/10000);
		SetCollisionB(GetX,GetY,0.8);
		yield;
	}
       @DrawLoop {
       DrawGraphicDefault();
       }
       @Finalize{
SetCommonData("BurstBulletNum",GetCommonDataDefault("BurstBulletNum",0)-1);
	}

task Tmain
{
	Move;
	loop(30)	
	{
		if(GetKeyState(VK_USER)==KEY_PUSH)
		{
			End;
		}
		yield;
	}
	Eraze;
	BulletToItem;
}

task Move
{
loop(30)
{
SetSpeed(Speed);
Speed-=StandradSpeed/30;
yield;
}

let mo=2.5*4;
loop
{       
SetSpeed(Speed);
if(Speed<1.5)
{
Speed+=1/60;
}
if(Speed<3.75)
{
Speed+=1/60;
}
if(TimeCounter>=120 && TimeCounter<360)
{
	R=255;G=183;B=76;
	ColorType=101;
	SetDefault(2);
}
else if(TimeCounter>=360)
{
	R=200;G=0;B=0;
	ColorType=102;
	SetDefault(1);
}
	//SetAngle(GetAngleToPlayer);

	loop(1)
	{
        if(sin(GetAngleToPlayer-GetAngle)>0){
            SetAngle(GetAngle+mo);
        }
        else{
            SetAngle(GetAngle-mo);
        }
	}

	if(GetDistanceToPlayer<=SRange)
	{
		TimeCounterPlus=3;
	}
	else if(GetDistanceToPlayer<=LRange)
	{
		TimeCounterPlus=1+2*(GetDistanceToPlayer-LRange)/(SRange-LRange);
	}
	else
	{
		TimeCounterPlus=1;
	}
	TimeCounter+=TimeCounterPlus;
yield;
}

}

task BulletToItem
{
loop
{
	if(GetKeyState(VK_USER)==KEY_PUSH)
	{
		if(TimeCounter<120)
		{
			if(rand_int(0,2)!=0)
			{
				ItemSet(GetX,GetY,6);
				ItemSet(GetX,GetY,6);
				ItemSet(GetX,GetY,6);
			}
			else
			{
				ItemSet(GetX,GetY,6.5);
			}
		}
		else if(TimeCounter>=120 && TimeCounter<360)
		{
			if(rand_int(0,2)!=0)
			{
				ItemSet(GetX,GetY,61);
				ItemSet(GetX,GetY,61);
				ItemSet(GetX,GetY,61);
			}
			else
			{
				ItemSet(GetX,GetY,61.5);
			}
		}
		else if(TimeCounter>=360)
		{
			if(rand_int(0,2)!=0)
			{
				ItemSet(GetX,GetY,62);
				ItemSet(GetX,GetY,62);
				ItemSet(GetX,GetY,62);
			}
			else
			{
				ItemSet(GetX,GetY,62.5);
			}
		}
		End;
		break;
	}
	if(GetCommonData("BURSTLEVEL")==0)
	{
		MagicCircleBreak(GetX,GetY,0.3);
		End;
		break;
	}
	yield;
}
}

task Eraze
{
loop
{
	if(GetX<GetClipMinX-64||GetX>GetClipMaxX+64||GetY<GetClipMinY-64||GetY>GetClipMaxY+64)
	{
		End;
	}
	if(OnBomb)
	{
		MagicCircleBreak(GetX,GetY,0.3);
		End;
	}
	if(GetCommonData("Playermissed"))
	{
		MagicCircleBreak(GetX,GetY,0.3);
		End;
	}
	if(TimeCounter>=TimeLimit)
	{
		MagicCircleBreak(GetX,GetY,0.3);
		End;
	}
yield;
}
}

function GetDistanceToPlayer
{
	let dis=((GetX-GetPlayerX)^2+(GetY-GetPlayerY)^2)^0.5;
	return(dis);
}

function ItemSet(x,y,type)//アイテム生成関数
{
	let XY=GetCommonDataDefault("ItemXY",[]);//共通データ内容を変数に渡す
	XY=XY~[x,y,type];//
	SetCommonData("ItemXY",XY);//共通データに変更後の配列を渡す
}

function MagicCircleBreak(x,y,scale)//アイテム生成関数
{
	let XY=GetCommonDataDefault("MagicCircleBreak",[]);//共通データ内容を変数に渡す
	XY=XY~[x,y,ColorType,scale];//
	SetCommonData("MagicCircleBreak",XY);//共通データに変更後の配列を渡す
}

task ShotEffect(x,y,delay,Alpha,R,G,B)
{
x+=GetSpeed*cos(GetAngle);
y+=GetSpeed*sin(GetAngle);
yield;
  		let obj = Obj_Create(OBJ_EFFECT);
		ObjEffect_SetTexture(obj,csd~"..\img\Light2.png");
		ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLEFAN);
		ObjEffect_SetRenderState(obj, ADD);
		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,  0,  0);
		ObjEffect_SetVertexUV(obj, 1,  32, 0);
		ObjEffect_SetVertexUV(obj, 2, 32, 32);
		ObjEffect_SetVertexUV(obj, 3, 0,  32);
			ascent(let i in 0..4)
			{
			ObjEffect_SetVertexColor(obj,i,Alpha,R,G,B);
			}

		Obj_SetPosition(obj,x,y);

		ObjEffect_SetLayer(obj,2);

		let Zangle=rand(0,360);
		ObjEffect_SetAngle(obj,0,0,Zangle);

		let Scale=0.4;

yield;
		Obj_Delete(obj);
}

}
//////////////////////////////////////////////////////////////////////////////

script_shot BurstReturnBigShot{//バースト反応弾
        let csd     = GetCurrentScriptDirectory;
	let R=0;
	let G=255;
	let B=0;
	let ColorType=100;
       let out=false;
	let Speed=rand(3,6);
	let StandradSpeed=Speed;
	let TimeCounter=0;
	let TimeCounterPlus=0;
	let TimeLimit=720;
	//let SRange=GetCommonData("MagicAbsorbShortRange");
	//let LRange=GetCommonData("MagicAbsorbLongRange");
	let SRange=50;
	let LRange=120;
	let StandardSRange=50;
	let StandardLRange=120;
	let grf=5;
       @Initialize{
	SetCommonData("BurstBulletNum",GetCommonDataDefault("BurstBulletNum",0)+2);
	SetDefault(grf);
	SetBombResist;
	SetSpeed(Speed);
	SetAngle(GetAngleToPlayer-180+rand(-45,45));
	Tmain;
       }

	@MainLoop
	{
		ShotEffect(GetX,GetY,1,128,R,G,B);
		SRange=StandardSRange*(1+0.5*GetCommonData("BURSTRANK")/10000);
		LRange=StandardLRange*(1+0.5*GetCommonData("BURSTRANK")/10000);
		SetCollisionB(GetX,GetY,0.8);
		yield;
	}
       @DrawLoop {
       DrawGraphicDefault();
       }
       @Finalize{
	SetCommonData("BurstBulletNum",GetCommonDataDefault("BurstBulletNum",0)-2);
	}

task Tmain
{
	Move;
	loop(30)	
	{
		if(GetKeyState(VK_USER)==KEY_PUSH)
		{
			End;
		}
		yield;
	}
	Eraze;
	BulletToItem;
}

task Move
{
loop(30)
{
SetSpeed(Speed);
Speed-=StandradSpeed/30;
yield;
}

let mo=2.5*4;
loop
{       
SetSpeed(Speed);
if(Speed<1.5)
{
Speed+=1/60;
}
if(Speed<3.75)
{
Speed+=1/60;
}
if(TimeCounter>=120 && TimeCounter<360)
{
	R=255;G=183;B=76;
	ColorType=101;
	SetDefault(grf-3);
}
else if(TimeCounter>=360)
{
	R=200;G=0;B=0;
	ColorType=102;
	SetDefault(grf-4);
}
	//SetAngle(GetAngleToPlayer);

	loop(1)
	{
        if(sin(GetAngleToPlayer-GetAngle)>0)
	{
            		SetAngle(GetAngle+mo);
        }
        else
	{
           SetAngle(GetAngle-mo);
        }
	}

	if(GetDistanceToPlayer<=SRange)
	{
		TimeCounterPlus=3;
	}
	else if(GetDistanceToPlayer<=LRange)
	{
		TimeCounterPlus=1+2*(GetDistanceToPlayer-LRange)/(SRange-LRange);
	}
	else
	{
		TimeCounterPlus=1;
	}
	TimeCounter+=TimeCounterPlus;
yield;
}

}

task BulletToItem
{
loop
{
	if(GetKeyState(VK_USER)==KEY_PUSH)
	{
		if(TimeCounter<120)
		{
			if(rand_int(0,2)!=0)
			{
				ItemSet(GetX,GetY,6);
				ItemSet(GetX,GetY,6);
				ItemSet(GetX,GetY,6);
			}
			else
			{
				ItemSet(GetX,GetY,6.5);
			}
		}
		else if(TimeCounter>=120 && TimeCounter<360)
		{
			if(rand_int(0,2)!=0)
			{
				ItemSet(GetX,GetY,61);
				ItemSet(GetX,GetY,61);
				ItemSet(GetX,GetY,61);
			}
			else
			{
				ItemSet(GetX,GetY,61.5);
			}
		}
		else if(TimeCounter>=360)
		{
			if(rand_int(0,2)!=0)
			{
				ItemSet(GetX,GetY,62);
				ItemSet(GetX,GetY,62);
				ItemSet(GetX,GetY,62);
			}
			else
			{
				ItemSet(GetX,GetY,62.5);
			}
		}
		End;
		break;
	}
	if(GetCommonData("BURSTLEVEL")==0)
	{
		MagicCircleBreak(GetX,GetY,0.3);
		End;
		break;
	}
	yield;
}
}

task Eraze
{
loop
{
	if(GetX<GetClipMinX-64||GetX>GetClipMaxX+64||GetY<GetClipMinY-64||GetY>GetClipMaxY+64)
	{
		End;
	}
	if(OnBomb)
	{
		MagicCircleBreak(GetX,GetY,0.3);
		End;
	}
	if(GetCommonData("Playermissed"))
	{
		MagicCircleBreak(GetX,GetY,0.3);
		End;
	}
	if(TimeCounter>=TimeLimit)
	{

		MagicCircleBreak(GetX,GetY,0.3);
		End;
	}
yield;
}
}

function GetDistanceToPlayer
{
	let dis=((GetX-GetPlayerX)^2+(GetY-GetPlayerY)^2)^0.5;
	return(dis);
}

function ItemSet(x,y,type)//アイテム生成関数
{
	let XY=GetCommonDataDefault("ItemXY",[]);//共通データ内容を変数に渡す
	XY=XY~[x,y,type,x,y,type];//
	SetCommonData("ItemXY",XY);//共通データに変更後の配列を渡す
}

function MagicCircleBreak(x,y,scale)//アイテム生成関数
{
	let XY=GetCommonDataDefault("MagicCircleBreak",[]);//共通データ内容を変数に渡す
	XY=XY~[x,y,ColorType,scale];//
	SetCommonData("MagicCircleBreak",XY);//共通データに変更後の配列を渡す
}

task ShotEffect(x,y,delay,Alpha,R,G,B)
{
x+=GetSpeed*cos(GetAngle);
y+=GetSpeed*sin(GetAngle);
yield;
  		let obj = Obj_Create(OBJ_EFFECT);
		ObjEffect_SetTexture(obj,csd~"..\img\Light3.png");
		ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLEFAN);
		ObjEffect_SetRenderState(obj, ADD);
		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,  0,  0);
		ObjEffect_SetVertexUV(obj, 1,  32, 0);
		ObjEffect_SetVertexUV(obj, 2, 32, 32);
		ObjEffect_SetVertexUV(obj, 3, 0,  32);
			ascent(let i in 0..4)
			{
			ObjEffect_SetVertexColor(obj,i,Alpha,R,G,B);
			}

		Obj_SetPosition(obj,x,y);

		ObjEffect_SetLayer(obj,2);

		let Zangle=rand(0,360);
		ObjEffect_SetAngle(obj,0,0,Zangle);

		let Scale=0.4;
/*		loop(delay)
		{
			ObjEffect_SetScale(obj, Scale, Scale);
			ObjEffect_SetAngle(obj,0,0,Zangle);
			Zangle+=6;
			Scale-=1.0/delay;
			yield;
		}
*/
//ObjEffect_SetScale(obj, Scale, Scale);
yield;
		Obj_Delete(obj);
}

}
//////////////////////////////////////////////////////////////////////////////


script_shot PowerReturnShot{//マジック反応弾
       let out=false;
	let Speed=rand(3,6);
	let StandradSpeed=Speed;
	let TimeCounter=0;
       @Initialize{
	SetDefault(GetArgument);
	SetBombResist;
	SetSpeed(Speed);
	SetAngle(GetAngleToPlayer-180+rand(-10,10));

	Tmain;
       }
       @MainLoop {
	SetCollisionB(GetX,GetY,2);
		yield;
          }
       @DrawLoop {
          DrawGraphicDefault();
       }
       @Finalize{

	}

task Tmain
{

	Move;
	Eraze;
	loop(30){yield;}
	BulletToItem;
}


task Move
{
loop(30)
{
SetSpeed(Speed);
Speed-=StandradSpeed/30;
yield;
}

loop
{       
SetSpeed(-Speed);
if(Speed<2)
{
Speed+=2/60;
}
else
{
break;
}

yield;
}

}


task BulletToItem
{
loop
{
	if(GetCommonData("BURSTLEVEL")==3)
	{
		ItemSet(GetX,GetY,66);
		ItemSet(GetX,GetY,66);
		ItemSet(GetX,GetY,66);
		End;
		break;
	}

	if(GetCommonDataDefault("SlowMoveSwitch",false))
	{
		ItemSet(GetX,GetY,7);
		ItemSet(GetX,GetY,7);
		ItemSet(GetX,GetY,7);
		End;
		break;
	}	
	yield;
}
}

task Eraze
{
loop
{
	if(GetX<GetClipMinX-64||GetX>GetClipMaxX+64||GetY<GetClipMinY-64||GetY>GetClipMaxY+64)
	{
		End;
	}
	if(OnBomb)
	{
		End;
	}
	if(GetCommonData("Playermissed"))
	{
		End;
	}
yield;
}
}

function GetDistanceToPlayer
{
	let dis=((GetX-GetPlayerX)^2+(GetY-GetPlayerY)^2)^0.5;
	return(dis);
}

function ItemSet(x,y,type)//アイテム生成関数
{
	let XY=GetCommonDataDefault("ItemXY",[]);//共通データ内容を変数に渡す
	XY=XY~[x,y,type];//
	SetCommonData("ItemXY",XY);//共通データに変更後の配列を渡す
}

}


script_shot StrongShot{//マジック反応弾
       let out=false;
	let Speed=rand(3,6);
	let StandradSpeed=Speed;
	let TimeCounter=0;
	let gra=GetArgument[0];
	let num=GetArgument[1]-1;
       @Initialize{
	SetDefault(gra);
	if(rand_int(0,10)==0)
	{
	SetBombResist;
	}
	SetSpeed(GetSpeed);
	SetAngle(GetAngle);

	Tmain;
       }
       @MainLoop {
	SetCollisionB(GetX,GetY,2);
		yield;
          }
       @DrawLoop {
          DrawGraphicDefault();
       }
       @Finalize{
		if(out==false)
		{
	//	let XY=GetCommonDataDefault("StrongDeleteShot",[]);//共通データ内容を変数に渡す
	//	XY=XY~[-1];//
	//	SetCommonData("StrongDeleteShot",XY);//共通データに変更後の配列を渡す
		}
	}

task Tmain
{
	Eraze;
}


task Move
{
loop(30)
{
SetSpeed(Speed);
Speed-=StandradSpeed/30;
yield;
}

loop
{       
SetSpeed(-Speed);
if(Speed<2)
{
Speed+=2/60;
}
else
{
break;
}

yield;
}

}


task BulletToItem
{
loop
{
	if(GetCommonData("BURSTLEVEL")==3)
	{
		ItemSet(GetX,GetY,66);
		ItemSet(GetX,GetY,66);
		ItemSet(GetX,GetY,66);
		End;
		break;
	}

	if(GetCommonDataDefault("SlowMoveSwitch",false))
	{
		ItemSet(GetX,GetY,7);
		ItemSet(GetX,GetY,7);
		ItemSet(GetX,GetY,7);
		End;
		break;
	}	
	yield;
}
}

task Eraze
{
loop
{
	if(GetX<GetClipMinX-64||GetX>GetClipMaxX+64||GetY<GetClipMinY-64||GetY>GetClipMaxY+64)
	{
		out=true;
		End;
	}
	if(OnBomb)
	{
		End;
	}
	if(GetCommonData("Playermissed"))
	{
		out=true;
		End;
	}
yield;
}
}

function GetDistanceToPlayer
{
	let dis=((GetX-GetPlayerX)^2+(GetY-GetPlayerY)^2)^0.5;
	return(dis);
}

function ItemSet(x,y,type)//アイテム生成関数
{
	let XY=GetCommonDataDefault("ItemXY",[]);//共通データ内容を変数に渡す
	XY=XY~[x,y,type];//
	SetCommonData("ItemXY",XY);//共通データに変更後の配列を渡す
}

}

////////////////////////////////////////////////////////////////////////////////////////////

script_shot iiiBurstReturnShot{//バースト反応弾
        let csd     = GetCurrentScriptDirectory;
	let R=0;
	let G=255;
	let B=0;
	let ColorType=100;
       let out=false;
       @Initialize{
	SetDefault(14);
	SetBombResist;
	SetSpeed(GetSpeed);
	SetAngle(GetAngle);
	Tmain;
       }
	@MainLoop
	{
		SetCollisionBDefault;
		yield;
	}
       @DrawLoop {
       DrawGraphicDefault();
       }
       @Finalize{

	}

task Tmain
{
	loop(40){yield;}
}

task Move
{
loop(30)
{
SetSpeed(Speed);
Speed-=StandradSpeed/30;
yield;
}

let mo=2.5*4;
loop
{       
SetSpeed(Speed);
if(Speed<1.5)
{
Speed+=1/60;
}
if(Speed<3.75)
{
Speed+=1/60;
}
if(TimeCounter>=120 && TimeCounter<300)
{
	R=255;G=183;B=76;
	ColorType=101;
	SetDefault(2);
}
else if(TimeCounter>=300)
{
	R=200;G=0;B=0;
	ColorType=102;
	SetDefault(1);
}
	//SetAngle(GetAngleToPlayer);

	loop(1)
	{
        if(sin(GetAngleToPlayer-GetAngle)>0){
            SetAngle(GetAngle+mo);
        }
        else{
            SetAngle(GetAngle-mo);
        }
	}

	if(GetDistanceToPlayer<=SRange)
	{
		TimeCounterPlus=3;
	}
	else if(GetDistanceToPlayer<=LRange)
	{
		TimeCounterPlus=1+2*(GetDistanceToPlayer-LRange)/(SRange-LRange);
	}
	else
	{
		TimeCounterPlus=1;
	}
	TimeCounter+=TimeCounterPlus;
yield;
}

}

task BulletToItem
{
loop
{
	if(GetKeyState(VK_USER)==KEY_PUSH)
	{
		if(TimeCounter<120)
		{
			if(rand_int(0,2)!=0)
			{
				ItemSet(GetX,GetY,6);
				ItemSet(GetX,GetY,6);
				ItemSet(GetX,GetY,6);
			}
			else
			{
				ItemSet(GetX,GetY,6.5);
			}
		}
		else if(TimeCounter>=120 && TimeCounter<300)
		{
			if(rand_int(0,2)!=0)
			{
				ItemSet(GetX,GetY,61);
				ItemSet(GetX,GetY,61);
				ItemSet(GetX,GetY,61);
			}
			else
			{
				ItemSet(GetX,GetY,61.5);
			}
		}
		else if(TimeCounter>=300)
		{
			if(rand_int(0,2)!=0)
			{
				ItemSet(GetX,GetY,62);
				ItemSet(GetX,GetY,62);
				ItemSet(GetX,GetY,62);
			}
			else
			{
				ItemSet(GetX,GetY,62.5);
			}
		}
		End;
		break;
	}
	if(GetCommonData("BURSTLEVEL")==0)
	{
		if(TimeCounter<120)
		{
			if(rand_int(0,2)!=0)
			{
				ItemSet(GetX,GetY,4);
				ItemSet(GetX,GetY,4);
				ItemSet(GetX,GetY,4);
			}
			else
			{
				ItemSet(GetX,GetY,4.5);
			}
		}
		else if(TimeCounter>=120 && TimeCounter<300)
		{
			if(rand_int(0,2)!=0)
			{
				ItemSet(GetX,GetY,41);
				ItemSet(GetX,GetY,41);
				ItemSet(GetX,GetY,41);
			}
			else
			{
				ItemSet(GetX,GetY,41.5);
			}
		}
		else if(TimeCounter>=300)
		{
			if(rand_int(0,2)!=0)
			{
				ItemSet(GetX,GetY,42);
				ItemSet(GetX,GetY,42);
				ItemSet(GetX,GetY,42);
			}
			else
			{
				ItemSet(GetX,GetY,42.5);
			}
		}
		End;
		break;
	}
	yield;
}
}

task Eraze
{
loop
{
	if(GetX<GetClipMinX-64||GetX>GetClipMaxX+64||GetY<GetClipMinY-64||GetY>GetClipMaxY+64)
	{
		End;
	}
	if(OnBomb)
	{
		if(TimeCounter<120)
		{
			if(rand_int(0,2)!=0)
			{
				ItemSet(GetX,GetY,4);
				ItemSet(GetX,GetY,4);
				ItemSet(GetX,GetY,4);
			}
			else
			{
				ItemSet(GetX,GetY,4.5);
			}
		}
		else if(TimeCounter>=120 && TimeCounter<300)
		{
			if(rand_int(0,2)!=0)
			{
				ItemSet(GetX,GetY,41);
				ItemSet(GetX,GetY,41);
				ItemSet(GetX,GetY,41);
			}
			else
			{
				ItemSet(GetX,GetY,41.5);
			}
		}
		else if(TimeCounter>=300)
		{
			if(rand_int(0,2)!=0)
			{
				ItemSet(GetX,GetY,42);
				ItemSet(GetX,GetY,42);
				ItemSet(GetX,GetY,42);
			}
			else
			{
				ItemSet(GetX,GetY,42.5);
			}
		}
		End;
	}
	if(GetCommonData("Playermissed"))
	{
		MagicCircleBreak(GetX,GetY,0.3);
		End;
	}
	if(TimeCounter>=TimeLimit)
	{

		MagicCircleBreak(GetX,GetY,0.3);
		End;
	}
yield;
}
}

function GetDistanceToPlayer
{
	let dis=((GetX-GetPlayerX)^2+(GetY-GetPlayerY)^2)^0.5;
	return(dis);
}

function ItemSet(x,y,type)//アイテム生成関数
{
	let XY=GetCommonDataDefault("ItemXY",[]);//共通データ内容を変数に渡す
	XY=XY~[x,y,type];//
	SetCommonData("ItemXY",XY);//共通データに変更後の配列を渡す
}

function MagicCircleBreak(x,y,scale)//アイテム生成関数
{
	let XY=GetCommonDataDefault("MagicCircleBreak",[]);//共通データ内容を変数に渡す
	XY=XY~[x,y,ColorType,scale];//
	SetCommonData("MagicCircleBreak",XY);//共通データに変更後の配列を渡す
}

task ShotEffect(x,y,delay,Alpha,R,G,B)
{
x+=GetSpeed*cos(GetAngle);
y+=GetSpeed*sin(GetAngle);
yield;
  		let obj = Obj_Create(OBJ_EFFECT);
		ObjEffect_SetTexture(obj,csd~"..\img\Light2.png");
		ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLEFAN);
		ObjEffect_SetRenderState(obj, ADD);
		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,  0,  0);
		ObjEffect_SetVertexUV(obj, 1,  32, 0);
		ObjEffect_SetVertexUV(obj, 2, 32, 32);
		ObjEffect_SetVertexUV(obj, 3, 0,  32);
			ascent(let i in 0..4)
			{
			ObjEffect_SetVertexColor(obj,i,Alpha,R,G,B);
			}

		Obj_SetPosition(obj,x,y);

		ObjEffect_SetLayer(obj,2);

		let Zangle=rand(0,360);
		ObjEffect_SetAngle(obj,0,0,Zangle);

		let Scale=0.4;
/*		loop(delay)
		{
			ObjEffect_SetScale(obj, Scale, Scale);
			ObjEffect_SetAngle(obj,0,0,Zangle);
			Zangle+=6;
			Scale-=1.0/delay;
			yield;
		}
*/
//ObjEffect_SetScale(obj, Scale, Scale);
yield;
		Obj_Delete(obj);
}

}

////////////////////////////////////////////////////////////////////////////////////////


script_shot ResistReturnShot{//バースト反応弾
        let csd     = GetCurrentScriptDirectory;
	let R=0;
	let G=255;
	let B=0;
	let ColorType=100;
       let out=false;
	let Speed=rand(3,6);
	let StandradSpeed=Speed;
	let TimeCounter=0;
	let TimeCounterPlus=0;
	let TimeLimit=750;
	//let SRange=GetCommonData("MagicAbsorbShortRange");
	//let LRange=GetCommonData("MagicAbsorbLongRange");
	let SRange=50;
	let LRange=120;
	let StandardSRange=50;
	let StandardLRange=120;
       @Initialize{
	SetCommonData("BurstBulletNum",GetCommonDataDefault("BurstBulletNum",0)+1);
	SetDefault(121);
	SetBombResist;
	SetSpeed(rand(1.5,3.0));
	SetAngle(GetAngleToPlayer+rand(-10,10));
	Tmain;
       }
	@MainLoop
	{
		SetCollisionBDefault;
		yield;
	}
       @DrawLoop {
       DrawGraphicDefault();
       }
       @Finalize{

	}

task Tmain
{
	wait(600);
	End;
}

function GetDistanceToPlayer
{
	let dis=((GetX-GetPlayerX)^2+(GetY-GetPlayerY)^2)^0.5;
	return(dis);
}

}

}