sub StageAllClearAchievementCheck
{//計１５
			if(GetCommonDataDefault("MSDPlayer",false)==true)
				{
				if(GetPlayerInfo(PLAYER_SPEED_HIGH)==4)
				{
					SetCommonDataEx(NsScore,NsAchievement[0],1);
				}
				else if(GetPlayerInfo(PLAYER_SPEED_HIGH)==5)
				{
					SetCommonDataEx(NsScore,NsAchievement[1],1);
				}
				if(GetPlayerInfo(PLAYER_SPEED_HIGH)==5.5)
				{
					SetCommonDataEx(NsScore,NsAchievement[2],1);
				}
				else if(GetPlayerInfo(PLAYER_SPEED_HIGH)==4.5)
				{
					SetCommonDataEx(NsScore,NsAchievement[3],1);
				}
				}
				alternative(SelectedDifficult)
				case("Moderate")
				{
					SetCommonDataEx(NsScore,NsAchievement[4],1);
					if(Continued==false)
					{
						SetCommonDataEx(NsScore,NsAchievement[5],1);
					}
				}
				case("Extream")
				{
					SetCommonDataEx(NsScore,NsAchievement[6],1);
					if(Continued==false)
					{
						SetCommonDataEx(NsScore,NsAchievement[7],1);
					}
				}
				
				case("Apocalypse")
				{
					SetCommonDataEx(NsScore,NsAchievement[8],1);
					if(GetCommonDataDefault("TrueBossFlag",false))
					{
					if(Continued==false)
					{
						SetCommonDataEx(NsScore,NsAchievement[9],1);
					}
					}
				}

				if(GetMissCount==0)
				{
					if(Continued==false)
					{
					SetCommonDataEx(NsScore,NsAchievement[10],1);
					}
				}
				if(GetBombCount==0)
				{
					if(Continued==false)
					{
					SetCommonDataEx(NsScore,NsAchievement[11],1);
					}
				}
				if(SlowMoveFlag==false)
				{
					if(Continued==false)
					{
					SetCommonDataEx(NsScore,NsAchievement[72],1);
					}
				}

				if(GetPlayerLife==1 && GetPlayerBomb==0)
				{
					if(Continued==false)
					{
					SetCommonDataEx(NsScore,NsAchievement[75],1);
					}
				}
				if(ExtendNum<6)
				{
					if(Continued==false)
					{
					SetCommonDataEx(NsScore,NsAchievement[96],1);
					}
				}
}

sub StageInitializeAchievementCheck
{//計１５
	if(GetCommonDataEx(NsScore,NsAchievement[30])==1)
	{
		InitialContinue+=1;
	}
	if(GetCommonDataEx(NsScore,NsAchievement[31])==1)
	{
		InitialContinue+=1;
	}
	if(GetCommonDataEx(NsScore,NsAchievement[34])==1)
	{
		InitialContinue+=1;
	}
	if(GetCommonDataEx(NsScore,NsAchievement[35])==1)
	{
		InitialContinue+=1;
	}
	if(GetCommonDataEx(NsScore,NsAchievement[67])==1)
	{
		InitialContinue+=1;
	}

	if(GetCommonDataEx(NsScore,NsAchievement[4])==1)
	{
		InitialLifeMax+=1;
	}
	if(GetCommonDataEx(NsScore,NsAchievement[5])==1)
	{
		InitialBombMax+=1;
	}

	if(GetCommonDataEx(NsScore,NsAchievement[38])==1)
	{
		InitialLifeMax+=1;
	}
	if(GetCommonDataEx(NsScore,NsAchievement[39])==1)
	{
		InitialBombMax+=1;
	}

	ExpertEx(false,InitialContinue,InitialLife);

	if(GetCommonDataDefaultEx(NsScore,NsAllScore2,0)>=50000)
	{
		SetCommonDataEx(NsScore,NsAchievement[16],1);
	}
	if(GetCommonDataDefaultEx(NsScore,NsAllScore2,0)>=100000)
	{
		SetCommonDataEx(NsScore,NsAchievement[17],1);
	}
	if(GetCommonDataDefaultEx(NsScore,NsAllScore2,0)>=500000)
	{
		SetCommonDataEx(NsScore,NsAchievement[18],1);
	}
	if(GetCommonDataDefaultEx(NsScore,NsAllScore3,0)>=1)
	{
		SetCommonDataEx(NsScore,NsAchievement[19],1);
	}
	if(GetCommonDataDefaultEx(NsScore,NsAllFragment,0)>=100000)
	{
		SetCommonDataEx(NsScore,NsAchievement[26],1);
	}
	if(GetCommonDataDefaultEx(NsScore,NsAllFragment2,0)>=1)
	{
		SetCommonDataEx(NsScore,NsAchievement[27],1);
	}
	if(GetCommonDataDefaultEx(NsScore,NsAllFragment2,0)>=5)
	{
		SetCommonDataEx(NsScore,NsAchievement[28],1);
	}
	if(GetCommonDataDefaultEx(NsScore,NsAllFragment2,0)>=10)
	{
		SetCommonDataEx(NsScore,NsAchievement[29],1);
	}

	if(GetCommonDataDefaultEx(NsScore,NsAchievement[0],0)==1)
	{
	if(GetCommonDataDefaultEx(NsScore,NsAchievement[1],0)==1)
	{
	if(GetCommonDataDefaultEx(NsScore,NsAchievement[2],0)==1)
	{
	if(GetCommonDataDefaultEx(NsScore,NsAchievement[3],0)==1)
	{
		SetCommonDataEx(NsScore,NsAchievement[56],1);
	}
	}
	}
	}

	if(GetCommonDataDefaultEx(NsScore,NsContinueCount,0)>=50)
	{
		SetCommonDataEx(NsScore,NsAchievement[57],1);
	}

	if(GetCommonDataDefaultEx(NsScore,"NsAllDeadNum",0)>=100)
	{
		SetCommonDataEx(NsScore,NsAchievement[59],1);
	}

	if(GetCommonDataDefaultEx(NsScore,"BurstModeErazeBulletNumAM",0)>=10000)
	{
		SetCommonDataEx(NsScore,NsAchievement[61],1);
	}

	if(GetCommonDataDefaultEx(NsScore,"UseAutoBombCount",0)>=100)
	{
		SetCommonDataEx(NsScore,NsAchievement[66],1);
	}

	if(GetCommonDataDefaultEx(NsScore,"LOWSPIRALNUM",0)>=15)
	{
		SetCommonDataEx(NsScore,NsAchievement[68],1);
	}

	if(GetCommonDataDefaultEx(NsScore,"LOWSPIRALNUM",0)>=30)
	{
		SetCommonDataEx(NsScore,NsAchievement[69],1);
	}
}

sub StageFinalizeAchievementCheck
{//計８
	if(ScoreNumber2>=5000)
	{
		SetCommonDataEx(NsScore,NsAchievement[12],1);
	}
	if(ScoreNumber2>=10000)
	{
		SetCommonDataEx(NsScore,NsAchievement[13],1);
	}
	if(ScoreNumber2>=20000)
	{
		SetCommonDataEx(NsScore,NsAchievement[14],1);
	}
	if(ScoreNumber2>=30000)
	{
		SetCommonDataEx(NsScore,NsAchievement[15],1);
	}

	if(InitialContinue-GetAllowedContinueCount>=3)
	{
		SetCommonDataEx(NsScore,NsAchievement[58],1);
	}

	if(GetCommonDataDefault("BitDefeatNum",0)==6)
	{
		SetCommonDataEx(NsScore,NsAchievement[84],1);
	}

	if(EliminateBurstReturnShotNum>=100)
	{
		SetCommonDataEx(NsScore,NsAchievement[89],1);
	}
}

task Ah_SlowMoveCheck
{
if(GetCommonDataDefaultEx(NsScore,NsAchievement[72],0)==1){return;}
loop
{
if(GetKeyState(VK_SLOWMOVE)==KEY_PUSH)
{
	SlowMoveFlag=true;
	return;
}

yield;
}
}

task Ah_DoubleExtendCheck
{
if(GetCommonDataDefault("DoubleExtend",false)==true)
{
	SetCommonDataEx(NsScore,NsAchievement[80],1);
}
else
{
SetCommonData("DoubleExtend",true);
wait(60);
SetCommonData("DoubleExtend",false);
}
}


sub TotalPlayCalculation
{
			let RAE=GetCommonDataDefaultEx(NsScore,NsFrequencyReimuAEasy,0);
			let RBE=GetCommonDataDefaultEx(NsScore,NsFrequencyReimuBEasy,0);
			let RCE=GetCommonDataDefaultEx(NsScore,NsFrequencyReimuCEasy,0);
			let RDE=GetCommonDataDefaultEx(NsScore,NsFrequencyReimuDEasy,0);
			let REE=GetCommonDataDefaultEx(NsScore,NsFrequencyReimuEEasy,0);
			let TE=RAE+RBE+RCE+RDE+REE;

			let RAN=GetCommonDataDefaultEx(NsScore,NsFrequencyReimuANormal,0);
			let RBN=GetCommonDataDefaultEx(NsScore,NsFrequencyReimuBNormal,0);
			let RCN=GetCommonDataDefaultEx(NsScore,NsFrequencyReimuCNormal,0);
			let RDN=GetCommonDataDefaultEx(NsScore,NsFrequencyReimuDNormal,0);
			let REN=GetCommonDataDefaultEx(NsScore,NsFrequencyReimuENormal,0);
			let TN=RAN+RBN+RCN+RDN+REN;

			let RAH=GetCommonDataDefaultEx(NsScore,NsFrequencyReimuAHard,0);
			let RBH=GetCommonDataDefaultEx(NsScore,NsFrequencyReimuBHard,0);
			let RCH=GetCommonDataDefaultEx(NsScore,NsFrequencyReimuCHard,0);
			let RDH=GetCommonDataDefaultEx(NsScore,NsFrequencyReimuDHard,0);
			let REH=GetCommonDataDefaultEx(NsScore,NsFrequencyReimuEHard,0);
			let TH=RAH+RBH+RCH+RDH+REH;

			let RAL=GetCommonDataDefaultEx(NsScore,NsFrequencyReimuALuna,0);
			let RBL=GetCommonDataDefaultEx(NsScore,NsFrequencyReimuBLuna,0);
			let RCL=GetCommonDataDefaultEx(NsScore,NsFrequencyReimuCLuna,0);
			let RDL=GetCommonDataDefaultEx(NsScore,NsFrequencyReimuDLuna,0);
			let REL=GetCommonDataDefaultEx(NsScore,NsFrequencyReimuELuna,0);
			let TL=RAL+RBL+RCL+RDL+REL;

			let TRA=RAE+RAN+RAH+RAL;
			let TRB=RBE+RBN+RBH+RBL;
			let TRC=RCE+RCN+RCH+RCL;
			let TRD=RDE+RDN+RDH+RDL;
			let TRE=REE+REN+REH+REL;		
			let TOTAL=TE+TN+TH+TL;

			TotalDisplay(355,180,255,255,255,255);

			if(RAE>9999){RAE=9999;}//9999でカンスト
			if(RBE>9999){RBE=9999;}
			if(RCE>9999){RCE=9999;}
			if(RDE>9999){RDE=9999;}
			if(REE>9999){REE=9999;}
			if(TE>9999){TE=9999;}
			if(RAN>9999){RAN=9999;}
			if(RBN>9999){RBN=9999;}
			if(RCN>9999){RCE=9999;}
			if(RDN>9999){RDE=9999;}
			if(REN>9999){REE=9999;}
			if(TN>9999){TN=9999;}
			if(RAH>9999){RAH=9999;}
			if(RBH>9999){RBH=9999;}
			if(RCH>9999){RCE=9999;}
			if(RDH>9999){RDE=9999;}
			if(REH>9999){REE=9999;}
			if(TH>9999){TH=9999;}
			if(RAL>9999){RAL=9999;}
			if(RBL>9999){RBL=9999;}
			if(RCL>9999){RCL=9999;}
			if(RDL>9999){RDL=9999;}
			if(REL>9999){REL=9999;}
			if(TL>9999){TL=9999;}
			if(TRA>9999){TRA=9999;}
			if(TRB>9999){TRB=9999;}
			if(TRC>9999){TRC=9999;}
			if(TRD>9999){TRD=9999;}
			if(TRE>9999){TRE=9999;}

			if(TOTAL>9999){TOTAL=9999;}
	let Acount=0;
	if(TOTAL>=50)
	{
		SetCommonDataEx(NsScore,NsAchievement[30],1);
		Acount+=1;
	}
	if(TOTAL>=100)
	{
		SetCommonDataEx(NsScore,NsAchievement[31],1);
	}
	if(TOTAL>=500)
	{
		SetCommonDataEx(NsScore,NsAchievement[32],1);

	}
	if(TOTAL>=1000)
	{
		SetCommonDataEx(NsScore,NsAchievement[33],1);
		Acount+=1;
	}
	if(PlayTime/3600>=1)
	{
		SetCommonDataEx(NsScore,NsAchievement[34],1);
		Acount+=1;
	}
	if(PlayTime/3600>=3)
	{
		SetCommonDataEx(NsScore,NsAchievement[35],1);
	}
	if(PlayTime/3600>=5)
	{
		SetCommonDataEx(NsScore,NsAchievement[36],1);
	}
	if(PlayTime/3600>=10)
	{
		SetCommonDataEx(NsScore,NsAchievement[37],1);
		Acount+=1;
	}
	if(Acount>=2)
	{
		SetCommonDataEx(NsScore,NsAchievement[38],1);
	}
	if(Acount>=4)
	{
		SetCommonDataEx(NsScore,NsAchievement[39],1);
	}
}