task StageSecretSpell
{
	SetCommonData("STARTPOWER",5000);
	wait(5);
	SetCommonData("STARTPOWER",0);
	alternative(SecretSpellSelect)
	case(SecretSpell1)
	{
		CreateEnemyBossFromFile(csd~"Secret/flashrain.txt",GetCenterX,GetClipMinY,2,0,0);
	}
	case(SecretSpell2)
	{
		CreateEnemyBossFromFile(csd~"Secret/fruit.txt",GetCenterX,GetClipMinY,2,0,0);
	}
	SecretRestart;
	WaitForZeroEnemy();
	if(GetPlayerLife==3)
	{
		wait(120);
	}
	StageState=Menu;
	MenuState=SecretSpellEnd;
	Select=SecretSpellRetry;
	loop
	{
		if(GetKeyState(VK_UP) == KEY_PUSH)
		{
			PlaySE(MenuSE[0]);
			Select-=1;
			if(Select<=50000)
			{
				Select=50002;
			}
		}
		if(GetKeyState(VK_DOWN) == KEY_PUSH)
		{
			PlaySE(MenuSE[0]);
			Select+=1;
			if(Select>=50003)
			{
				Select=50001;
			}
		}
		if(Select==SecretSpellRetry && GetKeyState(VK_SHOT) == KEY_PUSH)
		{
			PlaySE(MenuSE[0]);
			MenuState=SecretSpellEnd;
			StageState=Exit;
			StageSecretSpell;
			AddGraze(-GetGraze);
			AddScore(-GetScore);
			SetPlayerX(DefaultX);
			SetPlayerY(DefaultY);
			LifeAndBombDefine;
			return;
		}
		if(Select==SecretSpellFinish && GetKeyState(VK_SHOT) == KEY_PUSH)
		{
			PlaySE(MenuSE[0]);
			StageState=Menu;
			MenuState=Menu;
			Select=Start;
			wait(5);
			AddGraze(-GetGraze);
			AddScore(-GetScore);
			SetPlayerX(DefaultX);
			SetPlayerY(DefaultY);
			LifeAndBombDefine;
			StageTitleDisplay;
			SetCommonData("STARTPOWER",2000);
			wait(5);
			SetCommonData("STARTPOWER",0);
			return;
		}
	yield;
	}
}

task SecretRestart
{
while(SelectedDifficult=="SecretSpell")
{
if(OnPlayerMissed)
{
SetLifeZeroToAllEnemy;
}
yield;
}
}