#e[Player]
#ScriptVersion[2]
#Menu[얲@E]
#Text[ Ver2.00

u厇jv

@ucƈk̉Fv
@u_̐_Bv

  \́F
@OCY
@na[v\
  UserL[ŃIvVE^]
#Image[.\img\sui_rei.png]
#ReplayName[Reimu_Yu]

script_player_main
{
	let current = GetCurrentScriptDirectory();
	let img = current~"\img\STG_Player01.png";
	let img2 = current~"\img\Tiiiiilllll.png";
	let img3 = current~"\img\effect_tiny.png";
	let img4 = current~"\img\Spell.png";
	let img5 = current~"\img\bomb.png";
	let img6 = current~"\img\bomb2.png";
	let img10 = current~"\img\bomb3.png";
	let img18 = current~"\img\shot_all.png";
	let count = 0;
	let count2 = 0;
	let count3 = 0;
	let count4 = 0;
	let grazecount = 0;
	let flash = 0;
	let Wkey = 0;
	let Wkey2 = 0;
	let Wkey3 = 0;
	let Wkey4 = 0;
	let Sspe = 35;
	let Sspe2 = 0;
	let Sspe3 = 0;
	let Objx = GetPlayerX();
	let Objy = GetPlayerY();
	let Objr = 66;
	let Objr2 = 66;
	let gra=0;
	let gra2=0;
	let gra3=0;
	let gra4=0;
	let gra5=0;
	let graX=0;
	let graY=0;
	let mo = 255;
	let mo2 = 0;
	let mo3 = 0;
	let mo4 = 0;
	let mo5 = 0;
	let rr = 23;
	let j = 0;
	let alphas = 0;
	let shotCount = -1;
	let bNextShot = false;
	let Sppin = false;
	let OldX=[];
	let OldY=[];
	let maxframe=5;
	ascent(n in 0..maxframe){
    	 	OldX=OldX~[GetPlayerX];
    	 	OldY=OldY~[GetPlayerY];
		}
	let i=0;
	let g=4;

task Shot01(X, Y, Speed, Angle, Damage, Penetlate, Graphic)
{
	let count = 0;
	let obj = Obj_Create(OBJ_SHOT);
	ObjShot_SetGraphic(obj, Graphic);
	ObjShot_SetDamage(obj, Damage);
	Obj_SetPosition(obj, X, Y);
	Obj_SetSpeed(obj, Speed);
	Obj_SetAngle(obj, Angle);
	Obj_SetAutoDelete(obj, true);
	Obj_SetAlpha(obj, 205);
	ObjShot_SetPenetration(obj, 100);
	Obj_SetAutoDelete(obj,false);

	while(!Obj_BeDeleted(obj))
	{
		count++;
		if(Obj_IsIntersected(obj))
		{
		count--;
			Obj_SetSpeed(obj, 5.5);
			if(Graphic >= 2){ObjShot_SetGraphic(obj, Graphic+3);}
			else{ObjShot_SetGraphic(obj, 8);Obj_SetSpeed(obj, 2.5);}
			Obj_SetCollisionToPlayer(obj, false);

			let alpha = 205;
			if(Graphic >= 2){Obj_SetAngle(obj, Angle+rand(-10,10));}

				loop(15)
				{
				alpha-=205/15;
				Obj_SetAlpha(obj, alpha);
				yield;
				}

		Obj_Delete(obj);
		}
		if(count>23)
		{Obj_Delete(obj);}
	yield;
	}
}

task Shot02(X, Y, Speed, Angle, Damage, Penetlate, Graphic)
{
	let count = 0;
	let obj = Obj_Create(OBJ_SHOT);
	ObjShot_SetGraphic(obj, Graphic);
	ObjShot_SetDamage(obj, Damage);
	Obj_SetPosition(obj, X, Y);
	Obj_SetSpeed(obj, Speed);
	Obj_SetAngle(obj, Angle);
	Obj_SetAutoDelete(obj, true);
	Obj_SetAlpha(obj, 255);
	ObjShot_SetPenetration(obj, 100);
	Obj_SetAutoDelete(obj,false);

	while(!Obj_BeDeleted(obj))
	{
		count++;
		if(Obj_IsIntersected(obj))
		{
		count--;Obj_SetPosition(obj, Obj_GetX(obj), Obj_GetY(obj)-18);
			Obj_SetSpeed(obj, 5.5);
			if(Graphic == 9&&Graphic == 10){ObjShot_SetGraphic(obj, 8);}
			else{ObjShot_SetGraphic(obj, 8);Obj_SetSpeed(obj, 2.5);}
			Obj_SetCollisionToPlayer(obj, false);

			Obj_SetAlpha(obj, 111-20*(Graphic==9||Graphic==10));
			let alpha = 111-20*(Graphic==9||Graphic==10);

			if(Graphic >= 2){Obj_SetAngle(obj, Angle+rand(-10,10));}

				loop(15)
				{
				if(Graphic == 9&&Graphic == 10){alpha-=91/15;}
				else{alpha-=111/15;}
				Obj_SetAlpha(obj, alpha);
				yield;
				}

		Obj_Delete(obj);
		}
		if(count>23)
		{Obj_Delete(obj);}
	yield;
	}
}

	@Initialize
	{
		SetPlayerLifeImage(img, 2, 186, 29, 213);
		LoadGraphic(img);
		LoadGraphic(img2);
		LoadGraphic(img3);
		LoadGraphic(img4);
		LoadGraphic(img5);
		LoadGraphic(img6);
		LoadGraphic(img10);
		LoadGraphic(img18);
		LoadSE(current~"\se\Baaaaaaaan.wav");
		LoadSE(current~"\se\puu81.wav");
		LoadSE(current~"\se\graze.wav");
		LoadSE(current~"\se\power27.wav");
		LoadSE(current~"\se\cursor34.wav");
		SetSpeed(5.15, 1.9);SlowEff;
		SetCommonData("ddffffffffrrr",2);
		LoadPlayerShotData(current~"ReimuShotData.txt");
		SetAutoEffect(false);
	}
	
	@MainLoop
	{	
		OldX[i]=GetPlayerX;
		OldY[i]=GetPlayerY;
		Objx=OldX[g];
		Objy=OldY[g];
		if(Wkey4>0){
		Objx=GetPlayerX();
		Objy=GetPlayerY();
		Wkey4--;}
		i++;
		g++;
		if(i>=maxframe){i=0;}
		if(g>=maxframe){g=0;}

		if(OnMissed==true){j=1;Wkey4=5;}else{if(j>=1){Sppin=false;gra4=255;gra5=0;}j=0;}

		if(!OnMissed&&Wkey2==0){

		SetSpeed(5.15, 1.9);
		if(gra3-GetGraze()<0){gra++;gra2=18;}
		gra3=GetGraze();
		if(gra>16){gra=16;}
		if(gra>0&&gra2<0){gra--;gra2=18;}
		gra2--;
		if(gra>10&&count2%4==0){CollectItems;}

		if(count<110){gra=16;}
		if(count==110){gra=0;}
		if(OnBomb==true||grazecount>0){gra=12;}
		if(GetPlayerY()<=166){gra=11;}

		SetItemCollectLine(166*((gra-10)/10)+GetPlayerY()*(gra/10));

		if((GetKeyState(VK_SHOT)==KEY_PUSH || GetKeyState(VK_SHOT)==KEY_HOLD || bNextShot==true) && shotCount>=-1)
		{
			shotCount = 1;
			bNextShot = false;
		}
		if(GetKeyState(VK_SHOT)==KEY_HOLD && shotCount>-1)
		{
			bNextShot = true;
		}

		if(GetKeyState(VK_SLOWMOVE)==KEY_HOLD&&Sppin==false&&gra5<=0)
		{
			if(mo2<255){mo2+=24;}
			if(mo2>=211){mo2=211;}
			if(Objr>rr){Objr-=7;}
			if(Objr<=rr){Objr=rr;}
			if(Sspe<36){Sspe+=0.1;}
		}
		if(GetKeyState(VK_SLOWMOVE)!=KEY_HOLD&&Sppin==false&&gra5<=0)
		{
			if(mo2>0){mo2-=16;}
			if(mo2<=0){mo2=0;}
			if(Objr<60){Objr+=7;}
			if(Objr>=60){Objr=60;}
			if(Sspe>36){Sspe-=0.1;}
		}


		if(gra<=10){
		if(shotCount>=0&&count2%3==0&&Sppin==false)
		{
			Shot02(GetPlayerX()+8.5, GetPlayerY()+32, 23, 270, 1.3, 1, 10);
			Shot02(GetPlayerX()-8.25, GetPlayerY()+32, 23, 270, 1.3, 1, 9);
		}
		if(shotCount>=0&&count2%3==0&&Sppin==true)
		{
			Shot02(GetPlayerX()+8.5, GetPlayerY()+32, 23, 270, 2.2, 1, 11);
			Shot02(GetPlayerX()-8.25, GetPlayerY()+32, 23, 270, 2.2, 1, 1);
		}
		if(shotCount>=0&&count2%3==0&&Sppin==false&&gra4>=64)
		{	
		if(Wkey4>0){
		Objx=GetPlayerX()-1;Objy=GetPlayerY();}
		OldX[i]=GetPlayerX;
		OldY[i]=GetPlayerY;
			ascent(let t in 0..4){  Shot01(Objx+6+(Objr+0.5)*cos(count3*5+t*90),Objy+(Objr+0.5)*sin(count3*5+t*90)+6, 24.5-2*((Objr-rr)/90), 270+2*cos(count3*5+t*90)*((Objr-rr)/90), 1.1, rand_int(2,2), 4);
						Shot01(Objx-6+(Objr+0.5)*cos(count3*5+t*90),Objy+(Objr+0.5)*sin(count3*5+t*90)+6, 24.5-2*((Objr-rr)/90), 270+2*cos(count3*5+t*90)*((Objr-rr)/90), 1.1, rand_int(2,2), 3);
				if(Objr!=rr&&GetPlayerX()<122){Shot01(Objx+Objr*cos(count3*5+t*90)+400,Objy+Objr*sin(count3*5+t*90), 24.5-2*((Objr-rr)/90), 270+2*cos(count3*5+t*90)*((Objr-rr)/90), 0.7, 2, 2);}
				if(Objr!=rr&&GetPlayerX()>336){Shot01(Objx+Objr*cos(count3*5+t*90)-400,Objy+Objr*sin(count3*5+t*90), 24.5-2*((Objr-rr)/90), 270+2*cos(count3*5+t*90)*((Objr-rr)/90), 0.7, 2, 2);}}
		}
		if(shotCount>=0&&count2%3==0&&Sppin==true&&gra5>64)
		{	
		if(Wkey4>0){
		Objx=GetPlayerX()-1;Objy=GetPlayerY();}
		OldX[i]=GetPlayerX;
		OldY[i]=GetPlayerY;
			ascent(let t in 0..4){  Shot01(graX+6+(Objr2+0.5)*cos(count3*5+t*90),graY+(Objr2+0.5)*sin(count3*5+t*90)+6, 22.5, 270, 0.8, rand_int(2,2), 4);
						Shot01(graX-6+(Objr2+0.5)*cos(count3*5+t*90),graY+(Objr2+0.5)*sin(count3*5+t*90)+6, 22.5, 270, 0.8, rand_int(2,2), 3);
				if(Objr2!=rr&&graX<122){Shot01(graX+Objr2*cos(count3*5+t*90)+400,graY+Objr2*sin(count3*5+t*90), 22.5, 270, 0.6, 2, 2);}
				if(Objr2!=rr&&graX>336){Shot01(graX+Objr2*cos(count3*5+t*90)-400,graY+Objr2*sin(count3*5+t*90), 22.5, 270, 0.6, 2, 2);}}
		}
		}



		else{
		SetSpeed(5.15, 1.9);
		if(shotCount>=0&&count2%3==0&&Sppin==false)
		{
			Shot02(GetPlayerX()+8.5, GetPlayerY()+32, 23, 270, 3, 1, 20);
			Shot02(GetPlayerX()-6.25, GetPlayerY()+32, 23, 270, 3, 1, 19);
		}
		if(shotCount>=0&&count2%3==0&&Sppin==true)
		{
			Shot02(GetPlayerX()+8.5, GetPlayerY()+32, 23, 270, 2, 1, 21);
			Shot02(GetPlayerX()-6.25, GetPlayerY()+32, 23, 270, 2, 1, 12);
			Shot02(GetPlayerX()+8.5, GetPlayerY()+32, 23, 290, 1.5, 1, 21);
			Shot02(GetPlayerX()-6.25, GetPlayerY()+32, 23, 250, 1.5, 1, 12);
		}
		if(shotCount>=0&&count2%3==0&&Sppin==false&&gra4>=64)
		{	
		if(Wkey4>0){
		Objx=GetPlayerX()-1;Objy=GetPlayerY();}
		OldX[i]=GetPlayerX;
		OldY[i]=GetPlayerY;
			ascent(let t in 0..4){  Shot01(Objx+6+(Objr+0.5)*cos(count3*5+t*90),Objy+(Objr+0.5)*sin(count3*5+t*90)+6, 22.5, 270+0*cos(count3*5+t*90), 0.7, 2, 24);
						Shot01(Objx-6+(Objr+0.5)*cos(count3*5+t*90),Objy+(Objr+0.5)*sin(count3*5+t*90)+6, 22.5, 270+0*cos(count3*5+t*90), 0.7, 2, 23);
						Shot01(Objx+6+(Objr+0.5)*cos(count3*5+t*90),Objy+(Objr+0.5)*sin(count3*5+t*90)+6, 22.5, 270+0*cos(count3*5+t*90), 0.7, 2, 24);
						Shot01(Objx-6+(Objr+0.5)*cos(count3*5+t*90),Objy+(Objr+0.5)*sin(count3*5+t*90)+6, 22.5, 270+0*cos(count3*5+t*90), 0.7, 2, 23);
				if(Objr!=rr&&GetPlayerX()<122){Shot01(Objx+Objr*cos(count3*5+t*90)+400,Objy+Objr*sin(count3*5+t*90), 22.5, 270+2*cos(count3*5+t*90), 0.9, 2, 22);}
				if(Objr!=rr&&GetPlayerX()>336){Shot01(Objx+Objr*cos(count3*5+t*90)-400,Objy+Objr*sin(count3*5+t*90), 22.5, 270+2*cos(count3*5+t*90), 0.9, 2, 22);}}
		}
		if(shotCount>=0&&count2%3==0&&Sppin==true&&gra5>64)
		{	
		if(Wkey4>0){
		Objx=GetPlayerX()-1;Objy=GetPlayerY();}
		OldX[i]=GetPlayerX;
		OldY[i]=GetPlayerY;
			ascent(let t in 0..4){  Shot01(graX+6+(Objr2+0.5)*cos(count3*5+t*90),graY+(Objr2+0.5)*sin(count3*5+t*90)+6, 22.5, 270+22*cos(count3*5+t*90), 1.1, rand_int(2,2), 24);
						Shot01(graX-6+(Objr2+0.5)*cos(count3*5+t*90),graY+(Objr2+0.5)*sin(count3*5+t*90)+6, 22.5, 270+22*cos(count3*5+t*90), 1.1, rand_int(2,2), 23);
						Shot01(graX+6+(Objr2+0.5)*cos(count3*5+t*90),graY+(Objr2+0.5)*sin(count3*5+t*90)+6, 22.5, 270, 1.1, rand_int(2,2), 24);
						Shot01(graX-6+(Objr2+0.5)*cos(count3*5+t*90),graY+(Objr2+0.5)*sin(count3*5+t*90)+6, 22.5, 270, 1.1, rand_int(2,2), 23);
				if(Objr2!=rr&&graX<122){Shot01(graX+Objr2*cos(count3*5+t*90)+400,graY+Objr2*sin(count3*5+t*90), 22.5, 270, 1.1, 2, 22);
							Shot01(graX+6+Objr2*cos(count3*5+t*90)+400,graY+Objr2*sin(count3*5+t*90), 22.5, 270+22*cos(count3*5+t*90), 1.1, 1, 24);
							Shot01(graX-6+Objr2*cos(count3*5+t*90)+400,graY+Objr2*sin(count3*5+t*90), 22.5, 270+22*cos(count3*5+t*90), 1.1, 1, 23);}
				if(Objr2!=rr&&graX>336){Shot01(graX+Objr2*cos(count3*5+t*90)-400,graY+Objr2*sin(count3*5+t*90), 22.5, 270, 1.1, 2, 22);
							Shot01(graX+6+Objr2*cos(count3*5+t*90)-400,graY+Objr2*sin(count3*5+t*90), 22.5, 270+22*cos(count3*5+t*90), 1.1, 1, 24);
							Shot01(graX-6+Objr2*cos(count3*5+t*90)-400,graY+Objr2*sin(count3*5+t*90), 22.5, 270+22*cos(count3*5+t*90), 1.1, 1, 23);}}
		}
		}


		if(shotCount >= 0)
		{
			shotCount++;
		}
		if(shotCount == 6)
		{
			shotCount=-1;
		}
		if(grazecount<=0){SetIntersectionCircle(GetPlayerX, GetPlayerY, 0);}
		SetGrazeCircle(54);

	
		if(GetTimeOfSuperNaturalBorder()>0){grazecount=120;}
		if(grazecount>0){grazecount--;SetGrazeCircle(80);
		if(GetEnemyShotCountEx(GetPlayerX,GetPlayerY,12,ALL)<=0)
		{SetIntersectionCircle(GetPlayerX,GetPlayerY,0);
		 DeleteEnemyShotInCircle(ALL,GetPlayerX, GetPlayerY,5)}
		else{if(count2%3==0){PlaySE(current~"\se\graze.wav");AGraze(int(GetEnemyShotCountEx(GetPlayerX,GetPlayerY,22,ALL)/4));
		if(int(GetEnemyShotCountEx(GetPlayerX,GetPlayerY,22,ALL)/4)<=0){AGraze(1);}}}}

		if(GetTimeOfSuperNaturalBorder()<=0&&GetKeyState(VK_SLOWMOVE)!=KEY_HOLD&&GetKeyState(VK_SHOT)!=KEY_HOLD&&GetKeyState(VK_LEFT)==KEY_PUSH&&GetPlayerX()<=45&&Wkey>0){Wkey2=1;}
		if(GetTimeOfSuperNaturalBorder()<=0&&GetKeyState(VK_SLOWMOVE)!=KEY_HOLD&&GetKeyState(VK_SHOT)!=KEY_HOLD&&GetKeyState(VK_RIGHT)==KEY_PUSH&&GetPlayerX()>=403&&Wkey>0){Wkey2=2;}

		if(GetTimeOfSuperNaturalBorder()<=0&&GetKeyState(VK_SLOWMOVE)!=KEY_HOLD&&GetKeyState(VK_SHOT)!=KEY_HOLD&&GetKeyState(VK_LEFT)==KEY_PUSH&&GetPlayerX()<=85){Wkey=24;}
		if(GetTimeOfSuperNaturalBorder()<=0&&GetKeyState(VK_SLOWMOVE)!=KEY_HOLD&&GetKeyState(VK_SHOT)!=KEY_HOLD&&GetKeyState(VK_RIGHT)==KEY_PUSH&&GetPlayerX()>=363){Wkey=24;}

		Wkey3=0;

		if(OnBomb!=true&&GetTimeOfSuperNaturalBorder()<=0){if(GetKeyState(VK_USER)==KEY_PUSH){PlaySE(current~"\se\cursor34.wav");if(Sppin==false){Sppin=true;Objr2=Objr;graX=Objx;graY=Objy;}else{Sppin=false;}}}
		if(Sppin==true){if(mo2>0){mo2-=16;}if(mo2<=0){mo2=0;}if(Sspe>36){Sspe-=0.1;}}

		}

		if(!OnMissed&&Wkey2>0){

		if(GetTimeOfSuperNaturalBorder()<=0&&GetKeyState(VK_SLOWMOVE)!=KEY_HOLD&&GetKeyState(VK_SHOT)!=KEY_HOLD&&GetKeyState(VK_LEFT)==KEY_PUSH&&GetPlayerX()>=383){Wkey=24;}
		if(GetTimeOfSuperNaturalBorder()<=0&&GetKeyState(VK_SLOWMOVE)!=KEY_HOLD&&GetKeyState(VK_SHOT)!=KEY_HOLD&&GetKeyState(VK_RIGHT)==KEY_PUSH&&GetPlayerX()<=65){Wkey=24;}

		SetSpeed(0,0);
		if(Wkey3==0){PlaySE(current~"\se\power27.wav");}
		if(Wkey3==12){Wkey4=20;}

		if(Wkey2==1){Objx=GetPlayerX()-1-Wkey3*1.5;}
		if(Wkey2==2){Objx=GetPlayerX()-1+Wkey3*1.5;}

		if(Wkey3>=27&&Wkey2==1){SetX(GetPlayerX()+400);Wkey2=0;}
		if(Wkey3>=27&&Wkey2==2){SetX(GetPlayerX()-400);Wkey2=0;}

		Wkey3++;
		}

	if(mo5>10){SetX(graX);SetY(graY);SetSpeed(0, 0);Sppin=false;}


	if(gra4<255&&Sppin==false&&OnMissed==false){gra4+=10;}
	if(gra4>255&&Sppin==false&&OnMissed==false){gra4=255;}
	if(gra4>0&&Sppin==true){gra4-=255;}
	if(gra4<0&&Sppin==true){gra4=0;}

	if(gra5<255&&Sppin==true&&OnMissed==false){gra5+=255;}
	if(gra5>255&&Sppin==true&&OnMissed==false){gra5=255;}
	if(gra5>0&&Sppin==false){gra5-=10;}
	if(gra5<0&&Sppin==false){gra5=0;}

	if(OnBomb==true&&GetTimeOfSuperNaturalBorder()>0)
	{flash=80;mo3++;if(mo3>140){mo4++;}if(Sspe2<70){Sspe2++;}}
	else{flash--;mo3=0;mo4=0;}

	if(mo5>0){mo5-=3;}

	count++;count2++;count3+=(0.66-0.5*(Sppin==true));count4+=1.14;grazecount--;Wkey--;SetRateScoreSystemEnable(false);
	yield;
	}

	@Missed
	{
	gra=0;
	gra4=0;
	gra5=0;
	Wkey2=0;
	count=0;
	count2=0;
	count3=0;
	count4=0;
	//Sppin=false;
	MainLoop
	}

	@SpellCard
	{	
		if(Sppin==false){UseSpellCard("Demarcation", false);Dark(2);}
		else{UseSpellCard("Demarcation2", false);Dark(255);mo5=100;}
		flash=0;
	}
	
	@DrawLoop
	{
		if(Sspe2>10)
		{
		SetTexture(img4);
		SetColor(155, 155, 155);
		SetGraphicScale((Sspe2-10)/50,1);
		SetGraphicAngle(0,0,0);
		SetAlpha(255);
		SetRenderState(ADD);
		SetGraphicRect(0,0,384,1464);
		DrawGraphic(GetCenterX()+rand(-8-mo3*0.01,8+mo3*0.01),GetCenterY()-(count*8%488)+rand(-8-mo3*0.01,8+mo3*0.01));
		DrawGraphic(GetCenterX()+rand(-8-mo3*0.01,8+mo3*0.01),GetCenterY()-(count*18%488)+rand(-8-mo3*0.01,8+mo3*0.01));
		}

		if(flash>0&&flash<80)
		{
		SetTexture(img10);
		SetGraphicAngle(0,0,0);
		SetAlpha(255-255/80*flash);
		SetGraphicRect(0,0,256,256);
		SetRenderState(ADD);
		SetColor(255/80*flash, 255/80*flash, 255/80*flash);
		SetGraphicScale(12,12);
		DrawGraphic(GetCenterX(),GetCenterY());
		SetRenderState(SUBTRACT);
		SetGraphicScale(2.2/80*(80-flash),2.2/80*(80-flash));
		DrawGraphic(GetCenterX(),GetCenterY());
		SetColor(255/80*flash, 255/80*flash, 255/80*flash);
		SetGraphicScale(3/80*flash,3/80*flash);
		DrawGraphic(GetCenterX()+rand(-12,12),GetCenterY()+rand(-12,12));
		SetGraphicScale(1/80*(80-flash),1/80*(80-flash));
		DrawGraphic(GetCenterX(),GetCenterY());
		SetGraphicScale(5/80*(80-flash),5/80*(80-flash));
		DrawGraphic(GetCenterX(),GetCenterY());
		SetTexture(img5);
		SetColor(255/80*flash, 255/80*flash, 255/80*flash);
		SetGraphicScale(1,1);
		SetGraphicAngle(0,0,0);
		SetRenderState(ALPHA);
		SetAlpha(255/80*flash);
		SetGraphicRect(0,0,512,512);
		DrawGraphic(GetCenterX(),GetCenterY());Sspe2=0;
		}

		if(OnBomb==true&&GetTimeOfSuperNaturalBorder()>0)
		{

		SetTexture(img6);
		SetAlpha(Sspe2*2.55);
		SetRenderState(ADD);
		SetGraphicRect(0,0,512,256);
		SetGraphicScale((Sspe2-10)/110+mo3*0.005,(Sspe2-10)/110+mo3*0.005);
		SetGraphicAngle(0,0,count*2.8-1320*(1-cos(mo4)));
		SetColor(Sspe2*2.15, Sspe2*2.15, Sspe2*2.15);
		DrawGraphic(GetCenterX()+rand(-8-mo3*0.01,8+mo3*0.01),GetCenterY()-190+26+rand(-8-mo3*0.01,8+mo3*0.01));
		SetGraphicAngle(0,0,count*4.2-1300*(1-cos(mo4)));
		SetColor(Sspe2*2.35, Sspe2*2.35, Sspe2*2.35);
		SetGraphicScale((Sspe2-10)/80+mo3*0.0066,(Sspe2-10)/80+mo3*0.0066);
		DrawGraphic(GetCenterX()+rand(-8-mo3*0.02,8+mo3*0.02),GetCenterY()-70+26+rand(-8-mo3*0.02,8+mo3*0.03));
		SetGraphicAngle(0,0,count*7-1310*(1-cos(mo4)));
		SetColor(Sspe2*2.55, Sspe2*2.55, Sspe2*2.55);
		SetGraphicScale((Sspe2-10)/50+mo3*0.007,(Sspe2-10)/50+mo3*0.007);
		DrawGraphic(GetCenterX()+rand(-8-mo3*0.03,8+mo3*0.03),GetCenterY()+125+26+rand(-8-mo3*0.02,8+mo3*0.03));
		SetTexture(img10);
		SetGraphicAngle(0,0,50+count*7.4+1200*(1-cos(mo4)));
		SetGraphicRect(0,0,256,256);
		SetRenderState(ADD);
		SetColor(Sspe2*2.8, Sspe2*2.8, Sspe2*2.8);
		SetGraphicScale(0.68*sin(Sspe2+20)+mo3*0.002-1.5*(1-cos(mo4)),0.72*sin(Sspe2+2)+mo3*0.002-1.5*(1-cos(mo4)));
		DrawGraphic(GetCenterX()+rand(-mo3*0.03,mo3*0.03),GetCenterY()-6+rand(-mo3*0.05,mo3*0.05));
		}

		if(Sspe2<50)
		{
		SetTexture(img5);
		SetColor(255, 255, 255);
		SetGraphicScale(0.1/Sspe2-0.1,5);
		SetGraphicAngle(0,0,0);
		SetAlpha(255-5*Sspe2);
		SetRenderState(ALPHA);
		SetGraphicRect(0,0,512,512);
		DrawGraphic(GetCenterX(),500);
		}

		if(mo2>0)
		{
		SetTexture(img3);
		SetColor(255, 255, 255);
		SetAlpha(mo2);
		SetRenderState(ALPHA);
		SetGraphicRect(64, 104, 128, 168);
		SetGraphicAngle(0,0,-count*7);
		SetGraphicScale(0.2+mo2*0.0035,0.2+mo2*0.0035);
		DrawGraphic(GetPlayerX()+1, GetPlayerY()+1);
		}

		SetTexture(img);
		SetColor(255, 255, 255);
		if(grazecount>0&&GetTimeOfSuperNaturalBorder()>0){SetColor(100-(count%7)*12, 0, 255-(count%6)*64);}
		if(Wkey2>0&&count%3==0){SetColor(0, 0, 0);}
		if(GetTimeOfPlayerInvincibility>0&&count%4<=1){SetColor(0, 0, 0);}
		SetAlpha(255);
		SetGraphicScale(1,1);
		SetGraphicAngle(0,0,0);
		SetRenderState(ALPHA);
		if(GetKeyState(VK_LEFT)==KEY_PUSH || GetKeyState(VK_LEFT)==KEY_HOLD)
		{
			SetGraphicRect(0, 48, 48, 96);
		}
		else if(GetKeyState(VK_RIGHT)==KEY_PUSH || GetKeyState(VK_RIGHT)==KEY_HOLD)
		{
			SetGraphicRect(0, 96, 48, 144);
		}
		else 
		{
			SetGraphicRect(0, 0, 48, 48);
		}
		if(Wkey2>0){SetGraphicRect(0, 0, 48, 48);DrawGraphic(Objx,Objy);}
		else{DrawGraphic(GetPlayerX(),GetPlayerY());}
		if(GetPlayerX()<122&&Wkey2>0){DrawGraphic(Objx+1+400,Objy);}
		if(GetPlayerX()>336&&Wkey2>0){DrawGraphic(Objx+1-400,Objy);}

		if(gra4>0)
		{
		SetColor(255, 255, 255);
		SetAlpha(gra4/2);
		SetGraphicScale(1.4,1.4);
		SetRenderState(ALPHA);
		SetGraphicRect(0, 158,20, 178);
		ascent(let t in 0..4){SetGraphicAngle(0,0,count*8+t*90);
		DrawGraphic(Objx+(Objr-2)*cos(count3*5+t*90),Objy+1+(Objr-2)*sin(count3*5+t*90));
		if(GetPlayerX()<122||Wkey3>=27){DrawGraphic(Objx+(Objr-2)*cos(count3*5+t*90)+400,Objy+(Objr-2)*sin(count3*5+t*90));}
		if(GetPlayerX()>336||Wkey3>=27){DrawGraphic(Objx+(Objr-2)*cos(count3*5+t*90)-400,Objy+(Objr-2)*sin(count3*5+t*90));}}
		SetAlpha(gra4);
		SetGraphicScale(1.0,1.0);
		ascent(let t in 0..4){SetGraphicAngle(0,0,-count*8+t*90);
		DrawGraphic(Objx+(Objr-2)*cos(count3*5+t*90),Objy+1+(Objr-2)*sin(count3*5+t*90));
		if(GetPlayerX()<122||Wkey3>=27){DrawGraphic(Objx+(Objr-2)*cos(count3*5+t*90)+400,Objy+(Objr-2)*sin(count3*5+t*90));}
		if(GetPlayerX()>336||Wkey3>=27){DrawGraphic(Objx+(Objr-2)*cos(count3*5+t*90)-400,Objy+(Objr-2)*sin(count3*5+t*90));}}
		}

		if(gra5>0)
		{
		SetColor(255, 255, 255);
		SetAlpha(gra5/2);
		SetGraphicScale(1.4,1.4);
		SetRenderState(ALPHA);
		SetGraphicRect(0, 158,20, 178);
		ascent(let t in 0..4){SetGraphicAngle(0,0,count3*8+t*90);
		DrawGraphic(graX+(Objr-2)*cos(count3*5+t*90),graY+(Objr-2)*sin(count3*5+t*90));
		if(graX<122){DrawGraphic(graX+(Objr2-2)*cos(count3*5+t*90)+400,graY+(Objr2-2)*sin(count3*5+t*90));}
		if(graX>336){DrawGraphic(graX+(Objr2-2)*cos(count3*5+t*90)-400,graY+(Objr2-2)*sin(count3*5+t*90));}}
		SetGraphicScale(1.0,1.0);
		SetAlpha(gra5);
		ascent(let t in 0..4){SetGraphicAngle(0,0,-count3*8+t*90);
		DrawGraphic(graX+(Objr-2)*cos(count3*5+t*90),graY+(Objr-2)*sin(count3*5+t*90));
		if(graX<122){DrawGraphic(graX+(Objr2-2)*cos(count3*5+t*90)+400,graY+(Objr2-2)*sin(count3*5+t*90));}
		if(graX>336){DrawGraphic(graX+(Objr2-2)*cos(count3*5+t*90)-400,graY+(Objr2-2)*sin(count3*5+t*90));}}
		}

		SetTexture(img2);SetGraphicAngle(0,0,0);
		if(gra<=10){SetGraphicRect(0,32*gra,64,32+32*gra);}
		if(gra<=0){SetGraphicRect(0,0,64,32);}
		if(gra>10&&count4%8>=0){SetGraphicRect(0,352,64,383);}
		if(gra>10&&count4%8>=4){SetGraphicRect(0,383,64,416);}
		SetGraphicScale(1,1);SetAlpha(255);SetColor(mo,mo,mo);
		if(GetPlayerX()<160&&GetPlayerY()>332){if(mo>50){mo-=4;}}
		if(GetPlayerX()>=160||GetPlayerY()<=332){if(mo<255){mo+=4;}}
		SetRenderState(ADD);
		DrawGraphic(74,440);

		if(mo5>0)
		{
		SetTexture(img10);
		SetColor(255, 255, 255);
		SetGraphicScale(0.5*mo5/100,0.5*mo5/100);
		SetGraphicAngle(0,0,0);
		SetAlpha(255);
		SetRenderState(ADD);
		SetGraphicRect(0,0,256,256);
		DrawGraphic(GetPlayerX(),GetPlayerY());
		if(mo5>90){//GAON(GetPlayerX(),GetPlayerY());
		SetRenderState(ALPHA);
		SetColor(125, 125, 125);
		SetGraphicScale(8,8);
		DrawGraphic(GetPlayerX(),GetPlayerY());}
		}

		SetRenderState(ALPHA);
		SetAlpha(0);
	}
	
	@Finalize
	{
		DeleteGraphic(img);
		DeleteGraphic(img2);
		DeleteGraphic(img3);
		DeleteGraphic(img4);
		DeleteGraphic(img5);
		DeleteGraphic(img6);
		DeleteGraphic(img10);
		DeleteGraphic(img18);
		DeleteSE(current~"\se\Baaaaaaaan.wav");
		DeleteSE(current~"\se\puu81.wav");
		DeleteSE(current~"\se\graze.wav");
		DeleteSE(current~"\se\power27.wav");
		DeleteSE(current~"\se\cursor34.wav");
		DeleteCommonData("ddffffffffrrr");
	}

task SlowEff()
{
	let alpha = 0;
	let obj = Obj_Create(OBJ_EFFECT);
	Obj_SetX(obj, GetPlayerX+(GetKeyState(VK_RIGHT)==KEY_HOLD)-(GetKeyState(VK_LEFT)==KEY_HOLD));
	Obj_SetY(obj, GetPlayerY-(GetKeyState(VK_UP)==KEY_HOLD)+(GetKeyState(VK_DOWN)==KEY_HOLD));
	Obj_SetSpeed(obj, 0);//xݒ
	ObjEffect_SetTexture(obj, img18);//摜ݒ
	ObjEffect_SetRenderState(obj, ALPHA);//`@
	ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLESTRIP);
	ObjEffect_SetScale(obj,0.52,0.5);//g嗦w
	ObjEffect_SetAngle(obj,0,0,0);//]px
	ObjEffect_CreateVertex(obj, 4);//_4
	ObjEffect_SetLayer(obj,5);
	
	//lp`Ɋe_̍Wݒ
	ObjEffect_SetVertexXY(obj, 0, -14, -13.75);
	ObjEffect_SetVertexXY(obj, 1, -14,  13.75);
	ObjEffect_SetVertexXY(obj, 2,  14, -13.75);
	ObjEffect_SetVertexXY(obj, 3,  14,  13.75);
	
	//lp`Ɋe_UVlݒ
	ObjEffect_SetVertexUV(obj, 0,  0,290);
	ObjEffect_SetVertexUV(obj, 1,  0,317);
	ObjEffect_SetVertexUV(obj, 2, 28,290);
	ObjEffect_SetVertexUV(obj, 3, 28,317);

	while(!Obj_BeDeleted(obj))
	{//폜܂Ń[vs

		Obj_SetX(obj, GetPlayerX);
		Obj_SetY(obj, GetPlayerY);
		if(OnMissed==false){if(GetKeyState(VK_SLOWMOVE)==KEY_HOLD){if(alpha<255){alpha+=124;}else{alpha=255;}}
		else{if(alpha>0){alpha-=8;}else{alpha=0;}}
		if(GetPlayerX>48&&GetPlayerX<400&&GetPlayerY>36&&GetPlayerY<444){
		Obj_SetX(obj, GetPlayerX+((GetKeyState(VK_RIGHT)==KEY_HOLD)*1.9-((GetKeyState(VK_UP)==KEY_HOLD||GetKeyState(VK_DOWN)==KEY_HOLD)&&GetKeyState(VK_RIGHT)==KEY_HOLD)*1.37)-((GetKeyState(VK_LEFT)==KEY_HOLD)*1.9-((GetKeyState(VK_UP)==KEY_HOLD||GetKeyState(VK_DOWN)==KEY_HOLD)&&GetKeyState(VK_LEFT)==KEY_HOLD)*1.37));
		Obj_SetY(obj, GetPlayerY-((GetKeyState(VK_UP)==KEY_HOLD)*1.9-((GetKeyState(VK_RIGHT)==KEY_HOLD||GetKeyState(VK_LEFT)==KEY_HOLD)&&GetKeyState(VK_UP)==KEY_HOLD)*1.37)+((GetKeyState(VK_DOWN)==KEY_HOLD)*1.9-((GetKeyState(VK_RIGHT)==KEY_HOLD||GetKeyState(VK_LEFT)==KEY_HOLD)&&GetKeyState(VK_DOWN)==KEY_HOLD)*1.37));}}
		else{alpha-=8;}

		ObjEffect_SetVertexColor(obj, 0, alpha, 255, 255, 255);
		ObjEffect_SetVertexColor(obj, 1, alpha, 255, 255, 255);
		ObjEffect_SetVertexColor(obj, 2, alpha, 255, 255, 255);
		ObjEffect_SetVertexColor(obj, 3, alpha, 255, 255, 255);

		yield;
	}

}

task Dark(tu)
{
	let alpha = tu;
	let obj = Obj_Create(OBJ_EFFECT);
	Obj_SetX(obj, GetCenterX);
	Obj_SetY(obj, GetCenterY);
	Obj_SetSpeed(obj, 0);//xݒ
	ObjEffect_SetTexture(obj, img5);//摜ݒ
	ObjEffect_SetRenderState(obj, SUBTRACT);//`@
	ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLESTRIP);
	ObjEffect_SetScale(obj,1,1);//g嗦w
	ObjEffect_SetAngle(obj,0,0,0);//]px
	ObjEffect_CreateVertex(obj, 4);//_4
	ObjEffect_SetLayer(obj,1);

	//lp`Ɋe_̍Wݒ
	ObjEffect_SetVertexXY(obj, 0, -512, -512);
	ObjEffect_SetVertexXY(obj, 1, -512,  512);
	ObjEffect_SetVertexXY(obj, 2,  512, -512);
	ObjEffect_SetVertexXY(obj, 3,  512,  512);
	
	//lp`Ɋe_UVlݒ
	ObjEffect_SetVertexUV(obj, 0,   0,  0);
	ObjEffect_SetVertexUV(obj, 1,   0,256);
	ObjEffect_SetVertexUV(obj, 2, 256,  0);
	ObjEffect_SetVertexUV(obj, 3, 256,256);

	while(!Obj_BeDeleted(obj))
	{//폜܂Ń[vs

		if(OnBomb==true){if(alpha<255){alpha+=8;}else{alpha=255;}}
		else{if(alpha>0){alpha-=5;}else{alpha=0;}}
		ObjEffect_SetVertexColor(obj, 0, alpha, 255, 255, 255);
		ObjEffect_SetVertexColor(obj, 1, alpha, 255, 255, 255);
		ObjEffect_SetVertexColor(obj, 2, alpha, 255, 255, 255);
		ObjEffect_SetVertexColor(obj, 3, alpha, 255, 255, 255);
		Obj_SetX(obj, GetCenterX);
		Obj_SetY(obj, GetCenterY);

		yield;
	}

	if(alpha<=0)
	{Obj_Delete(obj);}
}

task AGraze(ag)
{AddGraze(ag);}

}

script_spell Demarcation
{
	let current = GetCurrentScriptDirectory();
	let count2 = 0;
	let count3 = 0;
	let ExistB = 0;

	@Initialize
	{
	}
	@MainLoop
	{
		
		if(count2==0){SetPlayerInvincibility(10);}
		if(count2==1){PlaySE(current~"\se\puu81.wav");SuperNaturalBorder(215);}

		if(count2>0&&GetTimeOfSuperNaturalBorder()<=0){ExistB=1;}
		if(ExistB==1){count3++;DeleteEnemyShotInCircle(GetCenterX(),GetCenterY(),count3*12,ALL);SetIntersectionCircle(GetCenterX(),GetCenterY(),count3*8,9,true);}
		if(count3==1){SetPlayerInvincibility(120);PlaySE(current~"\se\Baaaaaaaan.wav");}
		
		if(count3>92){End();}

		count2++;
	}
	@Finalize
	{

	}

}

script_spell Demarcation2
{
	let current = GetCurrentScriptDirectory();
	let count2 = 0;
	let count3 = 0;
	let x = 0;
	let y = 0;

task GAON(xxx,yyy)
{
	let alpha = 255;
	let obj = Obj_Create(OBJ_EFFECT);
	let xx = 0;
	let yy = 0;
	xx += xxx;
	yy += yyy;
	Obj_SetX(obj, xx+rand(-15,15));
	Obj_SetY(obj, yy+rand(-15,15));
	Obj_SetSpeed(obj, 0);//xݒ
	ObjEffect_SetTexture(obj, current~"\img\STG_Player01.png");//摜ݒ
	ObjEffect_SetRenderState(obj, ALPHA);//`@
	ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLESTRIP);
	ObjEffect_SetScale(obj,2,2);//g嗦w
	ObjEffect_SetAngle(obj,0,0,0);//]px
	ObjEffect_CreateVertex(obj, 4);//_4
	ObjEffect_SetLayer(obj,5);
	
	//lp`Ɋe_̍Wݒ
	ObjEffect_SetVertexXY(obj, 0, -64, -64);
	ObjEffect_SetVertexXY(obj, 1, -64,  64);
	ObjEffect_SetVertexXY(obj, 2,  64, -64);
	ObjEffect_SetVertexXY(obj, 3,  64,  64);
	
	//lp`Ɋe_UVlݒ
	ObjEffect_SetVertexUV(obj, 0, 48,0);
	ObjEffect_SetVertexUV(obj, 1, 48,159);
	ObjEffect_SetVertexUV(obj, 2, 256,0);
	ObjEffect_SetVertexUV(obj, 3, 256,159);

	while(!Obj_BeDeleted(obj))
	{//폜܂Ń[vs

		alpha-=3;
		Obj_SetX(obj, xx+rand(-5,5));
		Obj_SetY(obj, yy+rand(-5,5));
	
		if(alpha<=0)
		{Obj_Delete(obj);}

		yield;
	}

}

	@Initialize
	{x+=GetPlayerX;y+=GetPlayerY;}
	@MainLoop
	{
		
		if(count2==0){GAON(GetPlayerX(),GetPlayerY());GAON(GetPlayerX(),GetPlayerY());SuperNaturalBorder(1);SetPlayerInvincibility(100);PlaySE(current~"\se\Baaaaaaaan.wav");}
		//if(count2==2){GAON(GetPlayerX(),GetPlayerY());GAON(GetPlayerX(),GetPlayerY());}
		if(count2<=20){DeleteEnemyShotInCircle(GetPlayerX(),GetPlayerY(),44-count2,ALL);SetIntersectionCircle(GetPlayerX(),GetPlayerY(),44-count2,100,true);}
		if(count2<=0){DeleteEnemyShotInCircle(GetPlayerX(),GetPlayerY(),66,ALL);SetIntersectionCircle(GetPlayerX(),GetPlayerY(),66,2500,true);}
		if(count2>60){End();}

		count2++;yield;
	}
	@Finalize
	{

	}

}

}