script_enemy_main {
	let bossImage = GetCurrentScriptDirectory~"yukari.png";
	let bossBack = GetCurrentScriptDirectory~"yukariback.png";
	let objFrame = Obj_Create(OBJ_EFFECT);
	@Initialize {
		if(GetPlayerType==USER_PLAYER) { RaiseError("Why are you using this player","Error"); }
		SetLife(10000);
		SetTimer(605);
		LoadGraphic(bossImage);
		LoadGraphic(bossBack);
		SetText(""\""Terminus Boundary"\");
		SetDefaultStatusVisible(true);
		ObjEffect_SetTexture(objFrame, "img\STG_Frame.png");
		ObjEffect_CreateVertex(objFrame, 24);
		ObjEffect_SetPrimitiveType(objFrame, PRIMITIVE_TRIANGLELIST);
		ObjEffect_SetLayer(objFrame, 8);
		ObjEffect_SetVertexUV(objFrame, 0, 0, 0);
		ObjEffect_SetVertexUV(objFrame, 1, 32, 0);
		ObjEffect_SetVertexUV(objFrame, 2, 0, 480);
		ObjEffect_SetVertexUV(objFrame, 3, 32, 480);
		ObjEffect_SetVertexUV(objFrame, 4, 32, 0);
		ObjEffect_SetVertexUV(objFrame, 5, 0, 480);
		ObjEffect_SetVertexUV(objFrame, 6, 416, 0);
		ObjEffect_SetVertexUV(objFrame, 7, 640, 0);
		ObjEffect_SetVertexUV(objFrame, 8, 416, 480);
		ObjEffect_SetVertexUV(objFrame, 9, 640, 480);
		ObjEffect_SetVertexUV(objFrame, 10, 640, 0);
		ObjEffect_SetVertexUV(objFrame, 11, 416, 480);
		ObjEffect_SetVertexUV(objFrame, 12, 32, 0);
		ObjEffect_SetVertexUV(objFrame, 13, 416, 0);
		ObjEffect_SetVertexUV(objFrame, 14, 32, 16);
		ObjEffect_SetVertexUV(objFrame, 15, 416, 16);
		ObjEffect_SetVertexUV(objFrame, 16, 416, 0);
		ObjEffect_SetVertexUV(objFrame, 17, 32, 16);
		ObjEffect_SetVertexUV(objFrame, 18, 32, 464);
		ObjEffect_SetVertexUV(objFrame, 19, 416, 464);
		ObjEffect_SetVertexUV(objFrame, 20, 32, 480);
		ObjEffect_SetVertexUV(objFrame, 21, 416, 480);
		ObjEffect_SetVertexUV(objFrame, 22, 416, 464);
		ObjEffect_SetVertexUV(objFrame, 23, 32, 480);
		ObjEffect_SetVertexXY(objFrame, 0, 0, 0);
		ObjEffect_SetVertexXY(objFrame, 1, 32, 0);
		ObjEffect_SetVertexXY(objFrame, 2, 0, 480);
		ObjEffect_SetVertexXY(objFrame, 3, 32, 480);
		ObjEffect_SetVertexXY(objFrame, 4, 32, 0);
		ObjEffect_SetVertexXY(objFrame, 5, 0, 480);
		ObjEffect_SetVertexXY(objFrame, 6, 416, 0);
		ObjEffect_SetVertexXY(objFrame, 7, 640, 0);
		ObjEffect_SetVertexXY(objFrame, 8, 416, 480);
		ObjEffect_SetVertexXY(objFrame, 9, 640, 480);
		ObjEffect_SetVertexXY(objFrame, 10, 640, 0);
		ObjEffect_SetVertexXY(objFrame, 11, 416, 480);
		ObjEffect_SetVertexXY(objFrame, 12, 32, 0);
		ObjEffect_SetVertexXY(objFrame, 13, 416, 0);
		ObjEffect_SetVertexXY(objFrame, 14, 32, 16);
		ObjEffect_SetVertexXY(objFrame, 15, 416, 16);
		ObjEffect_SetVertexXY(objFrame, 16, 416, 0);
		ObjEffect_SetVertexXY(objFrame, 17, 32, 16);
		ObjEffect_SetVertexXY(objFrame, 18, 32, 464);
		ObjEffect_SetVertexXY(objFrame, 19, 416, 464);
		ObjEffect_SetVertexXY(objFrame, 20, 32, 480);
		ObjEffect_SetVertexXY(objFrame, 21, 416, 480);
		ObjEffect_SetVertexXY(objFrame, 22, 416, 464);
		ObjEffect_SetVertexXY(objFrame, 23, 32, 480);
	}
	let frame = -120;
	let frame2 = 0;
	let frame3 = 0;
	let frame4 = 0;
	let frame5 = 0;
	let frame6 = 0;
	let angle = 0;
	let bluh = 0;
	let life = GetLife;
	let objScreen = Obj_Create(OBJ_EFFECT);
	@MainLoop {
		Obj_Delete(objScreen);
		objScreen = Obj_Create(OBJ_EFFECT);
		ObjEffect_SetTexture(objScreen, "img\STG_Frame.png");
		ObjEffect_CreateVertex(objScreen, 4);
		ObjEffect_SetPrimitiveType(objScreen, PRIMITIVE_TRIANGLEFAN);
		ObjEffect_SetLayer(objScreen, 8);
		Obj_SetPosition(objScreen, 32, 16);
		life = GetLife;
		if(GetLife < life) { life = GetLife; }
		ObjEffect_CreateVertex(objScreen, 4);
		ObjEffect_SetVertexUV(objScreen, 0, GetClipMinX+0, GetClipMinY+0);
		ObjEffect_SetVertexUV(objScreen, 1, GetClipMinX+384, GetClipMinY+0);
		ObjEffect_SetVertexUV(objScreen, 2, GetClipMinX+384, GetClipMinY+448*(1-life/10000)*15/16);
		ObjEffect_SetVertexUV(objScreen, 3, GetClipMinX+0, GetClipMinY+448*(1-life/10000)*15/16);
		ObjEffect_SetVertexXY(objScreen, 0, 0, 0);
		ObjEffect_SetVertexXY(objScreen, 1, 384, 0);
		ObjEffect_SetVertexXY(objScreen, 2, 384, 448*(1-life/10000)*15/16);
		ObjEffect_SetVertexXY(objScreen, 3, 0, 448*(1-life/10000)*15/16);
		if(GetPlayerY < (GetClipMinY+448*(1-life/10000)*15/16)+8) { SetPlayerY((GetClipMinY+448*(1-life/10000)*15/16)+8); }
		if(OnBomb || GetTimeOfPlayerInvincibility != 0) { SetDamageRate(0, 0); } else { SetDamageRate(50, 0); } SetCollisionA(GetX, GetY, 50);
		SetCollisionB(GetX, GetY, 50);
		if(frame == -120) {
			SetMovePosition02(GetCenterX, GetCenterY-100, 15);
			Concentration01(120);
		}
		if(GetTimer <= 60) { if(GetLife > 1000) { AddLife(-50); } }
		SetScore(100000000000);
		frame++;
		if(GetLife <= 9000) { frame2++; }
		if(GetLife <= 7000) { frame3++; }
		if(GetLife <= 5000) { frame4++; }
		if(GetLife <= 3000) { frame5++; }
		if(GetLife <= 1000) { frame6++; }
		if(frame == 20) {
			ascent(i in -5..6) { ascent(j in 0..2) { CreateShot01(GetX, GetY, 2+j, GetAngleToPlayer+i*11, PURPLE01, 10); } }
			frame = 0;
		}
		if(frame2 == 1) {
			loop(2) { CreateShot01(GetX, GetY, 1, rand(0,360), PURPLE05, 10); }
			frame2 = 0;
		}
		if(frame3 == 45) {
			let a = rand(0,360);
			ascent(i in 0..47) { CreateShot01(GetX, GetY, 3+sin(GetAngleToPlayer*a+i*360/47*3), a+i*360/47, PURPLE02, 10); }
			frame3 = 0;
		}
		if(frame4 == 1) {
			ascent(i in 0..7) {
				CreateShot01(GetX, GetY, 3, angle+i*360/7, PURPLE31, 10);
			}
			angle-=50/pi; angle%=360;
			frame4 = 0;
		}
		if(frame5 == 60) {
			ascent(i in 0..27) {
				CreateShot02(GetX, GetY, 6, -angle+i*360/27, -1/10, 1, PURPLE03, 10);
			}
			frame5 = 0;
		}
		if(frame6 == 1) {
			MotionBlurEx(ALL, 60000, 200, ALPHA);
		} if(frame6 >= 2) { frame6 = 2; }
		if(bluh <= 60) {
			ascent(i in 0..24) { ObjEffect_SetVertexColor(objFrame, i, bluh/60*255, 255, 255, 255); }
			ascent(i in 0..4) { ObjEffect_SetVertexColor(objScreen, i, bluh/60*255, 255, 255, 255); }
		bluh++; } else if(bluh == 61) { SetEnemyMarker(false); SetDefaultStatusVisible(false); bluh++; }
	}
	@DrawLoop {
		SetTexture(bossImage);
		SetGraphicRect(0, 0, 128, 128);
		SetGraphicScale(1, 1);
		SetGraphicAngle(0, 0, 0);
		SetAlpha(255);
		SetRenderState(ALPHA);
		DrawGraphic(GetX, GetY);
		DrawText("Past Yukari Yakumo", 40, 30, 12, 255);
	}
	let backspin = 0;
	@BackGround {
		SetTexture(bossBack);
		SetGraphicRect(0, 0, 512, 512);
		SetGraphicScale(3/2, 3/2);
		SetGraphicAngle(0, 0, backspin);
		SetAlpha(255);
		SetRenderState(ADD);
		DrawGraphic(GetCenterX, GetCenterY);
		backspin+=1; backspin%=360;
	}
	@Finalize {
		DeleteGraphic(bossImage);
		DeleteGraphic(bossBack);
		ExtendPlayer(2-GetPlayerLife); AddBomb(-GetPlayerBomb); ShootDownPlayer;
	}
}