//#TouhouDanmakufu[Single]
#ScriptVersion[3]
#System["./../system/NSystem.dnh"]
#Player["./../player/Reimu by plasmaflame22/Reimu_A.txt", "./../../player/Reimu by plasmaflame22/Reimu_C.txt"]
#Title["IntroSaul"]
#include "./sharedfuncSaul.dnh"



let objBoss;
let width = 444;
let height = 448;
let life = 1;
let scene = GetEnemyBossSceneObjectID();

@Event{
    alternative(GetEventType())
    case(EV_REQUEST_LIFE){
        SetScriptResult(life);
    }
}


@Initialize{
    objBoss = ObjEnemy_Create(OBJ_ENEMY_BOSS);
    ObjEnemy_Regist(objBoss);
	SetCommonData("non1", "yes");
	
	animNon(objBoss, 1);
	TFinalize(objBoss);
	
	
    ObjMove_SetDestAtFrame(objBoss, width/2, height/2, 60);
	skip(objBoss);
	Main;
}




@MainLoop{
    ObjEnemy_SetIntersectionCircleToShot(objBoss, ObjMove_GetX(objBoss), ObjMove_GetY(objBoss), 32); 
    yield;
}


task Main{
    Name(1, objBoss);
    Indicator(objBoss, 1);
	NotifyEventAll(EV_USER_STAGE, 0);
    SetForbidPlayerShot(true);
	SetForbidPlayerSpell(true);
    ObjEnemy_SetDamageRate(objBoss, 0,0);
	let time = 180; let r= 255; let g= 255; let b = 255;
	wait(90);
	let t=0;
	let text = speak(false, "Well well well.[r]Look what we have here.", r, g, b);
	while(t<time){
	    if(GetVirtualKeyState(VK_OK) == KEY_PUSH){t=time;}
		t++; yield;
	}
	Obj_Delete(text);
	t=0;
	text = speak(false, "I must admit, you have[r]made a name for yourself[r]at Warwick.", r, g, b);
	while(t<time){
	    if(GetVirtualKeyState(VK_OK) == KEY_PUSH){t=time;}
		t++; yield;
	}
	Obj_Delete(text);
	t=0;
	text = speak(false, "Ever since your fight[r]with Dave, the entire", r, g, b);
	while(t<time){
	    if(GetVirtualKeyState(VK_OK) == KEY_PUSH){t=time;}
		t++; yield;
	}
	Obj_Delete(text);
	t=0;
	text = speak(false, "Maths department has been[r]terrified of your power.", r, g, b);
	while(t<time){
	    if(GetVirtualKeyState(VK_OK) == KEY_PUSH){t=time;}
		t++; yield;
	}
	Obj_Delete(text);
	t=0;
	text = speak(false, "They want to put an end[r]to your existence.", r, g, b);
	while(t<time){
	    if(GetVirtualKeyState(VK_OK) == KEY_PUSH){t=time;}
		t++; yield;
	}
	Obj_Delete(text);
	t=0;
	text = speak(false, "This, puny player, is[r]where I come in.", r, g, b);
	while(t<time){
	    if(GetVirtualKeyState(VK_OK) == KEY_PUSH){t=time;}
		t++; yield;
	}
	Obj_Delete(text);
	t=0;
	text = speak(false, "You see, as a topologist,", r, g, b);
	while(t<time){
	    if(GetVirtualKeyState(VK_OK) == KEY_PUSH){t=time;}
		t++; yield;
	}
	Obj_Delete(text);
	t=0;
	text = speak(false, "I shoot to confuse and kill!", r, g, b);
	while(t<time){
	    if(GetVirtualKeyState(VK_OK) == KEY_PUSH){t=time;}
		t++; yield;
	}
	Obj_Delete(text);
	t=0;
	text = speak(false, "And there is no escape[r]from me..", r, g, b);
	while(t<time){
	    if(GetVirtualKeyState(VK_OK) == KEY_PUSH){t=time;}
		t++; yield;
	}
	Obj_Delete(text);
	t=0;
	text = speak(false, "For you are trapped[r]in this mental dimension..", r, g, b);
	while(t<time){
	    if(GetVirtualKeyState(VK_OK) == KEY_PUSH){t=time;}
		t++; yield;
	}
	Obj_Delete(text);
	if(GetCommonData("Difficulty", 0)==2){
		t=0;
		text = speak(false, "AND I AM BRIMMING[r]WITH POWER!!", r, g, b);
		while(t<time){
			if(GetVirtualKeyState(VK_OK) == KEY_PUSH){t=time;}
			t++; yield;
		}
		Obj_Delete(text);
	}
	t=0;
	text = speak(false, "In other words...", r, g, b);
	while(t<time){
	    if(GetVirtualKeyState(VK_OK) == KEY_PUSH){t=time;}
		t++; yield;
	}
	Obj_Delete(text);
	t=0;
	text = speak(false, "YOU'RE IN MY WORLD NOW!!", r, g, b);
	while(t<time){
	    if(GetVirtualKeyState(VK_OK) == KEY_PUSH){t=time;}
		t++; yield;
	}
	Obj_Delete(text);
	t=0;
	text = speak(false, "NO ONE WILL[r]REMEMBER YOU!!", r, g, b);
	while(t<time){
	    if(GetVirtualKeyState(VK_OK) == KEY_PUSH){t=time;}
		t++; yield;
	}
	Obj_Delete(text);
	t=0;
	text = speak(false, "SO JUST DIE!!!!", r, g, b);
	while(t<time){
	    if(GetVirtualKeyState(VK_OK) == KEY_PUSH){t=time;}
		t++; yield;
	}
	Obj_Delete(text);
	NotifyEventAll(EV_USER_STAGE+1, 0);
	wait(80);
	ObjEnemy_SetLife(objBoss, 0);
}
	
	