#TouhouDanmakufu[Single]
#ScriptVersion[3]
#Title["Miyako dialog (Reimu)"]

let bossObj;
let bossX;
let bossY;
#include"./../../Functions/Event_Functions.txt"
#include"./MiyakoDrawBoss.txt"
#include"./LoadGraphics.txt"

@Initialize{	
	let objScene = GetEnemyBossSceneObjectID();
	ObjEnemyBossScene_StartSpell(objScene);
	bossObj = ObjEnemy_Create(OBJ_ENEMY_BOSS);
	ObjMove_SetDestAtFrame(bossObj,CenterX,130,1);
	SetCommonData("ForceLifebar",1);
	SetCommonData("bossAURA",0);
	SetAutoDeleteObject(true);
	ObjEnemy_Regist(bossObj);
	LoadShotData;
	mainTask;}

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

@MainLoop{
	bossX = ObjMove_GetX(bossObj);
	bossY = ObjMove_GetY(bossObj);
	ObjEnemy_SetDamageRate(bossObj,0,0);
	ObjEnemy_SetIntersectionCircleToShot(bossObj,bossX,bossY,24);
	ObjEnemy_SetIntersectionCircleToPlayer(bossObj,bossX,bossY,32);
	yield;}

@Finalize{}

task mainTask{
	DeleteShotAll(TYPE_ALL,TYPE_FADE);
	SetForbidPlayerShot(true);
	SetForbidPlayerSpell(true);
	wait(60);

	CreateTextBox;
	
	SetLeftImage(reimu05,0,0,212,340,212-30,340-40);
	TalkLeft;
		TextLeftA("This is a pretty weird looking parade. [r]Something about it screams Sanae.",255,120,120);
	SetCommonData("Boss",2);
	loop(120){yield;}
	animateBossM;
	TEnemyMarker;
	loop(60){yield;}
	SetRightImage(miyako01,0,0,260,330,230,300);
	TalkRight;
		TextRightA("Rice? Did you bring rice to the parade? ",255,150,64);
	SetLeftImage(reimu06,0,0,212,340,212-30,340-40);
	TalkLeft;
		TextLeftA("I brought a beat up magatama. Is that good?",255,120,120);
	TalkRight;
	SetRightImage(miyako02,0,0,260,330,230,300);
		TextRightA("Tsumugi? Ah, I remember her. She and I played [r]a while. She was just a warm up.",255,150,64);
	SetRightImage(miyako01,0,0,260,330,230,300);
		TextRightA("You, on the other hand, must be a different [r]story.",255,150,64);
	SetLeftImage(reimu01,0,0,212,340,212-30,340-40);
	TalkLeft;
		TextLeftA("A whole different story. Who are you?",255,120,120);
	TalkRight;TMiyakoName;
		TextRightA("Miyako, Yahouou Miyako.",255,150,64);
		TextRightA("A god from the Outside World who moved in [r]when people got sick of the parties.",255,150,64);
	SetLeftImage(reimu05,0,0,212,340,212-30,340-40);
	TalkLeft;
		TextLeftA("I can see why.",255,120,120);
	SetRightImage(miyako04,0,0,260,330,230-20,300-20);
	TalkRight;
		TextRightA("This is just a housewarming party.",255,150,64);
		TextRightA("If I were really trying, this whole place would [r]be covered in sparklers and dancers.",255,150,64);
	SetLeftImage(reimu08,0,0,212,340,212-30,340-40);
	TalkLeft;
		TextLeftA("All I see are a couple of cheap lanterns and a [r]few drunk merchants.",255,120,120);
	TalkRight;
		TextRightA("Well, uh, I haven't had all night to prepare! [r]I was still preparing!",255,150,64);
	SetLeftImage(reimu04,0,0,212,340,212-30,340-40);
	TalkLeft;
		TextLeftA("Why don't you get back to that? I could go for [r]some alcohol.",255,120,120);
	SetRightImage(miyako01,0,0,260,330,230-20,300-20);
	TalkRight;
		TextRightA("Alcohol before danmaku? Geez, you're just [r]asking to lose.",255,150,64);
	SetLeftImage(reimu08,0,0,212,340,212-30,340-40);
	TalkLeft;
		TextLeftA("Are you challenging me? You know, I'm pretty [r]tired.",255,120,120);
	TalkRight;
		TextRightA("You had the energy to beat up Tsumugi.",255,150,64);
	SetLeftImage(reimu05,0,0,212,340,212-30,340-40);
	TalkLeft;
		TextLeftA("Weren't you supposed to be preparing?",255,120,120);
	SetRightImage(miyako04,0,0,260,330,230-20,300-20);
	TalkRight;
		TextRightA("Ah, stop running circles around me!",255,150,64);
		TextRightA("Your attitude doesn't match up with your color. [r]Are pinks supposed to be aloof?",255,150,64);
	SetLeftImage(reimu08,0,0,212,340,212-30,340-40);
	TalkLeft;
		TextLeftA("I'm just gonna stop you there, loon.",255,120,120);
	SetRightImage(miyako03,0,0,260,330,230-20,300-20);
	TalkRight;
		TextRightA("Loon? How dare you!",255,150,64);
	TalkLeft;
		TextLeftA("Are you using that as an excuse to fight me?",255,120,120);
	TalkRight;
		TextRightA("Since when were pinks so perceptive?",255,150,64);
	SetRightImage(miyako01,0,0,260,330,230,300);
		TextRightA("Look, I've been itchin' for a good fight here [r]to break in the whole Gensokyo experience.",255,150,64);
		TextRightA("You understand, right, pinky?",255,150,64);
	TalkLeft;
		TextLeftA("It's Reimu, not pinky. However, if it means I get [r]alcohol, I guess I could duel you.",255,120,120);
	SetRightImage(miyako02,0,0,260,330,230-20,300-20);
	TalkRight;
		TextRightA("You don't have to be so shy about your feelings, [r]admit it.",255,150,64);
		TextRightA("You understand how I feel and want to help! [r]That's what pinks do!",255,150,64);
	TalkLeft;
		TextLeftA("Weren't you just talking about how I'm not a [r]pink?",255,120,120);
	SetRightImage(miyako01,0,0,260,330,230-20,300-20);
	TalkRight;SetCommonData("Boss",3);
		TextRightA("Forget about it! Let's just kick this party off with [r]a war cry, doyaa!",255,150,64);
	SetLeftImage(reimu04,0,0,212,340,212-30,340-40);
	TalkLeft;
		TextLeftA("(What a weird peron. They'll fit in here, that's [r]for sure, with all the other crazy people.)",255,120,120);
	
	SetForbidPlayerShot(false);
	SetForbidPlayerSpell(false);

	DeleteLeftImage;
	DeleteRightImage;
	DeleteTextBox;
	ObjEnemy_SetLife(bossObj,0);
	DeleteShotAll(TYPE_ALL,TYPE_ITEM);
	Obj_Delete(bossObj);
	CloseScript(GetOwnScriptID);}

task TMiyakoName{
	let logo = ObjPrim_Create(OBJ_SPRITE_2D);
	ObjPrim_SetTexture(logo, name_m);
	Obj_SetRenderPriorityI(logo,50);
	ObjSprite2D_SetSourceRect(logo,0,0,512,128);
	ObjSprite2D_SetDestCenter(logo);
	ObjRender_SetBlendType(logo,BLEND_ALPHA);
	ObjRender_SetPosition(logo,200,335,0);
	ObjRender_SetScaleXYZ(logo,0.8,0.8,0);
	
	let logo1 = ObjPrim_Create(OBJ_SPRITE_2D);
	ObjPrim_SetTexture(logo1, name_s);
	Obj_SetRenderPriorityI(logo1,51);
	ObjSprite2D_SetSourceRect(logo1,0,0,100,100);
	ObjSprite2D_SetDestCenter(logo1);
	ObjRender_SetBlendType(logo1,BLEND_ALPHA);
	ObjRender_SetPosition(logo1,120,350,0);
	ObjRender_SetScaleXYZ(logo1,0.8,0.8,0);
	
	let logo2 = ObjPrim_Create(OBJ_SPRITE_2D);
	ObjPrim_SetTexture(logo2, name_s);
	Obj_SetRenderPriorityI(logo2,51);
	ObjSprite2D_SetSourceRect(logo2,0,0,100,100);
	ObjSprite2D_SetDestCenter(logo2);
	ObjRender_SetBlendType(logo2,BLEND_ALPHA);
	ObjRender_SetPosition(logo2,280,320,0);
	ObjRender_SetScaleXYZ(logo2,0.5,0.5,0);
	let alpha = 0;
	let alpha2 = 0;
	let rotate = 0;
	loop(90){
		ObjRender_SetAlpha(logo,alpha2);
		ObjRender_SetAlpha(logo1,alpha);
		ObjRender_SetAlpha(logo2,alpha);
		ObjRender_SetAngleZ(logo1,rotate);
		ObjRender_SetAngleZ(logo2,rotate);
		alpha+=200/90; alpha2+=255/90; rotate+=0.5; yield;}
	loop(120){
		ObjRender_SetAngleZ(logo1,rotate);
		ObjRender_SetAngleZ(logo2,rotate);
		rotate+=0.5; yield;}
	loop(90){
		ObjRender_SetAlpha(logo,alpha2);
		ObjRender_SetAlpha(logo1,alpha);
		ObjRender_SetAlpha(logo2,alpha);
		ObjRender_SetAngleZ(logo1,rotate);
		ObjRender_SetAngleZ(logo2,rotate);
		alpha-=200/90; alpha2-=255/90; rotate+=0.5; yield;}
	Obj_Delete(logo);
	Obj_Delete(logo1);
	Obj_Delete(logo2);}