#TouhouDanmakufu[Plural]
#ScriptVersion[3]
#Title["Demystify! Hecatia VS. Hecatia (Absurdly Extra Mode)"]
#Text["For Jaimers and Pruns."]
#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(4);
	SetPlayerSpell(4);
	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_05.png";
		function Difficulty
		{
			let obj = ObjPrim_Create(OBJ_SPRITE_2D);
			ObjPrim_SetTexture(obj, path2);
			Obj_SetRenderPriority(obj, 99);
			ObjSprite2D_SetSourceRect(obj, 0, 0, 185, 64);
			ObjSprite2D_SetDestCenter(obj);
			ObjRender_SetBlendType(obj,BLEND_ALPHA);
			ObjRender_SetScaleXYZ(obj,1,1,0);
			ObjRender_SetPosition(obj, 28 + 384 + 115, 42, 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, 28, 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 ~ "Hecatia2.txt";
	idScript = LoadScriptInThread(path);

	yield;
	wait( 180 );
	StartScript(idScript);
	while(!IsCloseScript(idScript) && GetPlayerState() != STATE_END)
	{
		yield;
	}
	if(GetPlayerState() != STATE_END){
	wait( 120 );
IntiallizeEvent( 1, 2, 0.5, 0.5, 0.5 );

ObjEvent_SetGraphic( LEFT, 0, Hecatia1 );
ObjEvent_SetGraphic( RIGHT, 0, Hecatia6 );
Talking( 0, RIGHT );
SetText( RIGHT, -0.4, 0, "Awww..... I lost.....");

ObjEvent_SetGraphic( LEFT, 0, Hecatia2 );
Talking( 0, LEFT );
SetText( LEFT, -2.8, 0, "Now, show yourself who you are!");

ObjEvent_SetGraphic( RIGHT, 0, Hecatia6 );
Talking( 0, RIGHT );
SetText( RIGHT, -0.4, 0, "....I know that you know it.");

ObjEvent_SetGraphic( LEFT, 0, Hecatia3 );
Talking( 0, LEFT );
SetText( LEFT, -2.8, 0, "Mamizou, right ?");

ObjEvent_SetGraphic( RIGHT, 0, Hecatia6 );
Talking( 0, RIGHT );
SetText( RIGHT, -0.4, 0, "No.");

ObjEvent_SetGraphic( LEFT, 0, Hecatia5 );
Talking( 0, LEFT );
SetText( LEFT, -2.8, 0, "Then what's it ?");

ObjEvent_SetGraphic( RIGHT, 0, Hecatia6 );
Talking( 0, RIGHT );
SetText( RIGHT, -0.4, 0, "Ask yourself.");

ObjEvent_SetGraphic( LEFT, 0, Hecatia1 );
Talking( 0, LEFT );
SetText( LEFT, -2.8, 0, "....");

ObjEvent_SetGraphic( LEFT, 0, Hecatia1 );
Talking( 0, LEFT );
SetText( LEFT, -2.8, 0, "....");

ObjEvent_SetGraphic( LEFT, 0, Hecatia2 );
Talking( 0, LEFT );
SetText( LEFT, -2.8, 0, "I am Mamizou.");

ObjEvent_SetGraphic( RIGHT, 0, Hecatia6 );
Talking( 0, RIGHT );
SetText( RIGHT, -0.4, 0, "Why~.");

ObjEvent_SetGraphic( LEFT, 0, Hecatia2 );
Talking( 0, LEFT );
SetText( LEFT, -2.8, 0, "I was just welcoming the freshman.~");

ObjEvent_SetGraphic( RIGHT, 0, Hecatia6 );
Talking( 0, RIGHT );
SetText( RIGHT, -0.4, 0, "Was that how you 'welcome' [r]the freshman?!?!");

ObjEvent_SetGraphic( LEFT, 0, Hecatia2 );
Talking( 0, LEFT );
SetText( LEFT, -2.8, 0, "There's no common sense in Gensokyo.");

ObjEvent_SetGraphic( RIGHT, 0, Hecatia6 );
Talking( 0, RIGHT );
SetText( RIGHT, -0.4, 0, "Aww... ");

ObjEvent_SetGraphic( RIGHT, 0, Hecatia6 );
Talking( 0, RIGHT );
SetText( RIGHT, -0.4, 0, "Right now, I need to slap Junko's face.");

ObjEvent_SetGraphic( LEFT, 0, Hecatia3 );
Talking( 0, LEFT );
SetText( LEFT, -2.8, 0, "She's over there.");

ObjEvent_SetGraphic( RIGHT, 0, Hecatia6 );
Talking( 0, RIGHT );
SetText( RIGHT, -0.4, 0, "Thank you...");

ObjEvent_SetGraphic( RIGHT, 0, Hecatia6 );
Talking( 0, RIGHT );
SetText( RIGHT, -0.4, 0, "But wait...");

ObjEvent_SetGraphic( RIGHT, 0, Hecatia6 );
Talking( 0, RIGHT );
SetText( RIGHT, -0.4, 0, "Aren't you the one who asked that?");



FinallizeEvent;
}

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



