task SetScoreSpell(RightScore){//予定スペルボ−ナス
	let IceScore = GetCommonData("GetIce");		//得点調査
	let Points = GetGraze*100 + IceScore*10;	//追加ポイント
	RightScore = RightScore + Points ;		//ボーナスポイント確定
	if(RightScore >= 10000000){RightScore = 9999999}
	SetCommonData("GetSpellBounus_B",RightScore);
	let PX1=0;
	let PX2=0;
	let PY1=0;
	let PY2=0;
	let S0 = truncate(RightScore/1000000)-truncate(RightScore/10000000)*10;
	let S1 = truncate(RightScore/100000)- truncate(RightScore/1000000)*10;
	let S2 = truncate(RightScore/10000)-  truncate(RightScore/100000)*10;
	let S3 = truncate(RightScore/1000)-   truncate(RightScore/10000)*10;
	let S4 = truncate(RightScore/100)-    truncate(RightScore/1000)*10;
	let S5 = truncate(RightScore/10)-     truncate(RightScore/100)*10;
	let S6 = truncate(RightScore/1)-      truncate(RightScore/10)*10;

	let obj=Obj_Create(OBJ_EFFECT);
	ObjEffect_SetTexture(obj,imgScore);
	ObjEffect_SetPrimitiveType(obj,PRIMITIVE_TRIANGLESTRIP);
	ObjEffect_CreateVertex(obj,4);
	ObjEffect_SetLayer(obj,5);
	Obj_SetPosition(obj,GetCenterX+96,GetCenterY-176);
	ObjEffect_SetVertexXY(obj,0,-37,-7);
	ObjEffect_SetVertexXY(obj,1, 37,-7);
	ObjEffect_SetVertexXY(obj,2,-37, 7);
	ObjEffect_SetVertexXY(obj,3, 37, 7);
	ObjEffect_SetVertexUV(obj,0,158,68);
	ObjEffect_SetVertexUV(obj,1,232,68);
	ObjEffect_SetVertexUV(obj,2,158,83);
	ObjEffect_SetVertexUV(obj,3,232,83);

	let obj0=Obj_Create(OBJ_EFFECT);
	Obj_SetAutoDelete(obj0,false);
	ObjEffect_SetTexture(obj0,imgScore);
	ObjEffect_SetPrimitiveType(obj0,PRIMITIVE_TRIANGLESTRIP);
	ObjEffect_CreateVertex(obj0,4);
	ObjEffect_SetLayer(obj0,5);
	Obj_SetPosition(obj0,GetCenterX+138,GetCenterY-180);

	let obj1=Obj_Create(OBJ_EFFECT);
	Obj_SetAutoDelete(obj1,false);
	ObjEffect_SetTexture(obj1,imgScore);
	ObjEffect_SetPrimitiveType(obj1,PRIMITIVE_TRIANGLESTRIP);
	ObjEffect_CreateVertex(obj1,4);
	ObjEffect_SetLayer(obj1,5);
	Obj_SetPosition(obj1,GetCenterX+145,GetCenterY-180);

	let obj2=Obj_Create(OBJ_EFFECT);
	Obj_SetAutoDelete(obj2,false);
	ObjEffect_SetTexture(obj2,imgScore);
	ObjEffect_SetPrimitiveType(obj2,PRIMITIVE_TRIANGLESTRIP);
	ObjEffect_CreateVertex(obj2,4);
	ObjEffect_SetLayer(obj2,5);
	Obj_SetPosition(obj2,GetCenterX+152,GetCenterY-180);

	let obj3=Obj_Create(OBJ_EFFECT);
	Obj_SetAutoDelete(obj3,false);
	ObjEffect_SetTexture(obj3,imgScore);
	ObjEffect_SetPrimitiveType(obj3,PRIMITIVE_TRIANGLESTRIP);
	ObjEffect_CreateVertex(obj3,4);
	ObjEffect_SetLayer(obj3,5);
	Obj_SetPosition(obj3,GetCenterX+159,GetCenterY-180);

	let obj4=Obj_Create(OBJ_EFFECT);
	Obj_SetAutoDelete(obj4,false);
	ObjEffect_SetTexture(obj4,imgScore);
	ObjEffect_SetPrimitiveType(obj4,PRIMITIVE_TRIANGLESTRIP);
	ObjEffect_CreateVertex(obj4,4);
	ObjEffect_SetLayer(obj4,5);
	Obj_SetPosition(obj4,GetCenterX+166,GetCenterY-180);

	let obj5=Obj_Create(OBJ_EFFECT);
	Obj_SetAutoDelete(obj5,false);
	ObjEffect_SetTexture(obj5,imgScore);
	ObjEffect_SetPrimitiveType(obj5,PRIMITIVE_TRIANGLESTRIP);
	ObjEffect_CreateVertex(obj5,4);
	ObjEffect_SetLayer(obj5,5);
	Obj_SetPosition(obj5,GetCenterX+173,GetCenterY-180);

	let obj6=Obj_Create(OBJ_EFFECT);
	Obj_SetAutoDelete(obj6,false);
	ObjEffect_SetTexture(obj6,imgScore);
	ObjEffect_SetPrimitiveType(obj6,PRIMITIVE_TRIANGLESTRIP);
	ObjEffect_CreateVertex(obj6,4);
	ObjEffect_SetLayer(obj6,5);
	Obj_SetPosition(obj6,GetCenterX+180,GetCenterY-180);
	ascent( let i in 0..4){
		alternative(i)
		case(0){PX1=-5;PY1=-6;}
		case(1){PX1= 5;PY1=-6;}
		case(2){PX1=-5;PY1= 7;}
		case(3){PX1= 5;PY1= 7;}
		ObjEffect_SetVertexXY(obj0,i,PX1,PY1);
		ObjEffect_SetVertexXY(obj1,i,PX1,PY1);
		ObjEffect_SetVertexXY(obj2,i,PX1,PY1);
		ObjEffect_SetVertexXY(obj3,i,PX1,PY1);
		ObjEffect_SetVertexXY(obj4,i,PX1,PY1);
		ObjEffect_SetVertexXY(obj5,i,PX1,PY1);
		ObjEffect_SetVertexXY(obj6,i,PX1,PY1);
	}
	let X=[128,138,148,158,168,178,188,198,208,218];
	loop{
		if(GetMissCountInThisSpell!=0 || GetBombCountInThisSpell!=0){break;}
		S0 = truncate(RightScore/1000000)-truncate(RightScore/10000000)*10;
		S1 = truncate(RightScore/100000)- truncate(RightScore/1000000)*10;
		S2 = truncate(RightScore/10000)-  truncate(RightScore/100000)*10;
		S3 = truncate(RightScore/1000)-   truncate(RightScore/10000)*10;
		S4 = truncate(RightScore/100)-    truncate(RightScore/1000)*10;
		S5 = truncate(RightScore/10)-     truncate(RightScore/100)*10;
		S6 = truncate(RightScore/1)-      truncate(RightScore/10)*10;
		ascent( let i in 0..4){
			alternative(i)
			case(0){PX2= 0;PY2=82; }
			case(1){PX2= 9;PY2=82;}
			case(2){PX2= 0;PY2=95;}
			case(3){PX2= 9;PY2=95;}
			ObjEffect_SetVertexUV(obj0,i,X[S0]+PX2 ,PY2);
			ObjEffect_SetVertexUV(obj1,i,X[S1]+PX2 ,PY2);
			ObjEffect_SetVertexUV(obj2,i,X[S2]+PX2 ,PY2);
			ObjEffect_SetVertexUV(obj3,i,X[S3]+PX2 ,PY2);
			ObjEffect_SetVertexUV(obj4,i,X[S4]+PX2 ,PY2);
			ObjEffect_SetVertexUV(obj5,i,X[S5]+PX2 ,PY2);
			ObjEffect_SetVertexUV(obj6,i,X[S6]+PX2 ,PY2);
		}
		yield;
	}
	Obj_Delete(obj0);
	Obj_Delete(obj1);
	Obj_Delete(obj2);
	Obj_Delete(obj3);
	Obj_Delete(obj4);
	Obj_Delete(obj5);
	S6 = 0;
	ascent( let i in 0..4){
		if(i==0){PX2= 0;PY2=82;}
		if(i==1){PX2= 9;PY2=82;}
		if(i==2){PX2= 0;PY2=95;}
		if(i==3){PX2= 9;PY2=95;}
		ObjEffect_SetVertexUV(obj6,i,X[S6]+PX2 ,PY2);
	}
}

task GetSpellEffect(GetSpellScore){//取得スペルボ−ナス
	if(GetCommonData("REIGEKI") == true){GetSpellScore = GetSpellScore * 1.5;}
	let nun=[];
	AddS_task;
	if(GetSpellScore <10000000){
		ascent(i in 0..7){
			let S=[truncate(GetSpellScore/(1000000/10^i))-truncate(GetSpellScore/(10000000/10^i))*10];
			nun = nun ~ S;
		}
	}
	else{
		ascent(i in 0..8){
			let S=[truncate(GetSpellScore/(10000000/10^i))-truncate(GetSpellScore/(100000000/10^i))*10];
			nun = nun ~ S;
		}
	}
	let obj=Obj_Create(OBJ_EFFECT);
	let a=255;
	ObjEffect_SetTexture(obj,imgSpellBouns);
	ObjEffect_SetPrimitiveType(obj,PRIMITIVE_TRIANGLESTRIP);
	ObjEffect_CreateVertex(obj,4);
	ObjEffect_SetLayer(obj,5);
	ObjEffect_SetVertexXY(obj,0,-127,-15);
	ObjEffect_SetVertexXY(obj,1, 128,-15);
	ObjEffect_SetVertexXY(obj,2,-127, 15);
	ObjEffect_SetVertexXY(obj,3, 128, 15);
	ObjEffect_SetVertexUV(obj,0,  0,0);
	ObjEffect_SetVertexUV(obj,1,255,0);
	ObjEffect_SetVertexUV(obj,2,  0,32);
	ObjEffect_SetVertexUV(obj,3,255,32);
	ObjEffect_SetVertexColor(obj,0,a,255,200,200);
	ObjEffect_SetVertexColor(obj,1,a,255,200,200);
	ObjEffect_SetVertexColor(obj,2,a,255,200,200);
	ObjEffect_SetVertexColor(obj,3,a,255,200,200);
	Obj_SetPosition(obj,GetCenterX,GetCenterY-80);
	let X=[144,128,144,160,176,192,208,224,240,128];
	let Y=[128, 96, 96, 96, 96, 96, 96, 96, 96,128];

	if(GetSpellScore <10000000){
		let PX=-42;
		ascent(i in 0..7){
			Nun(X[nun[i]],Y[nun[i]],PX);
			PX+=14;
			loop(6){yield}
		}
	}
	else{//1000000点以上
		let PX=-49;
		ascent(i in 0..8){
			Nun(X[nun[i]],Y[nun[i]],PX);
			PX+=14;
			loop(5){yield}
		}
	}
	let i=0;
	loop(70){yield}
	loop(20){
		a-=255/20;
		ObjEffect_SetVertexColor(obj,0,a,255,190,190);
		ObjEffect_SetVertexColor(obj,1,a,255,190,190);
		ObjEffect_SetVertexColor(obj,2,a,255,190,190);
		ObjEffect_SetVertexColor(obj,3,a,255,190,190);
		yield;
	}
	Obj_Delete(obj);
	SetCommonData("GetSpell",false);

	task Nun(Nun_X,Nun_Y,PX){
		let PY=60;
		let a=0;
		let obj = Obj_Create(OBJ_EFFECT);
		Obj_SetAutoDelete(obj,false);
		ObjEffect_SetTexture(obj,imgScore);
		ObjEffect_SetPrimitiveType(obj,PRIMITIVE_TRIANGLESTRIP);
		ObjEffect_CreateVertex(obj,4);
		ObjEffect_SetLayer(obj,5);
		ObjEffect_SetVertexXY(obj,0,-8,-16);
		ObjEffect_SetVertexXY(obj,1, 8,-16);
		ObjEffect_SetVertexXY(obj,2,-8, 16);
		ObjEffect_SetVertexXY(obj,3, 8, 16);
		ObjEffect_SetVertexUV(obj,0,Nun_X   ,Nun_Y);
		ObjEffect_SetVertexUV(obj,1,Nun_X+16,Nun_Y);
		ObjEffect_SetVertexUV(obj,2,Nun_X   ,Nun_Y+32);
		ObjEffect_SetVertexUV(obj,3,Nun_X+16,Nun_Y+32);
		Obj_SetPosition(obj,GetCenterX+PX,GetCenterY-PY);
		loop(20){
			a+=255/20;
			PY--;
			ObjEffect_SetVertexColor(obj,0,a,255,255,0);
			ObjEffect_SetVertexColor(obj,1,a,255,255,0);
			ObjEffect_SetVertexColor(obj,2,a,255,255,0);
			ObjEffect_SetVertexColor(obj,3,a,255,255,0);
			Obj_SetPosition(obj,GetCenterX+PX,GetCenterY-PY);
			yield;
		}
		loop(70){yield;}
		loop(20){
			a-=255/20;
			ObjEffect_SetVertexColor(obj,0,a,255,255,0);
			ObjEffect_SetVertexColor(obj,1,a,255,255,0);
			ObjEffect_SetVertexColor(obj,2,a,255,255,0);
			ObjEffect_SetVertexColor(obj,3,a,255,255,0);
			yield;
		}
		Obj_Delete(obj);
	}

	task AddS_task{
		loop(60){
			let S = GetCommonData("Score");
			SetCommonData("Score",S+GetSpellScore/60);
			yield
		}
	}
}