#TouhouDanmakufu
#Title[Velon Momental Attack 1]
#Text[Velonis arcanum.]
#Player[player\ProcellaPlayers\FeliciaA\FeliciaA.dnh, player\ProcellaPlayers\FeliciaB\FeliciaB.dnh]
#PlayLevel[Normal]
#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 SeConcentrate = "script\se\power0.wav";
	let SeShot = "script\se\tan00.wav";
	let frame = -120;
	let trig = 0;
	let turndir = 1;
	let movecounter = 0;
	let px = GetCenterX;
	let py = GetCenterY;
	let trigger = 0;
	@Initialize {
		SetLife(2500);
		SetInvincibility(120);
//		SetDamageRate(20, 10);
		SetTimer(51);
//		SetScore(333333);
//		CutIn(KOUMA, ""\""Gravity Manipulation"\", "script\img\velonandserius.png", 0, 0, 0, 0);

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

		SetMovePosition03(GetCenterX, GetClipMinY + 150, 9, 4);
	}
	@MainLoop {
		SetCollisionA(GetX, GetY, 32);
		SetCollisionB(GetX, GetY, 16);
		SetShotAutoDeleteClip(100, 100, 100, 100);
		if(frame == -60) {
			PlaySE(SeConcentrate);
			Concentration01(60);
		}
		if(frame > 0) {
			SetPlayerX(GetPlayerX - cos(GetAngleToPlayer) * 0.25);
			SetPlayerY(GetPlayerY - sin(GetAngleToPlayer) * 0.25);
		}
		if(frame%60 == 1) {
			trigger++;
			ascent(a in 0..30) {
				CreateShotA(0, GetX, GetY, 0);
				SetShotDataA(0, 0, 3, a * 12 + trigger%2 * 6, 0, -0.1, 1, PURPLE04);
				SetShotDataA(0, 45, 1, NULL, -0.3 * (trigger%2 * 2 - 1), 0, 1, PURPLE04);
				ascent(v in 0..3) {
					CreateShotA(1, 0, 0, 0);
					SetShotDataA(1, 0, 1.25 + v * 0.25, a * 12 + trigger%2 * 6, 0, 0, 3, PURPLE52);
					AddShot(45, 0, 1, 0);
				}
				FireShot(0);
			}
		}
		yield;
		frame++;
	}
	task WhiteSpray(x, y, lv, hv, angle, var, num, int, graphic, delay) {
		loop(num) {
			PlaySE(SeShot);
			CreateShot01(x, y, rand(lv, hv), angle + rand(var * -1, var), graphic, delay);
			loop(int) {
				yield;
			}
		}
	}
	@DrawLoop {
		SetTexture(ImgBoss);
		DrawGraphic(GetX, GetY);
	}
	@Finalize {
		DeleteGraphic(ImgBoss);
	}
}