#東方弾幕風[Stage]
#Title[マインスイーパ]
#Text[東方弾幕風で遊ぶ
マインスイーパ]
#Player[FREE]
#BackGround[User()]
#ScriptVersion[2]

script_stage_main{

	let Current = GetCurrentScriptDirectory;

	#include_function ".\INCLUDE\STAGE_INI.dms"

	let Enemy_File = Current~"Enemy.dnh";

	CompileEnemyFromFile(Enemy_File);

	let BGM = Current ~ "BGM.mp3";
	PlayMusic(BGM);

	@Initialize{
		LoadCommonData;
		if(GetCommonData("CHECK") != "OK"){
			SetCommonData("SPELL_GET", 0);
			SetCommonData("SPELL_HISTORY", 0);
			SetCommonData("CHECK", "OK");
			SetCommonData("SPELL_BONUS_CHECK", false);
			SetCommonData("CHECK_HELP", 10);
			SetCommonData("CHECK_KEY", 0);
			SaveCommonData;
		}
		SetCommonData("X", 0);
		SetCommonData("Y", 0);
		SetRateScoreSystemEnable(false);
		SetDefaultStatusVisible(true);
		SPELL_BONUS_CHECK;
		Main;
	}

	@MainLoop{
		SetPlayerX(GetCenterX);
		SetPlayerY(GetClipMaxY - 50);
		yield;
	}

	@BackGround{
	}

	@Finalize{
		SetCommonData("SPELL_BONUS_CHECK", false);
		SaveCommonData;
		FadeOutMusic(BGM, 25);
	}

	task Main{
		yield;
		CreateEnemyFromFile(Enemy_File, 0, 0, 0, 0, 0);
		while(GetEnemyNum){ yield; }
		loop(40){
			Create_Object_Maple_Diffusion(GetCommonData("X"), GetCommonData("Y"));
		}
		STI;
		loop(420){ yield; }
		ClearStage;
	}

}