#TouhouDanmakufu[Single]
#ScriptVersion[3]
#Title["St1_StartTalk"]
#Text["..."]
#System[".\system\Default_System.txt"]


#include"./lib/WormShot_Const.dnh"
#include"./lib/TheFunctions.txt"
#include"./BGTask.txt"
//#include"./Animation_lib_satori.txt"
#include"./Animation_lib_Kaori.txt"
#include"./Animation_lib_subRoka.txt"
#include"./lib/Dialogue Prototype2.dnh"
let Enemy = ID_INVALID;
let Roka = ID_INVALID;
let EnemyX = 0;
let EnemyY = 0;
let RokaX = 0;
let RokaY = 0;

@Event{
	alternative(GetEventType)
	case(EV_REQUEST_LIFE){SetScriptResult(1);}
	case(EV_REQUEST_TIMER){SetScriptResult(-1);}
//case(EV_REQUEST_SPELL_SCORE){SetScriptResult(90000);}
}

@Initialize{
	Enemy = ObjEnemy_Create(OBJ_ENEMY_BOSS);
	Roka = ObjEnemy_Create(OBJ_ENEMY);
	ObjEnemy_Regist(Enemy);
	ObjEnemy_Regist(Roka);
SetDamageRateAtFrame(Enemy,60,10,120);
SetAutoDeleteObject(true);
//InitializeAction(Enemy,MichaelDot);
//DrawBoss_Task(Enemy);

BossImage_Roka;
//name("Michael Derpy",0,10);
//LifeCircleBar_A(Enemy,0.8,0.2,true);
//LifeCircleBar_B(Enemy,0.2,0.0,true);
//LifeCircleBar_Marker(Enemy,0.8);
//LifeStock(2,1);
//TWaveCircle_Shadertask(Enemy,5);
//TAura(Enemy,5);
LoadSounds;
ObjRender_SetPosition(Enemy,-80, 0,0);
ObjRender_SetPosition(Roka,-80, 0,0);
	//ObjMove_SetDestAtWeight(Enemy, GetStgFrameWidth/2, 100, 10,5);
	BossActions;
}

@MainLoop{

	yield;
}

task BossActions{
	ShootBullets;
//Texto;
	while(ObjEnemy_GetInfo(Enemy, INFO_LIFE) > 0){
		EnemyX = ObjMove_GetX(Enemy);
		EnemyY = ObjMove_GetY(Enemy);
		ObjEnemy_SetIntersectionCircleToShot(Enemy, EnemyX, EnemyY, 40);
		ObjEnemy_SetIntersectionCircleToPlayer(Enemy, EnemyX, EnemyY, 30);
                                          
		yield;
	}
DeleteShotAll(TYPE_ALL, TYPE_ITEM);
	Obj_Delete(Enemy);
	//loop(60){yield;}
	CloseScript(GetOwnScriptID);
}
function wait(t){loop(t){yield;}}

task ShootBullets{
wait(60);
talk;
wait(90);

loop{

wait(40);

}
}

sub talk{
/*
Set"x"Port"N"(Marisa15);
*/

//SetEventSpeaker(ENEMY1_SPEAKS);
	//SetEventTextA(SAY_YELLOW, "Si, Gusano sera tuyo, ahora[r]alejate de mi camino");

	let Charla ;
	let gusano = "";
	let lapros = "";
	let michael = MichaelNormal;
	SetCommonData("OnEvent",true);
	StartEvent;
	SetPlayerNumber(1);
	SetEnemyNumber(1);
	
	//SetNewPlayerPort1(Alice2);
	if(GetAreaCommonData("GAMEDATA","Personaje",defchar) == 0){
	SetNewPlayerPort1(ReimuSurprised); // Normal
	SetEventSpeaker(PLAYER1_SPEAKS);

	Charla = ["","So, here's where that trumpeteer ran away."];  //Normal
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	Charla = ["","This place is... so strange, i've[r]never seen plants like this."]; //Surprised
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	Charla = ["","What kind of magic is this?"];
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	SetEventSpeaker(UNKNOWN1_SPEAKS);

	Charla = ["","The youkai mountain is a great[r]place for all kinds of vegetation"];
	SetEventTextA(SAY_WHITE,Charla[GetLanguage]);

	Charla = ["","How did you never saw anything[r]like this?"];
	SetEventTextA(SAY_WHITE,Charla[GetLanguage]);

	SetEventSpeaker(PLAYER1_SPEAKS);

	Charla = ["","I... it was never like that."];  //Surprised
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	
	WaitToMove2;
	
	SetNewEnemyPort1(RokaNormal); 
	SetEventSpeaker(ENEMY1_SPEAKS);

	CharacterTitle(GetStgFrameWidth/2,100,1,GetLanguage);
	//CharacterTitle(GetStgFrameWidth/2,270,3,GetLanguage);
	Charla = ["","I see, I see, it's all work of my[r]ability of nature improvement."]; //relieved
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	Charla = ["","You couldn't see a forest like[r]this anywhere,"]; //relieved
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	Charla = ["","It would take a extremely long[r]time to grow."]; //relieved
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	SetEventSpeaker(PLAYER1_SPEAKS);

	Charla = ["","I have to admit this is beatiful[r]and I want something for my [r]shrine.     "];  //Surprised
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	Charla = ["","But I am here to give a lesson[r]to your boss!"];  //Annoyed
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

    SetEventSpeaker(ENEMY1_SPEAKS);

	Charla = ["","Bad news."]; //relieved
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	Charla = ["","I'm the boss."]; //relieved
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	SetEventSpeaker(PLAYER1_SPEAKS);

	Charla = ["","So you are behind all of this?"];  //Surprised
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	Charla = ["","Why I never suspected it?"];  //Annoyed
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	Charla = ["","You are not a youkar or a [r]human, just a regular spirit."];  //Annoyed
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

    SetEventSpeaker(ENEMY1_SPEAKS);

	Charla = ["","Not really."]; //relieved
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	Charla = ["","I'm a tree spirit, not a regular spirit."]; //relieved
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	Charla = ["","Youkai rules do not affect me, I learnt this by entering Gensokyo."]; //relieved
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	SetEventSpeaker(PLAYER1_SPEAKS);

	Charla = ["","I'm no pro in foreginer species, but..."];  //Surprised
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	Charla = ["","That doesn't give you the rights to make a rebellion, and scare[r]the human village."];  //Surprised
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	SetEventSpeaker(UNKNOWN1_SPEAKS);

	Charla = ["","Isn't that what you actually need[r]for youkai to survive?"];
	SetEventTextA(SAY_WHITE,Charla[GetLanguage]);

	SetEventSpeaker(PLAYER1_SPEAKS);

	Charla = ["","Who's there?"];  //Surprised
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	WaitToMove;

	SetNewEnemyPort2(KaoriHappy); 
	SetEventSpeaker(ENEMY2_SPEAKS);

    Charla = ["","Youkai like me are born out of[r]the human fears."];  //Surprised
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	Charla = ["","Without fear, we all dissapear[r]and the balance of Gensokyo would[r]be broken, right?"];  //Surprised
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	Charla = ["","So, why are you so mad?"];  //Surprised
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	SetEventSpeaker(PLAYER1_SPEAKS);

	Charla = ["","I'm mad because that's not how it[r]should be."];  //Surprised
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	Charla = ["","Humans shouldn't face youkai[r]because they can be eaten or[r]killed.         "];  //Surprised
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	Charla = ["","Because that damages the balance,[r]as you said."];  //Surprised
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	Charla = ["","So, can you explain all of this[r]excuse for rebellion?"];  //Surprised
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	SetEventSpeaker(ENEMY1_SPEAKS);

	Charla = ["","Scaring humans is just part of[r]the plan."];  //Surprised
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

    CharacterTitle(GetStgFrameWidth/2,100,2,GetLanguage);
    SetEventSpeaker(ENEMY2_SPEAKS);

    Charla = ["","All of the human plot was just an excuse to call you, Hakurei[r]shrine maiden."];  //Surprised
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	Charla = ["","We are looking for a far better[r]thing than teasing them."];  //Surprised
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	Charla = ["","You will have to listen to our[r]requests or we're going to end[r]you.[r]         "];  //Surprised
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	SetEventSpeaker(PLAYER1_SPEAKS);

	Charla = ["","That won't happen."];  //Surprised
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	Charla = ["","My end, obviously."];  //Surprised
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	SetEventSpeaker(ENEMY2_SPEAKS);

    Charla = ["","... I see."];  //Surprised
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	SetEventSpeaker(ENEMY1_SPEAKS);

    Charla = ["","Since I came here, neither youkai or humans wanted to be near me."];  //Surprised
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	Charla = ["","I was so lonely, I really wanted to get here,"];  //Surprised
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	Charla = ["","A place where creatures can be in peace."];  //Surprised
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	Charla = ["","But I didn't knew only the strong youkai can get there rights here."];  //Surprised
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	SetEventSpeaker(ENEMY2_SPEAKS);

    Charla = ["","It's not only because you aren't a youkai, but also you are[r]emanating a huge aura."];  //Surprised
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	Charla = ["","Have you noticed it?"];  //Surprised
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	SetEventSpeaker(ENEMY1_SPEAKS);

    Charla = ["","My aura, eh? Oh, it is that big?"];  //Surprised
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	SetEventSpeaker(ENEMY2_SPEAKS);

    Charla = ["","Yes, I think it's like 90% of[r]your energy."];  //Surprised
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	SetEventSpeaker(ENEMY1_SPEAKS);

    Charla = ["","Wait, 90%!? But why?"];  //Surprised
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	SetEventSpeaker(ENEMY2_SPEAKS);

    Charla = ["","It must be because you are only a part of a burned down tree."];  //Surprised
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	Charla = ["","Because of that, you can only use the energy assigned to you."];  //Surprised
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	Charla = ["","The rest is completely useless,[r]but plants and other vegetation[r]uses it as fertilizer."];  //Surprised
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	SetEventSpeaker(PLAYER1_SPEAKS);

	Charla = ["","That's too many wasted energy![r]Don't you feel tired?"];  //Surprised
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	SetEventSpeaker(ENEMY1_SPEAKS);

    Charla = ["","Not really, I feel full of energy"];  //Surprised
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	Charla = ["","Maybe I am used to the 10% Kaori says, right?"];  //Surprised
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	SetEventSpeaker(ENEMY2_SPEAKS);

    Charla = ["","Yes."];  //Surprised
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	Charla = ["","Your useless energy can be used [r]by me, too."];  //Surprised
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	SetEventSpeaker(ENEMY1_SPEAKS);

    Charla = ["","That's why I need you, Kaori-chan"];  //Surprised
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	SetEventSpeaker(ENEMY2_SPEAKS);

    Charla = ["","Sure, it's all ok for me."];  //Surprised
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	Charla = ["","So, listen, Hakurei Reimu:"];  //Surprised
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	Charla = ["","We want to make the strong youkai to have respect on the weak ones"];  //Surprised
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	Charla = ["","And not only youkai, but also [r]foreginer species!"];  //Surprised
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	SetEventSpeaker(ENEMY1_SPEAKS);

	Charla = ["","Fairies, Vampires, Ghosts, [r]Tree spirits and more!"];  //Surprised
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	SetEventSpeaker(ENEMY2_SPEAKS);

    Charla = ["","And get some friends too!"];  //Surprised
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	SetEventSpeaker(ENEMY1_SPEAKS);

	Charla = ["","Hold the fuck up, aren't we [r]friends already?"];  //Surprised
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	SetEventSpeaker(ENEMY2_SPEAKS);

    Charla = ["","... Sure."];  //Surprised
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	Charla = ["","Although we talked for a very[r]short time."];  //Surprised
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	SetEventSpeaker(ENEMY1_SPEAKS);

	Charla = ["","At least two weeks have passed."];  //Surprised
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	Charla = ["","That's enough for a friendship."];  //Surprised
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	SetEventSpeaker(ENEMY2_SPEAKS);

    Charla = ["","I barely have friends, so that's why I want more."];  //Surprised
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	SetEventSpeaker(ENEMY1_SPEAKS);

	Charla = ["","Ah, I understand."];  //Surprised
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	SetEventSpeaker(PLAYER1_SPEAKS);

	Charla = ["","Hey, I am here!"];  //Surprised
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	Charla = ["","Your youkai petitions are nothing[r]of my concern."];  //Surprised
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	Charla = ["","I protect the humans of the[r]village from youkai, not helping the predators.       "];  //Surprised
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	Charla = ["","You caused unnecesary chaos for [r]such an irrelevant theme like [r]respect.     "];  //Surprised
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	SetEventSpeaker(ENEMY2_SPEAKS);

    Charla = ["","So, I see."];  //Surprised
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	Charla = ["","We needed someone with a lot of[r]power over Gensokyo to share this and make others agree."];  //Surprised
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	Charla = ["","But it seems you only want to[r]exterminate youkai, despite[r]having befriended some of them."];  //Surprised
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	SetEventSpeaker(ENEMY1_SPEAKS);

	Charla = ["","Is that true?"];  //Surprised
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	SetEventSpeaker(ENEMY2_SPEAKS);

    Charla = ["","Yes, it's true."];  //Surprised
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	Charla = ["","We can't go and tell one of the [r]sages to help us, so using you[r]was our only way."];  //Surprised
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	SetEventSpeaker(PLAYER1_SPEAKS);

	Charla = ["","I don't care."];  //Surprised
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	Charla = ["","I see the fairies and the crew of[r]the scarlet devil mansion having[r]no problem with it."];  //Surprised
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	Charla = ["","You made an incident, I'll have[r]to exterminate you both, youkai [r]or not.     "];  //Surprised
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	SetEventSpeaker(ENEMY2_SPEAKS);

    Charla = ["","You are not a rival for me."];  //Surprised
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	Charla = ["","I have the advantage here with [r]Roka and this forest"];  //Surprised
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	Charla = ["","I won't lose to you because right now, I'm the strongest!"];  //Surprised
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	SetEventSpeaker(ENEMY1_SPEAKS);

	Charla = ["","How childish..."];  //Surprised
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	SetEventSpeaker(ENEMY2_SPEAKS);

    Charla = ["","Excuse me? I am older than you!"];  //Surprised
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	SetEventSpeaker(ENEMY1_SPEAKS);

	Charla = ["","Then act like a 1000 year old [r]girl, then"];  //Surprised
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	SetEventSpeaker(ENEMY2_SPEAKS);

    Charla = ["","OK."];  //Surprised
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	SetEventSpeaker(PLAYER1_SPEAKS);

	Charla = ["","They are gonna fight? How [r]unfortunate."];  //Surprised
	SetEventTextA(THINK_WHITE,Charla[GetLanguage]);

	SetEventSpeaker(ENEMY2_SPEAKS);

    Charla = ["","You will have to let me borrow [r]your energy if you want me to [r]win, Roka."];  //Surprised
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	SetEventSpeaker(ENEMY1_SPEAKS);

	Charla = ["","Okay Okay, but don't kill me [r]while doing that..."];  //Surprised
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

	Charla = ["","I'll have to drink some water for this..."];  //Surprised
	SetEventTextA(SAY_YELLOW,Charla[GetLanguage]);

SetAreaCommonData("Music","Change Music" ,1 );
	NotifyEventAll(EV_USER+69,1 );
	WaitToMove3;
	RemoveEnemyPort1;

	SetEventSpeaker(PLAYER1_SPEAKS);
	

	Charla = ["","It's time to put an end to this [r]stupid excuse of a rebellion!"];  //Surprised
	SetEventTextB(SAY_RED,Charla[GetLanguage],240);

	SetEventSpeaker(ENEMY2_SPEAKS);

    Charla = ["","It's time to put an end to this [r]egoistic excuse of a shrine [r]      maiden! "];  //Surprised
	SetEventTextB(SAY_RED,Charla[GetLanguage],240);



	}
	EndEvent;
	SetCommonData("OnEvent",false);
	ObjEnemy_SetLife(Enemy,0);
}

function WaitToMove{
//SetAction(Enemy,ACT_MOVE,70);
Concentration001(Enemy,70,90,90,90,255,0,255);
Concentration001(Enemy,70,90,90,-90,255,0,255);
ObjMove_SetPosition(Enemy, GetStgFrameWidth/2, 100);
//ObjRender_SetPosition(Enemy,-30 ,0 ,0 );
wait(120);
BossImage;
ObjRender_SetPosition(Enemy,GetStgFrameWidth/2, 100 ,0 );
wait(90);
}

function WaitToMove2{
//SetAction(Enemy,ACT_MOVE,70);
ObjMove_SetDestAtWeight(Roka, GetStgFrameWidth/2, 180, 10,5);
wait(90);
}

function WaitToMove3{
//SetAction(Enemy,ACT_MOVE,70);
ObjMove_SetDestAtWeight(Roka, GetStgFrameWidth/2-400, 0, 10,5);
wait(90);
}