#TouhouDanmakufu
#Title[Bonus 3/Last Word]
#Text[Rather simple and/or difficult.]
#Player[FREE]
#ScriptVersion[2]
#PlayLevel[Last Word]
script_enemy_main{


	let imgExRumia="script\ExRumia\img\ExRumia.png"; 
	let frame = 0; 
	let frame2 = 0;
	let angle = 0;
	let angleAcc = 0;
	let radius = 0;
	let w = 116;
	let x = 1;
	let n = 50;
	let q = 0;
	let e = 0;
	let s = 0;
	let frame4 = -500;
	 let r = 02;
	let frame3 = -240;
	let eyb = GetCurrentScriptDirectory~"eyb.mp3";
#include_function ".\lib\SHOT_REPLACE\shot_replace.dnh"
	let background = GetCurrentScriptDirectory~"patchybackground.png";
	@Initialize{
		SetLife(12000);
		SetTimer(90);
		shotinit;
		SetInvincibility(360);
		LoadGraphic(imgExRumia);
		CutIn(KOUMA, "Hakutaku "\""History Lesson"\", GetCurrentScriptDirectory~"rumia.png", 0, 0, 128, 256);
		SetMovePosition02(GetCenterX, GetCenterY -120, 120); 
		SetDamageRate(200, 0);
		SetScore(123456789);
		LoadMusic(eyb);
		PlayMusic(eyb);
		LastSpell;
	LoadGraphic(background);
	}
	
	@MainLoop{
	SetCollisionA(GetX, GetY, 32);
	SetCollisionB(GetX, GetY, 16);
	frame++; 
	frame2+=x;
	frame3++;
	frame4++;
	if(GetEnemyLife<7000 || GetTimer<60){
	
	w = 117;
	q = 0.1;
	frame2+=1.01;
	SetDamageRate(200, 0);
	}

	if(GetEnemyLife<3000 || GetTimer<20){
	SetDamageRate(80, 0);
	w = 117;
	q = -0.1;
	frame2+=1.10+e;
	e+=0.0001;
	}
	if(frame3==60) { ascent(i in 0..n) { CreateShot01(GetX, GetY, 2, GetAngleToPlayer+i*360/n, AQUA02, 60);
 }

					frame3 = 0;
		 }
			


	if(frame==120){
	let a   = 0;
        let num = 1; //Change this number here to specify the number of bullets in the ring.
        
        loop(num)
        {

		 CreateShot01(GetX, GetY, 3+q, frame2+0+e, RED12, 10);
            a += 360/num;

		 CreateShot01(GetX, GetY, 3+q, frame2+30+e, YELLOW12, 10);
            a += 360/num;

		 CreateShot01(GetX, GetY, 3+q, frame2+60+e, ORANGE12, 10);
            a += 360/num;
            CreateShot01(GetX, GetY, 3+q, frame2+90+e, RED12, 10);
            a += 360/num;

	 CreateShot01(GetX, GetY, 3+q, frame2+120+e, YELLOW12, 10);
            a += 360/num;

	 CreateShot01(GetX, GetY, 3+q, frame2+150+e, ORANGE12, 10);
            a += 360/num;
	
	 CreateShot01(GetX, GetY, 3+q, frame2+180+e, RED12, 10);
            a += 360/num;

	 CreateShot01(GetX, GetY, 3+q, frame2+210+e, YELLOW12, 10);
            a += 360/num;

	CreateShot01(GetX, GetY, 3+q, frame2+240+e, ORANGE12, 10);
            a += 360/num;

	CreateShot01(GetX, GetY, 3+q, frame2+270+e, RED12, 10);
            a += 360/num;

	 CreateShot01(GetX, GetY, 3+q, frame2+300+e, YELLOW12, 10);
            a += 360/num;

	CreateShot01(GetX, GetY, 3+q, frame2+330+e, ORANGE12, 10);
            a += 360/num;

	CreateShot01(GetX, GetY, 3+q, frame2+360+e, RED12, 10);
            a += 360/num;


	CreateShot01(GetX, GetY, 3+q, -frame2+0+-e, BLUE12, 10);
            a += 360/num;

		
	CreateShot01(GetX, GetY, 3+q, -frame2+-30+-e, PURPLE12, 10);
            a += 360/num;

		CreateShot01(GetX, GetY, 3+q, -frame2+-60-e, AQUA12, 10);
            a += 360/num;


	CreateShot01(GetX, GetY, 3+q, -frame2+-90-e, BLUE12, 10);
            a += 360/num;
		

	CreateShot01(GetX, GetY, 3+q, -frame2+-120-e, PURPLE12, 10);
            a += 360/num;
		

	CreateShot01(GetX, GetY, 3+q, -frame2+-150-e, AQUA12, 10);
            a += 360/num;

	CreateShot01(GetX, GetY, 3+q, -frame2+-180-e, BLUE12, 10);
            a += 360/num;

	CreateShot01(GetX, GetY, 3+q, -frame2+-210-e, PURPLE12, 10);
            a += 360/num;

	CreateShot01(GetX, GetY, 3+q, -frame2+-240-e, AQUA12, 10);
            a += 360/num;

	CreateShot01(GetX, GetY, 3+q, -frame2+-270-e, BLUE12, 10);
            a += 360/num;

	CreateShot01(GetX, GetY, 3+q, -frame2+-300-e, PURPLE12, 10);
            a += 360/num;

	CreateShot01(GetX, GetY, 3+q, -frame2+-330-e, AQUA12, 10);
            a += 360/num;

	CreateShot01(GetX, GetY, 3+q, -frame2+-360-e, BLUE12, 10);
            a += 360/num;
		frame = w;
}

}
		
	}


	@DrawLoop{
		SetTexture(imgExRumia);
                SetRenderState(ALPHA);
                SetAlpha(255);  
                SetGraphicScale(1,1);
                SetGraphicAngle(0,0,0);

                if(GetSpeedX==0){
                         SetGraphicRect(0,0,64,64); }
                        
 
                if(GetSpeedX>0){
                        SetGraphicRect(190, 126, 256, 64);
			}
 
                if(GetSpeedX<0){
                        
                        SetGraphicRect(128,128,186,64); }
                      
 
                DrawGraphic(GetX,GetY);
	}
		
let y = 0;

@BackGround{
   SetTexture(background);
   SetGraphicRect(0, 0 - y, 512, 512 - y);
   DrawGraphic(GetCenterX, GetCenterY);
   y+=10;
}
	@Finalize
	{
		DeleteGraphic(imgExRumia);
	}
}
