///////////////////////////////////////////////////
//Effects library compilation
//	      ///
///////////////////////////////////////////////////

	let effect_img_cir = GetCurrentScriptDirectory ~ ".\system\etama3.png";
	let Circ = GetCurrentScriptDirectory ~ ".\system\MCircle.png";
	let Circ1 = GetCurrentScriptDirectory ~ ".\system\outercirc.png";
	let Circ2 = GetCurrentScriptDirectory ~ ".\system\midcirc.png";
	let name= GetCurrentScriptDirectory ~ ".\system\name.png";
	let brdr = GetCurrentScriptDirectory~".\system\Border.png";
	let effectcircle=GetCurrentScriptDirectory~".\system\effect_circle.png";
	LoadGraphic(effect_img_cir);
	LoadGraphic(Circ);
	LoadGraphic(Circ1);
	LoadGraphic(Circ2);
	LoadGraphic(name);
	LoadGraphic(brdr);	
	LoadGraphic(effectcircle);


///////////////////////////////
//Function Index/////
//////////////////////////////

	//
	let angleS = 0;
	let angleS1 = 0;
	let angleS2 = 0;
	let scalecount = 0;

	let scale = 1;
	let scale2 = 1;
	let scalecountB = -120;
	let scaleB = 1;
	let ang = 0;
	let scaleb5=0.1;
	let scaleb6=0.5;
	let L=0;
	let lan=0;
	let en=0;


	//For Trail use
	let TrailNum=0;
	let TrailAngle=0;
	let TrailScale=0.1;
	let TrailX=[];
	let TrailY=[];
	ascent(i in 0..10){TrailX=TrailX~[0];TrailY=TrailX~[0];}
	

function DrawName{//For Custom Name Text
	SetColor(255,255,255);
	SetTexture(name);
	SetGraphicRect(0, 0, 128, 32);
	SetRenderState(ALPHA);
	SetAlpha(200);
	SetGraphicAngle(0, 0, 0);
	SetGraphicScale(0.8, 0.8);
	DrawGraphic(GetClipMinX+49, GetClipMinY+25);

}

///////////////////////////////////////////////////////////
///inner Magic Circle (Usually Boss)///
//////////////////////////////////////////////////////////
function CircleOp{
	yield;
	groweff(1.2,Circ1,255,255,255);
	groweff(0.6,Circ2,255,255,255);
}
	task groweff(scale,type,R,G,B){
			let alphs=255;
			let sca=2+scale;
			let obj=Obj_Create(OBJ_EFFECT);
			Obj_SetPosition(obj, GetX, GetY+1);
			ObjEffect_SetRenderState(obj, ADD);
			ObjEffect_SetTexture(obj, type);
			ObjEffect_SetLayer(obj, 1);
			ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLESTRIP);
			ObjEffect_CreateVertex(obj, 4);
			ObjEffect_SetVertexXY(obj, 0, -64, 64);
			ObjEffect_SetVertexXY(obj, 1,  -64, -64);
			ObjEffect_SetVertexXY(obj, 2, 64, 64);
			ObjEffect_SetVertexXY(obj, 3,  64, -64);

			ObjEffect_SetVertexUV(obj, 0,  0, 0);
			ObjEffect_SetVertexUV(obj, 1, 436,0);
			ObjEffect_SetVertexUV(obj, 2,  0, 425);
			ObjEffect_SetVertexUV(obj, 3, 436,425);

			while(!Obj_BeDeleted(obj)){
				ObjEffect_SetScale(obj,sca,sca);
				ascent(i in 0..4){
					ObjEffect_SetVertexColor(obj, i, alphs, R, G, B);	
				}
				alphs-=10;
				sca+=0.2;
				if(alphs<=0){alphs=0}
				if(sca>=10){Obj_Delete(obj);}
				yield;
			}
}







function Circle{
	angleS+=0.1;
	SetColor(255,255,255);
	SetTexture(Circ);
	SetGraphicRect(1, 1, 256, 256);
	SetRenderState(ADD);
	SetGraphicAngle(0, 0, angleS);
	SetGraphicScale(0.6, 0.6);
	DrawGraphic(GetX, GetY-1);


///////////////////////////////////////////////////////////
///mid Magic Circle (Usually Boss)///
//////////////////////////////////////////////////////////

	angleS1-=0.1;
	SetColor(255,255,255);
	SetTexture(Circ2);
	SetGraphicRect(1, 1, 436, 425);
	SetRenderState(ADD);
	SetGraphicAngle(0, 0, angleS1);
	SetGraphicScale(0.8, 0.8);
	DrawGraphic(GetX, GetY);


///////////////////////////////////////////////////////////
///mid Magic Circle (Usually Boss)///
//////////////////////////////////////////////////////////

	angleS+=0.1;
	SetColor(255,255,255);
	SetTexture(Circ1);
	SetGraphicRect(1, 1, 436, 425);
	SetRenderState(ADD);
	SetGraphicAngle(0, 0, angleS);
	SetGraphicScale(1, 1);
	DrawGraphic(GetX-1, GetY);

}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///Red Smaller Magic Circle(Special for farmiliars, replace the texture if you want another image  
// and change the rects if needed)						    
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function MiniCircle{
	angleS2+=12;
	scalecount ++;
	if(scalecount>=0 && scalecount<=30){
		scale2+= 0.01;
		}
	if(scalecount>=31 && scalecount<=61){
		scale2-=0.01;
		}
	if(scalecount==62){
		scalecount = 0;
		}
	SetTexture(Circ);
	SetGraphicRect(0, 0, 128, 128);
	SetAlpha(150);
	SetRenderState(ALPHA);
	SetGraphicAngle(0, 0, angleS2);
	SetGraphicScale(scale2/4, scale2/4);
	DrawGraphic(GetX, GetY);

}
//////////////////////////////////////////////////////////////////////////////////
///"BORDER" TIMED CIRCLES (from Mitori Kawashiro script)		///
//////////////////////////////////////////////////////////////////////////////////

function Border(){
yield;
	let S_Circle_r = 180;


		//Outer Circle
		////////////
	task Spell_CircleA{
		let e_r_flag = true;
		let e_r = 0;
		let e_r_d = 15;
		let e_r_dd = -0.3;
		let e_ang = 0;
		let e_ang_d = 3.5;
		let e_ang_sub = 360/24;

		let e_x = [GetEnemyX];
		let e_y = [GetEnemyY];

		let obj = Obj_Create(OBJ_EFFECT);
		Obj_SetPosition(obj, e_x[0], e_y[0]);
		Obj_SetAngle(obj, 0);
		Obj_SetSpeed(obj, 0);
		Obj_SetAutoDelete(obj, false);
		ObjEffect_SetTexture(obj, effect_img_cir);
		ObjEffect_SetRenderState(obj, ADD);
		ObjEffect_SetLayer(obj, 2);
		ObjEffect_SetAngle(obj, 0, 0, e_ang);
		ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLESTRIP);
		ObjEffect_CreateVertex(obj, 54);
		ascent(let i in 0..3){
			ascent(let j in 0..9){
				ObjEffect_SetVertexUV(obj, i*2*9+2*j, 80, j/8*127);
				ObjEffect_SetVertexUV(obj, i*2*9+2*j+1, 95, j/8*127);
				ObjEffect_SetVertexXY(obj, i*2*9+2*j, (e_r+16)*cos(120*i+e_ang_sub*j), (e_r+16)*sin(120*i+e_ang_sub*j));
				ObjEffect_SetVertexXY(obj, i*2*9+2*j+1, e_r*cos(120*i+e_ang_sub*j), e_r*sin(120*i+e_ang_sub*j));
			}
		}
		ascent(let i in 0..54){
			ObjEffect_SetVertexColor(obj, i, 255, 127, 127, 127);
		}

		yield;

		task e_move{
			let e_M_delay_t = 15;//

			loop(e_M_delay_t){
				e_x = e_x ~ [GetEnemyX];
				e_y = e_y ~ [GetEnemyY];
				yield;
			}
			loop{
				e_x = e_x ~ [GetEnemyX];
				e_y = e_y ~ [GetEnemyY];
				e_x = erase(e_x, 0);
				e_y = erase(e_y, 0);
				Obj_SetPosition(obj, e_x[0], e_y[0]);
				yield;
			}
		}
		e_move;

		loop{
			e_r += e_r_d;
			e_r_d += e_r_dd;
			if((e_r <= S_Circle_r)&&(e_r_d < 0)&&(e_r_flag)){
				e_r = S_Circle_r;
				e_r_d = -(S_Circle_r-16)/(GetTimer*60);
				e_r_dd = 0;
				e_r_flag = false;
			}
			ascent(let i in 0..3){
				ascent(let j in 0..9){
					ObjEffect_SetVertexXY(obj, i*2*9+2*j, (e_r+16)*cos(120*i+e_ang_sub*j), (e_r+16)*sin(120*i+e_ang_sub*j));
					ObjEffect_SetVertexXY(obj, i*2*9+2*j+1, e_r*cos(120*i+e_ang_sub*j), e_r*sin(120*i+e_ang_sub*j));
				}
			}
			e_ang += e_ang_d;
			if(e_ang > 360){e_ang += -360;}
			if(e_ang < -360){e_ang += 360;}
			ObjEffect_SetAngle(obj, 0, 0, e_ang);
			if(GetMissCountInThisSpell>=1 || GetBombCountInThisSpell>=1){Obj_Delete(obj);}
			yield;
		}

		Obj_Delete(obj);
	}
	/////////////
	//Inner Circle
	/////////////
	task Spell_CircleB{
		let e_r = 0;
		let e_ang_d = -3.5;
		let e_ang = 0;
		let e_ang_sub = 360/24;

		let e_x = [GetEnemyX];
		let e_y = [GetEnemyY];

		let obj = Obj_Create(OBJ_EFFECT);
		Obj_SetPosition(obj, e_x[0], e_y[0]);
		Obj_SetAngle(obj, 0);
		Obj_SetSpeed(obj, 0);
		Obj_SetAutoDelete(obj, false);
		ObjEffect_SetTexture(obj, effect_img_cir);
		ObjEffect_SetRenderState(obj, ADD);
		ObjEffect_SetLayer(obj, 2);
		ObjEffect_SetAngle(obj, 0, 0, e_ang);
		ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLESTRIP);
		ObjEffect_CreateVertex(obj, 54);
		ascent(let i in 0..3){
			ascent(let j in 0..9){
				ObjEffect_SetVertexUV(obj, i*2*9+2*j, 32, j/8*127);
				ObjEffect_SetVertexUV(obj, i*2*9+2*j+1, 48, j/8*127);
				ObjEffect_SetVertexXY(obj, i*2*9+2*j, e_r*cos(120*i+e_ang_sub*j), e_r*sin(120*i+e_ang_sub*j));
				ObjEffect_SetVertexXY(obj, i*2*9+2*j+1, (e_r-16)*cos(120*i+e_ang_sub*j), (e_r-16)*sin(120*i+e_ang_sub*j));
			}
		}
		ascent(let i in 0..54){
			ObjEffect_SetVertexColor(obj, i, 255, 200, 200, 200);
		}

		yield;


		task e_vt_1{
			let e_r_sub = 0;
			let e_r_sub_ang = 0;
			let e_r_sub_ang_d = 180/30;
			loop(30){
				e_r_sub_ang += e_r_sub_ang_d;
				e_r_sub = (S_Circle_r+6)/2 - (S_Circle_r+6)/2*cos(e_r_sub_ang);
				ascent(let i in 0..3){
					ascent(let j in 0..5){
						ObjEffect_SetVertexXY(obj, i*2*9+4*j, e_r_sub*cos(120*i+e_ang_sub*j*2), e_r_sub*sin(120*i+e_ang_sub*j*2));
					}
				}
				yield;
			}
		}


		task e_vt_2{
			let e_r_sub = 0;
			let e_r_sub_ang = 0;
			let e_r_sub_ang_d = 180/45;

			loop(45){
				e_r_sub_ang += e_r_sub_ang_d;
				e_r_sub = (S_Circle_r+6)/2 - (S_Circle_r+6)/2*cos(e_r_sub_ang);
				ascent(let i in 0..3){
					ascent(let j in 0..4){
						ObjEffect_SetVertexXY(obj, i*2*9+4*j+2, e_r_sub*cos(120*i+e_ang_sub*(2*j+1)), e_r_sub*sin(120*i+e_ang_sub*(2*j+1)));
					}
				}
				yield;
			}
		}


		task e_vt_3{
			let e_r_sub = 0;
			let e_r_sub_ang = 0;
			let e_r_sub_ang_d = 180/30;

			ef_wait(15);

			loop(30){
				e_r_sub_ang += e_r_sub_ang_d;
				e_r_sub = (S_Circle_r+6)/2 - (S_Circle_r+6)/2*cos(e_r_sub_ang) - 16;
				ascent(let i in 0..3){
					ascent(let j in 0..5){
						ObjEffect_SetVertexXY(obj, i*2*9+4*j+1, e_r_sub*cos(120*i+e_ang_sub*2*j), e_r_sub*sin(120*i+e_ang_sub*2*j));
					}
					ascent(let j in 0..4){
						ObjEffect_SetVertexXY(obj, i*2*9+4*j+3, e_r_sub*cos(120*i+e_ang_sub*(2*j+1)), e_r_sub*sin(120*i+e_ang_sub*(2*j+1)));
					}
				}
				yield;
			}
		}


		task e_vt_4{
			e_r = S_Circle_r+6;
			let e_r_d = -(S_Circle_r-16)/(GetTimer*60);

			ef_wait(60);
			loop{
			e_r += e_r_d;
			ascent(let i in 0..3){
				ascent(let j in 0..9){
					ObjEffect_SetVertexXY(obj, i*2*9+2*j, e_r*cos(120*i+e_ang_sub*j), e_r*sin(120*i+e_ang_sub*j));
					ObjEffect_SetVertexXY(obj, i*2*9+2*j+1, (e_r-16)*cos(120*i+e_ang_sub*j), (e_r-16)*sin(120*i+e_ang_sub*j));
				}
			}
				yield;
			}
		}

		task e_move{
			let e_M_delay_t = 15;//ˆÚ“®’x‰„ŽžŠÔ

			loop(e_M_delay_t){
				e_x = e_x ~ [GetEnemyX];
				e_y = e_y ~ [GetEnemyY];
				yield;
			}
			loop{
				e_x = e_x ~ [GetEnemyX];
				e_y = e_y ~ [GetEnemyY];
				e_x = erase(e_x, 0);
				e_y = erase(e_y, 0);
				Obj_SetPosition(obj, e_x[0], e_y[0]);
				yield;
			}
		}

		e_vt_1;
		e_vt_2;
		e_vt_3;
		e_vt_4;
		e_move;


		loop{
			e_ang += e_ang_d;
			if(e_ang > 360){e_ang += -360;}
			if(e_ang < -360){e_ang += 360;}
			ObjEffect_SetAngle(obj, 0, 0, e_ang);
			yield;
		}
		Obj_Delete(obj);
	}
	Spell_CircleB;

}




function spl_wait(let w){
	loop(w){yield;}
}
function ef_wait(let w){
	loop(w){yield;}
}

////////////////////////////////////////////////////////////////////////////////////////////////////////
///Concentration Lines (PhantasmRomance) (Extra effects for the concentration)////
////////////////////////////////////////////////////////////////////////////////////////////////////////

	task ConcentrationEx0(
		let frame,
		let R, // R intensity
		let G, // G intensity
		let B, // B intensity
		let con01	// Concentration01 true/false
	){
		if(con01){
			SetColor(R,G,B);
			Concentration01(frame);
			SetColor(255,255,255);
		}
		loop(frame-20){
			SetShotColor(R,G,B);
			ConcLinestart;
			SetShotColor(255,255,255);
			yield;
		}
		task ConcLinestart{
			let obj=Obj_Create(OBJ_LASER);
			let Length=400;
			Obj_SetAngle(obj,rand(0,360));
			ObjShot_SetDelay(obj,20);
			ObjShot_SetGraphic(obj,WHITE01);
			ObjLaser_SetWidth(obj,rand(5,80));
			ObjLaser_SetSource(obj,false);
			Obj_SetCollisionToPlayer(obj,false);
			let addLength=-Length/20;
			loop(20){
				Length+=addLength;
				ObjLaser_SetLength(obj,Length);
				Obj_SetX(obj,GetX);
				Obj_SetY(obj,GetY);
				yield;
			}
			Obj_Delete(obj);
		}
	}


/////////////////
//Charging Circle
/////////////////


	task charcircle(R,G,B,speed){
			let sca=10;	
			let alphs=0;
			let obj=Obj_Create(OBJ_EFFECT);
			Obj_SetPosition(obj, GetX, GetY);
			ObjEffect_SetRenderState(obj, ADD);
			ObjEffect_SetTexture(obj, effectcircle);
			ObjEffect_SetLayer(obj, 2);
			ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLESTRIP);
			ObjEffect_CreateVertex(obj, 4);
			ObjEffect_SetVertexXY(obj, 0, -64, 64);
			ObjEffect_SetVertexXY(obj, 1,  -64, -64);
			ObjEffect_SetVertexXY(obj, 2, 64, 64);
			ObjEffect_SetVertexXY(obj, 3,  64, -64);

			ObjEffect_SetVertexUV(obj, 0,  0, 0);
			ObjEffect_SetVertexUV(obj, 1, 128,0);
			ObjEffect_SetVertexUV(obj, 2,  0, 128);
			ObjEffect_SetVertexUV(obj, 3, 128,128);

			while(!Obj_BeDeleted(obj)){
				ObjEffect_SetScale(obj,sca,sca);
				ascent(i in 0..4){
					ObjEffect_SetVertexColor(obj, i, alphs, R, G, B);	
				}
				alphs+=5;
				sca-=speed;
				if(alphs>=255){alphs=255}
				if(sca<=0){Obj_Delete(obj);}
				yield;
			}
	
		}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Another Concentration Lines Effect ////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
task ConcentrationEx(
		 framec,	//duration in frames
		 graphic,	//graphic (round bullets looks better)
		 boolean	//if "1" then draw an ADD circle and Concentration01- 0 to nothing 
		 ){
				
	let circle = boolean;

		if(circle==1){
		charcircle(250,125,250,0.1);
		Concentration01(framec/2);
		}
	loop((framec-30)/3){
		loop(2){
		lines(rand(180,200), rand(0,360),graphic);
		}
		loop(2){yield;}
	}
	descent(let i in 3..30){
		lines(12*i, rand(0,360),graphic);
		yield;
	}

	
	

	task lines(let leng, let angl, let grbul){
		let del = leng/20;
		let obj = Obj_Create(OBJ_LASER);
		Obj_SetAngle(obj, angl);
		Obj_SetAlpha(obj, 128);
		ObjShot_SetGraphic(obj, graphic);
		Obj_SetCollisionToPlayer(obj, false);
		ObjLaser_SetSource(obj, false);
		ascent(let t in 0..26){
			Obj_SetPosition(obj, GetX-30*cos(angl),GetY-30*sin(angl));
			ObjLaser_SetLength(obj, leng);
			ObjLaser_SetWidth(obj,t*del/30+4);
			leng-=del;
			yield;
		}

		ObjShot_FadeDelete(obj);
	}

}


/////////////////////////////////////////////////
////Independent Concentration Lines
//////////////////////////////////////////////////

task ConcentrationEx2(
		 x,	//X Coord
		 y,	//Y Coord
		 framec,	//duration in frames
		 graphic,	//graphic (round bullets looks better)
		 ){
			

	loop((framec-30)/3){
		lines(rand(180,200), rand(0,360),graphic);
		loop(3){yield;}
	}
	descent(let i in 3..30){
		lines(12*i, rand(0,360),graphic);
		yield;
	}

		Explosion01(x,y,20,0.1,120);
	
	
	

	task lines(let leng, let angl, let grbul){
		let del = leng/20;
		let obj = Obj_Create(OBJ_LASER);
		Obj_SetAngle(obj, angl);
		Obj_SetAlpha(obj, 128);
		ObjShot_SetGraphic(obj, graphic);
		Obj_SetCollisionToPlayer(obj, false);
		ObjLaser_SetSource(obj, false);
		ascent(let t in 0..16){
			Obj_SetPosition(obj, x-30*cos(angl),y-30*sin(angl));
			ObjLaser_SetLength(obj, leng);
			ObjLaser_SetWidth(obj,t*del/30+4);
			leng-=del;
			yield;
		}

		ObjShot_FadeDelete(obj);
	}

}



//////////////////////////////////////
/////////BOSS Trails	/////////
//////////////////////////////////////

function BossTrail(alpha,R,G,B){
	SetGraphicAngle(0,0,0);
	SetColor(R,G,B);
	SetAlpha(alpha);
	SetGraphicScale(1.2+TrailScale*sin(TrailAngle),1.2+TrailScale*sin(TrailAngle));
	DrawGraphic(GetX,GetY);

	TrailAngle+=3;
	ascent(let j in 0..5){
		DrawGraphic(TrailX[j*2],TrailY[j*2]);
		}
	SetGraphicAngle(0,0,0);
	SetColor(255,255,255);
	SetAlpha(255);
	SetGraphicScale(1,1);
}

function GetTrailPosition{

	TrailNum++;
	if(TrailNum>9){
		TrailNum=0;
		}
	TrailX[TrailNum]=GetX;
	TrailY[TrailNum]=GetY;
}


//////////////////////////////////////////////////////////////////////////////////////////////////////
//////////BOSS Aura (Not as good as Hele's Aura, from Mitori KawashiroScript)///////////
//////////////////////////////////////////////////////////////////////////////////////////////////////
function Aura{
let effect = GetCurrentScriptDirectory~".\system\Aura.png";
LoadGraphic(effect);
	let scalecounter = 1.5;
	AuraA;
	AuraB;

	task AuraA{
		loop(5){
			AuraA;
			wait(9);
		}

		task AuraA{
			let scale_0 = 4;
			let scale = scale_0;
			let scale_d = -3.5/45;
			let color = [0, 0, 0];
			let color_r_d = 224/45;
			let color_gb = 127;
			let color_gb_ang = 0;
			let color_gb_ang_d = 90/45;

			let obj = Obj_Create(OBJ_EFFECT);

			Obj_SetPosition(obj, GetEnemyX, GetEnemyY);
			Obj_SetAngle(obj, 0);
			Obj_SetAutoDelete(obj, false);

			ObjEffect_SetTexture(obj, effect);
			ObjEffect_SetRenderState(obj, ADD);
			ObjEffect_SetLayer(obj, 1);
			ObjEffect_SetAngle(obj, 0, 0, rand(0, 360));
			ObjEffect_SetScale(obj, scale, scale * scalecounter);
			ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLESTRIP);
			ObjEffect_CreateVertex(obj, 4);

			ObjEffect_SetVertexUV(obj, 0, 52, 0);
			ObjEffect_SetVertexUV(obj, 1, 94, 0);
			ObjEffect_SetVertexUV(obj, 2, 52, 44);
			ObjEffect_SetVertexUV(obj, 3, 94, 44);

			ObjEffect_SetVertexXY(obj, 0, -22, -20);
			ObjEffect_SetVertexXY(obj, 1,  22, -20);
			ObjEffect_SetVertexXY(obj, 2, -22,  20);
			ObjEffect_SetVertexXY(obj, 3,  22,  20);

			ascent(let i in 0..4){
				ObjEffect_SetVertexColor(obj, i, color[0], color[1] , color[2] , 00);
			}

			yield;

			while(!Obj_BeDeleted(obj)){

				loop(44){
					scale += scale_d;
					color_gb_ang += color_gb_ang_d;

					//////////////////////////////////////////////////////////////////
					//You can change colors here. Change the last value if you want a different intensity of color
					//The higher the number, the less of that color. (1 means high intensity, 6 means low intensity). 
					color[0] = color_gb * sin(color_gb_ang)^1;  //Red Intensity
					color[1] = color_gb * sin(color_gb_ang)^3; //Green Intensity
					color[2] = color_gb * sin(color_gb_ang)^2;  //Blue Intensity

					ascent(let i in 0..4){
						ObjEffect_SetVertexColor(obj, i, 255, color[0], color[1], color[2]);
					}
					ObjEffect_SetScale(obj, scale, scale * scalecounter);
					Obj_SetPosition(obj, GetEnemyX, GetEnemyY);
					yield;
				}

				scale = scale_0;
				color_gb_ang = 0;
				color = [0, 0, 0];

				ascent(let i in 0..4){
					ObjEffect_SetVertexColor(obj, i, 255, color[0], color[1], color[2]);
				}

				ObjEffect_SetScale(obj, scale, scale * scalecounter);
				ObjEffect_SetAngle(obj, 0, 0, rand(0, 360));
				Obj_SetPosition(obj, GetEnemyX, GetEnemyY);

				yield;
			}
			Obj_Delete(obj);
		}
	}

	task AuraB{
		loop(4){
			AuraB;
			wait(10);
		}

		task AuraB{
			let ang_0 = 90;
			let ang = ang_0;
			let ang_d = 90/40;

		/////////////////////Change Colors for AuraB Here

		//	let color_0 = [R, G, B];
			let color_0 = [200, 60, 200];

		//	let color_d = [R/40, G/40, B/40];
			let color_d = [200/40, 60/40, 200/40];

			let color = color_0;
			let obj = Obj_Create(OBJ_EFFECT);

			Obj_SetPosition(obj, GetEnemyX, GetEnemyY);
			Obj_SetAngle(obj, 0);
			Obj_SetAutoDelete(obj, false);

			ObjEffect_SetTexture(obj, effect);
			ObjEffect_SetRenderState(obj, ADD);
			ObjEffect_SetLayer(obj, 1);
			ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLESTRIP);
			ObjEffect_CreateVertex(obj, 6);

			ObjEffect_SetVertexUV(obj, 0,  0, 0);
			ObjEffect_SetVertexUV(obj, 1, 50,0);
			ObjEffect_SetVertexUV(obj, 2,  0, 23);
			ObjEffect_SetVertexUV(obj, 3, 50, 23);
			ObjEffect_SetVertexUV(obj, 4,  0, 46);
			ObjEffect_SetVertexUV(obj, 5, 50, 46);

			ObjEffect_SetVertexXY(obj, 0, -24, -4.5);
			ObjEffect_SetVertexXY(obj, 1,  24, -4.5);
			ObjEffect_SetVertexXY(obj, 2, -24+rand(-3, 3), 45+rand(-4, 4));
			ObjEffect_SetVertexXY(obj, 3,  24+rand(-3, 3), 45+rand(-4, 4));
			ObjEffect_SetVertexXY(obj, 4, -24+rand(-9, 9), 90+rand(-8, 8));
			ObjEffect_SetVertexXY(obj, 5,  24+rand(-9, 9), 90+rand(-8, 8));

			ObjEffect_SetAngle(obj, ang, 0, 0);
			ObjEffect_SetScale(obj, 1, scalecounter);

			ascent(let i in 0..6){
				ObjEffect_SetVertexColor(obj, i, 255, color[0], color[1], color[2]);
			}

			yield;

			while(!Obj_BeDeleted(obj)){

				loop(40){
					color = color - color_d;
					ang += ang_d;

					ascent(let i in 0..6){
						ObjEffect_SetVertexColor(obj, i, 255, color[0], color[1], color[2]);
					}
					ObjEffect_SetAngle(obj, ang, 0, 0);
					ObjEffect_SetScale(obj, 1, scalecounter);
					Obj_SetPosition(obj, GetEnemyX, GetEnemyY);
					yield;
				}

				color = color_0;
				ang = ang_0;

				ascent(let i in 0..6){
					ObjEffect_SetVertexColor(obj, i, 255, color[0], color[1], color[2]);
				}
				ObjEffect_SetAngle(obj, ang, 0, 0);
				ObjEffect_SetScale(obj, 1, scalecounter);
				Obj_SetPosition(obj, GetEnemyX, GetEnemyY);

				yield;
			}
			Obj_Delete(obj);
		}
	}

	function wait(w){loop(w){yield;}}
}


////////////////////////////////////////////////
///Another Magic Circle (Timed) by Johnny Walker
/////////////////////////////////////////////////

function Border2(R,G,B){//In @Initialize or @MainLoop if you want a later activation
	ascent(i in 0..4){
		border(i*22,R,G,B);
	}
}

task border(let an,R,G,B)//an = angle
		{
			let obj = Obj_Create(OBJ_EFFECT);
			ObjEffect_SetTexture(obj, brdr);
			ObjEffect_SetRenderState(obj, ADD);
			ObjEffect_SetLayer(obj,2);
			ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLESTRIP);
			ObjEffect_CreateVertex(obj, 18);
//			ObjEffect_SetAngle(obj, 0,0,an);

			let x=0;
			let y=0;
			let ang=0;

			task vertex(let vrtx)
			{
		  	let radius = 0;

				let sc=1;
				let x = 0;
				let y = 0;
				let u = 128 *(vrtx/2);
				let v = 16 * (vrtx%2);
				let angle = an+45*truncate(vrtx/2);
				let alpha=0;
				task alphaState
				{	
					alpha=0;
					loop(60){alpha+=10; yield;}
					loop{alpha-=4;if(alpha<=150){alpha=150} yield;}


				}
				alphaState;		
					
				task xy
				{

					x = radius * cos(angle);
					y = radius * sin(angle);
					

					if(vrtx%2 == 0){loop(16){yield;}}
					
					loop(16)
					{
						radius += 100/16;
						x = radius * cos(angle);
						y = radius * sin(angle);
						yield;
					}
					if(vrtx%2 != 0){loop(16){yield;}}	
					if(vrtx%2 == 0){loop(32){yield;}}			
					loop(64)
					{
						if(vrtx%2 == 0)
						{	
							radius += 224/64-0.75;

						}
						else
						{	

							radius += 224/64;
						}
						x = radius * cos(angle);
						y = radius * sin(angle);
						yield;

					}


						
					
					if(vrtx%4==2 || vrtx%4==3)
					{	

						while(!Obj_BeDeleted(obj))
						{
							let tx = (radius * cos(angle-45) + radius * cos(angle+45) )/1.8;
							let ty = (radius * sin(angle-45) + radius * sin(angle+45) )/1.8;
							x += (tx-x) / 6;
							y += (ty-y) /8;
							yield;
						}

					}
						loop{					
						if(vrtx%2==0){
						ObjEffect_SetScale(obj,sc,sc);
						sc-=sc/(GetTimer*60);
						}
						yield;

					}
				}
				xy;
				

				task uv
				{

					loop(64){yield;}
					while(!Obj_BeDeleted(obj))
					{
						u-=8;
						yield;
					}
				}
				uv;
				
				while(!Obj_BeDeleted(obj))
				{

					ObjEffect_SetVertexXY(obj, vrtx, x, y);
					ObjEffect_SetVertexUV(obj, vrtx, u, v);
					ObjEffect_SetVertexColor(obj, vrtx, alpha,R,G,B);	

					yield;
				}
			}
			
			ascent(i in 0..18)
			{	
				vertex(i);
			}
			
	
			while(!Obj_BeDeleted(obj))
			{
			ang-=1;
			ObjEffect_SetAngle(obj, 0,0,ang);
			Obj_SetPosition(obj, GetX, GetY);

			yield;

			}
			
		}