#“Œ•û’e–‹•—
#Title[Genner Sitiens Attack 3 -Lunatic-]
#Text[Genneri arcanum.]
#Player[player\ProcellaPlayers\EmilyA\EmilyA.dnh, player\ProcellaPlayers\EmilyB\EmilyB.dnh, player\ProcellaPlayers\FeliciaA\FeliciaA.dnh, player\ProcellaPlayers\FeliciaB\FeliciaB.dnh]
#PlayLevel[Lunatic]
#ScriptVersion[2]
script_enemy_main
{
	#include_function "lib\SHOT_REPLACE\shot_replace.dnh"
	let count=-120;
	let mod = 0;
	let cenX=GetCenterX();
	let cenY=GetCenterY();
	let minX=GetClipMinX();
	let maxX=GetClipMaxX();
	let minY=GetClipMinY();
	let maxY=GetClipMaxY();
	let ExRumia="script\img\stg8enm.png";


	@Initialize
	{
		SetLife(4000);
		SetDamageRate(100,50);
		SetInvincibility(180);
		SetTimer(41);
		LoadGraphic(ExRumia);
		SetGraphicRect(6,195,70,285);
		shotinit;
		SetMovePosition02(GetCenterX,GetCenterY,60);
	}
	task FirstCircle(x, y, n) {
		ascent(a in 0..n) {
			CreateShotA(0, GetX, GetY, 0);
			SetShotDataA(0, 0, 1.5, GetAngleToPlayer + a * (360 / n) + (360 / n / 2), 0, 0.01, 2, WHITE56);
			SetShotDataA(0, 45, NULL, NULL, a%2 * 2 - 1, 0, 2, BLUE31);
			SetShotDataA(0, 135, NULL, NULL, 0, 0, 2, PURPLE31);
			FireShot(0);
		}
		yield;
	}
	task SecondCircle(x, y, n) {
		ascent(a in 0..n) {
			CreateShotA(0, GetX, GetY, 0);
			SetShotDataA(0, 0, 1.5, GetAngleToPlayer + a * (360 / n) + (360 / n / 2), 0, 0.01, 2, WHITE56);
			SetShotDataA(0, 45, NULL, NULL, a%2 * 2 - 1, 0, 2, RED31);
			SetShotDataA(0, 135, NULL, NULL, (a%2 * 2 - 1) / -3, 0, 2, PURPLE31);
			FireShot(0);
		}
		yield;
	}
	task ThirdCircle(x, y, n, m) {
		ascent(a in 0..n) {
			CreateShotA(0, GetX, GetY, 0);
			SetShotDataA(0, 0, 1, a * (360 / n) + (360 / n / 2), 0, 0.01, 2, WHITE01);
			SetShotDataA(0, 45, NULL, NULL, (a%2 * 2 - 1) * 1.5, 0, 2, WHITE23);
			SetShotDataA(0, 90, NULL, NULL, -1.5 * (m%2 * 2 - 1), 0.02, 2.2, AQUA23 + a%2);
			SetShotDataA(0, 240, NULL, NULL, 0, 0, 2, AQUA23 + a%2);
//			SetShotDataA(0, 330, NULL, NULL, (a%2 * 2 - 1), 0, 2, GREEN31);
//			SetShotDataA(0, 420, NULL, NULL, 0, 0, 2, BLUE31);
			FireShot(0);
		}
		Wait(330);
		loop(18) {
			ascent(a in 0..n/4) {
//				CreateShot01(GetX, GetY, 1.5, a * ((360 / n) * 4) + m, RED56 + m%8, 0);
			}
		}
	}

	@MainLoop
	{
		SetCollisionA(GetX, GetY, 32);
		SetCollisionB(GetX, GetY, 16);
		SetShotAutoDeleteClip(200, 200, 200, 200);
		if(count%600 >= 1 && count%600 <= 121 && count%10 == 1) {
			ThirdCircle(GetX, GetY, 96, mod);
			if(count%600 == 121) {
				mod++;
			}
		}
		if(OnPlayerMissed) {
			count = -60;
		}
		yield;
		count++;
	}
	
	function Wait(n)
	{
		loop(n)
		{
			yield;
		}
	}
	function LemmingDelay(x, y, size, graphic) {
		CreateShotA(0, x, y, size);
		SetShotDataA(0, 0, 0, 0, 0, 0, 0, graphic);
		SetShotKillTime(0, 0);
		FireShot(0);
	}
	@DrawLoop
	{
		SetTexture(ExRumia);
		DrawGraphic(GetX(),GetY());
	}

	@Finalize
	{
		DeleteGraphic(ExRumia);
	}
}