#뱦뺴뭙뼀븮[Stage]
#Title[VS뱻뙱뻺뛤]
#Text[]
#Image[.\img\snap1.bmp]
#BackGround[User(.\img\back2.png,0,0)]
#Player[FREE]
#ScriptVersion[2]
	
script_stage_main{
	let csd		=GetCurrentScriptDirectory;
	let bgm	= csd ~ "bgm\bgm.mp3";
	CreateCommonDataArea("EIYA");
	SetCommonDataEx("EIYA", "LastSpell", 0);

	task StageTask{
		function Wait(let frame){
		loop(frame){yield};
		}
		function WaitForZeroEnemy{
		while(GetEnemyNum != 0){yield;}
		}

		Wait(60);
		PlayMusic(bgm);
		CreateEnemyBossFromFile(csd~"mokou ex.txt",224,0,0,0,0);
		WaitForZeroEnemy;
		Wait(60);
		if(GetCommonDataEx("EIYA", "LastSpell")>=6){
		CreateEnemyBossFromFile(csd~"mokou last2.txt",224,240,0,0,0);
		WaitForZeroEnemy;
		}
		else if(GetCommonDataEx("EIYA", "LastSpell")>=3&&GetCommonDataEx("EIYA", "LastSpell")<6){
		CreateEnemyBossFromFile(csd~"mokou last1.txt",224,120,0,0,0);
		WaitForZeroEnemy;
		}
		FadeOutMusic(bgm,20);
		Wait(60);
		ClearStage;	
	}

	@Initialize{
		LoadMusic(bgm);
		StageTask;
		ExpertEx(false,1,4);
	}
		
	@MainLoop{
		yield;
	}

		
	@Finalize{
	}

}