"use strict";

DATA_SDS_DIALOGUE["Melody_c2_gracie_0"]=
	{ 
		x: DEFINE_DIALOGUE_BOX_UPPER.x,
		y: DEFINE_DIALOGUE_BOX_UPPER.y,
		width: DEFINE_DIALOGUE_BOX_UPPER.width,
		height: DEFINE_DIALOGUE_BOX_UPPER.height,
		pauses: false,
		blocks: true,
		title: "[shrine maiden]",
		script: [
			{command:"buffer", text:"...don't...worry...not...dead...just...stiff... . . . urrrghhhhhhh!\n"},			//0
			{command:"wait"},
			{command:"return", retval:0},
		] // an array of options/commands which will be evaluated in sequence
	};

DATA_SDS_DIALOGUE["Melody_c2_gracie_1"]=
	{ 
		x: DEFINE_DIALOGUE_BOX_UPPER.x,
		y: DEFINE_DIALOGUE_BOX_UPPER.y,
		width: DEFINE_DIALOGUE_BOX_UPPER.width,
		height: DEFINE_DIALOGUE_BOX_UPPER.height,
		pauses: false,
		blocks: true,
		title: "Melody",
		script: [
			{command:"buffer", text:"Whew... thanks!  It feels so good to sit up, at least; I think my tail will be asleep for a few more minutes yet.\n"},			//0
			{command:"wait"},
			{command:"clear"},
			{command:"buffer", text:"My name's Melody.  You're the new girl from the village aren't you?  I take it Grace found you when I sent her for Fred & Ned?\n"},
			{command:"wait"},
			{command:"clear"},
			{command:"buffer", text:"I'm supposed to be watching the bay shrine down in the sunken Nautilus, but things went crazy during the big earthquake, and now the whole place is full of smoke and shadows!\n"},
			{command:"wait"},
			{command:"clear"},
			{command:"buffer", text:"I wanted to go warn the village, but the gate was broken.  Warning the other keepers was the next best idea, so I headed up here to try to find someone to relay a message.\n"},
			{command:"wait"},
			{command:"clear"},
			{command:"buffer", text:"I'd just made it to the top of the beach when I heard a terrible creaking.  The next thing I know, the crown of a great tree is falling this way, and I'm hit by a flying branch!\n"},
			{command:"wait"},
			{command:"clear"},
			{command:"buffer", text:"The only tree tall enough to reach this far is the great Sky Tree in front of the forest shrine, and if the monkeys allowed it to be cut down...\n"},
			{command:"wait"},
			{command:"clear"},
			{command:"buffer", text:". . . I know this is sudden, but could YOU look into what's going on?\n"},
			{command:"wait"},
			{command:"buffer", text:"...\n"},
			{command:"wait"},
			{command:"buffer", text:"No, not as you are, of course!  But if Rinda trusts you with those Bracelets, then I can trust you with the Goddess' Necklace.  It should make crossing land much easier!\n"},
			{command:"wait"},
			{command:"clear"},
			{command:"buffer", text:"Here- take this [Nautilus Key].  You should be able to get inside with it.  The Necklace is in the hold at the bow of the vessel.\n"},
			{command:"wait"},
			{command:"buffer", text:"But... do be careful.  Something eerie is down there now; the smoke can't be doing any good!\n"},
			{command:"wait"},
			{command:"return", retval:0},
		] // an array of options/commands which will be evaluated in sequence
	};

DATA_SDS_DIALOGUE["Melody_c2_gracie_2"]=
	{ 
		x: DEFINE_DIALOGUE_BOX_UPPER.x,
		y: DEFINE_DIALOGUE_BOX_UPPER.y,
		width: DEFINE_DIALOGUE_BOX_UPPER.width,
		height: DEFINE_DIALOGUE_BOX_UPPER.height,
		pauses: false,
		blocks: true,
		title: "Melody",
		script: [
			{command:"buffer", text:"*siiiighhhh*\n"},			//0
			{command:"wait"},
			{command:"clear"},
			{command:"buffer", text:"You and your little imaginary friend... I know you're used to playing down in the hold, but I really don't think it's safe right now, honey.\n"},
			{command:"wait"},
			{command:"clear"},
			{command:"buffer", text:". . .\n"},
			{command:"wait"},
			{command:"clear"},
			{command:"buffer", text:"Who am I kidding?  Gracie'll talk my ear off until I say yes, and probably go after you anyway even if I don't.  She takes after mom and I when it comes to trouble...\n"},
			{command:"wait"},
			{command:"clear"},
			{command:"buffer", text:"Just... keep her close, ok?\n"},
			{command:"wait"},
			{command:"return", retval:0},
		] // an array of options/commands which will be evaluated in sequence
	};

DATA_SDS_DIALOGUE["Melody_c2_melody_0"]=
	{ 
		x: DEFINE_DIALOGUE_BOX_UPPER.x,
		y: DEFINE_DIALOGUE_BOX_UPPER.y,
		width: DEFINE_DIALOGUE_BOX_UPPER.width,
		height: DEFINE_DIALOGUE_BOX_UPPER.height,
		pauses: false,
		blocks: true,
		title: "Melody",
		script: [
			{command:"buffer", text:"Don't worry, I'll be fine.  Just need to stretch out a few cramps, then I'll head back to the village.\n"},			//0
			{command:"wait"},
			{command:"return", retval:0},
		] // an array of options/commands which will be evaluated in sequence
	};

DATA_SDS_DIALOGUE["Melody_c2_portals_0"]=
	{ 
		x: DEFINE_DIALOGUE_BOX_UPPER.x,
		y: DEFINE_DIALOGUE_BOX_UPPER.y,
		width: DEFINE_DIALOGUE_BOX_UPPER.width,
		height: DEFINE_DIALOGUE_BOX_UPPER.height,
		pauses: false,
		blocks: true,
		title: "Melody",
		script: [
			{command:"buffer", text:"Is my daughter being a handful?  I suppose I've just gotten used to it.\n"},			//0
			{command:"wait"},
			{command:"buffer", text:"But you're young, right?  Go on; just consider it a warm-up for your own adventures!\n"},			//0
			{command:"wait"},
			{command:"return", retval:0},
		] // an array of options/commands which will be evaluated in sequence
	};

DATA_SDS_DIALOGUE["Melody_c2_bossgood_0"]=
	{ 
		x: DEFINE_DIALOGUE_BOX_UPPER.x,
		y: DEFINE_DIALOGUE_BOX_UPPER.y,
		width: DEFINE_DIALOGUE_BOX_UPPER.width,
		height: DEFINE_DIALOGUE_BOX_UPPER.height,
		pauses: false,
		blocks: true,
		title: "Melody",
		script: [
			{command:"buffer", text:"So I hear you've been busy!  Find the necklace alright?\n"},			//0
			{command:"wait"},
			{command:"return", retval:0},
		] // an array of options/commands which will be evaluated in sequence
	};
DATA_SDS_DIALOGUE["Melody_c2_bossgood_1"]=
	{ 
		x: DEFINE_DIALOGUE_BOX_UPPER.x,
		y: DEFINE_DIALOGUE_BOX_UPPER.y,
		width: DEFINE_DIALOGUE_BOX_UPPER.width,
		height: DEFINE_DIALOGUE_BOX_UPPER.height,
		pauses: false,
		blocks: true,
		title: "Melody",
		script: [
			{command:"buffer", text:"It's a bit weird being out of the water, I know, but you can get used to it.\n"},			//0
			{command:"wait"},
			{command:"return", retval:0},
		] // an array of options/commands which will be evaluated in sequence
	};
DATA_SDS_DIALOGUE["Melody_c2_bossgood_2"]=
	{ 
		x: DEFINE_DIALOGUE_BOX_UPPER.x,
		y: DEFINE_DIALOGUE_BOX_UPPER.y,
		width: DEFINE_DIALOGUE_BOX_UPPER.width,
		height: DEFINE_DIALOGUE_BOX_UPPER.height,
		pauses: false,
		blocks: true,
		title: "Melody",
		script: [
			{command:"buffer", text:"All the space, all the peace and quiet...\n"},			//0
			{command:"wait"},
			{command:"return", retval:0},
		] // an array of options/commands which will be evaluated in sequence
	};
DATA_SDS_DIALOGUE["Melody_c2_bossgood_3"]=
	{ 
		x: DEFINE_DIALOGUE_BOX_UPPER.x,
		y: DEFINE_DIALOGUE_BOX_UPPER.y,
		width: DEFINE_DIALOGUE_BOX_UPPER.width,
		height: DEFINE_DIALOGUE_BOX_UPPER.height,
		pauses: false,
		blocks: true,
		title: "Melody",
		script: [
			{command:"buffer", text:"Heh.  Funny how perceptions change.\n"},			//0
			{command:"wait"},
			{command:"return", retval:0},
		] // an array of options/commands which will be evaluated in sequence
	};

DATA_SDS_DIALOGUE["Melody_c2_bossbad_0"]=
	{ 
		x: DEFINE_DIALOGUE_BOX_UPPER.x,
		y: DEFINE_DIALOGUE_BOX_UPPER.y,
		width: DEFINE_DIALOGUE_BOX_UPPER.width,
		height: DEFINE_DIALOGUE_BOX_UPPER.height,
		pauses: false,
		blocks: true,
		title: "Melody",
		script: [
			{command:"buffer", text:"That's the Necklace alright, but where's Gracie?\n"},			//0
			{command:"wait"},
			{command:"return", retval:0},
		] // an array of options/commands which will be evaluated in sequence
	};
DATA_SDS_DIALOGUE["Melody_c2_bossbad_1"]=
	{ 
		x: DEFINE_DIALOGUE_BOX_UPPER.x,
		y: DEFINE_DIALOGUE_BOX_UPPER.y,
		width: DEFINE_DIALOGUE_BOX_UPPER.width,
		height: DEFINE_DIALOGUE_BOX_UPPER.height,
		pauses: false,
		blocks: true,
		title: "Melody",
		script: [
			{command:"buffer", text:". . . What?  She is safe, right?\n"},			//0
			{command:"wait"},
			{command:"return", retval:0},
		] // an array of options/commands which will be evaluated in sequence
	};

DATA_SDS_DIALOGUE["Melody_c5_advice_0"]=
	{ 
		x: DEFINE_DIALOGUE_BOX_UPPER.x,
		y: DEFINE_DIALOGUE_BOX_UPPER.y,
		width: DEFINE_DIALOGUE_BOX_UPPER.width,
		height: DEFINE_DIALOGUE_BOX_UPPER.height,
		pauses: false,
		blocks: true,
		title: "Meli",
		script: [
			{command:"buffer", text:"(She trusted me to watch Gracie, and I... no, I can't show my face around here.)\n"},			//0
			{command:"wait"},
			{command:"return", retval:0},
		] // an array of options/commands which will be evaluated in sequence
	};

DATA_SDS_DIALOGUE["Melody_c5_boss_g0"]=
	{ 
		x: DEFINE_DIALOGUE_BOX_UPPER.x,
		y: DEFINE_DIALOGUE_BOX_UPPER.y,
		width: DEFINE_DIALOGUE_BOX_UPPER.width,
		height: DEFINE_DIALOGUE_BOX_UPPER.height,
		pauses: false,
		blocks: true,
		title: "Melody",
		script: [
			{command:"buffer", text:"Wait, you've been up to WHAT now?\n"},			//0
			{command:"wait"},
			{command:"clear"},
			{command:"buffer", text:"...\n"},
			{command:"wait"},
			{command:"clear"},
			{command:"buffer", text:"I'm not sure whether to hope Gracie takes after you or pray she never even gets the idea to try!\n"},
			{command:"wait"},
			{command:"return", retval:0},
		] // an array of options/commands which will be evaluated in sequence
	};
DATA_SDS_DIALOGUE["Melody_c5_boss_b0"]=
	{ 
		x: DEFINE_DIALOGUE_BOX_UPPER.x,
		y: DEFINE_DIALOGUE_BOX_UPPER.y,
		width: DEFINE_DIALOGUE_BOX_UPPER.width,
		height: DEFINE_DIALOGUE_BOX_UPPER.height,
		pauses: false,
		blocks: true,
		title: "Melody",
		script: [
			{command:"buffer", text:"Oh... hello.\n"},			//0
			{command:"wait"},
			{command:"clear"},
			{command:"buffer", text:"...\n"},
			{command:"wait"},
			{command:"clear"},
			{command:"buffer", text:"Good luck. ... I... really do mean it.\n"},
			{command:"wait"},
			{command:"return", retval:0},
		] // an array of options/commands which will be evaluated in sequence
	};

Dialogue_getCurrentEvent["Melody"] = function(){
		var retval = null;
		var line = 0;
		if (GLOBAL_SCRATCHPAD.check("Dlg_Melody_Line")){
			line = GLOBAL_SCRATCHPAD.check("Dlg_Melody_Line");
		}

		if (GLOBAL_DIARY.check(5,"BOSS",true)){
			if (GLOBAL_DIARY.check(2,"BOSS_GOOD")){
				retval = "GD_Melody_c5_boss_g"+line;
				line = Math.min(line+1,0);
			}
			else {//BOSS_BAD
				retval = "GD_Melody_c5_boss_b"+line;
				line = Math.min(line+1,0);
			}
		}
		else if (GLOBAL_DIARY.check(5,"AWAKE")){
			retval = "GD_Melody_c5_advice_"+line;
			line = Math.min(line+1,0);
		}
		else if (GLOBAL_DIARY.check(2,"TREASURE")){
			if (GLOBAL_DIARY.check(2,"BOSS_GOOD")){
				retval = "GD_Melody_c2_bossgood_"+line;
				line = Math.min(line+1,3);
			}
			else {//BOSS_BAD
				retval = "GD_Melody_c2_bossbad_"+line;
				line = Math.min(line+1,1);
			}
		}
		else if (GLOBAL_DIARY.check(2,"PORTALS")){
			retval = "GD_Melody_c2_portals_"+line;
			line = Math.min(line+1,0);
		}
		else if (GLOBAL_DIARY.check(2,"HELP_MELODY")){
			retval = "GD_Melody_c2_melody_"+line;
			line = Math.min(line+1,0);
		}
		else{//if (GLOBAL_DIARY.check(2,"HELP_GRACE")){
			retval = "Melody_free";
			//line = Math.min(line+1,0);
		}
		GLOBAL_SCRATCHPAD.note("Dlg_Melody_Line",line);
		return retval;
	};
