#TouhouDanmakufu[Plural]
#ScriptVersion[3]
#Title["Game: 1st Night"]
#System["./system/system.txt"]
#Background["./resource/bg/stg01.txt"]
#Player["./resource/player/Marisa by plasmaflame22/Marisa_A.txt","./resource/player/Marisa by plasmaflame22/Marisa_B.txt","./resource/player/Marisa by plasmaflame22/Marisa_C.txt"]

#include"./resource/[library] se.txt"

let dir = GetCurrentScriptDirectory;

let spell01 = dir ~ "night1spell01.txt";
let spell02 = dir ~ "night1spell02.txt";
let spell03 = dir ~ "night1spell03.txt";
let spell04 = dir ~ "night1spell04.txt";
let spell05 = dir ~ "night1spell05.txt";
let spell06 = dir ~ "night1spell06.txt";

@Initialize{
	SetCommonData("MUSIC",1);
	LoadSounds;
	LoadMusic;

	TPlural;
	BGM(night1,11126,5133242);
}

@MainLoop{
	SetPlayerSpell(0);
	yield;}

@Loading{
	LoadScript(spell01);
	LoadScript(spell02);
	LoadScript(spell03);
	LoadScript(spell04);
	LoadScript(spell05);
	LoadScript(spell06);
}

task TPlural{
	let arraySpellcard = [
		spell01, spell02, spell03,
		spell04, spell05, spell06
		];

	let number = 0;
	loop{
		SetPlayerLife(1);
		SetCommonData("MENU",0);
		let obj = ObjEnemyBossScene_Create();
		ObjEnemyBossScene_Add(obj, 0, arraySpellcard[number]);
		
		ObjEnemyBossScene_LoadInThread(obj);
		ObjEnemyBossScene_Regist(obj);

		while(!Obj_IsDeleted(obj)){yield;}
		while(GetCommonData("MENU",0) == 0){yield;}
		
		if(GetCommonData("CHECK","") == "YES"){number++;}
		if(GetCommonData("CHECK","") == "NO"){yield;}
		if(number >= 6){break;}
	}
	CloseScript(GetOwnScriptID());
}