//#TouhouDanmakufu[Single]
#ScriptVersion[3]
#System["./default_system/Default_System.txt"]
#Title["Nonspell 1"]
#Text["First Nonspell of Mirai"]

#include "./img/All_Star_Shots/AllStarShot_Const.txt"
#include "./Sounds.txt"
#include "./Functions.txt"
#include "./Animation.txt"
#include "./Effects.txt"
#include "./Reimu.txt"
#include "./Voyante.txt"

let bossObj;
let sceneObj = GetEnemyBossSceneObjectID;


@Initialize
{
	bossObj = ObjEnemy_Create(OBJ_ENEMY_BOSS);
	ObjMove_SetX(bossObj, GetCommonData("bossX", -32));
	ObjMove_SetY(bossObj, GetCommonData("bossY", -32));
	ObjEnemy_Regist(bossObj);
	
	DeleteShotAll(TYPE_ALL, TYPE_IMMEDIATE);
	SetCommonData("animStyle", "idle");
	
	
	renderBoss3;
	TFinalize;
	bulle;
	texte1;
	texte2;
	texte3;
}

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

@MainLoop
{
	SetCommonData("bossX", ObjMove_GetX(bossObj));
	SetCommonData("bossY", ObjMove_GetY(bossObj));
	yield;
}


task bulle {
	SetForbidPlayerShot(true);
	SetForbidPlayerSpell(true);
	ObjMove_SetDestAtFrame(bossObj, getCenterX, 90, 45);
	test(1);
	wait(60);
		ReimuNormalOmbre;
		VoyanteNormal;
		DialogueBubbleEnnemi(180,90,148,0.6,5,"CONTROL",0);
		VoyanteSerieuse;
		DialogueBubbleEnnemi(180,90,148,0.5,5,"CONTROL",0);
		test(0);
		VoyanteSerieuseOmbre;
		ReimuNormal;
		DialogueBubble(180,190,160,0.8,5,"CONTROL",0);
		DialogueBubble(180,190,160,0.5,5,"CONTROL",0);
		test(1);
		ReimuNormalOmbre;
		VoyanteNormal;
		DialogueBubbleEnnemi(180,90,148,0.8,5,"CONTROL",0);
		SetForbidPlayerShot(false);
		SetForbidPlayerSpell(false);
		ObjEnemy_AddLife(bossObj, -1);
}

task texte1 {
	wait(60);
		DialogueText(73,120,"CONTROL",0,21,"Je n'en revient pas, toi,");
		wait(5);
		DialogueText(73,128,"CONTROL",0,21,"Tu as reussi a me vaincre");
		wait(5);
		DialogueText(70,120,"CONTROL",0,21,"Je vais continuer a monter");
		wait(5);
		DialogueText(70,142,"CONTROL",0,21,"Que vais-je y trouver ?");
		wait(5);
		DialogueText(72,105,"CONTROL",0,21,"Une grotte, mais je doute");

}

task texte2 {
	wait(60);
		DialogueText(77,140,"CONTROL",0,21,"une simple humaine");
		wait(5);
		DialogueText(77,140,"CONTROL",0,21,"");
		wait(5);
		DialogueText(70,140,"CONTROL",0,21,"vers le haut de");
		wait(5);
		DialogueText(70,140,"CONTROL",0,21,"");
		wait(5);
		DialogueText(72,125,"CONTROL",0,21,"que vous puissiez");
}

task texte3 {
	wait(60);
		DialogueText(77,132,"CONTROL",0,21,"");
		wait(5);
		DialogueText(77,132,"CONTROL",0,21,"");
		wait(5);
		DialogueText(70,160,"CONTROL",0,21,"cette montagne");
		wait(5);
		DialogueText(72,145,"CONTROL",0,21,"");
		wait(5);
		DialogueText(72,145,"CONTROL",0,21,"y entrer...");
}

task TFinalize
{
	while (ObjEnemy_GetInfo(bossObj, INFO_LIFE) > 0) {yield;}
	wait(5);
	SetCommonData("bossX", ObjMove_GetX(bossObj));
	SetCommonData("bossY", ObjMove_GetY(bossObj));
	Obj_Delete(bossObj);
	DeleteShotAll(TYPE_ALL, TYPE_ITEM);
	SetAutoDeleteObject(true);
	CloseScript(GetOwnScriptID());
	return;
}



