#Title[Moonbeam Event]
#Text[Introducing Moonbeam Cathwright and Conscius.]
#BGM[bgm\We ARE Struggling Together!.mp3]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main {
	let ImgBoss = "script\img\stg8enm.png";
	let convotheme = "bgm\We ARE Struggling Together!.mp3";
	let bosstheme = "bgm\Sense and Sensibility ~ Lost Mind.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(LEFT);
			TextOutA("\c[BLUE]So this is the city jail?");
			ToFront(RIGHT);
			TextOutA("\c[RED]It is now.");
			ToFront(LEFT);
			TextOutA("\c[BLUE]You don't look like a warden...");
			ToFront(RIGHT);
			TextOutA("\c[RED]I'm the counselor.");
			SetNameFromText(RIGHT, TEXT_RED, "Moonbeam Cathwright", "Conscius");
			ToFront(LEFT);
			TextOutA("\c[BLUE]The prisoners I have here need counseling.");
			ToFront(RIGHT);
			TextOutA("\c[RED]It looks like you've given them pain therapy.");
			ToFront(LEFT);
			TextOutA("\c[BLUE]They attacked first.");
			ToFront(RIGHT);
			TextOutA("\c[RED]...in any case, it's not your place to play law enforcement.");
			ToFront(LEFT);
			TextOutA("\c[BLUE]I negated the concept of place.");
			ToFront(RIGHT);
			TextOutA("\c[RED]It's hardly your place to negate something like that.");
			ToFront(LEFT);
			SetStep(1);
			TextOutA("\c[BLUE]Then I guess I'd better put you in your place.");
			TextOutA("\c[GREEN]Uh, Emily...?");
			TextOutA("\c[BLUE]The road ahead is long, Nihil. I'd best warm up now.");
			TextOutA("\c[GREEN]Alright, if you don't mind getting thrown outta town...");
		}
		else {
			ToFront(RIGHT);
			TextOutA("\c[RED]Stop right there, miss!");
			ToFront(LEFT);
			TextOutA("\c[BLUE]Hunh? What'd I do?");
			ToFront(RIGHT);
			TextOutA("\c[RED]Sorry, but I'm supposed to pull you over and search you.\nPolice chief's orders.");
			ToFront(LEFT);
			TextOutA("\c[BLUE]No, really! I haven't done anything illegal yet!");
			ToFront(RIGHT);
			TextOutA("\c[RED]...yet?");
			ToFront(LEFT);
			TextOutA("\c[BLUE]Well, y'know the law... it's obstructive...");
			TextOutA("\c[GREEN]It's really just you, Felicia.");
			ToFront(RIGHT);
			TextOutA("\c[RED]...so you're a mage, too.");
			ToFront(LEFT);
			TextOutA("\c[BLUE]Ooh, you, too? I'm Felicia and this is Casus, nice to meet ya.");
			ToFront(RIGHT);
			SetNameFromText(RIGHT, TEXT_RED, "Moonbeam Cathwright", "Conscius");
			TextOutA("\c[RED]We're Moonbeam and Conscius.");
			TextOutA("\c[YELLOW]...this person gives me a bad feeling...");
			ToFront(LEFT);
			TextOutA("\c[GREEN]She's not malicious, I'll say that much.");
			ToFront(RIGHT);
			TextOutA("\c[YELLOW]I really think we need to take this person back to the station...");
			ToFront(LEFT);
			SetStep(1);
			TextOutA("\c[BLUE]...well, if that's your attitude...");
			ToFront(RIGHT);
			TextOutA("\c[RED]Huh? Conscius, what are you doing?!");
			TextOutA("\c[ORANGE]It's on!");
		}
		End;
	}
	@MainLoop {
		yield;
	}
	@DrawLoop {
	}
	@Finalize {
		DeleteGraphic(ImgBoss);
		DeleteGraphic(ImgPlayer);
	}
}