
task RiseLaser(SET_KEY)
{

	let speed=0;
	let angle=270;
	let damage=Status_MagicPower*0.4;
	let type=1000;
	if(IsPermitPlayerShot==false){return;}
	if(GetCommonData("SceneChange",false)==true){return;}
	if(MagicShotNum>=MagicShotNumMax){return;}

	let E_Array=GetIntersectionRegistedEnemyID;
	let TargetID=GetPlayerObjectID;
	let Dis=120;
	ascent(i in 0..length(E_Array))
	{
		if(Obj_IsValueExists(E_Array[i],"IntersectionPlayer"))
		{
		if( ((ObjMove_GetX(E_Array[i])-GetPlayerX)^2+(ObjMove_GetY(E_Array[i])-GetPlayerY)^2)^0.5<=Dis )
		{
			Dis=((ObjMove_GetX(E_Array[i])-GetPlayerX)^2+(ObjMove_GetY(E_Array[i])-GetPlayerY)^2)^0.5;
			TargetID=E_Array[i];
		}
		}
	}
	if(TargetID==GetPlayerObjectID)
	{
		SpiritPoint-=1;return;
	}
	if(SpiritPoint>=5*SpiritReduce)
	{
		SpiritPoint-=5*SpiritReduce;
	}
	else
	{
		SpiritPointLack;
		return;
	}

	Obj_PlaySE(GetCurrentScriptDirectory~"../se/tama1.wav");
	let objShot = ObjShot_Create(OBJ_STRAIGHT_LASER);
	ObjMove_SetX(objShot, ObjMove_GetX(TargetID));//x座標設定
	ObjMove_SetY(objShot, ObjMove_GetY(TargetID)+10);//y座標設定;
	ObjMove_SetSpeed(objShot, speed);//速度設定
	ObjMove_SetAngle(objShot, angle);
	ObjStLaser_SetAngle(objShot, angle);
	ObjShot_SetGraphic(objShot, type);//画像設定
	ObjShot_SetDamage(objShot, damage);//ダメージを設定
	ObjShot_SetPenetration(objShot, 10000);//貫通力は適当に大きく
	ObjShot_Regist(objShot);

	ObjLaser_SetLength(objShot,20);
	ObjLaser_SetInvalidLength(objShot,0,0);
	ObjLaser_SetRenderWidth(objShot,40);

	let ShotCount=0;
	HitEffect(1);
	loop(30)
	{
		if(ShotCount%5==0 && ShotCount<=25 )
		{ObjShot_SetDamage(objShot, damage);}
		else{ObjShot_SetDamage(objShot, 0);}
		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;
		yield;
	}

	Obj_Delete(objShot);

	task HitEffect(dir)
	{
	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,30);
	ObjRender_SetAngleZ(obj,0);

	ObjPrim_SetVertexPosition(obj, 0, 0, -4, 0);
	ObjPrim_SetVertexPosition(obj, 1, 800, -4, 0);
	ObjPrim_SetVertexPosition(obj, 2, 800, 4, 0);
	ObjPrim_SetVertexPosition(obj, 3,0, 4, 0);

	ObjPrim_SetVertexUVT(obj, 0, 2, 2);
	ObjPrim_SetVertexUVT(obj, 1, 29, 2);
	ObjPrim_SetVertexUVT(obj, 2, 29, 35);
	ObjPrim_SetVertexUVT(obj, 3, 2, 35);

	let ScaleX=0;
	let ScaleY=1;
	let Zangle=angle+90;

	ObjRender_SetPosition(obj,GetPlayerX,GetPlayerY,0);

	let Alpha=1;
	ObjRender_SetColor(obj,255*Alpha,196*Alpha,196*Alpha);

	while(!Obj_IsDeleted(objShot))
	{
		ScaleX+=0.1;
		ScaleY-=1/30;
		ObjRender_SetScaleXYZ(obj,ScaleX,ScaleY,1,);
		ObjRender_SetColor(obj,255*Alpha,196*Alpha,196*Alpha);
		ObjRender_SetAngleZ(obj,270);
		ObjRender_SetX(obj, ObjRender_GetX(objShot));//x座標設定
		ObjRender_SetY(obj, ObjRender_GetY(objShot));//y座標設定;
		yield;
	}

	Obj_Delete(obj);

	}
}
