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



let objBoss;
let width = 444;
let height = 448;
let life = 1;
let scene = GetEnemyBossSceneObjectID();
let path = GetCurrentScriptDirectory~"./../SFX/";



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


@Initialize{
    objBoss = ObjEnemy_Create(OBJ_ENEMY_BOSS);
    ObjEnemy_Regist(objBoss);
	SetCommonData("non1", "no");
	
	animNon(objBoss, 1);
	TFinalize(objBoss);
	skip(objBoss);
	
	
    ObjMove_SetPosition(objBoss, -60, -60);
	Main;
}




@MainLoop{
    yield;
}


task Main{
	ScreenShake(120, 20);
    NotifyEventAll(EV_USER_STAGE+3, 0);
	SetForbidPlayerSpell(true);
    ObjEnemy_SetDamageRate(objBoss, 0,0);
	let r= 255; let g= 255; let b = 255;
	wait(240);
	let t=0;
	let text = speak(false, "...", r, g, b);
	while(t<180){
	    if(GetVirtualKeyState(VK_CANCEL) == KEY_PUSH){t=180;}
		t++; yield;
	}
	Obj_Delete(text);
	ObjMove_SetDestAtFrame(objBoss, width/2, height/3, 120);
	wait(150);
	
	t=0;
	text = speak(false, "Well then..", r, g, b);
	while(t<180){
	    if(GetVirtualKeyState(VK_CANCEL) == KEY_PUSH){t=180;}
		t++; yield;
	}
	Obj_Delete(text);
	NotifyEventAll(EV_USER_STAGE+4, 0);
	
	t=0;
	text = speak(false, "It seems as though[r]you have won.", r, g, b);
	while(t<180){
	    if(GetVirtualKeyState(VK_CANCEL) == KEY_PUSH){t=180;}
		t++; yield;
	}
	Obj_Delete(text);
	
	t=0;
	text = speak(false, "Time after time,", r, g, b);
	while(t<180){
	    if(GetVirtualKeyState(VK_CANCEL) == KEY_PUSH){t=180;}
		t++; yield;
	}
	Obj_Delete(text);
	
	t=0;
	text = speak(false, "The Warwick Maths Department", r, g, b);
	while(t<180){
	    if(GetVirtualKeyState(VK_CANCEL) == KEY_PUSH){t=180;}
		t++; yield;
	}
	Obj_Delete(text);
	
	t=0;
	text = speak(false, "Has vainly attempted[r]to defeat you.", r, g, b);
	while(t<180){
	    if(GetVirtualKeyState(VK_CANCEL) == KEY_PUSH){t=180;}
		t++; yield;
	}
	Obj_Delete(text);
	
	t=0;
	text = speak(false, "Mario, James,[r]Dave, Saul..", r, g, b);
	while(t<180){
	    if(GetVirtualKeyState(VK_CANCEL) == KEY_PUSH){t=180;}
		t++; yield;
	}
	Obj_Delete(text);
	
	t=0;
	text = speak(false, "And now myself..[r]We have all failed.", r, g, b);
	while(t<180){
	    if(GetVirtualKeyState(VK_CANCEL) == KEY_PUSH){t=180;}
		t++; yield;
	}
	Obj_Delete(text);
	
	t=0;
	text = speak(false, "But I recall speaking[r]to Dave some days ago.", r, g, b);
	while(t<180){
	    if(GetVirtualKeyState(VK_CANCEL) == KEY_PUSH){t=180;}
		t++; yield;
	}
	Obj_Delete(text);
	
	t=0;
	text = speak(false, "He said that we are[r]in a video game series..", r, g, b);
	while(t<180){
	    if(GetVirtualKeyState(VK_CANCEL) == KEY_PUSH){t=180;}
		t++; yield;
	}
	Obj_Delete(text);
	
	t=0;
	text = speak(false, "And that we are just[r] copies of our real selves.", r, g, b);
	while(t<180){
	    if(GetVirtualKeyState(VK_CANCEL) == KEY_PUSH){t=180;}
		t++; yield;
	}
	Obj_Delete(text);
	
	t=0;
	text = speak(false, "Heh.. Hopefully we are[r]better at our jobs", r, g, b);
	while(t<180){
	    if(GetVirtualKeyState(VK_CANCEL) == KEY_PUSH){t=180;}
		t++; yield;
	}
	Obj_Delete(text);
	
	t=0;
	text = speak(false, "Than we are at[r]destroying you here.", r, g, b);
	while(t<180){
	    if(GetVirtualKeyState(VK_CANCEL) == KEY_PUSH){t=180;}
		t++; yield;
	}
	Obj_Delete(text);
	
	t=0;
	text = speak(false, "At least YOU might[r] have got some amusement..", r, g, b);
	while(t<180){
	    if(GetVirtualKeyState(VK_CANCEL) == KEY_PUSH){t=180;}
		t++; yield;
	}
	Obj_Delete(text);
	
	t=0;
	text = speak(false, "From all this.", r, g, b);
	while(t<180){
	    if(GetVirtualKeyState(VK_CANCEL) == KEY_PUSH){t=180;}
		t++; yield;
	}
	Obj_Delete(text);
	
	t=0;
	text = speak(false, "For our part,[r]we are very tired..", r, g, b);
	while(t<180){
	    if(GetVirtualKeyState(VK_CANCEL) == KEY_PUSH){t=180;}
		t++; yield;
	}
	Obj_Delete(text);
	
	t=0;
	text = speak(false, "I doubt that you[r]will see us again.", r, g, b);
	while(t<180){
	    if(GetVirtualKeyState(VK_CANCEL) == KEY_PUSH){t=180;}
		t++; yield;
	}
	Obj_Delete(text);
	
	t=0;
	text = speak(false, "Farewell, dear player..", r, g, b);
	while(t<180){
	    if(GetVirtualKeyState(VK_CANCEL) == KEY_PUSH){t=180;}
		t++; yield;
	}
	Obj_Delete(text);
	
	ObjMove_SetDestAtFrame(objBoss, -70, -70, 120);
	wait(180);
	
	t=0;
	text = speak(false, "Congratulations on beating..", r, g, b);
	while(t<180){
	    if(GetVirtualKeyState(VK_CANCEL) == KEY_PUSH){t=180;}
		t++; yield;
	}
	Obj_Delete(text);
	
	t=0;
	text = speak(false, "The final entry in[r]the DanMATHSkufu series.", r, g, b);
	while(t<180){
	    if(GetVirtualKeyState(VK_CANCEL) == KEY_PUSH){t=180;}
		t++; yield;
	}
	Obj_Delete(text);
	
	t=0;
	text = speak(false, "I hope you enjoyed[r]your time with it.", r, g, b);
	while(t<180){
	    if(GetVirtualKeyState(VK_CANCEL) == KEY_PUSH){t=180;}
		t++; yield;
	}
	Obj_Delete(text);
	
	t=0;
	text = speak(false, "Thanks for playing!!!", r, g, b);
	while(t<180){
	    if(GetVirtualKeyState(VK_CANCEL) == KEY_PUSH){t=180;}
		t++; yield;
	}
	Obj_Delete(text);
	
	ObjEnemy_SetLife(objBoss, 0);
}




