#e[Stage]
#Title[eۂȂ]
#Text[ԂXXXb
ԓɌŃEEE]
#Player[FREE]
#BackGround[User()]
#ScriptVersion[2]

script_stage_main{

	let Current = GetCurrentScriptDirectory;

	#include_function ".\INCLUDE\STAGE_INI.dms"

	CompileEnemyFromFile(Current ~ "pY.dnh");

	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);
			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(Current ~ "pY.dnh", 0, 0, 0, 0, 0);
		while(GetEnemyNum){ yield; }
		loop(40){
			Create_Object_Maple_Diffusion(GetCommonData("X"), GetCommonData("Y"));
		}
		STI;
		loop(300){ yield; }
		ClearStage;
	}

}