script_enemy_main
{
	#include_function ".\func.txt"


	let gcsd = GetCurrentScriptDirectory;
	let boss = gcsd~"b01.png";
	let name = gcsd~"nm1.png";

	let tan02 = gcsd~"se005.wav";

	let alpha = 0;

	@Initialize
	{
		Init(800, 100, 100, 0, 60, true, false, false, 0, false, false);
		SetLife(1000);

		LoadUserShotData(gcsd~"supershot.txt");
		SetMovePosition03(GetCenterX, GetClipMinY+120, 10, 5);

		MainTask;
		Event("jost");

		LoadGraphic(boss);
		LoadGraphic(name);
		LoadSE(tan02);
	}

	@MainLoop
	{
		if(OnEvent==false){SetCollision(GetX, GetY, 24);}

		yield;
	}

	@DrawLoop
	{
		SetColor(255, 255, 255);
		SetTexture(boss);
		SetAlpha(255);
		SetGraphicRect(0, 0, 64, 64);
		SetGraphicScale(1, 1);
		DrawGraphic(GetX, GetY);

		SetTexture(name);
		SetAlpha(alpha);
		SetGraphicRect(0, 0, 150, 30);
		DrawGraphic(GetClipMinX+75, GetClipMinY+30);
	}

	@Finalize
	{
	}

	task MainTask
	{
		Wait(120);
		while(OnEvent==true){yield;}
		CreateEnemyFromFile(gcsd~"bgm.txt", 0, 0, 0, 0, gcsd~"menu402.png");
		nameTask;
		SetTimer(35);
		Wait(60);
		move;
		attack;
	}

	task nameTask
	{
		loop(30)
		{
			alpha+=(255/30);
			yield;
		}
	}

	task attack
	{
		let ang = 0;

		loop
		{
			PlaySE(tan02);
			ascent(a in 0..5)
			{
				CreateShot02(GetX, GetY, 3.5, 90+ang, -0.05, 1.5, 70, 10+a*5);
				CreateShot02(GetX, GetY, 3.5, 90-ang, -0.05, 1.5, 70, 10+a*5);
				ang++;
			}
			ang+=30;
			Wait(6);
		}
	}

	task move
	{
		loop
		{
			Wait(60);
			SetMovePosition03(rand(GetClipMinX+80, GetClipMaxX-80), rand(GetClipMinY+90, GetClipMinY+150), 10, 2);
			Wait(60);
		}
	}
}

script_event jost
{
	let gcsd = GetCurrentScriptDirectory;
	let boss = gcsd~"002.mp3";

	@Initialize
	{
		LoadMusic(boss);
	}

	@MainLoop
	{
		if(GetPlayerScriptName == "patchy.txt")
		{
			TextOut("\c[BLUE]An entire city appeared out of nowhere.No magic can do this.");
			TextOut("\c[RED]Stop! What are you doing here?");
			TextOut("\c[BLUE]I'm collecting data for my grimoire.");
			TextOut("\c[RED]And who gave you permission to do that?");
			TextOut("\c[BLUE]I don't need permission to enter this \ncity.");
			SetNameFromText(RIGHT, TEXT_RED, "Jost de Bruin", "Multiple Personality");
			PlayMusic(boss);
			TextOut("\c[RED]Heh. Don't be so arrogant.");
			TextOut("\c[BLUE]I reckon you're the guard dog. Go sit.");
			DeleteName(RIGHT);
			TextOut("\c[RED]I'll just have to bite your head off!");
		}
		else if(GetPlayerScriptName == "keine.txt")
		{
			TextOut("\c[BLUE]Where is everyone?");
			TextOut("\c[RED]Right in front of you.");
			TextOut("\c[BLUE]Oh, I already thought this place was \ndeserted.");
			SetNameFromText(RIGHT, TEXT_RED, "Jost de Bruin", "Multiple Personality");
			TextOut("\c[RED]That's mean. Who are you anyway?");
			TextOut("\c[BLUE]No one in particular.");
			PlayMusic(boss);
			DeleteName(RIGHT);
			TextOut("\c[RED]So I can just use force to get you out then?");
			TextOut("\c[BLUE]There's more than meets the eye, \nit seems.");
			TextOut("\c[RED]Hehehe. There is, there is!");
		}
		else{RaiseError("The player type chosen cannot be used in this script.", "Invalid Player Type");}

		LoadCommonDataEx("MusicUnlock", gcsd~"DATA/MENU/MUSIC.dat");
		SetCommonDataEx("MusicUnlock", "Music02", 1);
		SaveCommonDataEx("MusicUnlock", gcsd~"DATA/MENU/MUSIC.dat");

		End;
	}

	@Finalize
	{
	}
}