"use strict";

// okay, the role is more that of Charon, but Death is a more iconic figurehead
DATA_SDS_DIALOGUE["Death's_domain"]=
	{ 
		x: DEFINE_DIALOGUE_BOX_LOWER.x,
		y: DEFINE_DIALOGUE_BOX_LOWER.y,
		width: DEFINE_DIALOGUE_BOX_LOWER.width,
		height: DEFINE_DIALOGUE_BOX_LOWER.height,
		pauses: false,
		blocks: true,
		script: [
			{command:"buffer", text:"...\n"},			//0
			{command:"wait"},
			{command:"clear"},
			{command:"buffer", text:"Huh?\n"},			//0
			{command:"wait"},
			{command:"buffer", text:"What... happened?  Where is this?\n"},			//0
			{command:"wait"},
			{command:"clear"},
			{command:"buffer", text:"It's so dark... and empty...  does the darkness go on forever, or...?\n"},
			{command:"wait"},
			{command:"return", retval:0},
		] // an array of options/commands which will be evaluated in sequence
	};

DATA_SDS_DIALOGUE["Death_newly_acquainted"]=
	{ 
		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,
		script: [
			{command:"buffer", text:"What have we here?  A dragonchild?  And so young... a pity.\n"},			//0
			{command:"wait"},
			{command:"buffer", text:"But what's this? ... I seem to recall your face somehow... did you have a sister?\n"},			//0
			{command:"wait"},
			{command:"clear"},
			{command:"buffer", text:"No... no, it's more than that... Your soul is... . . .\n"},
			{command:"wait"},
			{command:"clear"},
			{command:"buffer", text:"This is unacceptable.  I cannot allow it.  Return from whence you came!\n"},
			{command:"wait"},
			{command:"return", retval:0},
		] // an array of options/commands which will be evaluated in sequence
	};
DATA_SDS_DIALOGUE["Death_and_taxes"]=
	{ 
		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,
		script: [
			{command:"buffer", text:"Hmph.\n"},
			{command:"wait"},
			{command:"buffer", text:"Hm?\n"},
			{command:"wait"},
			{command:"buffer", text:"More than last time?  You can collect...  What ARE you?!\n"},
			{command:"wait"},
			{command:"return", retval:0},
		] // an array of options/commands which will be evaluated in sequence
	};
DATA_SDS_DIALOGUE["Death_warmed_over"]=
	{ 
		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,
		script: [
			{command:"buffer", text:"MONSTER!\n"},
			{command:"buffer", text:"Can you leave no one in peace??\n"},
			{command:"wait"},
			{command:"clear"},
			{command:"buffer", text:"I cannot stop you from whatever sacrilege you are performing out in the world, but in MY domain, souls are under MY protection!\n"},
			{command:"wait"},
			{command:"buffer", text:"I simply will not allow you to...\n"},
			{command:"wait"},
			{command:"buffer", text:"to...\n"},
			{command:"wait"},
			{command:"clear"},
			{command:"buffer", text:"Great Goddess, woman, what cursed magic do you possess to bind them to you so instantaneously and completely?!\n"},
			{command:"wait"},
			{command:"buffer", text:"Do you not realize how much of a threat you are to the natural order?\n"},
			{command:"wait"},
			{command:"buffer", text:"Be it in my power, I swear to you I will go to oblivion MYSELF before allowing you through to the next world!\n"},
			{command:"wait"},
			{command:"clear"},
			{command:"buffer", text:"Now GET\n"},
			{command:"wait"},
			{command:"buffer", text:"OUT\n"},
			{command:"wait"},
			{command:"buffer", text:"OF\n"},
			{command:"wait"},
			{command:"buffer", text:"MY\n"},
			{command:"wait"},
			{command:"buffer", text:"SIGHT!\n"},
			{command:"wait"},
			{command:"return", retval:0},
		] // an array of options/commands which will be evaluated in sequence
	};
DATA_SDS_DIALOGUE["Deaths_door"]=
	{ 
		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,
		script: [
			{command:"buffer", text:"BEGONE!  You do not belong here!\n"},
			{command:"wait"},
			{command:"return", retval:0},
		] // an array of options/commands which will be evaluated in sequence
	};
DATA_SDS_DIALOGUE["Death_cheated"]=
	{ 
		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,
		script: [
			{command:"buffer", text:"Thrice-cursed monster- RETURN FROM WHENCE YOU CAME!\n"},
			{command:"wait"},
			{command:"return", retval:0},
		] // an array of options/commands which will be evaluated in sequence
	};

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

		if (line>0){
			retval = GLOBAL_DIARY.hasSoul("YORICK") ? "GD_Death_cheated" : "GD_Deaths_door";
			line = Math.min(line+1,1);
		}
		else if (!GLOBAL_DIARY.check(0,"MET_DEATH")){
			retval = "Deaths_introduction";
			line = Math.min(line+1,1);
		}
		else if (GLOBAL_DIARY.souls.length>0){
			retval = "GD_Death_and_taxes";
			line = Math.min(line+1,1);
		}
		else{ // nothing to say
			retval = GLOBAL_DIARY.hasSoul("YORICK") ? "GD_Death_cheated" : "GD_Deaths_door";
			line = Math.min(line+1,1);
		}
		GLOBAL_SCRATCHPAD.note("Dlg_Death_Line",line);
		return retval;
	};
