#Title[Desdemona Valtiel Event]
#Text[Introducing Desdemona Valtiel and Invitus.]
#BGM[bgm\Tension ~ Enemy Engaged.mp3]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main {
	let ImgBoss = "script\img\stg8enm.png";
	let convotheme = "bgm\Tension ~ Enemy Engaged.mp3";
	let bosstheme = "bgm\Temptation ~ Mind Poison.mp3";
	let frame = -120;
	#include_function "lib\SHOT_REPLACE\shot_replace.dnh"
	#include_function "p_config.txt"

	@Initialize {
		SetLife(1);
		SetDamageRate(0, 0);

		LoadGraphic(ImgBoss);
		SetTexture(ImgBoss);
		SetGraphicRect(6,195,70,285);
		SetMovePosition03(GetCenterX, GetClipMinY + 120, 10, 3);

		if(bgm_on) {
			LoadMusic(convotheme);
			PlayMusic(convotheme);
		}
		MainTask;
	}
	task MainTask {
		loop(121) { yield; }
		CreateEventFromScript("BossEvent");
		while(GetEventStep == 0) { yield; }
		if(bgm_on) {
			LoadMusic(bosstheme);
			PlayMusic(bosstheme);
		}
		while(OnEvent) { yield; }
		SetLife(0);
	}
	@MainLoop {
		yield;
	}
	@DrawLoop {
		DrawGraphic(GetX, GetY);
	}
	@Finalize {
		DeleteGraphic(ImgBoss);
		DeleteMusic(convotheme);
	}

}
script_event BossEvent {
	let ImgBoss = "script\img\cin_moonbeam.png";
	let ImgPlayer = "script\img\cin_felicia.png";
	let isEmily = false;
	if(GetPlayerScriptName == "EmilyA.dnh" || GetPlayerScriptName == "EmilyB.dnh") {
		ImgPlayer = "script\img\cin_emily.png";
		isEmily = true;
	}
	@Initialize {
		LoadGraphic(ImgBoss);
		LoadGraphic(ImgPlayer);
		Event;
	}
	task Event {
		function ToFront(dir) {
			if(dir == LEFT) {
				MoveChar(LEFT, FRONT);
				MoveChar(RIGHT, BACK);
			}
			else {
				MoveChar(RIGHT, FRONT);
				MoveChar(LEFT, BACK);
			}
		}
		SetStep(0);
		yield;
		SetChar(RIGHT, ImgBoss);
		SetGraphicRect(RIGHT, 0, 0, 192, 256);
		SetChar(LEFT, ImgPlayer);
		SetGraphicRect(LEFT, 0, 0, 192, 256);
		if(isEmily) {
			ToFront(RIGHT);
			TextOutA("\c[RED]Felicia?");
			ToFront(LEFT);
			TextOutA("\c[PURPLE]She made me do it!");
			ToFront(RIGHT);
			TextOutA("\c[YELLOW]That... doesn't sound good.");
			ToFront(LEFT);
			TextOutA("\c[PURPLE]Seriously, she beat the crap out of me and everything... ow...");
			TextOutA("\c[BLUE]I'd be gentler if she weren't so stubborn.");
			ToFront(RIGHT);
			TextOutA("\c[RED]What business do you have with me?");
			TextOutA("\c[YELLOW]What the -- Nihil?");
			ToFront(LEFT);
			TextOutA("\c[GREEN]Yep. Hi, Invita.");
			SetNameFromText(RIGHT, TEXT_RED, "Desdemona Valtiel", "Invita");
			TextOutA("\c[BLUE]Emily Urmetus, nihili maga. Enchanted.\nAnyway, we're here to bring Eien down.");
			ToFront(RIGHT);
			TextOutA("\c[YELLOW]What the... What? Nihil... why?\nYou wouldn't even help Onis in wartime...");
			ToFront(LEFT);
			TextOutA("\c[GREEN]Actually, Onis is the least of our worries.");
			TextOutA("\c[BLUE]You're the bigger threat here.");
			ToFront(RIGHT);
			TextOutA("\c[YELLOW]What's that supposed to mean?! Nihil...");
			ToFront(LEFT);
			TextOutA("\c[BLUE]Simple political analysis: attempts to rule the world by humans rarely work.");
			TextOutA("\c[GREEN]I don't doubt national armies would stop Genner in his tracks...");
			TextOutA("\c[GREEN]And even I can't defy Emily. The Memor made sure of that.\nOnis won't be any better off.");
			TextOutA("\c[BLUE]But if you organize a resistance...\nit'll be easy to use the momentum to gain favor with the people.");
			ToFront(RIGHT);
			TextOutA("\c[RED]...you think we're trying to take over the world.");
			ToFront(LEFT);
			TextOutA("\c[BLUE]Taking precautions, more like.\nNihil tells me Invita isn't that sort, but you never know.");
			TextOutA("\c[GREEN]More to the point, Emily can deal with Genner alone, so...");
			ToFront(RIGHT);
			TextOutA("\c[RED]...that's a rather optimistic apprasial of the situation.");
			TextOutA("\c[RED]Remember, the storm god subjugated even you.");
			TextOutA("\c[RED]In any case, I don't have any such ambitions...");
			SetStep(1);
			TextOutA("\c[RED]...but Genner is my responsibility.");
			TextOutA("\c[YELLOW]Back off!");
			ToFront(LEFT);
			TextOutA("\c[GREEN]Optimistic? No, that's assuming Onis has a far worse plan.");
			TextOutA("\c[GREEN]I'm negating Invita's attacks on your willpower.\nYou'll have to fight with your own power...");
			TextOutA("\c[BLUE]...I see. Shall we, ah, change their minds?");
			TextOutA("\c[GREEN]...let's go!");
		}
		else {
			ToFront(RIGHT);
			TextOutA("\c[RED]Felicia?");
			ToFront(LEFT);
			TextOutA("\c[BLUE]Valtiel... we need to talk.");
			ToFront(RIGHT);
			TextOutA("\c[RED]State your business, then.");
			ToFront(LEFT);
			TextOutA("\c[BLUE]Eien. It's an ancient word meaning 'eternity.'");
			TextOutA("\c[BLUE]It implies you'd like to last for quite a while.");
			TextOutA("\c[BLUE]Even after, say... Genner's gone.");
			ToFront(RIGHT);
			TextOutA("\c[YELLOW]What are you thinking?");
			ToFront(LEFT);
			TextOutA("\c[GREEN]You'd like to use popular opinion to become a world power yourself.");
			TextOutA("\c[GREEN]Whoever wins Porta can take the Dead Plains...");
			TextOutA("\c[GREEN]...and even form a Northern League of Nations, with themself at the helm.");
			ToFront(RIGHT);
			TextOutA("\c[YELLOW]Okay, where'd you get that one?");
			ToFront(LEFT);
			TextOutA("\c[BLUE]Just a touch of pragmatism, really.");
			TextOutA("\c[GREEN]Nihil figured it out... we're her agents.");
			TextOutA("\c[BLUE]You didn't have to go and say that...");
			TextOutA("\c[GREEN]As if they didn't know.");
			ToFront(RIGHT);
			TextOutA("\c[YELLOW]...Nihil, huh? Sounds right...");
			TextOutA("\c[YELLOW]We never even thought of that...");
			TextOutA("\c[YELLOW]It's far more localized. That 'Eien' is just something personal.");
			ToFront(LEFT);
			TextOutA("\c[BLUE]If that's the case, you can dissolve Eien, right?");
			ToFront(RIGHT);
			TextOutA("\c[YELLOW]...uh, that...");
			TextOutA("\c[RED]I'm afraid not.");
			TextOutA("\c[RED]I don't have any such ambitions...");
			SetStep(1);
			TextOutA("\c[RED]...but Genner is my responsibility.");
			TextOutA("\c[RED]I will be the one to silence him.");
			ToFront(LEFT);
			TextOutA("\c[BLUE]You have zero credibility now.");
			TextOutA("\c[BLUE]I'd rather bet on a fight than your telling the truth.");
		}
		End;
	}
	@MainLoop {
		yield;
	}
	@DrawLoop {
	}
	@Finalize {
		DeleteGraphic(ImgBoss);
		DeleteGraphic(ImgPlayer);
	}
}