
task RappidShot
{
	let speed=7.5;
	let angle=CharaDirection*45-90;
	let damage=Status_MagicPower*1.0;
	let type=6;
	if(IsPermitPlayerShot==false){return;}
	if(GetCommonData("SceneChange",false)==true){return;}
	if(MagicShotNum>=MagicShotNumMax){return;}

	if(SpiritPoint>=1*SpiritReduce)
	{
		SpiritPoint-=1*SpiritReduce;
	}
	else
	{
		SpiritPointLack;
		return;
	}

	Obj_PlaySE(GetCurrentScriptDirectory~"../se/tama1.wav");
	MagicShotNum+=1;

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

	ShotForbitTime(6);

	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>=31){Obj_Delete(objShot);}
		if(ObjCol_IsIntersected(objShot))
		{
			HitEffect(ObjMove_GetX(objShot),ObjMove_GetY(objShot));
		}
		yield;
	}
	
	MagicShotNum-=1;

	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, 212);
	ObjPrim_SetVertexUVT(obj, 1, 36, 212);
	ObjPrim_SetVertexUVT(obj, 2, 36, 249);
	ObjPrim_SetVertexUVT(obj, 3, 18, 249);

	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, 212);
		ObjPrim_SetVertexUVT(obj, 1, 36+floor(i/4)*18, 212);
		ObjPrim_SetVertexUVT(obj, 2, 36+floor(i/4)*18, 249);
		ObjPrim_SetVertexUVT(obj, 3, 18+floor(i/4)*18, 249);

		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);

	}
}
