#TouhouDanmakufu[Stage]
#Title[東方儚い幻 ~ Miserable Illusion]
#Text[Touhou Hakanai Moboroshi
version 1]
#Player[REIMU,MARISA]
#ScriptVersion[2]

script_stage_main {
	let fairyImage = GetCurrentScriptDirectory~"fairy.png";
	let foeImage = GetCurrentScriptDirectory~"foe.png";
	let music1 = GetCurrentScriptDirectory~"冬ざれば颪の声も高く.mp3";
	let music2 = GetCurrentScriptDirectory~"幻想高天ヶ原　～ Gensokyo Ragnarok.mp3";
	let music3 = GetCurrentScriptDirectory~"闇黒の宇宙に　～ Inside the Dark Cloud.mp3";
	let music4 = GetCurrentScriptDirectory~"破壊された南瓜田.mp3";
	let cont = 0;
	@Initialize {
		LoadGraphic(fairyImage);
		LoadGraphic(foeImage);
		stage;
		continuecount;
	}
	@MainLoop {
		ForbidBomb(!OnPlayerMissed);
		yield;
	}
	@DrawTopObject {
		SetFontColor(255,255,255,255,255,255);
		DrawText("Continue: "~ToString(cont), 36, GetClipMaxY-40, 12, 255);
	}
	@Finalize {
		DeleteGraphic(fairyImage);
		DeleteGraphic(foeImage);
	}
	function wait(frames) {
		loop(frames) {
			yield;
		}
	}
	function waitToEnemyNum(number) {
		while(GetEnemyNum > number) {
			yield;
		}
	}
	task stage {
		SetDefaultStatusVisible(true);
		if(GetKeyState(VK_SHOT)==KEY_FREE && GetKeyState(VK_SLOWMOVE)==KEY_FREE) {
			ExpertEx(false, 16777216, 3);
		} else {
			ExpertEx(false, 0, 0);
		}
		if(GetPlayerType==USER_PLAYER) { RaiseError("Why are you using this player","Error"); }
		LoadMusic(music1);
		wait(60);
		stage1;
		stage2;
		stage3;
	}
	task continuecount {
		yield;
		let nowlife = 3;
		loop {
			if(nowlife < GetPlayerLife) { cont++; }
			nowlife = GetPlayerLife;
			yield;
		}
	}
	#include_function ".\stages.txt"
}