#TouhouDanmakufu[Single]
#ScriptVersion[3]
#Title["DialogueBox"]
#Text["Wooooooop"]

let objBoss;
#include "./Functions/Index.txt"


@Initialize {
	objBoss = ObjEnemy_Create(OBJ_ENEMY_BOSS);
	SE_Play(GetCurrentScriptDirectory ~ "Functions/sfx/death.wav", 90);
	ObjEnemy_Regist(objBoss);
	ObjEnemy_SetDamageRate(objBoss,0,0);
	ObjMove_SetPosition(objBoss,-50,-50);
	mainTask;	
} 

@Event { 
	alternative(GetEventType())
	case(EV_REQUEST_LIFE){
		SetScriptResult(1);
        }
	case(EV_REQUEST_TIMER){
		SetScriptResult(900000000000000);
	}
	case(EV_REQUEST_SPELL_SCORE){
		SetScriptResult(0);
	}
} 

let BossX = 0;
let BossY = 0;

@MainLoop {
	BossX = ObjMove_GetX(objBoss);
	BossY = ObjMove_GetY(objBoss);
	yield;
} 

@Finalize {} 

task mainTask { 
	end;
	renderdiancie(objBoss);
	wait(100);
	SetForbidPlayerShot(true);
	DialogueBox;
	wait(35);
	//----------
	OrinSetEmotion("Regular");
	OrinPortrait;
	DianciePortrait;
	Dialogue("Well, I think that does it for you.", "Orin");
	wait(5);
	while(GetVirtualKeyState(VK_SHOT)!=KEY_PUSH){yield;}
	SE_Play(GetCurrentScriptDirectory ~ "Functions/sfx/shot.wav", 200);
	wait(5);
	//----------
	DiancieTalk;
	Dialogue("Why did you come here in the first place?", "Diancie");
	wait(5);
	while(GetVirtualKeyState(VK_SHOT)!=KEY_PUSH){yield;}
	SE_Play(GetCurrentScriptDirectory ~ "Functions/sfx/shot.wav", 200);
	wait(5);
	//----------
	OrinSetEmotion("Happeh");
	OrinTalk;
	Dialogue("Oh nothing, [r]I was sent here, that's all.", "Orin");
	wait(5);
	while(GetVirtualKeyState(VK_SHOT)!=KEY_PUSH){yield;}
	SE_Play(GetCurrentScriptDirectory ~ "Functions/sfx/shot.wav", 200);
	wait(5);
	//----------
	OrinSetEmotion("Regular");
	OrinTalk;
	Dialogue("You're still smiling?", "Orin");
	wait(5);
	while(GetVirtualKeyState(VK_SHOT)!=KEY_PUSH){yield;}
	SE_Play(GetCurrentScriptDirectory ~ "Functions/sfx/shot.wav", 200);
	wait(5);
	//----------
	DiancieTalk;
	Dialogue("I told you, I can't stop smiling...", "Diancie");
	wait(5);
	while(GetVirtualKeyState(VK_SHOT)!=KEY_PUSH){yield;}
	SE_Play(GetCurrentScriptDirectory ~ "Functions/sfx/shot.wav", 200);
	wait(5);
	//----------
	OrinSetEmotion("Regular");
	OrinTalk;
	Dialogue("That's fine.[r]I got to go now, Later sis!", "Orin");
	wait(5);
	while(GetVirtualKeyState(VK_SHOT)!=KEY_PUSH){yield;}
	SE_Play(GetCurrentScriptDirectory ~ "Functions/sfx/shot.wav", 200);
	wait(5);
	//----------
	DiancieTalk;
	Dialogue("Owww...", "Diancie");
	wait(5);
	while(GetVirtualKeyState(VK_SHOT)!=KEY_PUSH){yield;}
	SE_Play(GetCurrentScriptDirectory ~ "Functions/sfx/shot.wav", 200);
	wait(5);
	//----------
	dissapear = true;
	SetForbidPlayerShot(false);
	wait(10);
	ObjEnemy_SetLife(objBoss,0);
	SetCommonData("musicswap",2);
	}

task end{
    while(ObjEnemy_GetInfo(objBoss, INFO_LIFE) > 0){yield;}
    Obj_Delete(objBoss);
    DeleteShotAll(TYPE_ALL, TYPE_IMMEDIATE);
    SetAutoDeleteObject(true);
    CloseScript(GetOwnScriptID());
}

