#TouhouDanmakufu[Stage]
#Title[Grimoire of Marisa Maniac]
#Text[What the hell. Play after playing the normal version.]
#BackGround[User(.\img\BG.png,0,0)]
#Player[FREE]
#ScriptVersion[2]

script_stage_main{
let csd = GetCurrentScriptDirectory; 
let BossDeath = csd~"se/BossDeath.wav";
function Wait(let frames){ loop(frames){yield;}}
@Initialize{
	LoadSE(BossDeath);
	stage;
	}
 @MainLoop{
	yield;
	}
@Finalize{}
task stage{
	function WaitForZeroEnemy{ while(GetEnemyNum != 0){yield;} }
	Wait(60);
	CreateEnemyBossFromFile(GetCurrentScriptDirectory~"_MarisaL.txt",GetCenterX,0,-5,90,NULL);
	WaitForZeroEnemy;
	PlaySE(BossDeath);
	if(Continued==true){CreateEventFromScript("End1");}
	else {CreateEventFromScript("End2");}
	yield;
	}
}

script_event End1{
	let MariNorm=GetCurrentScriptDirectory~"img\MariNorm.png";
	let MariSmug=GetCurrentScriptDirectory~"img\MariSmug.png";
	@Initialize{
		LoadGraphic(MariNorm);
		LoadGraphic(MariSmug);
	}
	@MainLoop{
		SetChar(RIGHT,MariSmug);SetGraphicRect(RIGHT,0,0,128,256);
		MoveChar(RIGHT,FRONT);
		TextOutA("\c[RED]Convinced now?");
		MoveChar(RIGHT,BACK);
		TextOutA("\c[BLUE]I can't feel my legs.");
		TextOutA("\c[BLUE]Yes, convinced.");
		MoveChar(RIGHT,FRONT);
		SetChar(RIGHT,MariNorm);SetGraphicRect(RIGHT,0,0,128,256);
		TextOutA("\c[RED]That's the answer I wanted.");
		MoveChar(RIGHT,BACK);
		TextOutA("\c[BLUE]But I-");
		MoveChar(RIGHT,FRONT);
		TextOutA("\c[RED]You nothing. Time to scram!");
		SetChar(RIGHT,MariSmug);SetGraphicRect(RIGHT,0,0,0,0);
		MoveChar(RIGHT,BACK);
		TextOutA("\c[BLUE]GODDAMNIT");
		StageClear;
	}
	@Finalize{
	}
}

script_event End2{
	let MariDefeated=GetCurrentScriptDirectory~"img\MariDefeated.png";
	@Initialize{
		LoadGraphic(MariDefeated);
	}
	@MainLoop{	
		TextOutA("\c[RED]K-Kyah~!");
		SetChar(RIGHT,MariDefeated);SetGraphicRect(RIGHT,0,0,128,256);
		MoveChar(RIGHT,BACK);
		TextOutA("\c[BLUE]I can't believe you did all that.");
		TextOutA("\c[BLUE]Are you nuts?");
		MoveChar(RIGHT,FRONT);
		TextOutA("\c[RED]You can say that.");
		MoveChar(RIGHT,BACK);
		TextOutA("\c[BLUE]You're gonna kill yourself at this\nrate.");
		MoveChar(RIGHT,FRONT);
		TextOutA("\c[RED]But if I don't?");
		MoveChar(RIGHT,BACK);
		TextOutA("\c[BLUE]Then you can say you're some\nsort of insane Youkai.");
		MoveChar(RIGHT,FRONT);
		TextOutA("\c[RED]That wouldn't be so bad.");
		StageClear;
	}
	@Finalize{
	}
}