#東方弾幕風[Stage]
#Title[幻想妖洞窟　Ｖｅｒ０．７０]
#Text[]
#Player[REIMU,MARISA,.\Patche\Patche\Patche.dnh]
#Image[]
#BackGround[]
#ScriptVersion[2]

#include_script ".\Event\EventMain11.txt"
#include_script ".\Event\EventMain21.txt"
#include_script ".\Event\EventMain31.txt"
#include_script ".\Event\EventMain41.txt"
#include_script ".\Event\EventMain12.txt"
#include_script ".\Event\EventMain22.txt"
#include_script ".\Event\EventMain32.txt"
#include_script ".\Event\EventMain42.txt"
#include_script ".\Event\EventMain13.txt"
#include_script ".\Event\EventMain23.txt"
#include_script ".\Event\EventMain33.txt"
#include_script ".\Event\EventMain43.txt"
#include_script ".\Event\EventMain14.txt"
#include_script ".\Event\EventMain24.txt"
#include_script ".\Event\EventMain34.txt"
#include_script ".\Event\EventMain44.txt"
#include_script ".\Event\EventMain15.txt"
#include_script ".\Event\EventMain25.txt"
#include_script ".\Event\EventMain35.txt"
#include_script ".\Event\EventMain45.txt"
#include_script ".\Event\EventMain16.txt"
#include_script ".\Event\EventMain26.txt"
#include_script ".\Event\EventMain36.txt"
#include_script ".\Event\EventMain46.txt"
#include_script ".\Event\EventMain17.txt"
#include_script ".\Event\EventMain27.txt"
#include_script ".\Event\EventMain37.txt"
#include_script ".\Event\EventMain47.txt"
#include_script ".\Event\EventMain110.txt"
#include_script ".\Event\EventMain210.txt"
#include_script ".\Event\EventMain310.txt"
#include_script ".\Event\EventMain410.txt"

script_stage_main{
#include_function ".\Config.txt"
#include_function ".\Stage functionA.txt"
#include_function ".\Stage functionB.txt"
#include_function ".\Patche\Library\InitializePatcheSystemOnStage.dnh"

task StageTask{//ステージタスク
	#include_function ".\StageTask.txt"
	#include_function ".\StageMainA.txt"
	#include_function ".\StageMainB.txt"
	#include_function ".\StageMainC.txt"
	#include_function ".\Config.txt"
	
	ChackMode();

	let P = ChoosePatchePlayer;
	let PMP = PlacticeMagicPoint;
	if(IsReplay == false){SetCommonData("PLAYER",P);
	SetCommonData("PLACTICE_MAGICPOINT",PMP);
	SaveCommonDataInReplayFile();}
	else if(IsReplay == true){LoadCommonDataFromReplayFile();}

	let E  = GetCommonData("EASY_START");
	let N  = GetCommonData("NORMAL_START");
	let H  = GetCommonData("HARD_START");
	let L  = GetCommonData("LUNATIC_START");
	let EX = GetCommonData("EXTRA_START");

	if(GetPlayerType() == USER_PLAYER){setPlayerIndex(GetCommonData("PLAYER"));}

	let scorebonus = trunc(GetCommonData("MAGICPOINT") * GetCommonData("MAGICPOINT_BONUSRATE"));
	let spellbonus = trunc(GetCommonData("MAGICPOINT") * 3500);
	SetCommonData("SCOREBONUS",scorebonus);
	SetCommonData("SPELLBONUS",spellbonus);

	if(E == 1){
	EasyStage1;
	EasyStage2;
	EasyStage3;
	EasyStage4;
	EasyStage5;
	if(GetCommonData("STAGE6_CHOOSE") == 1){EasyStage6A;}
	if(GetCommonData("STAGE6_CHOOSE") == 2){EasyStage6B;}
	}
	if(E == 2){EasyStage1;}
	if(E == 3){EasyStage2;}
	if(E == 4){EasyStage3;}
	if(E == 5){EasyStage4;}
	if(E == 6){EasyStage5;}
	if(E == 7){EasyStage6A;}
	if(E == 8){EasyStage6B;}
	if(N == 1){
	NormalStage1;
	NormalStage2;
	NormalStage3;
	NormalStage4;
	NormalStage5;
	if(GetCommonData("STAGE6_CHOOSE") == 1){NormalStage6A;}
	if(GetCommonData("STAGE6_CHOOSE") == 2){NormalStage6B;}
	NormalStageFinal;
	}
	if(N == 2){NormalStage1;}
	if(N == 3){NormalStage2;}
	if(N == 4){NormalStage3;}
	if(N == 5){NormalStage4;}
	if(N == 6){NormalStage5;}
	if(N == 7){NormalStage6A;}
	if(N == 8){NormalStage6B;}
	if(N == 9){NormalStageFinal;}
	if(H == 1){
	HardStage1;
	HardStage2;
	HardStage3;
	HardStage4;
	HardStage5;
	if(GetCommonData("STAGE6_CHOOSE") == 1){HardStage6A;}
	if(GetCommonData("STAGE6_CHOOSE") == 2){HardStage6B;}
	HardStageFinal;
	}
	if(H == 2){HardStage1;}
	if(H == 3){HardStage2;}
	if(H == 4){HardStage3;}
	if(H == 5){HardStage4;}
	if(H == 6){HardStage5;}
	if(H == 7){HardStage6A;}
	if(H == 8){HardStage6B;}
	if(H == 9){HardStageFinal;}
	if(L == 1){
	LunaticStage1;
	LunaticStage2;
	LunaticStage3;
	LunaticStage4;
	LunaticStage5;
	if(GetCommonData("STAGE6_CHOOSE") == 1){LunaticStage6A;}
	if(GetCommonData("STAGE6_CHOOSE") == 2){LunaticStage6B;}
	LunaticStageFinal;
	}
	if(L == 2){LunaticStage1;}
	if(L == 3){LunaticStage2;}
	if(L == 4){LunaticStage3;}
	if(L == 5){LunaticStage4;}
	if(L == 6){LunaticStage5;}
	if(L == 7){LunaticStage6A;}
	if(L == 8){LunaticStage6B;}
	if(L == 9){LunaticStageFinal;}
	ClearStage();//ステージクリア
	}

	@Initialize(){
	let player = ChoosePlayerLife();
	if(player >= 9){player = 8;}
	ExpertEx(false,3,player);
	SetRateScoreSystemEnable(false);
	StageTask();//ステージタスク起動
	//各種システムタスク起動
	PointExtend();
	MagicPointOnStage();
	MagicPowerOnStage();
	FullItemOnStage();
	if(ChooseMusicRing == 0){MusicControl();}
	if(ChooseBgDraw == 0){BGControl();}
	if(GetPlayerType() == USER_PLAYER){initPatche(false,true,true);}
	}

	@MainLoop(){
	let scorebonus = trunc(GetCommonData("MAGICPOINT") * GetCommonData("MAGICPOINT_BONUSRATE"));
	let spellbonus = trunc(GetCommonData("MAGICPOINT") * 3500);
	SetCommonData("SCOREBONUS",scorebonus);
	SetCommonData("SPELLBONUS",spellbonus);
	yield;//毎フレームタスク復帰
	}	

	@DrawTopObject{
	MagicPointDrawText();
	}

	@BackGround(){
	DrawGraphic(GetCenterX,GetCenterY);
	}

	@Finalize(){
	}
}
}