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

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


@Initialize {
	objBoss = ObjEnemy_Create(OBJ_ENEMY_BOSS);
	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;
	DialogueNormal;
	}

task DialogueNormal{
	renderdiancie(objBoss);
	wait(100);
	SetForbidPlayerShot(true);
	DialogueBox;
	wait(35);
	//----------
	OrinSetEmotion("Regular");
	OrinPortrait;
	Dialogue(".....Hmm, Let's see...", "Orin");
	wait(5);
	while(GetVirtualKeyState(VK_SHOT)!=KEY_PUSH){yield;}
	SE_Play(GetCurrentScriptDirectory ~ "Functions/sfx/shot.wav", 200);
	wait(5);
	//----------
	Dialogue("Miss Satori told me to explore this[r]cave on the middle of nowhere.", "Orin");
	wait(5);
	while(GetVirtualKeyState(VK_SHOT)!=KEY_PUSH){yield;}
	SE_Play(GetCurrentScriptDirectory ~ "Functions/sfx/shot.wav", 200);
	wait(5);
	//----------
	Dialogue("And yet, I've found nothing but these[r]strange creatures I shooted.", "Orin");
	wait(5);
	while(GetVirtualKeyState(VK_SHOT)!=KEY_PUSH){yield;}
	SE_Play(GetCurrentScriptDirectory ~ "Functions/sfx/shot.wav", 200);
	wait(5);
	//----------
	DiancieTalk;
	OrinSetEmotion("What");
	ObjMove_SetDestAtWeight(objBoss,384/2,150,25,6);
	Dialogue("Hey, You there.", "Diancie");
	wait(5);
	while(GetVirtualKeyState(VK_SHOT)!=KEY_PUSH){yield;}
	SE_Play(GetCurrentScriptDirectory ~ "Functions/sfx/shot.wav", 200);
	wait(5);
	//----------
	DianciePortrait;
	DiancieTalk;
	Dialogue("I don't think you're from here. [r]Who are you?", "Diancie");
	wait(5);
	while(GetVirtualKeyState(VK_SHOT)!=KEY_PUSH){yield;}
	SE_Play(GetCurrentScriptDirectory ~ "Functions/sfx/shot.wav", 200);
	wait(5);
	//----------
	OrinSetEmotion("Regular");
	OrinTalk;
	Dialogue("Oh hi, My name's Orin and I'm just a cat.", "Orin");
	wait(5);
	while(GetVirtualKeyState(VK_SHOT)!=KEY_PUSH){yield;}
	SE_Play(GetCurrentScriptDirectory ~ "Functions/sfx/shot.wav", 200);
	wait(5);
	//----------
	OrinSetEmotion("Regular");
	OrinTalk;
	Dialogue("(I don't think she's like the others.)", "Orin");
	wait(5);
	while(GetVirtualKeyState(VK_SHOT)!=KEY_PUSH){yield;}
	SE_Play(GetCurrentScriptDirectory ~ "Functions/sfx/shot.wav", 200);
	wait(5);
	//----------
	DiancieTalk;
	Dialogue("You don't seem like one to be honest.", "Diancie");
	wait(5);
	while(GetVirtualKeyState(VK_SHOT)!=KEY_PUSH){yield;}
	SE_Play(GetCurrentScriptDirectory ~ "Functions/sfx/shot.wav", 200);
	wait(5);
	//----------
	DiancieTalk;
	Dialogue("In any case, I can't find the Pokemon [r]that live here. Or Carbink.", "Diancie");
	wait(5);
	while(GetVirtualKeyState(VK_SHOT)!=KEY_PUSH){yield;}
	SE_Play(GetCurrentScriptDirectory ~ "Functions/sfx/shot.wav", 200);
	wait(5);
	//----------
	OrinSetEmotion("Regular");
	OrinTalk;
	Dialogue("Your what?", "Orin");
	wait(5);
	while(GetVirtualKeyState(VK_SHOT)!=KEY_PUSH){yield;}
	SE_Play(GetCurrentScriptDirectory ~ "Functions/sfx/shot.wav", 200);
	wait(5);
	//----------
	DiancieTalk;
	Dialogue("My Pokemon.", "Diancie");
	wait(5);
	while(GetVirtualKeyState(VK_SHOT)!=KEY_PUSH){yield;}
	SE_Play(GetCurrentScriptDirectory ~ "Functions/sfx/shot.wav", 200);
	wait(5);
	//----------
	OrinSetEmotion("Regular");
	OrinTalk;
	Dialogue("Oh, you mean the creatures I shooted?", "Orin");
	wait(5);
	while(GetVirtualKeyState(VK_SHOT)!=KEY_PUSH){yield;}
	SE_Play(GetCurrentScriptDirectory ~ "Functions/sfx/shot.wav", 200);
	wait(5);
	//----------
	DiancieTalk;
	Dialogue("You did what?!", "Diancie");
	wait(5);
	while(GetVirtualKeyState(VK_SHOT)!=KEY_PUSH){yield;}
	SE_Play(GetCurrentScriptDirectory ~ "Functions/sfx/shot.wav", 200);
	wait(5);
	//----------
	OrinSetEmotion("What");
	OrinTalk;
	Dialogue("They attacked me first! [r]It was practically self defense.", "Orin");
	wait(5);
	while(GetVirtualKeyState(VK_SHOT)!=KEY_PUSH){yield;}
	SE_Play(GetCurrentScriptDirectory ~ "Functions/sfx/shot.wav", 200);
	wait(5);
	//----------
	OrinSetEmotion("Regular");
	OrinTalk;
	Dialogue("(I might just take their corpses later..)", "Orin");
	wait(5);
	while(GetVirtualKeyState(VK_SHOT)!=KEY_PUSH){yield;}
	SE_Play(GetCurrentScriptDirectory ~ "Functions/sfx/shot.wav", 200);
	wait(5);
	//----------
	OrinSetEmotion("Happeh");
	OrinTalk;
	Dialogue("Besides, Ya look rather okay with that,[r]smiling and everything.", "Orin");
	wait(5);
	while(GetVirtualKeyState(VK_SHOT)!=KEY_PUSH){yield;}
	SE_Play(GetCurrentScriptDirectory ~ "Functions/sfx/shot.wav", 200);
	wait(5);
	//----------
	DiancieTalk;
	Dialogue("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);
	//----------
	DiancieTalk;
	Dialogue("You, are going down for what you did[r]to those poor defenseless Pokemon.", "Diancie");
	wait(5);
	while(GetVirtualKeyState(VK_SHOT)!=KEY_PUSH){yield;}
	SE_Play(GetCurrentScriptDirectory ~ "Functions/sfx/shot.wav", 200);
	wait(5);
	//----------
	OrinSetEmotion("Happeh");
	OrinTalk;
	Dialogue("(It was self defense.)[r]", "Orin");
	wait(5);
	while(GetVirtualKeyState(VK_SHOT)!=KEY_PUSH){yield;}
	SE_Play(GetCurrentScriptDirectory ~ "Functions/sfx/shot.wav", 200);
	wait(5);
	//---------- 
	OrinSetEmotion("Laugh");
	OrinTalk;
	Dialogue("I guess I can take your corpse too when[r]I'm finished~", "Orin");
	wait(5);
	while(GetVirtualKeyState(VK_SHOT)!=KEY_PUSH){yield;}
	SE_Play(GetCurrentScriptDirectory ~ "Functions/sfx/shot.wav", 200);
	wait(5);
	SetCommonData("musicswap",1);
	DiancieTalk;
	Dialogue("Your spree ends right here, Right now!", "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);
}

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

