task CheckAchievement
{//計２６
Ah_EmptyBurstCheck;			//空うち
Ah_SectionMagicFragmentCheck;		//ステージフラグメント２種
Ah_MagicFragmentCheck;			//ステージ累計フラグメント４種
Ah_PowerCheck;				//魔力節約
Ah_RankCheck;				//ランク１０
Ah_MSCheck;				//マスタースパーク
Ah_CancelBonbCheck;			//キャンセルボム
Ah_BurstCheck;				//バースト回数
Ah_RushBurstCheck;			//ラッシュバースト回数
Ah_AutoBombCheck;			//オートボム回数
Ah_AwakeCheck;				//覚醒
Ah_RechargeCheck;			//リチャージ
Ah_InvinsibleCheck;			//インビンシブル
Ah_EmptyBombCheck;			//ボム不発
Ah_WorthressBombCheck;			//無駄ボム
Ah_BitZoneCheck;			//ビット氏ね
Ah_TrueBossCheck;			//きみならできるよ
Ah_KakaeCheck;				//抱え神
Ah_ComandCheck;				//某コマンド
StandbyModeCheck;			//休止モード
}

sub Ah_Sub_OverExtendCheck
{
	SetCommonDataEx(NsScore,NsAchievement[54],1);
}

sub Ah_Sub_EscapeDeathCheck
{
	if(GetPlayerLife==1 && GetPlayerBomb==0)
	{
		SetCommonDataEx(NsScore,NsAchievement[74],1);
	}
}

task Ah_EmptyBurstCheck
{
if(GetCommonDataDefaultEx(NsScore,NsAchievement[87],0)==1){return;}

loop
{
	if(Power<1000 && GetKeyState(VK_USER)==KEY_PUSH && !IsForbidBomb)
	{
		SetCommonDataEx(NsScore,NsAchievement[87],1);
	}
yield;
}
}

task Ah_SectionMagicFragmentCheck
{
if(GetCommonDataDefaultEx(NsScore,NsAchievement[21],0)==1){return;}

loop
{
if(SectionMagicFragment>=10000)
{
	SetCommonDataEx(NsScore,NsAchievement[20],1);
}
if(SectionMagicFragment>=30000)
{
	SetCommonDataEx(NsScore,NsAchievement[21],1);
}
yield;
}
}

task Ah_MagicFragmentCheck
{
if(GetCommonDataDefaultEx(NsScore,NsAchievement[25],0)==1){return;}

loop
{
if(MagicFragment>=10000)
{
	SetCommonDataEx(NsScore,NsAchievement[22],1);
}
if(MagicFragment>=30000)
{
	SetCommonDataEx(NsScore,NsAchievement[23],1);
}
if(MagicFragment>=50000)
{
	SetCommonDataEx(NsScore,NsAchievement[24],1);
}
if(MagicFragment>=100000)
{
	SetCommonDataEx(NsScore,NsAchievement[25],1);
}
yield;
}
}

task Ah_PowerCheck
{
if(GetCommonDataDefaultEx(NsScore,NsAchievement[71],0)==1){return;}
let PowerCount=0;
loop
{
	if(Power>=1000)
	{
		PowerCount+=1;
		if(PowerCount>=10800)
		{
			SetCommonDataEx(NsScore,NsAchievement[71],1);
		}
	}
	else
	{
		PowerCount=0;
	}
yield;
}
}

task Ah_RankCheck
{
if(GetCommonDataDefaultEx(NsScore,NsAchievement[55],0)==1){return;}
loop
{
if(BurstRank>=10000)
{
	SetCommonDataEx(NsScore,NsAchievement[55],1);
}

yield;
}
}

task Ah_MSCheck
{
if(GetCommonDataDefaultEx(NsScore,NsAchievement[62],0)==1){return;}
loop
{
if(UseMasterSparkCount>=10)
{
	SetCommonDataEx(NsScore,NsAchievement[62],1);
}

yield;
}
}

task Ah_CancelBonbCheck
{
if(GetCommonDataDefaultEx(NsScore,NsAchievement[63],0)==1){return;}
loop
{
if(UseMasterSparkCount>=10)
{
	SetCommonDataEx(NsScore,NsAchievement[63],1);
}

yield;
}
}


task Ah_BurstCheck
{
if(GetCommonDataDefaultEx(NsScore,NsAchievement[64],0)==1){return;}
loop
{
if(UseBurstCount>=30)
{
	SetCommonDataEx(NsScore,NsAchievement[64],1);
}

yield;
}
}


task Ah_RushBurstCheck
{
if(GetCommonDataDefaultEx(NsScore,NsAchievement[65],0)==1){return;}
loop
{
if(UseRushBurstCount>=10)
{
	SetCommonDataEx(NsScore,NsAchievement[65],1);
}

yield;
}
}

task Ah_AutoBombCheck
{
if(GetCommonDataDefaultEx(NsScore,NsAchievement[67],0)==1){return;}
loop
{
if(UseAutoBombCount>=10)
{
	SetCommonDataEx(NsScore,NsAchievement[67],1);
}

yield;
}
}

task Ah_AwakeCheck
{
if(GetCommonDataDefaultEx(NsScore,NsAchievement[73],0)==1){return;}
let AwakeCount=0;
loop
{
	if(GetPlayerLife==1 && GetPlayerBomb==0)
	{
		AwakeCount+=1;
		if(AwakeCount>=3600)
		{
			SetCommonDataEx(NsScore,NsAchievement[73],1);
		}
	}
	else
	{
		AwakeCount=0;
	}
yield;
}
}

task Ah_RechargeCheck
{
if(GetCommonDataDefaultEx(NsScore,NsAchievement[77],0)==1){return;}
yield;
loop(60)
{
	if(Power>=1000)
	{
		SetCommonDataEx(NsScore,NsAchievement[77],1);
	}
	yield;
}
}


task Ah_InvinsibleCheck
{
if(GetCommonDataDefaultEx(NsScore,NsAchievement[79],0)==1){return;}
let InvinsibleCount=0;
loop
{
	if(GetTimeOfPlayerInvincibility>0)
	{
		InvinsibleCount+=1;
		if(InvinsibleCount>=900)
		{
			SetCommonDataEx(NsScore,NsAchievement[79],1);
		}
	}
	else
	{
		InvinsibleCount=0;
	}
yield;
}
}

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

task Ah_EmptyBombCheck
{
if(GetCommonDataDefaultEx(NsScore,NsAchievement[88],0)==1){return;}
loop
{
if(GetKeyState(VK_BOMB)==KEY_PUSH && GetPlayerBomb==0)
{
	SetCommonDataEx(NsScore,NsAchievement[88],1);
}

yield;
}
}

task Ah_WorthressBombCheck
{
if(GetCommonDataDefaultEx(NsScore,NsAchievement[90],0)==1){return;}
loop(120)
{
if(OnBomb)
{
	SetCommonDataEx(NsScore,NsAchievement[90],1);
}

yield;
}
}

task Ah_BitZoneCheck
{
if(GetCommonDataDefaultEx(NsScore,NsAchievement[93],0)==1){return;}
loop
{
if(GetCommonDataDefault("BitZone",false) && GetPlayerLife==0)
{
	SetCommonDataEx(NsScore,NsAchievement[93],1);
}

yield;
}
}

task Ah_TrueBossCheck
{
if(GetCommonDataDefaultEx(NsScore,NsAchievement[94],0)==1){return;}
loop
{
if(GetCommonDataDefault("TrueBossLastAttack",false) && GetPlayerLife==0)
{
	SetCommonDataEx(NsScore,NsAchievement[94],1);
}

yield;
}
}

task Ah_KakaeCheck
{
if(GetCommonDataDefaultEx(NsScore,NsAchievement[95],0)==1){return;}
loop
{
if(KakaeBombNum>=20 && GetBombCount!=0)
{
	SetCommonDataEx(NsScore,NsAchievement[95],1);
}

yield;
}
}

task Ah_ComandCheck
{
if(GetCommonDataDefaultEx(NsScore,NsAchievement[97],0)==1){return;}
loop
{
if(GetKeyState(VK_UP)==KEY_PUSH)
{
	if(Command(VK_UP))
	{
	if(Command(VK_DOWN))
	{
	if(Command(VK_DOWN))
	{
	if(Command(VK_LEFT))
	{
	if(Command(VK_RIGHT))
	{
	if(Command(VK_LEFT))
	{
	if(Command(VK_RIGHT))
	{
		SetCommonDataEx(NsScore,NsAchievement[97],1);
	}
	}
	}
	}
	}
	}
	}
}
yield;
}
}

function Command(Key)
{
yield;
let KeyArray=[VK_UP,VK_DOWN,VK_LEFT,VK_RIGHT,VK_BOMB,VK_SHOT,VK_SKIP,VK_SLOWMOVE,VK_USER];
loop
{
if(GetKeyState(Key)==KEY_PUSH)
{
	return(true);
}
else
{
	ascent(i in 0..9)
	{
	if(GetKeyState(KeyArray[i])==KEY_PUSH)
	{
	return(false);
	}
	}
}
yield;
}
}

task StandbyModeCheck
{
let KeyArray=[VK_UP,VK_DOWN,VK_LEFT,VK_RIGHT,VK_BOMB,VK_SHOT,VK_SKIP,VK_SLOWMOVE,VK_USER];
if(GetCommonDataDefaultEx(NsScore,NsAchievement[98],0)==1){return;}
let FreeCount=0;
loop
{
	if(FreeCheck)
	{
		FreeCount+=1;
		if(FreeCount>=1800)
		{
			SetCommonDataEx(NsScore,NsAchievement[98],1);
		}
	}
	else
	{
		FreeCount=0;
	}
yield;
}

function FreeCheck
{
let num=0;
ascent(i in 0..9)
{
if(GetKeyState(KeyArray[i])==KEY_FREE)
{
num+=1;
}
}
if(num==9){return(true);}
else{return(false);}
}

}