#TouhouDanmakufu
#Title["Gathering of Temperament"]
#Text[Conscii arcanum.]
#Image[snapshot\gatheringoftemperament.bmp]
#Player[player\ProcellaPlayers\EmilyA\EmilyA.dnh, player\ProcellaPlayers\EmilyB\EmilyB.dnh, player\ProcellaPlayers\FeliciaA\FeliciaA.dnh, player\ProcellaPlayers\FeliciaB\FeliciaB.dnh]
#PlayLevel[Hard]
#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;
	let counter = 0;
	let outAngle = 0;
	@Initialize {
		SetLife(666);
		SetInvincibility(240);
		SetDamageRate(20, 10);
		SetTimer(51);
		SetScore(111111);
		CutIn(KOUMA, ""\""Gathering of Temperament"\", "script\img\moonbeamandconscius.png", 0, 0, 0, 0);

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

		SetMovePosition03(GetCenterX, GetCenterY, 9, 4);
	}
	@MainLoop {
		SetCollisionA(GetX, GetY, 32);
		SetCollisionB(GetX, GetY, 16);
		if(frame%480 == 61) {
			CreateLaserB(0, 400, 150, PURPLE51, 90);
			SetLaserDataB(0, 0, 0, 0, 0, 0, 0, GetAngleToPlayer, 0);
			SetShotKillTime(0, 420);
			FireShot(0);
			ascent(a in 0..88) {
				CreateShotA(0, GetX, GetY, 0);
				SetShotDataA(0, 0, rand(1, 5), rand(0, 360), 0, -0.05, 0, PURPLE04);
				SetShotDataA(0, 90, 0, NULL, 0, -0.05, rand(-1, -3), PURPLE04);
				FireShot(0);
				CreateShotA(0, GetX, GetY, 180);
				SetShotDataA(0, 0, rand(1, 4), rand(0, 360), 0, -0.05, 0, PURPLE04);
				SetShotDataA(0, 90, 0, NULL, 0, -0.05, rand(-1, -3), PURPLE04);
				FireShot(0);
				if(a%2 == 0) {
					CreateShotA(0, GetX, GetY, 0);
					SetShotDataA(0, 0, rand(1, 5), rand(0, 360), 0, -0.05, 0, RED02);
					SetShotDataA(0, 90, 0, NULL, 0, -0.05, rand(-1, -3), RED02);
					FireShot(0);
					CreateShotA(0, GetX, GetY, 180);
					SetShotDataA(0, 0, rand(1, 5), rand(0, 360), 0, -0.05, 0, RED02);
					SetShotDataA(0, 90, 0, NULL, 0, -0.05, rand(-1, -3), RED02);
					FireShot(0);
				}
			}
		}
		if(frame%480 == 1) {
			Concentration01(60);
			movecounter++;
		}
		yield;
		frame++;
	}
	@DrawLoop {
		SetTexture(ImgBoss);
		DrawGraphic(GetX, GetY);
	}
	@Finalize {
		loop(6) {
			CreateItem(ITEM_SCORE, GetX + rand(-50, 50), GetY - rand(20, 100));
		}
		DeleteGraphic(ImgBoss);
	}
}