//#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);
	wait(60);
		ReimuQuestion;
		DialogueBubble(180,190,160,0.6,5,"CONTROL",0);
		test(1);
		ReimuQuestionOmbre;
		VoyanteNormal;
		DialogueBubbleEnnemi(180,90,148,0.6,5,"CONTROL",0);
		test(0);
		VoyanteNormalOmbre;
		ReimuNormal;
		DialogueBubble(180,190,160,0.8,5,"CONTROL",0);
		test(1);
		ReimuNormalOmbre;
		VoyanteSerieuse;
		DialogueBubbleEnnemi(180,90,148,0.6,5,"CONTROL",0);
		DialogueBubbleEnnemi(180,90,148,0.6,5,"CONTROL",0);
		DialogueBubbleEnnemi(180,90,148,0.5,5,"CONTROL",0);
		test(0);
		VoyanteSerieuseOmbre;
		ReimuEnerve;
		DialogueBubble(180,190,160,0.8,5,"CONTROL",0);
		DialogueBubble(180,190,160,0.8,5,"CONTROL",0);
		test(1);
		ReimuEnerveOmbre;
		VoyanteEnerver;
		DialogueBubbleEnnemi(180,90,148,0.8,5,"CONTROL",0);
		test(0);
		VoyanteEnerverOmbre;
		ReimuEnerve;
		DialogueBubble(180,190,160,0.6,5,"CONTROL",0);
		ReimuNormal;
		DialogueBubble(180,190,160,0.6,5,"CONTROL",0);
		test(1);
		ReimuNormalOmbre;
		VoyanteSerieuse;
		DialogueBubbleEnnemi(180,90,148,0.8,5,"CONTROL",0);
		DialogueBubbleEnnemi(180,90,148,0.6,5,"CONTROL",0);
		SetForbidPlayerShot(false);
		SetForbidPlayerSpell(false);
		ObjEnemy_AddLife(bossObj, -1);
}

task texte1 {
	wait(60);
		DialogueText(70,128,"CONTROL",0,21,"Vous me barrez la route,");
		wait(5);
		DialogueText(73,122,"CONTROL",0,21,"Je suis l'une des gardiennes");
		wait(5);
		DialogueText(70,120,"CONTROL",0,21,"Parfait, pile au moment");
		wait(5);
		DialogueText(72,115,"CONTROL",0,21,"Je suis une gardienne");
		wait(5);
		DialogueText(72,115,"CONTROL",0,21,"Pitoyable humaine,");
		wait(5);
		DialogueText(72,118,"CONTROL",0,21,"Je ne te le redirais");
		wait(5);
		DialogueText(70,120,"CONTROL",0,21,"Quel mauvais caractere,");
		wait(5);
		DialogueText(70,120,"CONTROL",0,21,"Les cristaux semblent");
		wait(5);
		DialogueText(72,105,"CONTROL",0,21,"On avait bien besoin qu'une");
		wait(5);
		DialogueText(70,130,"CONTROL",0,21,"Tu commence serieusement");
		wait(5);
		DialogueText(70,130,"CONTROL",0,21,"Soit tu part maintenant");
		wait(5);
		DialogueText(72,105,"CONTROL",0,21,"Je suis l'un des trois");
		wait(5);
		DialogueText(73,120,"CONTROL",0,21,"Aucun humain ne");
		wait(5);

}

task texte2 {
	wait(60);
		DialogueText(70,148,"CONTROL",0,21,"qui etes vous ?");
		wait(5);
		DialogueText(77,142,"CONTROL",0,21,"de cette montagne");
		wait(5);
		DialogueText(70,140,"CONTROL",0,21,"ou je voulais des");
		wait(5);
		DialogueText(72,135,"CONTROL",0,21,"pas un guide touristique");
		wait(5);
		DialogueText(72,135,"CONTROL",0,21,"fait demi-tour immediatement");
		wait(5);
		DialogueText(72,138,"CONTROL",0,21,"pas deux fois");
		wait(5);
		DialogueText(70,140,"CONTROL",0,21,"et non je ne ferais");
		wait(5);
		DialogueText(70,140,"CONTROL",0,21,"provenir du haut");
		wait(5);
		DialogueText(72,125,"CONTROL",0,21,"stupide humaine se mele de");
		wait(5);
		DialogueText(70,150,"CONTROL",0,21,"a me gonfler");
		wait(5);
		DialogueText(70,150,"CONTROL",0,21,"soit je t'extermine");
		wait(5);
		DialogueText(72,125,"CONTROL",0,21,"piliers protecteur de");
		wait(5);
		DialogueText(77,142,"CONTROL",0,21,"passera vivant !");
		wait(5);
}

task texte3 {
	wait(60);
		DialogueText(70,160,"CONTROL",0,21,"");
		wait(5);
		DialogueText(77,132,"CONTROL",0,21,"");
		wait(5);
		DialogueText(70,160,"CONTROL",0,21,"renseignements !");
		wait(5);
		DialogueText(72,145,"CONTROL",0,21,"");
		wait(5);
		DialogueText(70,143,"CONTROL",0,21,"");
		wait(5);
		DialogueText(70,143,"CONTROL",0,21,"");
		wait(5);
		DialogueText(70,160,"CONTROL",0,21,"pas demi-tour !");
		wait(5);
		DialogueText(70,160,"CONTROL",0,21,"de cette montagne");
		wait(5);
		DialogueText(72,145,"CONTROL",0,21,"ce qui ne la regarde pas !");
		wait(5);
		DialogueText(70,160,"CONTROL",0,21,"");
		wait(5);
		DialogueText(77,132,"CONTROL",0,21,"");
		wait(5);
		DialogueText(72,145,"CONTROL",0,21,"cette montagne");
		wait(5);
		DialogueText(77,132,"CONTROL",0,21,"");
		wait(5);
}

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;
}



