script_enemy_main{

   	let CSD = GetCurrentScriptDirectory;
        let bg = CSD ~ "system\stagebg.png";
	let musics = CSD ~ "Music\fake.mp3";
        let musicb = CSD ~ "Music\spook.mp3";
	let f=0;
        let f2=0;
	let m=0;
	let m2 = 0;
	let m3 = 0;
	let m4 = 0;
	let m5 = 0;
	let bossalpha=0;
	let c = 0;

	@Initialize{
		SetLife(1);
		SetDamageRate(1,1);
		LoadMusic(musics);
		LoadMusic(musicb);
		LoadSE(CSD ~"SFX\se_spook3.wav");
		LoadSE(CSD ~"SFX\se_schreeuw1.wav");
		LoadSE(CSD ~"SFX\se_schreeuw2.wav");
		LoadSE(CSD ~"SFX\se_schreeuw3.wav");
		CreateEventFromScript("showdown");
		SetMovePosition01(GetCenterX,-120,5);
		PlayMusic(musics);
	}

	task effect{
		if(m==0){
			SetColor(64,64,255);
			MotionBlurEx(ALL,60,255,ADD); 
			PlaySE(CSD~"SFX\se_spookshift.wav");
			Concentration01(60);
			bossalpha=255;
			SetColor(255,255,255);
			m++;
		}
		yield;
	}

	sub geluid1{ if(m2==0){PlaySE(CSD ~"SFX\se_spook3.wav"); m2++} }
	sub geluid2{ if(m3==0){PlaySE(CSD ~"SFX\se_schreeuw1.wav"); m3++;} }
	sub geluid3{ if(m4==0){PlaySE(CSD ~"SFX\se_schreeuw2.wav"); m4++;} }

	sub sfx1{ if(m5==0){PlaySE(CSD ~"SFX\se_schreeuw3.wav"); m5++;} }


	@MainLoop{
		if(GetEventStep==1){geluid1; sfx1;}
		if(GetEventStep==2){geluid2; sfx1;}
		if(GetEventStep==3){geluid3; sfx1; SetMovePosition01(GetCenterX,120,5);}
		if(GetEventStep==4){AddLife(-10); DeleteMusic(musics); PlayMusic(musicb); }
		yield;
	}

	@DrawLoop{

	}

   	@BackGround
    	{

    	}

	#include_function ".\Hwfunctions.txt"
}

script_event showdown{
	let CSD = GetCurrentScriptDirectory;

	let ReiNorm = CSD ~ "system\ReiNorm.png";
	let ReiBoos = CSD ~ "system\ReiBoos.png";
	let ReiOk = CSD ~ "system\ReiOk.png";
	let ReiTel = CSD ~ "system\ReiTel.png";
	let ReiOpm = CSD ~ "system\ReiOpm.png";

	let KogaNorm = CSD ~ "system\KogaNorm.png";
	let KogaHa = CSD ~ "system\KogaHa.png";
	let KogaHe = CSD ~ "system\KogaHe.png";
	let KogaHey = CSD ~ "system\KogaHey.png";

	let Spooky = CSD ~ "system\spooky.png";


	@Initialize{
		LoadGraphic(ReiNorm);
		LoadGraphic(ReiBoos);
		LoadGraphic(ReiOk);
		LoadGraphic(ReiTel);
		LoadGraphic(ReiOpm);

		LoadGraphic(KogaNorm);
		LoadGraphic(KogaHe);
		LoadGraphic(KogaHa);
		LoadGraphic(KogaHey);

		LoadGraphic(Spooky);
	
	}
	@MainLoop{
		if(GetPlayerType==REIMU_A || GetPlayerType==REIMU_B){
			SetChar(LEFT,ReiTel);SetGraphicRect(LEFT,0,0,192,240);
			MoveChar(LEFT,FRONT);
			TextOutA("\c[RED]Sigh* Why did that little brat called \nme to the Scarlet Devil Mansion.");
			SetChar(LEFT,ReiTel);SetGraphicRect(LEFT,0,0,192,240);
			TextOutA("\c[RED]She is so full of herself. One day \nI am going to break her charisma..");
			SetChar(LEFT,ReiBoos);SetGraphicRect(LEFT,0,0,192,240);
			TextOutA("\c[RED]And make her beg for mercy. \n They better have food and tea ready!");
			SetStep(1);
			SetChar(LEFT,ReiTel);SetGraphicRect(LEFT,0,0,192,240);
			TextOutA("\c[RED]... *mummble*");
			SetChar(LEFT,ReiOpm);SetGraphicRect(LEFT,0,0,192,240);
			TextOutA("\c[RED]?! That sound.");
			MoveChar(LEFT,BACK);
			SetStep(2);
			SetStep(3);
			MoveChar(LEFT,FRONT);
			SetChar(LEFT,ReiTel);SetGraphicRect(LEFT,0,0,192,240);
			TextOutA("\c[RED]Allright, who ever it is. Quit it.");
			SetChar(LEFT,ReiBoos);SetGraphicRect(LEFT,0,0,192,240);
			TextOutA("\c[RED]Someone is asking to be erased I see. \nCome out stupid coward.");
			SetChar(LEFT,ReiTel);SetGraphicRect(LEFT,0,0,192,240);
			TextOutA("\c[RED]So you won't come out huh.\nI guess I will have to blast you out!");
			SetChar(LEFT,ReiNorm);SetGraphicRect(LEFT,0,0,192,240);
			TextOutA("\c[RED]Time to erase some ghosts!");
			SetStep(4);
		}
	}
	@Finalize{
		DeleteGraphic(ReiNorm);
		DeleteGraphic(ReiBoos);
		DeleteGraphic(ReiOk);
		DeleteGraphic(ReiTel);
		DeleteGraphic(ReiOpm);

		DeleteGraphic(KogaNorm);
		DeleteGraphic(KogaHe);
		DeleteGraphic(KogaHa);
		DeleteGraphic(KogaHey);
	}
}