task OtherModeItemTask
{
	ScoreItemdraw;
	SectionScoreItemdraw;
	OtherModeBombExtend;
	StageDeleteBulletCheck;
	OtherPlayerExtendSystem;
loop
{
	MSDScoreItemCount+=GetPoint;
	MSDSectionScoreItemCount+=GetPoint;
	AddPoint(-GetPoint);
	if(OnBomb)
	{
		if(MSDSectionScoreItemCount>5000)
		{
		MSDSectionScoreItemCount-=trunc(MSDSectionScoreItemCount/5000)+1;
		}
		else if(MSDSectionScoreItemCount>0)
		{
		MSDSectionScoreItemCount-=1;
		}
	}
yield;
}
}

task StageDeleteBulletCheck
{
let Dnum;
let Dx;
let Dy;

loop
{
	if(GetCommonDataDefault("DeleteBulletNum",0)>0)
	{
		Dnum=GetCommonDataDefault("DeleteBulletNum",0);
		Dx=GetCommonDataDefault("DeleteBulletX",0);
		Dy=GetCommonDataDefault("DeleteBulletY",0);
		if(Dnum>200){Dnum=200;}
		MSDScoreItemCount+=Dnum;
		MSDSectionScoreItemCount+=Dnum;
		if(GetTimeOfSuperNaturalBorder==0)
		{
			SpiritCounter+=Dnum/2;
			if(SpiritCounter>1000){SpiritCounter=1000;}
		}
		else
		{
			SpiritRank+=Dnum/2*3;
			if(SpiritRank>10000){SpiritRank=10000;}
		}
		DeleteShotNumdraw(Dnum,Dx,Dy,2);

		SetCommonData("DeleteBulletNum",0);
	}
yield;
}
}

task DeleteShotNumdraw(Dnum,x,y,type)//ボーナスポイント表示のタスク
{
if(IsBossExisting || GetCommonDataDefault("IsMSDBossExisting",false))
{
x=GetPlayerX;
y=GetPlayerY-30;
}
let Bnum=[];
let number=1;
loop(4){Bnum=Bnum~[0];}

Bnum[0]=trunc(Dnum%10);
Bnum[1]=trunc(Dnum%100/10);
Bnum[2]=trunc(Dnum%1000/100);
Bnum[3]=trunc(Dnum%10000/1000);

DeleteBonusnum(x-0*12,y,Bnum[0],type);

ascent(let i in 1..4)
{
	if(Dnum>=10^i)
	{
		DeleteBonusnum(x-i*12,y,Bnum[i],type);
		number=i+1;
	}
}


DeleteBonusnum(x-number*12,y,12,type);

}

task DeleteBonusnum(x,y,num,type)
{
		let Alpha=0;
		let R;let G;let B;
		if(type==1)
		{
			R=255;G=127;B=127;
		}
		if(type==2)
		{
			R=127;G=127;B=255;
		}
		if(type==3)
		{
			R=255;G=255;B=255;
		}
		let scx=0.6;
		let scy=0.6;
		let obj0 = Obj_Create(OBJ_EFFECT);
		ObjEffect_SetTexture(obj0,imgNumber);
		ObjEffect_SetPrimitiveType(obj0, PRIMITIVE_TRIANGLEFAN);
		ObjEffect_SetRenderState(obj0, ADD); 
		ObjEffect_CreateVertex(obj0, 4);
		ObjEffect_SetVertexXY(obj0, 0, -13, -16);
		ObjEffect_SetVertexXY(obj0, 1, 13,  -16);
		ObjEffect_SetVertexXY(obj0, 2, 13, 16);
		ObjEffect_SetVertexXY(obj0, 3,  -13,  16);
		
		ObjEffect_SetVertexUV(obj0, 0,  0+40*num,  6);
		ObjEffect_SetVertexUV(obj0, 1,  26+40*num, 6);
		ObjEffect_SetVertexUV(obj0, 2, 26+40*num,  38);
		ObjEffect_SetVertexUV(obj0, 3, 0+40*num, 38);

		ascent(let i in 0..4)
		{	
			ObjEffect_SetVertexColor(obj0,i,Alpha,R,G,B);
		}
		
		ObjEffect_SetScale(obj0, scx,scy);
		Obj_SetPosition(obj0,x,y+5);
		ObjEffect_SetLayer(obj0,8);
		loop(30)
		{
		ascent(let i in 0..4)
		{	
			ObjEffect_SetVertexColor(obj0,i,Alpha,R,G,B);
		}
		Alpha+=8;
		Obj_SetY(obj0,Obj_GetY(obj0)-0.1);
		yield;
		}
		loop(30)
		{
		Obj_SetY(obj0,Obj_GetY(obj0)-0.1);
		yield;
		}
		loop(30)
		{
		ascent(let i in 0..4)
		{	
			ObjEffect_SetVertexColor(obj0,i,Alpha,R,G,B);
		}
		Obj_SetY(obj0,Obj_GetY(obj0)-0.1);
		Alpha-=8;
		yield;
		}
		Obj_Delete(obj0);
}


task ScoreItemdraw//ボーナスポイント表示のタスク
{
	let bx=GetClipMaxX+190;
	let by=270;
	let bx=GetClipMaxX-20;
	let by=GetClipMinY+12;
wait(5);
while(GetCommonDataDefault("TitleMenu",false)){yield;}
if(GetCommonDataDefault("SELECTEDDIFFICULT","None")=="None")
{return;}
let Bnum=[];
loop(8){Bnum=Bnum~[0];}
loop{
if(IsBossExisting || GetCommonDataDefault("IsMSDBossExisting",false))
{
	if(by<GetClipMinY+32)
	{
	by+=0.5;
	}
}
else
{
	if(by>GetClipMinY+12)
	{
	by-=0.5;
	}
}
Bnum[0]=trunc(MSDScoreItemCount%10);
Bnum[1]=trunc(MSDScoreItemCount%100/10);
Bnum[2]=trunc(MSDScoreItemCount%1000/100);
Bnum[3]=trunc(MSDScoreItemCount%10000/1000);
Bnum[4]=trunc(MSDScoreItemCount%100000/10000);
Bnum[5]=trunc(MSDScoreItemCount%1000000/100000);

Bonusnum(bx,by,Bnum[0],1);

ascent(let i in 1..6)
{
	if(MSDScoreItemCount>=10^i)
	{
		Bonusnum(bx-i*12,by,Bnum[i],1);
	}
}

yield;


}
}

task SectionScoreItemdraw//ボーナスポイント表示のタスク
{
	let bx=GetClipMaxX+190;
	let by=GetClipMinY+227;
	let bx=GetClipMaxX-20;
	let by=GetClipMinY+36;
wait(5);
while(GetCommonDataDefault("TitleMenu",false)){yield;}
if(GetCommonDataDefault("SELECTEDDIFFICULT","None")=="None")
{return;}
let Bnum=[];
loop(8){Bnum=Bnum~[0];}
loop{
if(IsBossExisting || GetCommonDataDefault("IsMSDBossExisting",false))
{
	if(by<GetClipMinY+56)
	{
	by+=0.5;
	}
}
else
{
	if(by>GetClipMinY+36)
	{
	by-=0.5;
	}
}

Bnum[0]=trunc(MSDSectionScoreItemCount%10);
Bnum[1]=trunc(MSDSectionScoreItemCount%100/10);
Bnum[2]=trunc(MSDSectionScoreItemCount%1000/100);
Bnum[3]=trunc(MSDSectionScoreItemCount%10000/1000);
Bnum[4]=trunc(MSDSectionScoreItemCount%100000/10000);
Bnum[5]=trunc(MSDSectionScoreItemCount%1000000/100000);

Bonusnum(bx,by,Bnum[0],0);

ascent(let i in 1..6)
{
	if(MSDSectionScoreItemCount>=10^i)
	{
		Bonusnum(bx-i*12,by,Bnum[i],0);
	}
}

yield;


}
}

task OtherPlayerExtendSystem//エクステンドの設定
{
	while(ScoreNumber2<50){yield;}
	ExtendPlayer(1);
	PlaySE("se\se1UP.wav");
	while(ScoreNumber2<150){yield;}
	ExtendPlayer(1);
	PlaySE("se\se1UP.wav");
	while(ScoreNumber2<300){yield;}
	ExtendPlayer(1);
	PlaySE("se\se1UP.wav");
	while(ScoreNumber2<500){yield;}
	ExtendPlayer(1);
	PlaySE("se\se1UP.wav");
	while(ScoreNumber2<750){yield;}
	ExtendPlayer(1);
	PlaySE("se\se1UP.wav");
}

task OtherModeBombExtend//ボムエクステンド
{
	let BombExtendNum=0;
	let BombExtendCounter=0;
	let Necessary=5000;
	loop
	{
		BombExtendCounter=MSDScoreItemCount-(Necessary*BombExtendNum);
		if(BombExtendCounter>=Necessary)
		{
			BombExtendCounter-=Necessary;
			BombExtendNum+=1;
			BombExtendTask;
		}
		yield;
	}

	task BombExtendTask
	{
		if(OnPlayerMissed)
		{
		while(OnPlayerMissed){yield;}
		wait(15);
		}
		
		PlaySE(SE[4]);
		AddBomb(1);
	}
}