#Title[Genner Sitiens Event 2]
#Text[Congratulations... victory is yours.]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main {
	let ImgBoss = "script\img\stg8enm.png";
	let bosstheme = "bgm\Soul Battle ~ Clash of Souls.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);
		MainTask;
	}
	task MainTask {
		loop(121) { yield; }
		CreateEventFromScript("BossEvent");
		while(OnEvent) { yield; }
		SetLife(0);
	}
	@MainLoop {
		yield;
	}
	@DrawLoop {
		DrawGraphic(GetX, GetY);
	}
	@Finalize {
		DeleteGraphic(ImgBoss);
	}

}
script_event BossEvent {
	let ImgBoss = "script\img\cin_genner.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]...");
			TextOutA("\c[YELLOW]H-how did you...");
			ToFront(LEFT);
			TextOutA("\c[BLUE]I told you not to underestimate me.");
			TextOutA("\c[GREEN]I negated your clouds while she did the fighting.");
			ToFront(RIGHT);
			TextOutA("\c[RED]...well, now I feel like an idiot.");
			ToFront(LEFT);
			TextOutA("\c[GREEN]No need. He did rule the world once, y'know.");
			ToFront(RIGHT);
			TextOutA("\c[RED]He's not doing it again.");
			ToFront(LEFT);
			TextOutA("\c[PURPLE]That's the ticket!");
			ToFront(RIGHT);
			TextOutA("\c[RED]...eh?");
			ToFront(LEFT);
			TextOutA("\c[PURPLE]Go on, Genner. Finish it.");
			ToFront(RIGHT);
			TextOutA("\c[YELLOW]Not now, you don't!");
			TextOutA("\c[YELLOW]Don't underestimate Genner, either!");
			TextOutA("\c[YELLOW]I turned your powers against you, Nihil...");
			TextOutA("\c[YELLOW]One more push on his mind and I'll be free...");
			ToFront(LEFT);
			TextOutA("\c[GREEN]...well, now I feel like an idiot.");
			ToFront(RIGHT);
			TextOutA("\c[RED]No need. He did rule the world once, y'know.");
			ToFront(LEFT);
			TextOutA("\c[BLUE]You seeem confident.");
			ToFront(RIGHT);
			TextOutA("\c[RED]The moon shines in my mind...");
			TextOutA("\c[RED]No clouds shall obscure the truth now.");
			TextOutA("\c[RED]Don't underestimate me, Onis...");
			TextOutA("\c[RED]I am in command!");
		}
		else {
			ToFront(RIGHT);
			TextOutA("\c[RED]...");
			TextOutA("\c[YELLOW]...ngaah...");
			ToFront(LEFT);
			TextOutA("\c[BLUE]What do you know? We were right.");
			ToFront(RIGHT);
			TextOutA("\c[YELLOW]Seems our reinforcements are still fighting...");
			ToFront(LEFT);
			TextOutA("\c[PURPLE]Not really. No one was trying much, I think.");
			ToFront(RIGHT);
			TextOutA("\c[YELLOW]Wh -- Nihil?!");
			ToFront(LEFT);
			TextOutA("\c[GREEN]Now that we've worn you out...");
			TextOutA("\c[PURPLE]it shouldn't be much trouble to negate your clouds.");
			ToFront(RIGHT);
			TextOutA("\c[RED]...");
			TextOutA("\c[RED]...well, now I feel like an idiot.");
			ToFront(LEFT);
			TextOutA("\c[BLUE]Well, he is the lord of all spirits.");
			ToFront(RIGHT);
			TextOutA("\c[RED]Not anymore, he's not.");
			ToFront(LEFT);
			TextOutA("\c[GREEN]That's more like it.");
			ToFront(RIGHT);
			TextOutA("\c[YELLOW]Ahahahaha...");
			TextOutA("\c[YELLOW]He's confused now...\nOne more push on his mind and I'll be free...");
			ToFront(LEFT);
			TextOutA("\c[PURPLE]Hm... you'd think that, but...");
			TextOutA("\c[PURPLE]Hi.");
			ToFront(RIGHT);
			TextOutA("\c[RED]...eh?");
			ToFront(LEFT);
			TextOutA("\c[PURPLE]We're he~re.");
			TextOutA("\c[PURPLE]I don't think any of us want Onis to return again.");
			TextOutA("\c[PURPLE]Well, maybe Serius, but...");
			ToFront(RIGHT);
			TextOutA("\c[RED]...hmph.");
			TextOutA("\c[YELLOW]Oh...");
			TextOutA("\c[RED]The moon shines in my mind...");
			TextOutA("\c[RED]No clouds shall obscure the truth now.");
			TextOutA("\c[RED]Don't underestimate me, Onis...");
			TextOutA("\c[RED]I am in command!");
		}
		End;
	}
	@MainLoop {
		yield;
	}
	@DrawLoop {
	}
	@Finalize {
		DeleteGraphic(ImgBoss);
		DeleteGraphic(ImgPlayer);
	}
}