#TouhouDanmakufu[Stage]
#ScriptVersion[3]
#Title["Doremy Halloween"]
#Text["Feel like:Endless Dream as you can't die (Hard-Lunatic-Extra  mode like) [r] Made by:EterNal Lantarn.S (SKN ft.Haru) [r] For:RaNGE15 contest ENJOY~!"]
#System["./system/Default_System.txt"]
#include"./Shot/AllStarShot_Const.dnh"
#include"./system/Default_Effect.Txt"
#include"./Functions/EventList.Txt"
#include"./Functions/SoundFunctions.Txt"
#include"./StageFunction.Txt"
let dir = GetCurrentScriptDirectory();
let dirCurrent = GetCurrentScriptDirectory();
let enearr = [];
let PhaseChange = false;
let song = ObjSound_Create;

@Initialize
{
	ClearCommonData;
	SetCommonData("Difficulty","Hard");
	DrawDifficulty;
	SetPlayerLife(999);
	TStage;
	StartScript(LoadScriptInThread(dir ~ "BG.txt"));
	LoadTexture(dirCurrent~"img/Cutin.png");
	LoadTexture(dirCurrent~"img/effbreak.png");
	LoadTexture(dirCurrent~"img/Marisa1.png");
	LoadTexture(dirCurrent~"img/stg3bg1.png");
	LoadTexture(dirCurrent~"img/boss.png");
	LoadTexture(dirCurrent~"Shot/AllStarShot.png");
	LoadTexture(dirCurrent~"system/img/front01.png");
	LoadTexture(dirCurrent~"system/img/front00.png");
	LoadTexture(dirCurrent~"img/Dot.png");
	LoadTexture(dirCurrent~"img/Cutin.png");
	LoadTexture(dirCurrent~"img/cdbg05a.png");
	LoadTexture(dirCurrent~"img/cdbg05b.png");
	LoadTexture(dirCurrent ~ "img/doremycutin.png");
	StartItemScript(dirCurrent ~"Item.txt");
}

@Event
{
	alternative(GetEventType())
	case(EV_PLAYER_SHOOTDOWN) // dmf event
	{
		if(GetPlayerLife<1){
		NotifyEventAll(EV_FAKE_DEAD,0);
		}
	}
	case(EV_GET_CONTINUE)
	{
		SetPlayerLife(GetEventArgument(0));
	}
 	case(EV_PAUSE_ENTER) // dmf event
	{
		ObjSound_Stop(song);
	}
	case(EV_PAUSE_LEAVE) // dmf event
	{
		ObjSound_Play(song);
	}
   case(EV_START_SONG)
  {
		ObjSound_Play(song);
  }
    case(EV_STOP_SONG)
  {
	ObjSound_Stop(song);
  }
     case(EV_DELETE_SONG)
  {
	StopS(song);
  }
     case(EV_SET_SONG)
  {
	if(GetEventArgument(0)==1)
	{
		Sound(dirCurrent ~ "eternal.mp3");
		ObjSound_SetVolumeRate(song,95);
	}
  }
}

@MainLoop
{
	yield;
}

@Finalize
{
}

task TStage
{
	SetCommonData("EnemyIsDie",0);
	let path;
	let idScript;	
	let ene;
	loop(60){yield;}
	path = dir ~ "Doremy.txt";
	idScript = LoadScriptInThread(path);
	yield;
	StartScript(idScript);
	while(!IsCloseScript(idScript) && GetPlayerState() != STATE_END)
	{
		yield;
	}
	//-------------------------------------------------//
	loop(180){yield;}
	CloseStgScene();
}

	


