task ColdInferno(x,y, speed, angle, damage, pene, type)
{
	if(IsPermitPlayerShot==false){return;}
	if(OrreryNum>=OrreryNumMax){return;}
	let ExRange=1;
	let ShotNum=100;
	let RadiusPlus=30;
	if(SpiritPoint>=15*SpiritReduce)
	{
		SpiritPoint-=15*SpiritReduce;
	}
	else
	{
		SpiritPointLack;
		return;
	}
	Obj_PlaySE(GetCurrentScriptDirectory~"../se/se_maoudamashii_element_fire09.wav");
	OrreryBit(1);
	OrreryBit(-1);
	ShotForbitTime(30);

	task OrreryBit(dir)
	{
	let angle=0;

	OrreryNum+=0.5;

	let Radius=0;
	let obj = ObjShot_Create(OBJ_SHOT);
	ObjMove_SetX(obj, x);//x座標設定
	ObjMove_SetY(obj, y);//y座標設定;
//	ObjMove_SetSpeed(obj, speed);//x座標設定
//	ObjMove_SetAngle(obj, angle);//y座標設定;
	ObjShot_SetGraphic(obj, ShotNum);//画像設定
	ObjShot_SetDamage(obj, 0);//ダメージを設定
	ObjShot_SetPenetration(obj, 1000);//貫通力は適当に大きく
	ObjShot_Regist(obj);
	ObjRender_SetColor(obj,255,128,128);
	ObjRender_SetAlpha(obj,255);
	ObjRender_SetScaleXYZ(obj,1.5,1.5,1.5);
	ObjShot_SetAutoDelete(obj,false);

	let S_count=0;
	loop(30)
	{
		ShotEffect(ObjMove_GetX(obj),ObjMove_GetY(obj));
		ObjMove_SetX(obj, GetPlayerX+Radius*cos(angle)-5);//x座標設定
		ObjMove_SetY(obj, GetPlayerY+Radius*sin(angle));//y座標設定;
		Radius+=RadiusPlus/30;
		angle=CharaDirection*45+90*dir+90;
		S_count+=1;
		yield;
	}
	loop(300)
	{
		if(S_count%15==0){CShot(ObjMove_GetX(obj),ObjMove_GetY(obj));}
		ShotEffect(ObjMove_GetX(obj),ObjMove_GetY(obj));
		if(GetVirtualKeyState(VK_SLOWMOVE) == KEY_FREE)
		{
		ObjMove_SetX(obj, GetPlayerX+Radius*cos(angle)-5);//x座標設定
		ObjMove_SetY(obj, GetPlayerY+Radius*sin(angle));//y座標設定;
		}
		else
		{
			let sr=Obj_GetValue(GetPlayerObjectID,"Move_Right");
			let sl=Obj_GetValue(GetPlayerObjectID,"Move_Left");
			let su=Obj_GetValue(GetPlayerObjectID,"Move_Up");
			let sd=Obj_GetValue(GetPlayerObjectID,"Move_Down");
			if(sr!=0)
			{
				ObjRender_SetX(obj, ObjRender_GetX(obj)-sr);
			}
			if(sl!=0)
			{
				ObjRender_SetX(obj, ObjRender_GetX(obj)-sl);
			}
			if(su!=0)
			{
				ObjRender_SetY(obj, ObjRender_GetY(obj)-su);
			}
			if(sd!=0)
			{
				ObjRender_SetY(obj, ObjRender_GetY(obj)-sd);
			}
		}
		angle=CharaDirection*45+90*dir+90;
		S_count+=1;
		yield;
	}
	loop(30)
	{
		ShotEffect(ObjMove_GetX(obj),ObjMove_GetY(obj));
		ObjMove_SetX(obj, GetPlayerX+Radius*cos(angle)-5);//x座標設定
		ObjMove_SetY(obj, GetPlayerY+Radius*sin(angle));//y座標設定;
		Radius-=RadiusPlus/30;
		angle=CharaDirection*45+90*dir+90;
		S_count+=1;
		yield;
	}
	Obj_Delete(obj);
	OrreryNum-=0.5;

	task ShotEffect(x,y)
	{
		let imgWhite = GetCurrentScriptDirectory() ~ "../img/effects.png";
		let obje = ObjPrim_Create(OBJ_PRIMITIVE_2D);
		ObjPrim_SetTexture(obje, imgWhite);
		ObjPrim_SetPrimitiveType(obje, PRIMITIVE_TRIANGLEFAN);
		ObjPrim_SetVertexCount(obje, 4);
		ObjRender_SetBlendType(obje, BLEND_ADD_RGB);
		Obj_SetRenderPriorityI(obje,30);
		ObjRender_SetAngleZ(obje,0);

		ObjPrim_SetVertexPosition(obje, 0, -64, -64, 0);
		ObjPrim_SetVertexPosition(obje, 1, 64, -64, 0);
		ObjPrim_SetVertexPosition(obje, 2, 64, 64, 0);
		ObjPrim_SetVertexPosition(obje, 3,-64, 64, 0);

		ObjPrim_SetVertexUVT(obje, 0, 0, 0);
		ObjPrim_SetVertexUVT(obje, 1, 128, 0);
		ObjPrim_SetVertexUVT(obje, 2, 128, 128);
		ObjPrim_SetVertexUVT(obje, 3, 0, 128);

		let ox=GetPlayerX;
		let oy=GetPlayerY;
		let Speed=rand(2,10);
		let Angle=rand(0,360);

		let Scale=0.2*ExRange;

		let Xangle=rand(0,360)*0;
		let Yangle=rand(0,360)*0;
		let Zangle=rand(0,360)*0;

		let XanglePlus=rand(-10,10);
		let YanglePlus=rand(-10,10);
		let ZanglePlus=rand(-10,10);

		ObjRender_SetPosition(obje,ox,oy,0);

		let Alpha=1;

		let color=[64,rand(128,196),rand(196,255)];

		ObjRender_SetPosition(obje,x,y,0);

		loop(30)
		{
			let sr=Obj_GetValue(GetPlayerObjectID,"Move_Right");
			let sl=Obj_GetValue(GetPlayerObjectID,"Move_Left");
			let su=Obj_GetValue(GetPlayerObjectID,"Move_Up");
			let sd=Obj_GetValue(GetPlayerObjectID,"Move_Down");
			if(sr!=0)
			{
				ObjRender_SetX(obje, ObjRender_GetX(obje)-sr);
			}
			if(sl!=0)
			{
				ObjRender_SetX(obje, ObjRender_GetX(obje)-sl);
			}
			if(su!=0)
			{
				ObjRender_SetY(obje, ObjRender_GetY(obje)-su);
			}
			if(sd!=0)
			{
				ObjRender_SetY(obje, ObjRender_GetY(obje)-sd);
			}
			ObjRender_SetAngleXYZ(obje,Xangle,Yangle,Zangle);
			ObjRender_SetScaleXYZ(obje,Scale,Scale,Scale);
			ObjRender_SetColor(obje,color[0]*Alpha,color[1]*Alpha,color[2]*Alpha);
			Alpha-=1/30;
		//	Scale-=1/30;
			Xangle+=XanglePlus;
			Yangle+=YanglePlus;
			Zangle+=ZanglePlus;
			yield;
		}

		Obj_Delete(obje);
	
	}

	}


task CShot(x,y)
{
	if(IsPermitPlayerShot==false){SetForbidPlayerShot(false);}
	let speed=5.0;
	let angle=CharaDirection*45-90;
	let damage=Status_MagicPower*0.25;
	let type=9;
	if(GetCommonData("SceneChange",false)==true){return;}

	Obj_PlaySE(GetCurrentScriptDirectory~"../se/tama1.wav");

	let objShot = ObjShot_Create(OBJ_SHOT);
	ObjMove_SetX(objShot, x);//x座標設定
	ObjMove_SetY(objShot, y);//y座標設定;
	ObjMove_SetSpeed(objShot, speed);//速度設定
	ObjMove_SetAngle(objShot, angle);
	ObjShot_SetGraphic(objShot, type);//画像設定
	ObjShot_SetDamage(objShot, damage);//ダメージを設定
	ObjShot_SetPenetration(objShot, 1);//貫通力は適当に大きく
	ObjShot_Regist(objShot);

	let ShotCount=0;
	while( !Obj_IsDeleted(objShot) )
	{
		let sr=Obj_GetValue(GetPlayerObjectID,"Move_Right");
		let sl=Obj_GetValue(GetPlayerObjectID,"Move_Left");
		let su=Obj_GetValue(GetPlayerObjectID,"Move_Up");
		let sd=Obj_GetValue(GetPlayerObjectID,"Move_Down");
		if(sr!=0)
		{
			ObjMove_SetX(objShot, ObjMove_GetX(objShot)-sr);
		}
		if(sl!=0)
		{
			ObjMove_SetX(objShot, ObjMove_GetX(objShot)-sl);
		}
		if(su!=0)
		{
			ObjMove_SetY(objShot, ObjMove_GetY(objShot)-su);
		}
		if(sd!=0)
		{
			ObjMove_SetY(objShot, ObjMove_GetY(objShot)-sd);
		}
		ShotCount+=1;
		if(ShotCount>=30){Obj_Delete(objShot);}
		if(ObjCol_IsIntersected(objShot))
		{
			HitEffect(ObjMove_GetX(objShot),ObjMove_GetY(objShot));
		}
		yield;
	}


	task HitEffect(x,y)
	{
	let img = GetCurrentScriptDirectory() ~ "../img/dot_marisa1.png";
	let obj = ObjPrim_Create(OBJ_PRIMITIVE_2D);
	ObjPrim_SetTexture(obj, img);
	ObjPrim_SetPrimitiveType(obj, PRIMITIVE_TRIANGLEFAN);
	ObjPrim_SetVertexCount(obj, 4);
	ObjRender_SetBlendType(obj, BLEND_ADD_RGB);
	Obj_SetRenderPriorityI(obj,20);
	ObjRender_SetAngleZ(obj,0);

	ObjPrim_SetVertexPosition(obj, 0, -9, -18, 0);
	ObjPrim_SetVertexPosition(obj, 1, 9, -18, 0);
	ObjPrim_SetVertexPosition(obj, 2, 9, 18, 0);
	ObjPrim_SetVertexPosition(obj, 3,-9, 18, 0);

	ObjPrim_SetVertexUVT(obj, 0, 18, 175);
	ObjPrim_SetVertexUVT(obj, 1, 36, 175);
	ObjPrim_SetVertexUVT(obj, 2, 36, 212);
	ObjPrim_SetVertexUVT(obj, 3, 18, 212);

	let Scale=1.0;

	let Zangle=angle+90;

	ObjRender_SetPosition(obj,x,y,0);

	let Alpha=1;
	ObjRender_SetColor(obj,64,64,128*Alpha);

	
	ascent(i in 0..16)
	{
		let sr=Obj_GetValue(GetPlayerObjectID,"Move_Right");
		let sl=Obj_GetValue(GetPlayerObjectID,"Move_Left");
		let su=Obj_GetValue(GetPlayerObjectID,"Move_Up");
		let sd=Obj_GetValue(GetPlayerObjectID,"Move_Down");
		if(sr!=0)
		{
			ObjRender_SetX(obj, ObjRender_GetX(obj)-sr);
		}
		if(sl!=0)
		{
			ObjRender_SetX(obj, ObjRender_GetX(obj)-sl);
		}
		if(su!=0)
		{
			ObjRender_SetY(obj, ObjRender_GetY(obj)-su);
		}
		if(sd!=0)
		{
			ObjRender_SetY(obj, ObjRender_GetY(obj)-sd);
		}

		ObjRender_SetPosition(obj,ObjRender_GetX(obj)+speed/4*cos(angle),ObjRender_GetY(obj)+speed/4*sin(angle),0);

		ObjPrim_SetVertexUVT(obj, 0, 18+floor(i/4)*18, 140);
		ObjPrim_SetVertexUVT(obj, 1, 36+floor(i/4)*18, 140);
		ObjPrim_SetVertexUVT(obj, 2, 36+floor(i/4)*18, 175);
		ObjPrim_SetVertexUVT(obj, 3, 18+floor(i/4)*18, 175);

		ObjRender_SetAngleXYZ(obj,0,0,Zangle);
		ObjRender_SetScaleXYZ(obj,Scale,Scale,Scale);
		ObjRender_SetColor(obj,255*Alpha,255*Alpha,255*Alpha);
		Alpha-=1/16;
		yield;
		if(!PlayerShield){break;}
	}

	Obj_Delete(obj);

	}
}

}