#Title[Alex Event]
#Text[Introducing Alex Ryder and Aqua.]
#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\White Whirlpool ~ Raging Sea.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]Hey, stop right there!");
			ToFront(LEFT);
			TextOutA("\c[BLUE]Oh? More of the criminal element?");
			ToFront(RIGHT);
			TextOutA("\c[RED]What the --");
			TextOutA("\c[YELLOW]Are you calling us criminals?");
			ToFront(LEFT);
			TextOutA("\c[BLUE]Well, are you?");
			ToFront(RIGHT);
			SetNameFromText(RIGHT, TEXT_RED, "Alex Ryder", "Aqua");
			TextOutA("\c[RED]Quite the opposite.");
			TextOutA("\c[YELLOW]We're all the order this town has left.");
			ToFront(LEFT);
			TextOutA("\c[BLUE]Well, you and us.");
			ToFront(RIGHT);
			TextOutA("\c[RED]Conscius's report says otherwise...");
			TextOutA("\c[YELLOW]We're afraid we're going to have to arrest you.");
			ToFront(LEFT);
			TextOutA("\c[BLUE]Oh? I thought Moonbeam had a fairly good impression of me.");
			TextOutA("\c[GREEN]Well, Conscius... isn't the sharpest knife in the drawer.\nShe thinks with her feelings.");
			TextOutA("\c[BLUE]I'd rather think with thoughts.");
			SetStep(1);
			TextOutA("\c[BLUE]Anyway, we're afraid we're going to have to defeat you.");
			TextOutA("\c[GREEN]Yes, we have politics to meddle in.");
		}
		else {
			ToFront(RIGHT);
			TextOutA("\c[RED]Hey, stop right there!");
			ToFront(LEFT);
			TextOutA("\c[BLUE]Gah, more of the law?!");
			TextOutA("\c[GREEN]She really hasn't done anything yet!");
			ToFront(RIGHT);
			TextOutA("\c[RED]Except resisting police and causing fights, that is.");
			ToFront(LEFT);
			TextOutA("\c[GREEN]She was a counselor, and her spirit started it!");
			TextOutA("\c[BLUE]And we sort of just hit each other until we got bored...");
			ToFront(RIGHT);
			TextOutA("\c[YELLOW]Such technicalities won't save you.");
			SetNameFromText(RIGHT, TEXT_RED, "Alex Ryder", "Aqua");
			ToFront(LEFT);
			TextOutA("\c[GREEN]Technicalities?! They're the situation!\nIf they won't save us, nothing will!");
			ToFront(RIGHT);
			TextOutA("\c[RED]Nothing will save you from the law.");
			ToFront(LEFT);
			TextOutA("\c[GREEN]Oh, for... This is Aqua, from my squad under Onis.\nHe seems easygoing, but...\n he'll follow the law to the letter, even if Onis is setting it.");
			TextOutA("\c[BLUE]Old friends turned enemies, huh?");
			SetStep(1);
			TextOutA("\c[GREEN]Not really, no. It's just that I know his weaknesses.");
			ToFront(RIGHT);
			TextOutA("\c[YELLOW]Casus... always reluctant to obey.");
			TextOutA("\c[YELLOW]It's about time I taught you a lesson.");
		}
		End;
	}
	@MainLoop {
		yield;
	}
	@DrawLoop {
	}
	@Finalize {
		DeleteGraphic(ImgBoss);
		DeleteGraphic(ImgPlayer);
	}
}