#TouhouDanmakufu[Plural]
#ScriptVersion[3]
#System["./../tricky_system/TrickySystem.dnh"]
#Title["Kosuke Boss H"]
#Player["./../lib/Okina_player_by_Python/Okina Matara/Okina.dnh"]

#include "../lib/includes/dialogueconsts.dnh"
#include "../lib/stage.eventdialogue.dnh"
#include "../lib/includes/Function_Audio.dnh"
#include "../tricky_system/Event_Const.dnh"
#include "../lib/includes/EffectFunctions.dnh"

let obj;
let CSD = GetCurrentScriptDirectory;
let scriptBackground;

function LoadAllImagesInFolder(path){

	yield;
	let plist = GetFilePathList(path);
	let dlist = GetDirectoryList(path);
	
	ascent(i in 0..length(plist)){
		let cFile = plist[i];
		let fExt = cFile[length(cFile)-3..length(cFile)];
		if(fExt == "png" || fExt == "jpg" || fExt == "bmp"){
			LoadTextureInLoadThread(cFile);
		}
	}
	
	ascent(i in 0..length(dlist)){
		LoadAllImagesInFolder(dlist[i]);
	}
}


@Loading {

	LoadAllImagesInFolder(CSD~"../");
	
	obj = ObjEnemyBossScene_Create;
	ObjEnemyBossScene_Add(obj, 0, CSD ~ "KosukeN1_H.dnh");
	ObjEnemyBossScene_Add(obj, 0, CSD ~ "KosukeS1_H.dnh");
	ObjEnemyBossScene_Add(obj, 1, CSD ~ "KosukeN2_H.dnh");
	ObjEnemyBossScene_Add(obj, 1, CSD ~ "KosukeS2_H.dnh");
	ObjEnemyBossScene_Add(obj, 2, CSD ~ "KosukeS3_H.dnh");
	ObjEnemyBossScene_LoadInThread(obj);
	
	
}

@Initialize {
	SetPlayerLife(6);
	scriptBackground = LoadScript(GetCurrentScriptDirectory ~ "./NamelessPath.dnh");
	StartScript(scriptBackground);
	
	Plural;
}

@MainLoop {
	yield;
}

@Event{

	alternative(GetEventType())	
	case(EV_PAUSE_ENTER){
		NotifyEventAll(EV_MUSIC_PAUSE, true);
	}
	case(EV_PAUSE_LEAVE){
		NotifyEventAll(EV_MUSIC_RESUME, true);
	}
}

@Finalize {
}

task Plural {
	loop(120){ yield; }
	SetCommonData("BGSpeed", 4);
	loop(120){ yield; }
	PlayMusic(1.2);
	ObjEnemyBossScene_Regist(obj);
	BossCircle;
	BossShadow;
	while(!Obj_IsDeleted(obj)) {
		yield;
	}
	
	CloseScript(GetOwnScriptID());
}

