#TouhouDanmakufu[Single]
#ScriptVersion[3]

#include "./functions.txt"

timer = 0;
let text = GetCommonData("TEXT_ENABLED",true);

@Initialize
{
	Obj_SetValue(GetEnemyBossSceneObjectID,"INIT",true);
	TEnemyWork;
}

@MainLoop
{
	yield;
}

@Event
{
	alternative(GetEventType())
	case(EV_REQUEST_LIFE)
		{
		SetScriptResult(1/(10^10));
		}
	case(EV_REQUEST_TIMER)
		{
		SetScriptResult(timer);
		}
	case(EV_REQUEST_SPELL_SCORE)
		{
		SetScriptResult(0);
		}
}

task TEnemyWork
{
	SetForbidPlayerShot(true);
	SetForbidPlayerSpell(true);
	loop(30){yield;}
	if(text == true)
		{
		InitializeEvent(1,1);
		Talking(0,LEFT);
		ObjEvent_SetGraphic(LEFT,0,Nue_Face);
		SetText(LEFT,0,0,"So this is what \"Trick or Treating\" is like.");
		SetText(LEFT,0,0,"It was definitely a good idea to[r] bring Mamizou here,");
		SetText(LEFT,0,0,"But she sure brought some strange traditions...");
		Talking(0,RIGHT);
		SetText(RIGHT,0,9,"OooooOOOOOooooOOOO...");
		}
	objEnemy = ObjEnemy_Create(OBJ_ENEMY_BOSS);
	ObjEnemy_Regist(objEnemy);
	TXY;
	ObjEnemy_Render; 
	ObjMove_SetPosition(objEnemy,GetStgFrameWidth/2-64,-64);
	ObjMove_SetDestAtWeight(objEnemy,GetStgFrameWidth/2,GetStgFrameHeight/2-110,20,5);
	loop(89){yield;}
	if(text == true)
		{
		loop(31){yield;}
		ObjEvent_SetGraphic(RIGHT,0,Hecatia_Face);
		SetText(RIGHT,0,0,"Ooooh myyyyy, it looks like you've stumbled into...");
		SetText(RIGHT,0,0,"Hecatia's House of Hooorrooor's!");
		SetText(RIGHT,0,0,"Who knows what kind of terrible things await you\~");
		Talking(0,LEFT);	
		SetText(LEFT,0,0,"Oh, is this supposed to be scary?");
		Talking(0,RIGHT);	
		SetText(RIGHT,0,0,"Kids these days are so cruel...");
		SetText(RIGHT,0,0,"Why can't you let us adults[r] have fun sometimes?");
		Talking(0,LEFT);	
		SetText(LEFT,0,0,"Do you perceive me as a child?");
		SetText(LEFT,0,0,"How strange.");
		SetText(LEFT,0,0,"Though really, I'd never have guessed[r]that you were an adult.");
		Talking(0,RIGHT);	
		SetText(RIGHT,0,0,"Ohohoh\~");
		SetText(RIGHT,0,0,"Complimenting my[r]youthful appearance, are you?");
		Talking(0,LEFT);	
		SetText(LEFT,0,0,"Your outfit is too weird for an adult.");
		Talking(0,RIGHT);	
		SetText(RIGHT,0,0,"Here's your candy, kid. Now beat it.");
		Talking(0,LEFT);	
		SetText(LEFT,0,0,"Wait, wait! Weren't you going to scare me?");
		SetText(LEFT,0,0,"I heard you're a Hell goddess.");
		SetText(LEFT,0,0,"Something like that could be interesting...");
		Obj_SetValue(objPlayer,"MUSIC",false);
		Talking(0,RIGHT);	
		Obj_SetValue(objPlayer,"MUSIC",false);
		SetText(RIGHT,0,0,"Oh, so that's how it is.");
		Obj_SetValue(objPlayer,"MUSIC",true);
		SetText(RIGHT,0,0,"Usually, I'd rather not fight a little kid, but...");
		SetText(RIGHT,0,0,"I don't think you're actually a child.");
		SetText(RIGHT,0,0,"For that reason alone, I'll drop you into hell.");
		SetText(RIGHT,0,0,"For that reason and no more!");
		SetText(RIGHT,0,0,"Now suffer on this most treacherous of nights!");
		ObjEvent_SetGraphic(LEFT,0,"");
		ObjEvent_SetGraphic(RIGHT,0,"");
		loop(20){yield;}
		FinalizeEvent;
		}
	else
		{
		Obj_SetValue(objPlayer,"MUSIC",false);
		yield;
		Obj_SetValue(objPlayer,"MUSIC",true);
		}
	ObjEnemy_SetLife(objEnemy,0);
	Obj_Delete(objEnemy);
	yield;
	SetForbidPlayerShot(false);
	SetForbidPlayerSpell(false);
	CloseScript(GetOwnScriptID);
}