//#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 "./FeeDesFeuillesMortes.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");
	
	
	renderBoss1;
	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);
	wait(60);
		MarisaSueur;
		DialogueBubble(180,190,160,0.8,5,"CONTROL",0);
		test(1);
		ObjMove_SetDestAtFrame(bossObj, getCenterX, 90, 45);
		MarisaSueurOmbre;
		FeeDesFeuillesMortesConfiante;		
		DialogueBubbleEnnemi(180,90,178,0.7,5,"CONTROL",0);
		test(0);
		FeeDesFeuillesMortesConfianteOmbre;
		MarisaNormal;
		DialogueBubble(180,190,160,0.5,5,"CONTROL",0);
		test(1);
		MarisaNormalOmbre;
		FeeDesFeuillesMortesNormal;
		DialogueBubbleEnnemi(180,90,178,0.8,5,"CONTROL",0);
		test(0);
		FeeDesFeuillesMortesNormalOmbre;
		MarisaNormal;
		DialogueBubble(180,190,160,0.6,5,"CONTROL",0);
		test(1);
		MarisaNormalOmbre;
		FeeDesFeuillesMortesConfiante;
		DialogueBubbleEnnemi(180,90,178,0.5,5,"CONTROL",0);
		test(0);
		SetForbidPlayerShot(false);
		SetForbidPlayerSpell(false);
		ObjEnemy_AddLife(bossObj, -1);
}

task texte1 {
	wait(60);
		DialogueText(72,118,"CONTROL",0,21,"Ouah ! Mais c'est quoi");
		wait(5);
		DialogueText(72,145,"CONTROL",0,21,"Aucune idee, mais c'est");
		wait(5);
		DialogueText(72,142,"CONTROL",0,21,"Euh, t'es qui toi ?");
		wait(5);
		DialogueText(72,135,"CONTROL",0,21,"En temps que Yokai");
		wait(5);
		DialogueText(72,129,"CONTROL",0,21,"Bon, un petit echauffement");
		wait(5);
		DialogueText(72,160,"CONTROL",0,21,"Tu vas voir !");
}

task texte2 {
	wait(60);
		DialogueText(72,138,"CONTROL",0,21,"toutes ses petites");
		wait(5);
		DialogueText(72,165,"CONTROL",0,21,"un temps pour se battre !");
		wait(5);
		DialogueText(72,135,"CONTROL",0,21,"");
		wait(5);
		DialogueText(72,155,"CONTROL",0,21,"manipulant les feuilles");
		wait(5);
		DialogueText(72,149,"CONTROL",0,21,"ne fait pas de mal");
		wait(5);
		DialogueText(72,165,"CONTROL",0,21,"");
}

task texte3 {
	wait(60);
		DialogueText(72,158,"CONTROL",0,21,"choses volantes ?");
		wait(5);
		DialogueText(72,165,"CONTROL",0,21,"");
		wait(5);
		DialogueText(72,155,"CONTROL",0,21,"");
		wait(5);
		DialogueText(72,175,"CONTROL",0,21,"mortes je te defie !");
		wait(5);
		DialogueText(72,158,"CONTROL",0,21,"");
		wait(5);
		DialogueText(72,145,"CONTROL",0,21,"");
}

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



