#東方弾幕風[Single]
#ScriptVersion[3]
#Title["Dialogue1"]
#Text["a"]
#System["./default_system/Default_System.txt"]
#Background["./default_System/Default_Background.txt"]
#include"./default_system/Default_Index.txt"

let objBoss;
	
let BossX;
let BossY;

@Initialize {
	SetPlayerClip(126, 12, 510, 468);
	objBoss = ObjEnemy_Create(OBJ_ENEMY_BOSS);
	ObjEnemy_Regist(objBoss);
	
	ObjMove_SetPosition(objBoss, -50, -50);
	
	SetCommonData("RenderTimer", 0);

	Initialization;
	
	Main;
	end;
} 

task Initialization{
	RenderGaraiya(objBoss);
	RenderGaraiyaNoShikigami(objBoss);
	//MagicRing(objBoss);
	HitSound(objBoss,60,500);
	TimerCountdown;
	SetArmor(objBoss, [90, 80], 180);
	EnemyMarker(objBoss);
}

@Event { 
	alternative(GetEventType())
	case(EV_REQUEST_LIFE){SetScriptResult(1);}
	case(EV_REQUEST_TIMER){SetScriptResult(-1);}
	//case(EV_REQUEST_SPELL_SCORE){SetScriptResult(10000);}
	//case(EV_REQUEST_IS_DURABLE_SPELL){SetScriptResult(true);}
	//case(EV_REQUEST_IS_LAST_SPELL){SetScriptResult(true);}
} 

@MainLoop {
	BossX = ObjMove_GetX(objBoss);
	BossY = ObjMove_GetY(objBoss);
	SetCommonData("BossX", BossX);
	SetCommonData("BossY", BossY);
	yield;
} 

@Finalize {
} 

task ColorChange{
wait(120);
ascent(i in 0..64){
SetCommonData("StgFrameColor", [255-i*4, 255, 255-i*4]);
yield;
}
}

task GrayToRed{
ascent(i in 0..32){
SetCommonData("StgFrameColor", [255, 255-i*8, 255-i*8]);
yield;
}
}

task RedToGreen{
ascent(i in 0..32){
SetCommonData("StgFrameColor", [255-i*8, 0+i*8, 0]);
yield;
}
}

task RedToOrange{
ascent(i in 0..32){
SetCommonData("StgFrameColor", [255, 0+i*4, 0]);
yield;
}
}

task OrangeToGreen{
ascent(i in 0..32){
SetCommonData("StgFrameColor", [255-i*8, 126+i*4, 0]);
yield;
}
}

task GreenToRed{
ascent(i in 0..32){
SetCommonData("StgFrameColor", [0+i*8, 255-i*8, 0]);
yield;
}
}

task GreenToOrange{
ascent(i in 0..32){
SetCommonData("StgFrameColor", [0+i*8, 255-i*4, 0]);
yield;
}
}

task OrangeToBlue{
ascent(i in 0..32){
SetCommonData("StgFrameColor", [255-i*8, 126-i*4, 0+i*8]);
yield;
}
}

task BlueToRed{
ascent(i in 0..32){
SetCommonData("StgFrameColor", [0+i*8, 0, 255-i*8]);
yield;
}
}

task BlueToGreen{
ascent(i in 0..32){
SetCommonData("StgFrameColor", [0, 0+i*8, 255-i*8]);
yield;
}
}

task GreenToBlue{
ascent(i in 0..32){
SetCommonData("StgFrameColor", [0, 255-i*8, 0+i*8]);
yield;
}
}

task RedToBlue{
ascent(i in 0..32){
SetCommonData("StgFrameColor", [255-i*8, 0, 0+i*8]);
yield;
}
}

task BlueToOrange{
ascent(i in 0..32){
SetCommonData("StgFrameColor", [0+i*8, 0+i*4, 255-i*8]);
yield;
}
}

task OrangeToRed{
ascent(i in 0..32){
SetCommonData("StgFrameColor", [255, 126-i*4, 0]);
yield;
}
}


task Main { 
SetCommonData("BackgroundSpeed", 4);
wait(120);

GrayToRed;
SetText(GetPlayerX, GetPlayerY, 2,0,0,0,"After the Ink rain stopped...",130,65, true);
SetText(GetPlayerX, GetPlayerY, 2,0,0,0,"Everyone I've met has tried to blast me.",175,65, true);
SetText(GetPlayerX, GetPlayerY, 2,0,0,0,"I don't think I can't just give away my title of[r]Emperor even after an event like this!",195,65, true);

RedToOrange;
SetText(GetStageLeft+15, GetStageUp+50, 0,0,0,0,"There they are, Master!",0,0, false);
OrangeToGreen;
SetText(GetStageLeft+15, GetStageUp+50, 0,0,0,0,"Good Find, Kaisen.",0,0, false);
GreenToRed;
ObjMove_SetDestAtWeight(objBoss, GetStgFrameWidth/2, GetStgFrameHeight/2-100, 5, 4);
SetText(GetPlayerX, GetPlayerY, 2,0,0,160,"Ugh, Who is it now?",100,65, true);


RedToGreen;
SetText(BossX, BossY, 2,0,0,0,"This one's name is Garaiya.",130,75, false);
SetText(BossX, BossY, 2,0,0,0,"You must be the Emperor from the Capital City, Yes?",230,75, false);
GreenToOrange;
SetText(BossX, BossY, 2,0,0,0,"They're the Emperor?",100,45, false);
OrangeToBlue;
SetText(BossX, BossY, 2,0,0,0,"They don't seem like one with these clothes!",180,60, false);
BlueToRed;
SetText(GetPlayerX, GetPlayerY, 2,0,0,0,"Not formal wear by any stretch of the imagination.~",220,65, true);
SetText(GetPlayerX, GetPlayerY, 2,0,0,0,"At least it wasn't ruined during the Ink rain.",185,65, true);
RedToGreen;
SetText(BossX, BossY, 2,0,0,0,"I've been investigating the cause of the rain.",200,75, false);
GreenToOrange;
SetText(BossX, BossY, 2,0,0,0,"We've been collecting some of the Ink too.",200,45, false);
OrangeToBlue;
SetText(BossX, BossY, 2,0,0,0,"And I don't really care about your dress!",170,60, false);
BlueToGreen;
SetText(BossX, BossY, 2,0,0,0,"Kujiru, Be nice.",80,75, false);
GreenToRed;
SetText(GetPlayerX, GetPlayerY, 2,0,0,0,"You heard them!",90,65, true);
RedToOrange;
SetText(BossX, BossY, 2,0,0,0,"Looks like you cornered yourself, Slug!",180,45, false);
OrangeToBlue;
SetText(BossX, BossY, 2,0,0,0,"-Quiet you...!",50,60, false);
BlueToGreen;
SetText(BossX, BossY, 2,0,0,0,"Ku-jiruu~",60,75, false);
GreenToBlue;
SetText(BossX, BossY, 2,0,0,0,"Okay fine..!",45,60, false);
BlueToGreen;
SetText(BossX, BossY, 2,0,0,0,"Would you happen to have any of that Ink in you at the moment?",280,75, false);
GreenToRed;
SetText(GetPlayerX, GetPlayerY, 2,0,0,0,"Egh, Everyone so far has tried to ask for that same thing.",240,65, true);
SetText(GetPlayerX, GetPlayerY, 2,0,0,0,"Some... Less friendly than others.",140,65, true);
SetText(GetPlayerX, GetPlayerY, 2,0,0,0,"They're even worse than that Ice cream man[r]I murdered for charging way too much.-",210,65, true);
RedToGreen;
SetText(BossX, BossY, 2,0,0,0,"Excuse me what.",90,75, false);
GreenToOrange;
SetText(BossX, BossY, 2,0,0,0,". . .",35,45, false);
OrangeToBlue;
SetText(BossX, BossY, 2,0,0,0,"Eh? They did what now?",100,60, false);
BlueToRed;
SetText(GetPlayerX, GetPlayerY, 2,0,0,0,"What, Sweets like that are enjoyable!",170,65, true);
SetText(GetPlayerX, GetPlayerY, 2,0,0,0,"Charging way too much for that is unforgivable.",210,65, true);
SetText(GetPlayerX, GetPlayerY, 2,0,0,0,"And thus I had to get rid of him along[r]with every other corrupt individual.",190,65, true);
RedToOrange;
SetText(BossX, BossY, 2,0,0,0,"THE ICE CREAM MAAAAAAAAAAAAAN!",190,45, false);
OrangeToGreen;
SetText(BossX, BossY, 2,0,0,0,"Kaisen wha-",60,75, false);
GreenToOrange;
SetText(BossX, BossY, 2,0,0,0,"ICE CREAAAAAAAAAAAAAAAAAAAAAAAAAAAAAM",240,45, false);
OrangeToBlue;
SetText(BossX, BossY, 2,0,0,0,"I think you enraged the frog, That's new...?",170,60, false);
BlueToRed;
SetText(GetPlayerX, GetPlayerY, 2,0,0,0,"I don't think I can reason with them anymore, Can I go now?",260,65, true);
RedToOrange;
SetText(BossX, BossY, 2,0,0,90,"ICE CREAAAAAAAAAAAAAAAAAAAAAAAAAAAAAM",240,45, false);
OrangeToGreen;
SetText(BossX, BossY, 2,0,0,0,"I would try to calm Kaisen down but that was mean.",240,75, false);
GreenToRed;
SetText(GetPlayerX, GetPlayerY, 2,0,0,0,"Pleasedon'tfightmeI'mabittiredatthemoment-",200,65, true);
RedToBlue;
SetText(BossX, BossY, 2,0,0,0,"Master's right, I think you deserve a beatdown!",190,60, false);
BlueToOrange;
SetText(BossX, BossY, 2,0,0,60,"ICE CREAAAAAAAAAAAAAAAAAAAAAAAAAAAAAM",240,45, false);

SetCommonData("IsBoss", 1);
NotifyEventAll(EV_USER+1, 0);

OrangeToRed;
SetText(GetPlayerX, GetPlayerY, 2,0,0,0,"Oh fine, It isn't the first time I've been attacked Three-on-One.",270,65, true);
SetText(GetPlayerX, GetPlayerY, 2,0,0,0,"I can catch a breath later!",120,65, true);
RedToOrange;
SetText(BossX, BossY, 2,0,0,30,"ICE CREAAAAAAAAAAAAAAAAAAAAAAAAAAAAAM",240,45, false);
OrangeToBlue;
SetText(BossX, BossY, 2,0,0,0,"Someone shut the frog up I can't fight straight with so much shouting.",260,60, false);
BlueToGreen;
SetText(BossX, BossY, 2,0,0,0,"Looks like we have no choice.",140,75, false);

wait(60);
ObjEnemy_SetLife(objBoss, 0);
}

task end{
    while(ObjEnemy_GetInfo(objBoss, INFO_LIFE) > 0){yield;}
	//NotifyEvent(GetStageID, EV_USER_STAGE, [true, true, true, false, false, false]); //smexplosion, smparticles, items, bigexplosion, bigparticles, shake+slow
    Obj_Delete(objBoss);
    DeleteShotAll(TYPE_ALL, TYPE_ITEM);
    SetAutoDeleteObject(true);
    CloseScript(GetOwnScriptID());
} 