//#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 "./Marisa.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);
		MarisaNormalOmbre;
		VoyanteNormal;
		DialogueBubbleEnnemi(180,90,148,0.6,5,"CONTROL",0);
		test(0);
		VoyanteSerieuseOmbre;
		MarisaSueur;
		DialogueBubble(180,190,160,0.5,5,"CONTROL",0);
		test(1);
		MarisaSueurOmbre;
		VoyanteNormal;
		DialogueBubbleEnnemi(180,90,148,0.8,5,"CONTROL",0);
		test(0);
		VoyanteSerieuseOmbre;
		MarisaNormal;
		DialogueBubble(180,190,160,0.5,5,"CONTROL",0);
		test(1);
		MarisaNormalOmbre;
		VoyanteNormal;
		DialogueBubbleEnnemi(180,90,148,0.8,5,"CONTROL",0);
		test(0);
		VoyanteNormalOmbre;
		MarisaNormal;
		DialogueBubble(180,190,160,0.5,5,"CONTROL",0);
		test(1);
		MarisaNormalOmbre;
		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,"Tu n'est pas une");
		wait(5);
		DialogueText(70,142,"CONTROL",0,21,"Ou dois-je aller deja ?");
		wait(5);
		DialogueText(72,105,"CONTROL",0,21,"J'imagine que vous voulez");
		wait(5);
		DialogueText(70,142,"CONTROL",0,21,"Ah oui, c'est vrai !");
		wait(5);
		DialogueText(72,105,"CONTROL",0,21,"Continue de monter tu");
		wait(5);
		DialogueText(68,142,"CONTROL",0,21,"Tu est bien docile tout a coup");
		wait(5);
		DialogueText(72,105,"CONTROL",0,21,"C'est parce que je sais que");
		wait(5);
}

task texte2 {
	wait(60);
		DialogueText(77,140,"CONTROL",0,21,"humaine ordinaire...");
		wait(5);
		DialogueText(70,140,"CONTROL",0,21,"");
		wait(5);
		DialogueText(72,125,"CONTROL",0,21,"aller jusqu'a la source");
		wait(5);
		DialogueText(70,140,"CONTROL",0,21,"");
		wait(5);
		DialogueText(72,125,"CONTROL",0,21,"arrivera face a une grotte");
		wait(5);
		DialogueText(77,140,"CONTROL",0,21,"");
		wait(5);
		DialogueText(72,125,"CONTROL",0,21,"vous n'entrerez jamais dans");
}

task texte3 {
	wait(60);
		DialogueText(77,132,"CONTROL",0,21,"");
		wait(5);
		DialogueText(77,132,"CONTROL",0,21,"");
		wait(5);
		DialogueText(72,145,"CONTROL",0,21,"de ses cristaux...");
		wait(5);
		DialogueText(77,132,"CONTROL",0,21,"");
		wait(5);
		DialogueText(72,145,"CONTROL",0,21,"d'ou emane ses cristaux");
		wait(5);
		DialogueText(77,132,"CONTROL",0,21,"");
		wait(5);
		DialogueText(72,145,"CONTROL",0,21,"la grotte de toute facon");
}

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



