#TouhouDanmakufu[Plural]
#ScriptVersion[3]
#Title["Patchy Boss Battle"]
#Text["Patchouli Boss Fight"]
#BGM["./LockedGirl.mp3"]
#Image["./resources/images/yuu3.png"]
//#Background["./Background.txt"]
#Player["./Reimu/ReimuB.dnh"]

let S1;
let S2;
let S3;
let S4;
let S5;

@Initialize
{
	Spell1Decide;
	SetPlayerLife(21);
	TPlural();
}

@MainLoop
{
	yield;
}

@Finalize
{
}


task TPlural
{
	let dir = GetCurrentScriptDirectory();
	
	////////////////////////Spell randomizer!
	
					let type1 = round(rand(1, 2));	
					let type2 = round(rand(1, 2));	
					let type3 = round(rand(1, 2));	
					let type4 = round(rand(1, 2));
					
					let type5 = 1; //truncate(rand(1, 2.9));	
	
					if(type1==1){
						S1 = dir ~ "PSpell1.txt"
						}
		
					if(type1==2){
						S1 = dir ~ "PSpell1B.txt"
						}
						
					if(type2==1){
						S2 = dir ~ "PSpell2.txt"
						}
		
					if(type2==2){
						S2 = dir ~ "PSpell2B.txt"
						}
						
					if(type3==1){
						S3 = dir ~ "PSpell3.txt"
						}
		
					if(type3==2){
						S3 = dir ~ "PSpell3B.txt"
						}
					
					if(type4==1){
						S4 = dir ~ "PSpell4.txt"
						}
		
					if(type4==2){
						S4 = dir ~ "PSpell4B.txt"
						}
						
					if(type5==1){
						S5 = dir ~ "PSpell5.txt"
						}
		
					if(type5==2){
						S5 = dir ~ "PSpell5B.txt"
						}
						
	///////////////////////////////////////////
		
	
	let obj = ObjEnemyBossScene_Create();
	ObjEnemyBossScene_Add(obj, 0, dir ~ "PNon1.txt");
	ObjEnemyBossScene_Add(obj, 0, S1);
	ObjEnemyBossScene_Add(obj, 1, dir ~ "PNon2.txt");
	ObjEnemyBossScene_Add(obj, 1, S2);
	ObjEnemyBossScene_Add(obj, 2, dir ~ "PNon3.txt");
	ObjEnemyBossScene_Add(obj, 2, S3);
	ObjEnemyBossScene_Add(obj, 3, dir ~ "PNon4.txt");
	ObjEnemyBossScene_Add(obj, 3, S4);
	ObjEnemyBossScene_Add(obj, 4, dir ~ "PNon5.txt");
	ObjEnemyBossScene_Add(obj, 4, S5);
	ObjEnemyBossScene_Add(obj, 5, dir ~ "PSpell6.txt");
	ObjEnemyBossScene_Add(obj, 6, dir ~ "PSpellFinal.txt");

	ObjEnemyBossScene_LoadInThread(obj);
	ObjEnemyBossScene_Regist(obj);

	while(!Obj_IsDeleted(obj))
	{
		yield;
	}
	CloseScript(GetOwnScriptID());
}

task Spell1Decide {
	let type = truncate(rand(1, 2.9));	
	let dir = GetCurrentScriptDirectory();
	
	if(type==1){
		S1 = dir ~ "PSpell1.txt"
		}
		
	if(type==2){
		S1 = dir ~ "PSpell1B.txt"
		}
	}
	
task Spell2Decide {
	let type = truncate(rand(1, 2.9));	
	let dir = GetCurrentScriptDirectory();
	type=1;
	
	if(type==1){
		S2 = dir ~ "PSpell2.txt"
		}
		
	if(type==2){
		S2 = dir ~ "PSpell2B.txt"
		}
	}