
task IllusionLaser(SET_KEY)
{
	if(IsPermitPlayerShot==false){return;}
	let speed=0;
	let angle=CharaDirection*45-90;
	let damage=Status_MagicPower*0.35;
	let type=1000;
	if(IsPermitPlayerShot==false){return;}
	if(GetCommonData("SceneChange",false)==true){return;}
	if(MagicShotNum>=MagicShotNumMax){return;}

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

	let objShot = ObjShot_Create(OBJ_STRAIGHT_LASER);
	ObjMove_SetX(objShot, GetPlayerX);//x座標設定
	ObjMove_SetY(objShot, GetPlayerY);//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,800);
	ObjLaser_SetInvalidLength(objShot,0,0);
	ObjLaser_SetRenderWidth(objShot,56);

	let ShotCount=0;
	HitEffect(1);
	HitEffect(-1);
	while(GetVirtualKeyState(SET_KEY)==KEY_PUSH || GetVirtualKeyState(SET_KEY)==KEY_HOLD)
	{
		if(SpiritPoint>=0.08*SpiritReduce)
		{
			SpiritPoint-=0.08*SpiritReduce;
		}
		else
		{
			SpiritPointLack;
			break;
		}
		ShotForbitTime(5);
		if(ShotCount%5==0 && ShotCount%60>=30)
		{ObjShot_SetDamage(objShot, damage);}
		else{ObjShot_SetDamage(objShot, 0);}
		ObjStLaser_SetAngle(objShot, CharaDirection*45-90);
		ObjMove_SetX(objShot, GetPlayerX);//x座標設定
		ObjMove_SetY(objShot, GetPlayerY);//y座標設定;
		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 Scale=1.0;

	let Zangle=angle+90;

	ObjRender_SetPosition(obj,GetPlayerX,GetPlayerY,0);

	ObjRender_SetScaleXYZ(obj,1,1,1,);
	let Alpha=0;
	ObjRender_SetColor(obj,255*Alpha,196*Alpha,196*Alpha);
	loop(30)
	{
		if(Obj_IsDeleted(objShot)){break;}
		if(ShotCount%60>=30){Alpha=1;}
		else{Alpha=absolute(cos(ShotCount*3+90));}
		ObjRender_SetColor(obj,255*Alpha,196*Alpha,196*Alpha);
		ObjRender_SetAngleZ(obj,CharaDirection*45-90);
		ObjRender_SetX(obj, GetPlayerX+10*cos(CharaDirection*45-90)+10*dir*cos(CharaDirection*45));//x座標設定
		ObjRender_SetY(obj, GetPlayerY+10*sin(CharaDirection*45-90)+10*dir*sin(CharaDirection*45));//y座標設定;
		yield;
	}
	while(!Obj_IsDeleted(objShot))
	{
		if(ShotCount%60>=30){Alpha=1;}
		else{Alpha=absolute(cos(ShotCount*6));}
		ObjRender_SetColor(obj,255*Alpha,196*Alpha,196*Alpha);
		ObjRender_SetAngleZ(obj,CharaDirection*45-90);
		ObjRender_SetX(obj, GetPlayerX+10*cos(CharaDirection*45-90)+10*dir*cos(CharaDirection*45));//x座標設定
		ObjRender_SetY(obj, GetPlayerY+10*sin(CharaDirection*45-90)+10*dir*sin(CharaDirection*45));//y座標設定;
		yield;
	}

	Obj_Delete(obj);

	}
}
