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

#include"./../../Functions/Event_Functions.txt"
#include"./../../Functions/Effects/Effects.txt"
#include"./LoadGraphics.txt"
#include"./LoadSounds.txt"

let bossObj;
let bossX;
let bossY;

@Initialize{
	bossObj = ObjEnemy_Create(OBJ_ENEMY_BOSS);
	SetCommonData("ForceLifebar",1);
	SetAutoDeleteObject(true);
	ObjEnemy_Regist(bossObj);
	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{
	MakeExplosionA2(192,224,"SAKURA",255,255,255);
	MakeExplosionA2(192,224,"SAKURA",255,255,255);
	MakeExplosionA2(192,224,"SAKURA",255,255,255);
	DeleteShotAll(TYPE_ALL,TYPE_FADE);
	SE(se_enep2);
	SetForbidPlayerShot(true);
	SetForbidPlayerSpell(true);
	loop(60){yield;}
	StopSlow(TARGET_ALL);
	loop(30){yield;}

	CreateTextBox;

	SetLeftImage(marisa02,0,0,180,320,180-30,320-40);
	SetRightImage(miyako05,0,0,260,330,230+20,300+20);
	TalkRight;
		TextRightA("Oof... You really are something! Should'a known [r]by that flame in you.",255,150,64);
	TalkLeft;
		TextLeftA("Yep! I'm the famous Marisa, hero of Gensokyo! [r]Everybody here knows me and praises me!",255,120,120);
	TalkRight;
		TextRightA("Something tells me you're lying.",255,150,64);
	SetLeftImage(marisa05,0,0,180,320,180-30,320-40);
	TalkLeft;
		TextLeftA("Ah, you got me.",255,120,120);
	TalkRight;
		TextRightA("Doesn't matter. Still up for that drink?",255,150,64);
	SetLeftImage(marisa03,0,0,180,320,180-30,320-40);
	TalkLeft;
		TextLeftA("Hell yeah!",255,120,120);
	TalkRight;
		TextRightA("(She's interestin'. I've got a feelin' I'm really [r]gonna dig it here!)",255,150,64);
	SetLeftImage(marisa04,0,0,180,320,180-30,320-40);
	TalkLeft;
		TextLeftA("How 'bout we kick this party off again? All [r]nighter?",255,120,120);
	TalkRight;
		TextRightA("All nighter!",255,150,64);
	SetRightImage2(tsugumi01,0,0,310,450,240,280);
		TextRight2A("But I have work tomorrow...",255,150,200);
	TalkCorrect;
	SetLeftImage(marisa02,0,0,180,320,180-30,320-40);
	TalkLeft;
		TextLeftA("Too bad~",255,120,120);
	TalkRight;
		TextRightA("Come on, just drink with us.",255,150,64);
	TalkCorrect2;
		TextRight2A("Ugh... I guess one wouldn't hurt.",255,150,200);
	DeleteLeftImage;
	DeleteRightImage;
	DeleteRightImage2;
	loop(60){yield;}
		TextLeftA("(It was then they all got drunk and Tsumugi [r]married Marisa to a plant.)",255,255,255);
	DeleteTextBox;

	SetForbidPlayerShot(false);
	SetForbidPlayerSpell(false);

	loop(60){yield;}
	ObjEnemy_SetLife(bossObj,0);
	loop(1){yield;}
	DeleteShotAll(TYPE_ALL,TYPE_ITEM);
	Obj_Delete(bossObj);
	CloseScript(GetOwnScriptID);}