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

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(marisa06,0,0,180,320,180-30,320-40);
	SetRightImage(circle,0,0,0,0,1,1);
	TalkLeft;
		TextLeftA("What's with all the lanterns? Somethin' goin' on? [r]Was I not invited to the party? That's cold.",255,255,64);
	TalkRight;
		TextRightA("Nonsense!",255,150,64);
	TalkLeft;
		TextLeftA("Who are you?",255,255,64);
	SetCommonData("Boss",2);
	loop(120){yield;}
	animateBossM;
	TEnemyMarker;
	loop(60){yield;}
	SetRightImage(miyako01,0,0,260,330,230-20,300-10);
	TalkRight;TMiyakoName;
		TextRightA("The Emperor of the Night Treasure!",255,150,64);
	SetLeftImage(marisa04,0,0,180,320,180-30,320-40);
	TalkLeft;
		TextLeftA("Yahouou? Never heard of ya.",255,255,64);
	SetRightImage(miyako06,0,0,260,330,230-20,300-10);
	TalkRight;
		TextRightA("Ah, I'm a pretty new God here in Gensokyo. [r]Just breakin' in the new place with a parade.",255,150,64);
	SetLeftImage(marisa03,0,0,180,320,180-30,320-40);
	TalkLeft;
		TextLeftA("Sounds fun. Does that mean you'll be breakin' [r]in...",255,255,64);
	SetRightImage(miyako07,0,0,260,330,230-20,300-10);
	TalkRight;
		TextRightA("Danmaku? Of course, doyaa!",255,150,64);
		TextRightA("I knew someone interesting would come when [r]they saw the parade.",255,150,64);
	SetLeftImage(marisa07,0,0,180,320,180-30,320-40);
	TalkLeft;
		TextLeftA("That magatama back there wasn't that strong, [r]especially for a goddess.",255,255,64);
	SetRightImage(miyako01,0,0,260,330,230-20,300-10);
	TalkRight;
		TextRightA("Tsumugi? She 'n' I already played a bit. She was [r]probably tired.",255,150,64);
	SetLeftImage(marisa04,0,0,180,320,180-30,320-40);
	TalkLeft;
		TextLeftA("Are you tired from battling her?",255,255,64);
	SetRightImage(miyako02,0,0,260,330,230-20,300-10);
	TalkRight;
		TextRightA("Nah, she was still weak.",255,150,64);
	SetLeftImage(marisa02,0,0,180,320,180-30,320-40);
	TalkLeft;
		TextLeftA("Besides the magatama, whaddya say we--",255,255,64);
	SetRightImage(miyako01,0,0,260,330,230-20,300-10);
	TalkRight;
		TextRightA("No need to be so hasty~ Don't you wanna [r]drink?",255,150,64);
	SetLeftImage(marisa03,0,0,180,320,180-30,320-40);
	TalkLeft;
		TextLeftA("Are you gonna get me drunk so I don't dodge [r]right?",255,255,64);
	SetRightImage(miyako06,0,0,260,330,230-20,300-10);
	TalkRight;
		TextRightA("You're so cold, I've got so much for everyone. [r]After?",255,150,64);
	SetLeftImage(marisa04,0,0,180,320,180-30,320-40);
	TalkLeft;
		TextLeftA("After. You're a pretty cool god. Way better than [r]that cranky one on the mountain.",255,255,64);
	SetRightImage(miyako07,0,0,260,330,230-20,300-10);
	TalkRight;
		TextRightA("You're a pretty cool human. Your aura might not [r]be the cleanest, but it sure is bright.",255,150,64);
	SetLeftImage(marisa06,0,0,180,320,180-30,320-40);
	TalkLeft;
		TextLeftA("Color? Can you read my aura or somethin'?",255,255,64);
	SetRightImage(miyako01,0,0,260,330,230-20,300-10);
	TalkRight;
		TextRightA("Yep. Still itchin' for that housewarming [r]danmaku battle? That's what I'm gettin'.",255,150,64);
	SetLeftImage(marisa04,0,0,180,320,180-30,320-40);
	TalkLeft;
		TextLeftA("You must be a psychic, I was just thinkin' that.",255,255,64);
	SetRightImage(miyako02,0,0,260,330,230-20,300-10);
	TalkRight;
		TextRightA("So was I. What was your name again?",255,150,64);
	SetLeftImage(marisa02,0,0,180,320,180-30,320-40);
	TalkLeft;
		TextLeftA("Why don't we chat some more after the battle?",255,255,64);
	TalkRight;SetCommonData("Boss",3);
		TextRightA("Alright, let's go! Let's kick this off with a good [r]ol' war cry, doyaa!",255,150,64);
	SetLeftImage(marisa04,0,0,180,320,180-30,320-40);
	TalkLeft;
		TextLeftA("(What a kook. They'd fit right in here.)",255,255,64);
	
	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);}