#TouhouDanmakufu
#Title[Jeane d'Ark Attack 1 -Lunatic-]
#Text[Ieannis arcanum.]
#Image[]
#Player[player\ProcellaPlayers\EmilyA\EmilyA.dnh, player\ProcellaPlayers\EmilyB\EmilyB.dnh]
#PlayLevel[Lunatic]
#BGM[bgm\Night Falls ~ Evening Star.mp3]
#ScriptVersion[2]

script_enemy_main {
	#include_function "lib\SHOT_REPLACE\shot_replace.dnh"
	let ImgBoss = "script\img\stg8enm.png";
	let frame = -120;
	let trig = 0;
	let turndir = 1;
	let movecounter = 0;
	@Initialize {
		SetLife(4000);
		SetInvincibility(150);
		SetDamageRate(100, 100);
		SetTimer(34);
//		SetScore(333333);
//		CutIn(KOUMA, ""\""Tri Edge"\", "script\img\jeaneandarcadia.png", 0, 0, 0, 0);

		LoadGraphic(ImgBoss);
		SetTexture(ImgBoss);
		SetGraphicRect(6,195,70,285);
		psrand(747030);
		shotinit;

		SetMovePosition02(GetCenterX, GetClipMinY + 180, 120);
	}
	@MainLoop {
		SetCollisionA(GetX, GetY, 32);
		SetCollisionB(GetX, GetY, 16);
		SetShotAutoDeleteClip(0, 0, 0, 0);
		if(frame%480 == 1) {
			CreateLaserB(0, 100, 30, WHITE55, 30);
			SetLaserDataB(0, 0, 0, 10, 0, 90, 0, 90, 0);
			SetLaserDataB(0, 30, 0, NULL, 0, NULL, ((movecounter%3)%2 * 2 - 1) * -2, NULL, ((movecounter%3)%2 * 2 - 1) * -2);
			ascent(t in 0..360) {
				let mod = rand(1, 3);
				CreateShotA(1, 0, 0, 60);
				SetShotDataA(1, 0, mod / 3, 0, rand(-0.2, 0.2), 0, mod / 3, WHITE55);
				AddShot(t + 31, 0, 1, 100);
				CreateShotA(1, 0, 0, 60);
				SetShotDataA(1, 0, mod, 0, rand(-0.1, 0.1), 0, mod, ORANGE21);
				AddShot(t + 31, 0, 1, 100);
				CreateShotA(1, 0, 0, 60);
				SetShotDataA(1, 0, mod, 0, rand(-0.1, 0.1), 0.02, 1 + mod, YELLOW21);
				AddShot(t + 31, 0, 1, 100);
			}
			SetShotKillTime(0, 360);
			FireShot(0);
		}
		if(frame%480 == 2) {
			turndir = turndir * -1;
		}
		if(frame%480 == 181) {
			if(movecounter%3 == 0) {
				SetMovePosition03(GetCenterX - 75, GetClipMinY + 80, 9, 3);
			}
			else if(movecounter%3 == 1) {
				SetMovePosition03(GetCenterX + 75, GetClipMinY + 80, 9, 3);
			}
			else {
				SetMovePosition03(GetCenterX, GetClipMinY + 180, 9, 3);
			}
			movecounter++;
		}
		yield;
		frame++;
	}
	@DrawLoop {
		SetTexture(ImgBoss);
		DrawGraphic(GetX, GetY);
	}
	@Finalize {
		DeleteGraphic(ImgBoss);
	}
}