//#TouhouDanmakufu[Single]
#ScriptVersion[3]
#Title["IntroDave"]
#include "./sharedfuncDave.dnh"



let objBoss;
let width = 384;
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);
	TFinalize(objBoss);
	
	
    ObjMove_SetDestAtFrame(objBoss, width/2, height/2, 60);
	Main;
}


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


task Main{
    Name(1, objBoss);
    Indicator(objBoss, 1);
	skip(objBoss);
    SetForbidPlayerShot(true);
    ObjEnemy_SetDamageRate(objBoss, 0,0);
	let time = 150;
	wait(90);
	let t=0;
	let text = speak(false, "So.. you're the one[r]who has been bothering[r]Mario and James.");
	while(t<time){
	    if(GetVirtualKeyState(VK_OK) == KEY_PUSH){t=time;}
		t++; yield;
	}
	Obj_Delete(text);
    t=0;
	text = speak(false, "Yet both as their friend[r] and as the Director[r] of Undergraduate Studies..");
	while(t<time){
	    if(GetVirtualKeyState(VK_OK) == KEY_PUSH){t=time;}
		t++; yield;
	}
	Obj_Delete(text);
	t=0;
	text = speak(false, "I cannot allow this [r]to go unpunished.");
	while(t<time){
	    if(GetVirtualKeyState(VK_OK) == KEY_PUSH){t=time;}
		t++; yield;
	}
	Obj_Delete(text);
	t=0;
	text = speak(false, "En garde, dear player!");
	while(t<time){
	    if(GetVirtualKeyState(VK_OK) == KEY_PUSH){t=time;}
		t++; yield;
	}
	Obj_Delete(text);
	ObjEnemy_SetLife(objBoss, 0);
}
