#TouhouDanmakufu
#Title[Jeane d'Ark Attack 2 -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(3000);
		SetInvincibility(150);
		SetDamageRate(100, 100);
		SetTimer(46);
//		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;

		SetMovePosition03(GetCenterX, GetClipMinY + 150, 9, 4);
	}
	@MainLoop {
		SetShotAutoDeleteClip(6, 150, 6, 6);
		if(frame < 0 || frame%540 > 270) {
			SetCollisionA(GetX, GetY, 32);
			SetCollisionB(GetX, GetY, 16);
		}
		else {
			SetY(GetClipMinY - 63);
		}
		if(frame%540 >= 61 && frame%540 <= 81 && frame%10 == 1) {
			let y = rand(GetPlayerY - 60, GetPlayerY + 60);
			CreateLaserA(0, GetClipMinX - 120, y, 900, 33,WHITE60, 60);
			SetLaserDataA(0, 0, rand(-5, 5), 0, 0, 0, 0);
			ascent(i in 0..150) {
				CreateShotA(1, 0, 0, 0);
				SetShotDataA(1, 0, 0, rand(0, 360), 0, 0.01, rand(1.5, 2.5), YELLOW21);
				AddShot(210 - frame%540, 0, 1, i * 6);
			}
			SetShotKillTime(0, 211 - frame%540);
			FireShot(0);
		}
		if(frame%540 >= 91 && frame%540 <= 101 && frame%10 == 1) {
			let x = rand(GetClipMinX, GetClipMaxX);
			CreateLaserA(0, x, GetClipMinY - 120, 900, 66, YELLOW60, 60);
			SetLaserDataA(0, 0, atan2(GetPlayerY - (GetClipMinY - 120), GetPlayerX - x), 0, 0, 0, 0);
			ascent(i in 0..60) {
				CreateShotA(1, 0, 0, 0);
				SetShotDataA(1, 0, 0, rand(0, 360), 0, 0.01, rand(0.5, 1.5), YELLOW02);
				AddShot(210 - frame%540, 0, 1, i * 15);
			}
			SetShotKillTime(0, 211 - frame%540);
			FireShot(0);
		}
		if(frame%540 == 271) {
			SetMovePosition03(GetCenterX, GetClipMinY + 150, 9, 4);
		}
		if(frame%540 == 481) {
			Concentration01(60);
			movecounter++;
		}
		yield;
		frame++;
	}
	@DrawLoop {
		SetTexture(ImgBoss);
		if(frame < 0 || frame%540 > 270) {
			DrawGraphic(GetX, GetY);
		}
	}
	@Finalize {
		DeleteGraphic(ImgBoss);
	}
}