#TouhouDanmakufu[Plural]
#ScriptVersion[3]
#Title["Demystify! Hecatia VS. Hecatia (Easy Extra Mode)"]
#Text["For those who don't want to get tired."]
#Player["./Hecatia/Hecatia.txt"]
#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"
#include"./Functions/DialogueFunctions.dnh"
#include"./Functions/Portrait_Const.dnh"
let dir = GetCurrentScriptDirectory();
let dirCurrent = GetCurrentScriptDirectory();
let enearr = [];
let PhaseChange = false;
let song = ObjSound_Create;

@Initialize
{
	SetCommonData("Extra",1);
	//ClearCommonData;
	SetPlayerLife(5);
	SetPlayerSpell(5);
	TStage;
	SEE;
	Difficulty;
	//SetStgFrame(0, 0, 640, 480, 0, 200);
	//SetPlayerClip( 0, 0, 640, 450 );
	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");
	StartItemScript(dirCurrent ~"Item.txt");
}

		let path2 = GetCurrentScriptDirectory() ~ "img_diff_13.png";
		function Difficulty
		{
			let obj = ObjPrim_Create(OBJ_SPRITE_2D);
			ObjPrim_SetTexture(obj, path2);
			Obj_SetRenderPriority(obj, 99);
			ObjSprite2D_SetSourceRect(obj, 0, 0, 185, 61);
			ObjSprite2D_SetDestCenter(obj);
			//ObjRender_SetColor( obj, 255/2, 255/2, 255/2 );
			ObjRender_SetBlendType(obj,BLEND_ALPHA);
			ObjRender_SetScaleXYZ(obj,1,1,0);
			ObjRender_SetPosition(obj, 28 + 384 + 115, 40, 0);
			ObjRender_SetAlpha(obj,255);
		}

		let path3 = GetCurrentScriptDirectory() ~ "stg7enm3.png";
		function SEE
		{
			let obj = ObjPrim_Create(OBJ_SPRITE_2D);
			ObjPrim_SetTexture(obj, path3);
			Obj_SetRenderPriority(obj, 98);
			ObjSprite2D_SetSourceRect(obj, 0, 0, 128, 128);
			ObjSprite2D_SetDestCenter(obj);
			ObjRender_SetBlendType(obj,BLEND_ALPHA);
			ObjRender_SetScaleXYZ(obj,2.2,1,0);
			ObjRender_SetPosition(obj, 28 + 384 + 115, 30, 0);
			ObjRender_SetAlpha(obj,155);
		}

		task Effect( obj ){ 
		wait( 255 );
		ascent( i in 0..255/5 ){
		ObjRender_SetAlpha( obj, i*5 );
		yield;
		}
		}	


@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 ~ "Pandemonic Planet.mp3");
		ObjSound_SetVolumeRate(song,100);
	}
  }
}

@MainLoop
{
	yield;
}

@Finalize
{
}

task TStage
{
	SetCommonData("EnemyIsDie",0);
	let path;
	let idScript;
	let path0;
	let idScript0;	
	let ene;

	path = dir ~ "Hecatia0.txt";
	idScript = LoadScriptInThread(path);

	yield;
	wait( 180 );
	StartScript(idScript);
	while(!IsCloseScript(idScript) && GetPlayerState() != STATE_END)
	{
		yield;
	}

	//-------------------------------------------------//
	loop(180){yield;}
	CloseStgScene();
}



