// ========== Ten Desires-like Halo Effect by Lunasa Prismriver v 1.1 ==========
// 13 colors are allowed (from red to purple + grey) : "RED" "ORANGE" "YELLOW" "CHARTREUSE" "GREEN" "SPRINGGREEN" "CYAN" "AZURE" "BLUE" "VIOLET" "MAGENTA" "ROSE" "GREY"
// Now, you can use custom color by putting "RGB#RRRGGGBBB" .R are values for the red, G for green and B for blue aswell (eg. for violet RGB#255000128)
// If nothing of correct is put, a default color (red) would be apply.
// 2 effects are allowed : 1 create the aura with a transition, 0 create the aura without transition.
// Style : 0 shows all effects, 1 shows the magic circle and the halo, 2 shows the magic circle and the burning effect, 3 only shows the magic circle
// Style : 4 shows the halo and the burning effect, 5 only shows the halo, 6 only shows the burning effect.
// For functions 3 and 4, flameX is the X scale for the flame (default is 1.2); same for flameY, originScale is the scale (X and Y) for the base of the flame.
// Change systemdirectory if you change the directory of the function.
// Call CreateAura01 in @Initialize and don't forget to put yield; in @MainLoop !
// Include this function with # include_function "Path of the function"; at the top of the script.
// Don't use GetCurrentScriptDirectory() in the path of # include_function but instead, use ".\" or else it won't work.


let systemdirectory = ".\system\";
let CSD = GetCurrentScriptDirectory();


task CreateAura01(color,style,effect){

	let FlareTime = 0;

	if(color=="RED"){
		SubHalo(192,0,0);
		SubAura;
		loop {
			yield;
			if(FlareTime == 4){
				SubCreateFlame(255,0,0);
				SubCreateFlame(255,0,0);
				SubCreateOrigin(255,0,0);
				SubCreateOrigin(255,0,0);
				FlareTime = 0;
			}
		FlareTime ++;
		yield;
		}
	}if(color=="ORANGE"){
		SubHalo(192,192,0);
		SubHalo(192,96,96);
		SubAura;
		loop {
			yield;
			if(FlareTime == 4){
				SubCreateFlame(255,92,0);
				SubCreateFlame(255,92,0);
				SubCreateOrigin(255,92,0);
				SubCreateOrigin(255,92,0);
				FlareTime = 0;
			}
		FlareTime ++;
		yield;
		}
	}if(color=="YELLOW"){
		SubHalo(255,192,0);
		SubAura;
		loop {
			yield;
			if(FlareTime == 4){
				SubCreateFlame(255,255,0);
				SubCreateFlame(255,255,0);
				SubCreateOrigin(255,255,0);
				SubCreateOrigin(255,255,0);
				FlareTime = 0;
			}
			FlareTime ++;
			yield;
		}
	}if(color=="CHARTREUSE"){
		SubHalo(192,192,0);
		SubHalo(96,192,96);
		SubAura;
		loop {
			yield;
			if(FlareTime == 4){
				SubCreateFlame(92,255,0);
				SubCreateFlame(92,255,0);
				SubCreateOrigin(92,255,0);
				SubCreateOrigin(92,255,0);
				FlareTime = 0;
			}
			FlareTime ++;
			yield;
		}
	}if(color=="GREEN"){
		SubHalo(0,192,0);
		SubAura;
		loop {
			yield;
			if(FlareTime == 4){
				SubCreateFlame(0,255,0);
				SubCreateFlame(0,255,0);
				SubCreateOrigin(0,255,0);
				SubCreateOrigin(0,255,0);
				FlareTime = 0;
			}
			FlareTime ++;
			yield;
		}
	}if(color=="SPRINGGREEN"){
		SubHalo(0,192,255);
		SubHalo(96,192,96);
		SubAura;
		loop {
			yield;
			if(FlareTime == 4){
				SubCreateFlame(0,255,92);
				SubCreateFlame(0,255,92);
				SubCreateOrigin(0,255,92);
				SubCreateOrigin(0,255,92);
				FlareTime = 0;
			}
			FlareTime ++;
			yield;
		}
	}if(color=="CYAN"){
		SubHalo(0,192,192);
		SubAura;
		loop {
			yield;
			if(FlareTime == 4){
				SubCreateFlame(0,255,255);
				SubCreateFlame(0,255,255);
				SubCreateOrigin(0,255,255);
				SubCreateOrigin(0,255,255);
				FlareTime = 0;
			}
			FlareTime ++;
			yield;
		}
	}if(color=="AZURE"){
		SubHalo(0,192,192);
		SubHalo(96,96,192);
		SubAura;
		loop {
			yield;
			if(FlareTime == 4){
				SubCreateFlame(0,92,255);
				SubCreateFlame(0,92,255);
				SubCreateOrigin(0,92,255);
				SubCreateOrigin(0,92,255);
				FlareTime = 0;
			}
			FlareTime ++;
			yield;
		}
	}if(color=="BLUE"){
		SubHalo(0,0,192);
		SubAura;
		loop {
			yield;
			if(FlareTime == 4){
				SubCreateFlame(0,0,255);
				SubCreateFlame(0,0,255);
				SubCreateOrigin(0,0,255);
				SubCreateOrigin(0,0,255);
				FlareTime = 0;
			}
			FlareTime ++;
			yield;
		}
	}if(color=="VIOLET"){
		SubHalo(192,0,192);
		SubHalo(96,192,96);
		SubAura;
		loop {
			yield;
			if(FlareTime == 4){
				SubCreateFlame(92,0,255);
				SubCreateFlame(92,0,255);
				SubCreateOrigin(92,0,255);
				SubCreateOrigin(92,0,255);
				FlareTime = 0;
			}
			FlareTime ++;
			yield;
		}
	}if(color=="MAGENTA"){
		SubHalo(192,0,96);
		SubAura;
		loop {
			yield;
			if(FlareTime == 4){
				SubCreateFlame(255,0,255);
				SubCreateFlame(255,0,255);
				SubCreateOrigin(255,0,255);
				SubCreateOrigin(255,0,255);
				FlareTime = 0;
			}
			FlareTime ++;
			yield;
		}
	}if(color=="ROSE"){
		SubHalo(192,0,96);
		SubHalo(192,160,96);
		SubAura;
		loop {
			yield;
			if(FlareTime == 4){
				SubCreateFlame(255,0,92);
				SubCreateFlame(255,0,92);
				SubCreateOrigin(255,0,92);
				SubCreateOrigin(255,0,92);
				FlareTime = 0;
			}
			FlareTime ++;
			yield;
		}
	}if(color=="GREY"){
		SubHalo(96,96,96);
		SubAura;
		loop {
			yield;
			if(FlareTime == 4){
				SubCreateFlame(128,128,128);
				SubCreateFlame(128,128,128);
				SubCreateOrigin(128,128,128);
				SubCreateOrigin(128,128,128);
				FlareTime = 0;
			}
			FlareTime ++;
			yield;
		}
	}if(color[0] == 'R' && color[1] == 'G' && color[2] == 'B' &&color[3] == '#' && length(color) == 13){
		let colorarray = [ToNumber(color[4])*100+ToNumber(color[5])*10+ToNumber(color[6]),ToNumber(color[7])*100+ToNumber(color[8])*10+ToNumber(color[9]),ToNumber(color[10])*100+ToNumber(color[11])*10+ToNumber(color[12])];
		SubHalo(colorarray[0]-(colorarray[0]*0.3),colorarray[1]-(colorarray[1]*0.3),colorarray[2]-(colorarray[2]*0.3));
		SubAura;
		loop {
			yield;
			if(FlareTime == 4){
				SubCreateFlame(colorarray[0],colorarray[1],colorarray[2]);
				SubCreateFlame(colorarray[0],colorarray[1],colorarray[2]);
				SubCreateOrigin(colorarray[0],colorarray[1],colorarray[2]);
				SubCreateOrigin(colorarray[0],colorarray[1],colorarray[2]);
				FlareTime = 0;
			}
			FlareTime ++;
			yield;
		}
	}else{
		SubHalo(192,0,0);
		SubAura;
		loop {
			yield;
			if(FlareTime == 4){
				SubCreateFlame(255,0,0);
				SubCreateFlame(255,0,0);
				SubCreateOrigin(255,0,0);
				SubCreateOrigin(255,0,0);
				FlareTime = 0;
			}
		FlareTime ++;
		yield;
		}
	}
	


	task SubHalo(r,v,b) {
	
		if(style == 2 || style == 3 || style == 6){
		
		}else{

		let objHalo = Obj_Create(OBJ_EFFECT);
		let objscale = 0;

		let HaloImage = CSD ~ systemdirectory ~ "Halo.png";
		LoadGraphic(HaloImage); 


		ObjEffect_SetLayer(objHalo,1);
		ObjEffect_SetRenderState(objHalo,SUBTRACT);
		ObjEffect_SetTexture(objHalo, HaloImage);
		ObjEffect_SetScale(objHalo,1.25,1.25);
		ObjEffect_SetPrimitiveType(objHalo, PRIMITIVE_TRIANGLEFAN);
		ObjEffect_CreateVertex(objHalo, 4);

		ObjEffect_SetVertexXY(objHalo, 0, -128, 128);
		ObjEffect_SetVertexXY(objHalo, 1, 128, 128);
		ObjEffect_SetVertexXY(objHalo, 2, 128, -128);
		ObjEffect_SetVertexXY(objHalo, 3, -128, -128);

		ObjEffect_SetVertexUV(objHalo, 0, 0, 0);
		ObjEffect_SetVertexUV(objHalo, 1, 256, 0);
		ObjEffect_SetVertexUV(objHalo, 2, 256, 256);
		ObjEffect_SetVertexUV(objHalo, 3, 0, 256);

		ObjEffect_SetVertexColor(objHalo,0,255,255-r,255-v,255-b);	
		ObjEffect_SetVertexColor(objHalo,1,255,255-r,255-v,255-b);
		ObjEffect_SetVertexColor(objHalo,2,255,255-r,255-v,255-b);
		ObjEffect_SetVertexColor(objHalo,3,255,255-r,255-v,255-b);


		while(!Obj_BeDeleted(objHalo)){
			if(effect==1 && objscale<1.25){
				ObjEffect_SetScale(objHalo,objscale,objscale);
				objscale+=0.025;
				yield;
			}
			Obj_SetX(objHalo, GetEnemyX);
			Obj_SetY(objHalo, GetEnemyY);
			yield;
		}
		}

	}



	task SubAura {
	
	  if(style == 4 || style == 5 || style == 6 ){
	  
	  }else{

	  let objHalo = Obj_Create(OBJ_EFFECT);
	  let objscale = 0;
	  let rotate = 0;
	  let sinscale = 0;
	  let scale = 0;

	  let CircleImage = CSD ~ systemdirectory ~ "MagicCircle.png";
	  LoadGraphic(CircleImage); 

	  ObjEffect_SetLayer(objHalo,1);
	  ObjEffect_SetRenderState(objHalo,ADD);
	  ObjEffect_SetTexture(objHalo, CircleImage);
	  ObjEffect_SetPrimitiveType(objHalo, PRIMITIVE_TRIANGLEFAN);
	  ObjEffect_CreateVertex(objHalo, 4);

	  ObjEffect_SetVertexXY(objHalo, 0, -64,64);
	  ObjEffect_SetVertexXY(objHalo, 1, 64,64);
	  ObjEffect_SetVertexXY(objHalo, 2, 64,-64);
	  ObjEffect_SetVertexXY(objHalo, 3, -64,-64);

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

	  ObjEffect_SetVertexColor(objHalo,0,160,255,255,255);	
	  ObjEffect_SetVertexColor(objHalo,1,160,255,255,255);	
	  ObjEffect_SetVertexColor(objHalo,2,160,255,255,255);	
	  ObjEffect_SetVertexColor(objHalo,3,160,255,255,255);	


	  while(!Obj_BeDeleted(objHalo)){
		  if(effect==1 && objscale<=2){
				ObjEffect_SetScale(objHalo,objscale,objscale);
				ObjEffect_SetAngle(objHalo,0,0,rotate);
				Obj_SetX(objHalo, GetEnemyX);
				Obj_SetY(objHalo, GetEnemyY);
				objscale+=0.05;
				rotate+=5;
				yield;
			}else{
				ObjEffect_SetScale(objHalo,scale,scale);
				ObjEffect_SetAngle(objHalo,0,0,rotate);
				Obj_SetX(objHalo, GetEnemyX);
				Obj_SetY(objHalo, GetEnemyY);
				yield;
				rotate+=5;
				scale = 1.95+0.20*sin(sinscale);
				sinscale+=5;
			}
		}
		}

	}

	task SubCreateFlame (r,v,b){
	
	  if(style == 1 || style == 3 || style == 5 ){
	  
	  }else{

	  let objHalo = Obj_Create(OBJ_EFFECT);

	  let ScaleY = 1;
	  let Alpha = 160;


	  let CircleImage = CSD ~ systemdirectory ~ "Aura.png";
	  LoadGraphic(CircleImage); 

		  ObjEffect_SetLayer(objHalo,1);
		  ObjEffect_SetRenderState(objHalo,ADD);
		  ObjEffect_SetTexture(objHalo, CircleImage);
		  ObjEffect_SetPrimitiveType(objHalo, PRIMITIVE_TRIANGLEFAN);
		  ObjEffect_CreateVertex(objHalo, 4);

		  ObjEffect_SetVertexXY(objHalo, 0, -24,32);
		  ObjEffect_SetVertexXY(objHalo, 1, 24,32);
		  ObjEffect_SetVertexXY(objHalo, 2, 24,-32);
		  ObjEffect_SetVertexXY(objHalo, 3, -24,-32);

		  ObjEffect_SetVertexUV(objHalo, 0, 0, 0);
		  ObjEffect_SetVertexUV(objHalo, 1, 48, 0);
		  ObjEffect_SetVertexUV(objHalo, 2, 48, 64);
		  ObjEffect_SetVertexUV(objHalo, 3, 0, 64);
		  ObjEffect_SetAngle(objHalo, 0, 0, 180+rand(-15,15));
	 

	  while(!Obj_BeDeleted(objHalo)){
		  Obj_SetX(objHalo, GetEnemyX);
		  Obj_SetY(objHalo, GetEnemyY-13);
		  ObjEffect_SetScale(objHalo, 1.2,ScaleY);
		  ObjEffect_SetVertexColor(objHalo,0,Alpha,r+33,v+33,b+33);	
		  ObjEffect_SetVertexColor(objHalo,1,Alpha,r+66,v+66,b+66);		
		  ObjEffect_SetVertexColor(objHalo,2,Alpha,r+33,v+33,b+33);		
		  ObjEffect_SetVertexColor(objHalo,3,Alpha,r+66,v+66,b+66);
		 
		

		  ScaleY+=0.03+rand(0,0.01);
		  Alpha-=3+rand(-0.5,1);
		  yield;
		  if(Alpha <= 0){Obj_Delete(objHalo);}

		}
		
		}
	}

	task SubCreateOrigin (r,v,b){
	
		if(style == 1 || style == 3 || style == 5 ){
	  
	    }else{

		let objHalo = Obj_Create(OBJ_EFFECT);

		let Scale = 1;
		let Alpha = 160;


		let CircleImage = CSD ~ systemdirectory ~ "Aura.png";
		LoadGraphic(CircleImage); 

		ObjEffect_SetLayer(objHalo,1);
		ObjEffect_SetRenderState(objHalo,ADD);
		ObjEffect_SetTexture(objHalo, CircleImage);
		ObjEffect_SetPrimitiveType(objHalo, PRIMITIVE_TRIANGLEFAN);
		ObjEffect_CreateVertex(objHalo, 4);

		ObjEffect_SetVertexXY(objHalo, 0, -24,32);
		ObjEffect_SetVertexXY(objHalo, 1, 24,32);
		ObjEffect_SetVertexXY(objHalo, 2, 24,-32);
		ObjEffect_SetVertexXY(objHalo, 3, -24,-32);

		ObjEffect_SetVertexUV(objHalo, 0, 48, 0);
		ObjEffect_SetVertexUV(objHalo, 1, 96, 0);
		ObjEffect_SetVertexUV(objHalo, 2, 96, 64);
		ObjEffect_SetVertexUV(objHalo, 3, 48, 64);
		ObjEffect_SetAngle(objHalo, 0, 0, rand(0,360));
	 

		while(!Obj_BeDeleted(objHalo)){
			Obj_SetX(objHalo, GetEnemyX);
			Obj_SetY(objHalo, GetEnemyY+16);
			ObjEffect_SetScale(objHalo, Scale,Scale);
			ObjEffect_SetVertexColor(objHalo,0,Alpha,r+66,v+66,b+66);	
			ObjEffect_SetVertexColor(objHalo,1,Alpha,r+33,v+33,b+33);		
			ObjEffect_SetVertexColor(objHalo,2,Alpha,r+66,v+66,b+66);		
			ObjEffect_SetVertexColor(objHalo,3,Alpha,r+33,v+33,b+33);
		
			Scale+=0.02;
			Alpha-=5+rand(-0.5,1);
			yield;
			if(Alpha <= 0){Obj_Delete(objHalo);}
		}
		
		}
	}
}


//Use this function for child enemies.

task CreateAura02(enemyID,color,style,effect){



	let FlareTime = 0;

	if(color=="RED"){
		SubHalo(192,0,0);
		SubAura;
		loop {
			yield;
			if(FlareTime == 4){
				SubCreateFlame(255,0,0);
				SubCreateFlame(255,0,0);
				SubCreateOrigin(255,0,0);
				SubCreateOrigin(255,0,0);
				FlareTime = 0;
			}
		FlareTime ++;
		yield;
		}
	}if(color=="ORANGE"){
		SubHalo(192,192,0);
		SubHalo(192,96,96);
		SubAura;
		loop {
			yield;
			if(FlareTime == 4){
				SubCreateFlame(255,92,0);
				SubCreateFlame(255,92,0);
				SubCreateOrigin(255,92,0);
				SubCreateOrigin(255,92,0);
				FlareTime = 0;
			}
		FlareTime ++;
		yield;
		}
	}if(color=="YELLOW"){
		SubHalo(255,192,0);
		SubAura;
		loop {
			yield;
			if(FlareTime == 4){
				SubCreateFlame(255,255,0);
				SubCreateFlame(255,255,0);
				SubCreateOrigin(255,255,0);
				SubCreateOrigin(255,255,0);
				FlareTime = 0;
			}
			FlareTime ++;
			yield;
		}
	}if(color=="CHARTREUSE"){
		SubHalo(192,192,0);
		SubHalo(96,192,96);
		SubAura;
		loop {
			yield;
			if(FlareTime == 4){
				SubCreateFlame(92,255,0);
				SubCreateFlame(92,255,0);
				SubCreateOrigin(92,255,0);
				SubCreateOrigin(92,255,0);
				FlareTime = 0;
			}
			FlareTime ++;
			yield;
		}
	}if(color=="GREEN"){
		SubHalo(0,192,0);
		SubAura;
		loop {
			yield;
			if(FlareTime == 4){
				SubCreateFlame(0,255,0);
				SubCreateFlame(0,255,0);
				SubCreateOrigin(0,255,0);
				SubCreateOrigin(0,255,0);
				FlareTime = 0;
			}
			FlareTime ++;
			yield;
		}
	}if(color=="SPRINGGREEN"){
		SubHalo(0,192,255);
		SubHalo(96,192,96);
		SubAura;
		loop {
			yield;
			if(FlareTime == 4){
				SubCreateFlame(0,255,92);
				SubCreateFlame(0,255,92);
				SubCreateOrigin(0,255,92);
				SubCreateOrigin(0,255,92);
				FlareTime = 0;
			}
			FlareTime ++;
			yield;
		}
	}if(color=="CYAN"){
		SubHalo(0,192,192);
		SubAura;
		loop {
			yield;
			if(FlareTime == 4){
				SubCreateFlame(0,255,255);
				SubCreateFlame(0,255,255);
				SubCreateOrigin(0,255,255);
				SubCreateOrigin(0,255,255);
				FlareTime = 0;
			}
			FlareTime ++;
			yield;
		}
	}if(color=="AZURE"){
		SubHalo(0,192,192);
		SubHalo(96,96,192);
		SubAura;
		loop {
			yield;
			if(FlareTime == 4){
				SubCreateFlame(0,92,255);
				SubCreateFlame(0,92,255);
				SubCreateOrigin(0,92,255);
				SubCreateOrigin(0,92,255);
				FlareTime = 0;
			}
			FlareTime ++;
			yield;
		}
	}if(color=="BLUE"){
		SubHalo(0,0,192);
		SubAura;
		loop {
			yield;
			if(FlareTime == 4){
				SubCreateFlame(0,0,255);
				SubCreateFlame(0,0,255);
				SubCreateOrigin(0,0,255);
				SubCreateOrigin(0,0,255);
				FlareTime = 0;
			}
			FlareTime ++;
			yield;
		}
	}if(color=="VIOLET"){
		SubHalo(192,0,192);
		SubHalo(96,192,96);
		SubAura;
		loop {
			yield;
			if(FlareTime == 4){
				SubCreateFlame(92,0,255);
				SubCreateFlame(92,0,255);
				SubCreateOrigin(92,0,255);
				SubCreateOrigin(92,0,255);
				FlareTime = 0;
			}
			FlareTime ++;
			yield;
		}
	}if(color=="MAGENTA"){
		SubHalo(192,0,96);
		SubAura;
		loop {
			yield;
			if(FlareTime == 4){
				SubCreateFlame(255,0,255);
				SubCreateFlame(255,0,255);
				SubCreateOrigin(255,0,255);
				SubCreateOrigin(255,0,255);
				FlareTime = 0;
			}
			FlareTime ++;
			yield;
		}
	}if(color=="ROSE"){
		SubHalo(192,0,96);
		SubHalo(192,160,96);
		SubAura;
		loop {
			yield;
			if(FlareTime == 4){
				SubCreateFlame(255,0,92);
				SubCreateFlame(255,0,92);
				SubCreateOrigin(255,0,92);
				SubCreateOrigin(255,0,92);
				FlareTime = 0;
			}
			FlareTime ++;
			yield;
		}
	}if(color=="GREY"){
		SubHalo(96,96,96);
		SubAura;
		loop {
			yield;
			if(FlareTime == 4){
				SubCreateFlame(128,128,128);
				SubCreateFlame(128,128,128);
				SubCreateOrigin(128,128,128);
				SubCreateOrigin(128,128,128);
				FlareTime = 0;
			}
			FlareTime ++;
			yield;
		}
	}if(color[0] == 'R' && color[1] == 'G' && color[2] == 'B' &&color[3] == '#' && length(color) == 13){
		let colorarray = [ToNumber(color[4])*100+ToNumber(color[5])*10+ToNumber(color[6]),ToNumber(color[7])*100+ToNumber(color[8])*10+ToNumber(color[9]),ToNumber(color[10])*100+ToNumber(color[11])*10+ToNumber(color[12])];
		SubHalo(colorarray[0]-(colorarray[0]*0.3),colorarray[1]-(colorarray[1]*0.3),colorarray[2]-(colorarray[2]*0.3));
		SubAura;
		loop {
			yield;
			if(FlareTime == 4){
				SubCreateFlame(colorarray[0],colorarray[1],colorarray[2]);
				SubCreateFlame(colorarray[0],colorarray[1],colorarray[2]);
				SubCreateOrigin(colorarray[0],colorarray[1],colorarray[2]);
				SubCreateOrigin(colorarray[0],colorarray[1],colorarray[2]);
				FlareTime = 0;
			}
			FlareTime ++;
			yield;
		}
	}else{
		SubHalo(192,0,0);
		SubAura;
		loop {
			yield;
			if(FlareTime == 4){
				SubCreateFlame(255,0,0);
				SubCreateFlame(255,0,0);
				SubCreateOrigin(255,0,0);
				SubCreateOrigin(255,0,0);
				FlareTime = 0;
			}
		FlareTime ++;
		yield;
		}
	}


	task SubHalo(r,v,b) {
	
		if(style == 2 || style == 3 || style == 6){
		
		}else{

		let objHalo = Obj_Create(OBJ_EFFECT);
		let objscale = 0;

		let HaloImage = CSD ~ systemdirectory ~ "Halo.png";
		LoadGraphic(HaloImage); 


		ObjEffect_SetLayer(objHalo,1);
		ObjEffect_SetRenderState(objHalo,SUBTRACT);
		ObjEffect_SetTexture(objHalo, HaloImage);
		ObjEffect_SetScale(objHalo,1.25,1.25);
		ObjEffect_SetPrimitiveType(objHalo, PRIMITIVE_TRIANGLEFAN);
		ObjEffect_CreateVertex(objHalo, 4);

		ObjEffect_SetVertexXY(objHalo, 0, -128, 128);
		ObjEffect_SetVertexXY(objHalo, 1, 128, 128);
		ObjEffect_SetVertexXY(objHalo, 2, 128, -128);
		ObjEffect_SetVertexXY(objHalo, 3, -128, -128);

		ObjEffect_SetVertexUV(objHalo, 0, 0, 0);
		ObjEffect_SetVertexUV(objHalo, 1, 256, 0);
		ObjEffect_SetVertexUV(objHalo, 2, 256, 256);
		ObjEffect_SetVertexUV(objHalo, 3, 0, 256);

		ObjEffect_SetVertexColor(objHalo,0,255,255-r,255-v,255-b);	
		ObjEffect_SetVertexColor(objHalo,1,255,255-r,255-v,255-b);
		ObjEffect_SetVertexColor(objHalo,2,255,255-r,255-v,255-b);
		ObjEffect_SetVertexColor(objHalo,3,255,255-r,255-v,255-b);


		while(!Obj_BeDeleted(objHalo)){
			if(effect==1 && objscale<1.25){
				ObjEffect_SetScale(objHalo,objscale,objscale);
				objscale+=0.025;
				yield;
			}
			Obj_SetX(objHalo, GetEnemyInfo(enemyID,ENEMY_X));
			Obj_SetY(objHalo, GetEnemyInfo(enemyID,ENEMY_Y));
		}
		}

	}



	task SubAura {
	
	  if(style == 4 || style == 5 || style == 6 ){
	  
	  }else{

	  let objHalo = Obj_Create(OBJ_EFFECT);
	  let objscale = 0;
	  let rotate = 0;
	  let sinscale = 0;
	  let scale = 0;

	  let CircleImage = CSD ~ systemdirectory ~ "MagicCircle.png";
	  LoadGraphic(CircleImage); 

	  ObjEffect_SetLayer(objHalo,1);
	  ObjEffect_SetRenderState(objHalo,ADD);
	  ObjEffect_SetTexture(objHalo, CircleImage);
	  ObjEffect_SetPrimitiveType(objHalo, PRIMITIVE_TRIANGLEFAN);
	  ObjEffect_CreateVertex(objHalo, 4);

	  ObjEffect_SetVertexXY(objHalo, 0, -64,64);
	  ObjEffect_SetVertexXY(objHalo, 1, 64,64);
	  ObjEffect_SetVertexXY(objHalo, 2, 64,-64);
	  ObjEffect_SetVertexXY(objHalo, 3, -64,-64);

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

	  ObjEffect_SetVertexColor(objHalo,0,160,255,255,255);	
	  ObjEffect_SetVertexColor(objHalo,1,160,255,255,255);	
	  ObjEffect_SetVertexColor(objHalo,2,160,255,255,255);	
	  ObjEffect_SetVertexColor(objHalo,3,160,255,255,255);	


	  while(!Obj_BeDeleted(objHalo)){
		  if(effect==1 && objscale<=2){
				ObjEffect_SetScale(objHalo,objscale,objscale);
				ObjEffect_SetAngle(objHalo,0,0,rotate);
				Obj_SetX(objHalo, GetEnemyInfo(enemyID,ENEMY_X));
				Obj_SetY(objHalo, GetEnemyInfo(enemyID,ENEMY_Y));
				objscale+=0.05;
				rotate+=5;
				yield;
			}else{
				ObjEffect_SetScale(objHalo,scale,scale);
				ObjEffect_SetAngle(objHalo,0,0,rotate);
				Obj_SetX(objHalo, GetEnemyInfo(enemyID,ENEMY_X));
				Obj_SetY(objHalo, GetEnemyInfo(enemyID,ENEMY_Y));
				yield;
				rotate+=5;
				scale = 1.95+0.20*sin(sinscale);
				sinscale+=5;
			}
		}
		}

	}

	task SubCreateFlame (r,v,b){
	
	  if(style == 1 || style == 3 || style == 5 ){
	  
	  }else{

	  let objHalo = Obj_Create(OBJ_EFFECT);

	  let ScaleY = 1;
	  let Alpha = 160;


	  let CircleImage = CSD ~ systemdirectory ~ "Aura.png";
	  LoadGraphic(CircleImage); 

		  ObjEffect_SetLayer(objHalo,1);
		  ObjEffect_SetRenderState(objHalo,ADD);
		  ObjEffect_SetTexture(objHalo, CircleImage);
		  ObjEffect_SetPrimitiveType(objHalo, PRIMITIVE_TRIANGLEFAN);
		  ObjEffect_CreateVertex(objHalo, 4);

		  ObjEffect_SetVertexXY(objHalo, 0, -24,32);
		  ObjEffect_SetVertexXY(objHalo, 1, 24,32);
		  ObjEffect_SetVertexXY(objHalo, 2, 24,-32);
		  ObjEffect_SetVertexXY(objHalo, 3, -24,-32);

		  ObjEffect_SetVertexUV(objHalo, 0, 0, 0);
		  ObjEffect_SetVertexUV(objHalo, 1, 48, 0);
		  ObjEffect_SetVertexUV(objHalo, 2, 48, 64);
		  ObjEffect_SetVertexUV(objHalo, 3, 0, 64);
		  ObjEffect_SetAngle(objHalo, 0, 0, 180+rand(-15,15));
	 

	  while(!Obj_BeDeleted(objHalo)){
		  Obj_SetX(objHalo, GetEnemyInfo(enemyID,ENEMY_X));
		  Obj_SetY(objHalo, GetEnemyInfo(enemyID,ENEMY_Y)-13);
		  ObjEffect_SetScale(objHalo, 1.2,ScaleY);
		  ObjEffect_SetVertexColor(objHalo,0,Alpha,r+33,v+33,b+33);	
		  ObjEffect_SetVertexColor(objHalo,1,Alpha,r+66,v+66,b+66);		
		  ObjEffect_SetVertexColor(objHalo,2,Alpha,r+33,v+33,b+33);		
		  ObjEffect_SetVertexColor(objHalo,3,Alpha,r+66,v+66,b+66);
		 
		

		  ScaleY+=0.03+rand(0,0.01);
		  Alpha-=3+rand(-0.5,1);
		  yield;
		  if(Alpha <= 0){Obj_Delete(objHalo);}

		}
		
		}
	}

	task SubCreateOrigin (r,v,b){
	
		if(style == 1 || style == 3 || style == 5 ){
	  
	    }else{

		let objHalo = Obj_Create(OBJ_EFFECT);

		let Scale = 1;
		let Alpha = 160;


		let CircleImage = CSD ~ systemdirectory ~ "Aura.png";
		LoadGraphic(CircleImage); 

		ObjEffect_SetLayer(objHalo,1);
		ObjEffect_SetRenderState(objHalo,ADD);
		ObjEffect_SetTexture(objHalo, CircleImage);
		ObjEffect_SetPrimitiveType(objHalo, PRIMITIVE_TRIANGLEFAN);
		ObjEffect_CreateVertex(objHalo, 4);

		ObjEffect_SetVertexXY(objHalo, 0, -24,32);
		ObjEffect_SetVertexXY(objHalo, 1, 24,32);
		ObjEffect_SetVertexXY(objHalo, 2, 24,-32);
		ObjEffect_SetVertexXY(objHalo, 3, -24,-32);

		ObjEffect_SetVertexUV(objHalo, 0, 48, 0);
		ObjEffect_SetVertexUV(objHalo, 1, 96, 0);
		ObjEffect_SetVertexUV(objHalo, 2, 96, 64);
		ObjEffect_SetVertexUV(objHalo, 3, 48, 64);
		ObjEffect_SetAngle(objHalo, 0, 0, rand(0,360));
	 

		while(!Obj_BeDeleted(objHalo)){
			Obj_SetX(objHalo, GetEnemyInfo(enemyID,ENEMY_X));
			Obj_SetY(objHalo, GetEnemyInfo(enemyID,ENEMY_Y)+16);
			ObjEffect_SetScale(objHalo, Scale,Scale);
			ObjEffect_SetVertexColor(objHalo,0,Alpha,r+66,v+66,b+66);	
			ObjEffect_SetVertexColor(objHalo,1,Alpha,r+33,v+33,b+33);		
			ObjEffect_SetVertexColor(objHalo,2,Alpha,r+66,v+66,b+66);		
			ObjEffect_SetVertexColor(objHalo,3,Alpha,r+33,v+33,b+33);
		
			Scale+=0.02;
			Alpha-=5+rand(-0.5,1);
			yield;
			if(Alpha <= 0){Obj_Delete(objHalo);}
		}
		
		}
	}
}

//These functions are the same but you can modify the size of the flame.

task CreateAura03(color,style,effect,flameX,flameY,originScale){

	let FlareTime = 0;

	if(color=="RED"){
		SubHalo(192,0,0);
		SubAura;
		loop {
			yield;
			if(FlareTime == 4){
				SubCreateFlame(255,0,0);
				SubCreateFlame(255,0,0);
				SubCreateOrigin(255,0,0);
				SubCreateOrigin(255,0,0);
				FlareTime = 0;
			}
		FlareTime ++;
		yield;
		}
	}if(color=="ORANGE"){
		SubHalo(192,192,0);
		SubHalo(192,96,96);
		SubAura;
		loop {
			yield;
			if(FlareTime == 4){
				SubCreateFlame(255,92,0);
				SubCreateFlame(255,92,0);
				SubCreateOrigin(255,92,0);
				SubCreateOrigin(255,92,0);
				FlareTime = 0;
			}
		FlareTime ++;
		yield;
		}
	}if(color=="YELLOW"){
		SubHalo(255,192,0);
		SubAura;
		loop {
			yield;
			if(FlareTime == 4){
				SubCreateFlame(255,255,0);
				SubCreateFlame(255,255,0);
				SubCreateOrigin(255,255,0);
				SubCreateOrigin(255,255,0);
				FlareTime = 0;
			}
			FlareTime ++;
			yield;
		}
	}if(color=="CHARTREUSE"){
		SubHalo(192,192,0);
		SubHalo(96,192,96);
		SubAura;
		loop {
			yield;
			if(FlareTime == 4){
				SubCreateFlame(92,255,0);
				SubCreateFlame(92,255,0);
				SubCreateOrigin(92,255,0);
				SubCreateOrigin(92,255,0);
				FlareTime = 0;
			}
			FlareTime ++;
			yield;
		}
	}if(color=="GREEN"){
		SubHalo(0,192,0);
		SubAura;
		loop {
			yield;
			if(FlareTime == 4){
				SubCreateFlame(0,255,0);
				SubCreateFlame(0,255,0);
				SubCreateOrigin(0,255,0);
				SubCreateOrigin(0,255,0);
				FlareTime = 0;
			}
			FlareTime ++;
			yield;
		}
	}if(color=="SPRINGGREEN"){
		SubHalo(0,192,255);
		SubHalo(96,192,96);
		SubAura;
		loop {
			yield;
			if(FlareTime == 4){
				SubCreateFlame(0,255,92);
				SubCreateFlame(0,255,92);
				SubCreateOrigin(0,255,92);
				SubCreateOrigin(0,255,92);
				FlareTime = 0;
			}
			FlareTime ++;
			yield;
		}
	}if(color=="CYAN"){
		SubHalo(0,192,192);
		SubAura;
		loop {
			yield;
			if(FlareTime == 4){
				SubCreateFlame(0,255,255);
				SubCreateFlame(0,255,255);
				SubCreateOrigin(0,255,255);
				SubCreateOrigin(0,255,255);
				FlareTime = 0;
			}
			FlareTime ++;
			yield;
		}
	}if(color=="AZURE"){
		SubHalo(0,192,192);
		SubHalo(96,96,192);
		SubAura;
		loop {
			yield;
			if(FlareTime == 4){
				SubCreateFlame(0,92,255);
				SubCreateFlame(0,92,255);
				SubCreateOrigin(0,92,255);
				SubCreateOrigin(0,92,255);
				FlareTime = 0;
			}
			FlareTime ++;
			yield;
		}
	}if(color=="BLUE"){
		SubHalo(0,0,192);
		SubAura;
		loop {
			yield;
			if(FlareTime == 4){
				SubCreateFlame(0,0,255);
				SubCreateFlame(0,0,255);
				SubCreateOrigin(0,0,255);
				SubCreateOrigin(0,0,255);
				FlareTime = 0;
			}
			FlareTime ++;
			yield;
		}
	}if(color=="VIOLET"){
		SubHalo(192,0,192);
		SubHalo(96,192,96);
		SubAura;
		loop {
			yield;
			if(FlareTime == 4){
				SubCreateFlame(92,0,255);
				SubCreateFlame(92,0,255);
				SubCreateOrigin(92,0,255);
				SubCreateOrigin(92,0,255);
				FlareTime = 0;
			}
			FlareTime ++;
			yield;
		}
	}if(color=="MAGENTA"){
		SubHalo(192,0,96);
		SubAura;
		loop {
			yield;
			if(FlareTime == 4){
				SubCreateFlame(255,0,255);
				SubCreateFlame(255,0,255);
				SubCreateOrigin(255,0,255);
				SubCreateOrigin(255,0,255);
				FlareTime = 0;
			}
			FlareTime ++;
			yield;
		}
	}if(color=="ROSE"){
		SubHalo(192,0,96);
		SubHalo(192,160,96);
		SubAura;
		loop {
			yield;
			if(FlareTime == 4){
				SubCreateFlame(255,0,92);
				SubCreateFlame(255,0,92);
				SubCreateOrigin(255,0,92);
				SubCreateOrigin(255,0,92);
				FlareTime = 0;
			}
			FlareTime ++;
			yield;
		}
	}if(color=="GREY"){
		SubHalo(96,96,96);
		SubAura;
		loop {
			yield;
			if(FlareTime == 4){
				SubCreateFlame(128,128,128);
				SubCreateFlame(128,128,128);
				SubCreateOrigin(128,128,128);
				SubCreateOrigin(128,128,128);
				FlareTime = 0;
			}
			FlareTime ++;
			yield;
		}
	}if(color[0] == 'R' && color[1] == 'G' && color[2] == 'B' &&color[3] == '#' && length(color) == 13){
		let colorarray = [ToNumber(color[4])*100+ToNumber(color[5])*10+ToNumber(color[6]),ToNumber(color[7])*100+ToNumber(color[8])*10+ToNumber(color[9]),ToNumber(color[10])*100+ToNumber(color[11])*10+ToNumber(color[12])];
		SubHalo(colorarray[0]-(colorarray[0]*0.3),colorarray[1]-(colorarray[1]*0.3),colorarray[2]-(colorarray[2]*0.3));
		SubAura;
		loop {
			yield;
			if(FlareTime == 4){
				SubCreateFlame(colorarray[0],colorarray[1],colorarray[2]);
				SubCreateFlame(colorarray[0],colorarray[1],colorarray[2]);
				SubCreateOrigin(colorarray[0],colorarray[1],colorarray[2]);
				SubCreateOrigin(colorarray[0],colorarray[1],colorarray[2]);
				FlareTime = 0;
			}
			FlareTime ++;
			yield;
		}
	}else{
		SubHalo(192,0,0);
		SubAura;
		loop {
			yield;
			if(FlareTime == 4){
				SubCreateFlame(255,0,0);
				SubCreateFlame(255,0,0);
				SubCreateOrigin(255,0,0);
				SubCreateOrigin(255,0,0);
				FlareTime = 0;
			}
		FlareTime ++;
		yield;
		}
	}


	task SubHalo(r,v,b) {
	
		if(style == 2 || style == 3 || style == 6){
		
		}else{

		let objHalo = Obj_Create(OBJ_EFFECT);
		let objscale = 0;

		let HaloImage = CSD ~ systemdirectory ~ "Halo.png";
		LoadGraphic(HaloImage); 


		ObjEffect_SetLayer(objHalo,1);
		ObjEffect_SetRenderState(objHalo,SUBTRACT);
		ObjEffect_SetScale(objHalo,1.25,1.25);
		ObjEffect_SetTexture(objHalo, HaloImage);
		ObjEffect_SetPrimitiveType(objHalo, PRIMITIVE_TRIANGLEFAN);
		ObjEffect_CreateVertex(objHalo, 4);

		ObjEffect_SetVertexXY(objHalo, 0, -128, 128);
		ObjEffect_SetVertexXY(objHalo, 1, 128, 128);
		ObjEffect_SetVertexXY(objHalo, 2, 128, -128);
		ObjEffect_SetVertexXY(objHalo, 3, -128, -128);

		ObjEffect_SetVertexUV(objHalo, 0, 0, 0);
		ObjEffect_SetVertexUV(objHalo, 1, 256, 0);
		ObjEffect_SetVertexUV(objHalo, 2, 256, 256);
		ObjEffect_SetVertexUV(objHalo, 3, 0, 256);

		ObjEffect_SetVertexColor(objHalo,0,255,255-r,255-v,255-b);	
		ObjEffect_SetVertexColor(objHalo,1,255,255-r,255-v,255-b);
		ObjEffect_SetVertexColor(objHalo,2,255,255-r,255-v,255-b);
		ObjEffect_SetVertexColor(objHalo,3,255,255-r,255-v,255-b);


		while(!Obj_BeDeleted(objHalo)){
			if(effect==1 && objscale<1.25){
				ObjEffect_SetScale(objHalo,objscale,objscale);
				objscale+=0.025;
				yield;
			}
			Obj_SetX(objHalo, GetEnemyX);
			Obj_SetY(objHalo, GetEnemyY);
			yield;
		}
		}

	}



	task SubAura {
	
	  if(style == 4 || style == 5 || style == 6 ){
	  
	  }else{

	  let objHalo = Obj_Create(OBJ_EFFECT);
	  let objscale = 0;
	  let rotate = 0;
	  let sinscale = 0;
	  let scale = 0;

	  let CircleImage = CSD ~ systemdirectory ~ "MagicCircle.png";
	  LoadGraphic(CircleImage); 

	  ObjEffect_SetLayer(objHalo,1);
	  ObjEffect_SetRenderState(objHalo,ADD);
	  ObjEffect_SetTexture(objHalo, CircleImage);
	  ObjEffect_SetPrimitiveType(objHalo, PRIMITIVE_TRIANGLEFAN);
	  ObjEffect_CreateVertex(objHalo, 4);

	  ObjEffect_SetVertexXY(objHalo, 0, -64,64);
	  ObjEffect_SetVertexXY(objHalo, 1, 64,64);
	  ObjEffect_SetVertexXY(objHalo, 2, 64,-64);
	  ObjEffect_SetVertexXY(objHalo, 3, -64,-64);

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

	  ObjEffect_SetVertexColor(objHalo,0,160,255,255,255);	
	  ObjEffect_SetVertexColor(objHalo,1,160,255,255,255);	
	  ObjEffect_SetVertexColor(objHalo,2,160,255,255,255);	
	  ObjEffect_SetVertexColor(objHalo,3,160,255,255,255);	


	  while(!Obj_BeDeleted(objHalo)){
		  if(effect==1 && objscale<=2){
				ObjEffect_SetScale(objHalo,objscale,objscale);
				ObjEffect_SetAngle(objHalo,0,0,rotate);
				Obj_SetX(objHalo, GetEnemyX);
				Obj_SetY(objHalo, GetEnemyY);
				objscale+=0.05;
				rotate+=5;
				yield;
			}else{
				ObjEffect_SetScale(objHalo,scale,scale);
				ObjEffect_SetAngle(objHalo,0,0,rotate);
				Obj_SetX(objHalo, GetEnemyX);
				Obj_SetY(objHalo, GetEnemyY);
				yield;
				rotate+=5;
				scale = 1.95+0.20*sin(sinscale);
				sinscale+=5;
			}
		}
		}

	}

	task SubCreateFlame (r,v,b){
	
	  if(style == 1 || style == 3 || style == 5 ){
	  
	  }else{

	  let objHalo = Obj_Create(OBJ_EFFECT);

	  let ScaleY = flameY;
	  let Alpha = 160;


	  let CircleImage = CSD ~ systemdirectory ~ "Aura.png";
	  LoadGraphic(CircleImage); 

		  ObjEffect_SetLayer(objHalo,1);
		  ObjEffect_SetRenderState(objHalo,ADD);
		  ObjEffect_SetTexture(objHalo, CircleImage);
		  ObjEffect_SetPrimitiveType(objHalo, PRIMITIVE_TRIANGLEFAN);
		  ObjEffect_CreateVertex(objHalo, 4);

		  ObjEffect_SetVertexXY(objHalo, 0, -24,32);
		  ObjEffect_SetVertexXY(objHalo, 1, 24,32);
		  ObjEffect_SetVertexXY(objHalo, 2, 24,-32);
		  ObjEffect_SetVertexXY(objHalo, 3, -24,-32);

		  ObjEffect_SetVertexUV(objHalo, 0, 0, 0);
		  ObjEffect_SetVertexUV(objHalo, 1, 48, 0);
		  ObjEffect_SetVertexUV(objHalo, 2, 48, 64);
		  ObjEffect_SetVertexUV(objHalo, 3, 0, 64);
		  ObjEffect_SetAngle(objHalo, 0, 0, 180+rand(-15,15));
	 

	  	while(!Obj_BeDeleted(objHalo)){
		  Obj_SetX(objHalo, GetEnemyX);
		  Obj_SetY(objHalo, GetEnemyY-13);
		  ObjEffect_SetScale(objHalo, flameX,ScaleY);
		  ObjEffect_SetVertexColor(objHalo,0,Alpha,r+33,v+33,b+33);	
		  ObjEffect_SetVertexColor(objHalo,1,Alpha,r+66,v+66,b+66);		
		  ObjEffect_SetVertexColor(objHalo,2,Alpha,r+33,v+33,b+33);		
		  ObjEffect_SetVertexColor(objHalo,3,Alpha,r+66,v+66,b+66);
		 
		

		  ScaleY+=0.03+rand(0,0.01);
		  Alpha-=3+rand(-0.5,1);
		  yield;
		  if(Alpha <= 0){Obj_Delete(objHalo);}

		}
		
		}
	}

	task SubCreateOrigin (r,v,b){
	
		if(style == 1 || style == 3 || style == 5 ){
	  
	    }else{

		let objHalo = Obj_Create(OBJ_EFFECT);

		let Scale = originScale;
		let Alpha = 160;


		let CircleImage = CSD ~ systemdirectory ~ "Aura.png";
		LoadGraphic(CircleImage); 

		ObjEffect_SetLayer(objHalo,1);
		ObjEffect_SetRenderState(objHalo,ADD);
		ObjEffect_SetTexture(objHalo, CircleImage);
		ObjEffect_SetPrimitiveType(objHalo, PRIMITIVE_TRIANGLEFAN);
		ObjEffect_CreateVertex(objHalo, 4);

		ObjEffect_SetVertexXY(objHalo, 0, -24,32);
		ObjEffect_SetVertexXY(objHalo, 1, 24,32);
		ObjEffect_SetVertexXY(objHalo, 2, 24,-32);
		ObjEffect_SetVertexXY(objHalo, 3, -24,-32);

		ObjEffect_SetVertexUV(objHalo, 0, 48, 0);
		ObjEffect_SetVertexUV(objHalo, 1, 96, 0);
		ObjEffect_SetVertexUV(objHalo, 2, 96, 64);
		ObjEffect_SetVertexUV(objHalo, 3, 48, 64);
		ObjEffect_SetAngle(objHalo, 0, 0, rand(0,360));
	 

		while(!Obj_BeDeleted(objHalo)){
			Obj_SetX(objHalo, GetEnemyX);
			Obj_SetY(objHalo, GetEnemyY+16);
			ObjEffect_SetScale(objHalo, Scale,Scale);
			ObjEffect_SetVertexColor(objHalo,0,Alpha,r+66,v+66,b+66);	
			ObjEffect_SetVertexColor(objHalo,1,Alpha,r+33,v+33,b+33);		
			ObjEffect_SetVertexColor(objHalo,2,Alpha,r+66,v+66,b+66);		
			ObjEffect_SetVertexColor(objHalo,3,Alpha,r+33,v+33,b+33);
		
			Scale+=0.02;
			Alpha-=5+rand(-0.5,1);
			yield;
			if(Alpha <= 0){Obj_Delete(objHalo);}
		}
		
		}
	}
}


//Use this function for child enemies.

task CreateAura04(enemyID,color,style,effect,flameX,flameY,originScale){



	let FlareTime = 0;

	if(color=="RED"){
		SubHalo(192,0,0);
		SubAura;
		loop {
			yield;
			if(FlareTime == 4){
				SubCreateFlame(255,0,0);
				SubCreateFlame(255,0,0);
				SubCreateOrigin(255,0,0);
				SubCreateOrigin(255,0,0);
				FlareTime = 0;
			}
		FlareTime ++;
		yield;
		}
	}if(color=="ORANGE"){
		SubHalo(192,192,0);
		SubHalo(192,96,96);
		SubAura;
		loop {
			yield;
			if(FlareTime == 4){
				SubCreateFlame(255,92,0);
				SubCreateFlame(255,92,0);
				SubCreateOrigin(255,92,0);
				SubCreateOrigin(255,92,0);
				FlareTime = 0;
			}
		FlareTime ++;
		yield;
		}
	}if(color=="YELLOW"){
		SubHalo(255,192,0);
		SubAura;
		loop {
			yield;
			if(FlareTime == 4){
				SubCreateFlame(255,255,0);
				SubCreateFlame(255,255,0);
				SubCreateOrigin(255,255,0);
				SubCreateOrigin(255,255,0);
				FlareTime = 0;
			}
			FlareTime ++;
			yield;
		}
	}if(color=="CHARTREUSE"){
		SubHalo(192,192,0);
		SubHalo(96,192,96);
		SubAura;
		loop {
			yield;
			if(FlareTime == 4){
				SubCreateFlame(92,255,0);
				SubCreateFlame(92,255,0);
				SubCreateOrigin(92,255,0);
				SubCreateOrigin(92,255,0);
				FlareTime = 0;
			}
			FlareTime ++;
			yield;
		}
	}if(color=="GREEN"){
		SubHalo(0,192,0);
		SubAura;
		loop {
			yield;
			if(FlareTime == 4){
				SubCreateFlame(0,255,0);
				SubCreateFlame(0,255,0);
				SubCreateOrigin(0,255,0);
				SubCreateOrigin(0,255,0);
				FlareTime = 0;
			}
			FlareTime ++;
			yield;
		}
	}if(color=="SPRINGGREEN"){
		SubHalo(0,192,255);
		SubHalo(96,192,96);
		SubAura;
		loop {
			yield;
			if(FlareTime == 4){
				SubCreateFlame(0,255,92);
				SubCreateFlame(0,255,92);
				SubCreateOrigin(0,255,92);
				SubCreateOrigin(0,255,92);
				FlareTime = 0;
			}
			FlareTime ++;
			yield;
		}
	}if(color=="CYAN"){
		SubHalo(0,192,192);
		SubAura;
		loop {
			yield;
			if(FlareTime == 4){
				SubCreateFlame(0,255,255);
				SubCreateFlame(0,255,255);
				SubCreateOrigin(0,255,255);
				SubCreateOrigin(0,255,255);
				FlareTime = 0;
			}
			FlareTime ++;
			yield;
		}
	}if(color=="AZURE"){
		SubHalo(0,192,192);
		SubHalo(96,96,192);
		SubAura;
		loop {
			yield;
			if(FlareTime == 4){
				SubCreateFlame(0,92,255);
				SubCreateFlame(0,92,255);
				SubCreateOrigin(0,92,255);
				SubCreateOrigin(0,92,255);
				FlareTime = 0;
			}
			FlareTime ++;
			yield;
		}
	}if(color=="BLUE"){
		SubHalo(0,0,192);
		SubAura;
		loop {
			yield;
			if(FlareTime == 4){
				SubCreateFlame(0,0,255);
				SubCreateFlame(0,0,255);
				SubCreateOrigin(0,0,255);
				SubCreateOrigin(0,0,255);
				FlareTime = 0;
			}
			FlareTime ++;
			yield;
		}
	}if(color=="VIOLET"){
		SubHalo(192,0,192);
		SubHalo(96,192,96);
		SubAura;
		loop {
			yield;
			if(FlareTime == 4){
				SubCreateFlame(92,0,255);
				SubCreateFlame(92,0,255);
				SubCreateOrigin(92,0,255);
				SubCreateOrigin(92,0,255);
				FlareTime = 0;
			}
			FlareTime ++;
			yield;
		}
	}if(color=="MAGENTA"){
		SubHalo(192,0,96);
		SubAura;
		loop {
			yield;
			if(FlareTime == 4){
				SubCreateFlame(255,0,255);
				SubCreateFlame(255,0,255);
				SubCreateOrigin(255,0,255);
				SubCreateOrigin(255,0,255);
				FlareTime = 0;
			}
			FlareTime ++;
			yield;
		}
	}if(color=="ROSE"){
		SubHalo(192,0,96);
		SubHalo(192,160,96);
		SubAura;
		loop {
			yield;
			if(FlareTime == 4){
				SubCreateFlame(255,0,92);
				SubCreateFlame(255,0,92);
				SubCreateOrigin(255,0,92);
				SubCreateOrigin(255,0,92);
				FlareTime = 0;
			}
			FlareTime ++;
			yield;
		}
	}if(color=="GREY"){
		SubHalo(96,96,96);
		SubAura;
		loop {
			yield;
			if(FlareTime == 4){
				SubCreateFlame(128,128,128);
				SubCreateFlame(128,128,128);
				SubCreateOrigin(128,128,128);
				SubCreateOrigin(128,128,128);
				FlareTime = 0;
			}
			FlareTime ++;
			yield;
		}
	}if(color[0] == 'R' && color[1] == 'G' && color[2] == 'B' &&color[3] == '#' && length(color) == 13){
		let colorarray = [ToNumber(color[4])*100+ToNumber(color[5])*10+ToNumber(color[6]),ToNumber(color[7])*100+ToNumber(color[8])*10+ToNumber(color[9]),ToNumber(color[10])*100+ToNumber(color[11])*10+ToNumber(color[12])];
		SubHalo(colorarray[0]-(colorarray[0]*0.3),colorarray[1]-(colorarray[1]*0.3),colorarray[2]-(colorarray[2]*0.3));
		SubAura;
		loop {
			yield;
			if(FlareTime == 4){
				SubCreateFlame(colorarray[0],colorarray[1],colorarray[2]);
				SubCreateFlame(colorarray[0],colorarray[1],colorarray[2]);
				SubCreateOrigin(colorarray[0],colorarray[1],colorarray[2]);
				SubCreateOrigin(colorarray[0],colorarray[1],colorarray[2]);
				FlareTime = 0;
			}
			FlareTime ++;
			yield;
		}
	}else{
		SubHalo(192,0,0);
		SubAura;
		loop {
			yield;
			if(FlareTime == 4){
				SubCreateFlame(255,0,0);
				SubCreateFlame(255,0,0);
				SubCreateOrigin(255,0,0);
				SubCreateOrigin(255,0,0);
				FlareTime = 0;
			}
		FlareTime ++;
		yield;
		}
	}


	task SubHalo(r,v,b) {
	
		if(style == 2 || style == 3 || style == 6){
		
		}else{

		let objHalo = Obj_Create(OBJ_EFFECT);
		let objscale = 0;

		let HaloImage = CSD ~ systemdirectory ~ "Halo.png";
		LoadGraphic(HaloImage); 


		ObjEffect_SetLayer(objHalo,1);
		ObjEffect_SetRenderState(objHalo,SUBTRACT);
		ObjEffect_SetTexture(objHalo, HaloImage);
		ObjEffect_SetScale(objHalo,1.25,1.25);
		ObjEffect_SetPrimitiveType(objHalo, PRIMITIVE_TRIANGLEFAN);
		ObjEffect_CreateVertex(objHalo, 4);

		ObjEffect_SetVertexXY(objHalo, 0, -128, 128);
		ObjEffect_SetVertexXY(objHalo, 1, 128, 128);
		ObjEffect_SetVertexXY(objHalo, 2, 128, -128);
		ObjEffect_SetVertexXY(objHalo, 3, -128, -128);

		ObjEffect_SetVertexUV(objHalo, 0, 0, 0);
		ObjEffect_SetVertexUV(objHalo, 1, 256, 0);
		ObjEffect_SetVertexUV(objHalo, 2, 256, 256);
		ObjEffect_SetVertexUV(objHalo, 3, 0, 256);

		ObjEffect_SetVertexColor(objHalo,0,255,255-r,255-v,255-b);	
		ObjEffect_SetVertexColor(objHalo,1,255,255-r,255-v,255-b);
		ObjEffect_SetVertexColor(objHalo,2,255,255-r,255-v,255-b);
		ObjEffect_SetVertexColor(objHalo,3,255,255-r,255-v,255-b);


		while(!Obj_BeDeleted(objHalo)){
			if(effect==1 && objscale<1.25){
				ObjEffect_SetScale(objHalo,objscale,objscale);
				objscale+=0.025;
				yield;
			}
			Obj_SetX(objHalo, GetEnemyInfo(enemyID,ENEMY_X));
			Obj_SetY(objHalo, GetEnemyInfo(enemyID,ENEMY_Y));
		}
		}

	}



	task SubAura {
	
	  if(style == 4 || style == 5 || style == 6 ){
	  
	  }else{

	  let objHalo = Obj_Create(OBJ_EFFECT);
	  let objscale = 0;
	  let rotate = 0;
	  let sinscale = 0;
	  let scale = 0;

	  let CircleImage = CSD ~ systemdirectory ~ "MagicCircle.png";
	  LoadGraphic(CircleImage); 

	  ObjEffect_SetLayer(objHalo,1);
	  ObjEffect_SetRenderState(objHalo,ADD);
	  ObjEffect_SetTexture(objHalo, CircleImage);
	  ObjEffect_SetPrimitiveType(objHalo, PRIMITIVE_TRIANGLEFAN);
	  ObjEffect_CreateVertex(objHalo, 4);

	  ObjEffect_SetVertexXY(objHalo, 0, -64,64);
	  ObjEffect_SetVertexXY(objHalo, 1, 64,64);
	  ObjEffect_SetVertexXY(objHalo, 2, 64,-64);
	  ObjEffect_SetVertexXY(objHalo, 3, -64,-64);

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

	  ObjEffect_SetVertexColor(objHalo,0,160,255,255,255);	
	  ObjEffect_SetVertexColor(objHalo,1,160,255,255,255);	
	  ObjEffect_SetVertexColor(objHalo,2,160,255,255,255);	
	  ObjEffect_SetVertexColor(objHalo,3,160,255,255,255);	


	  while(!Obj_BeDeleted(objHalo)){
		  if(effect==1 && objscale<=2){
				ObjEffect_SetScale(objHalo,objscale,objscale);
				ObjEffect_SetAngle(objHalo,0,0,rotate);
				Obj_SetX(objHalo, GetEnemyInfo(enemyID,ENEMY_X));
				Obj_SetY(objHalo, GetEnemyInfo(enemyID,ENEMY_Y));
				objscale+=0.05;
				rotate+=5;
				yield;
			}else{
				ObjEffect_SetScale(objHalo,scale,scale);
				ObjEffect_SetAngle(objHalo,0,0,rotate);
				Obj_SetX(objHalo, GetEnemyInfo(enemyID,ENEMY_X));
				Obj_SetY(objHalo, GetEnemyInfo(enemyID,ENEMY_Y));
				yield;
				rotate+=5;
				scale = 1.95+0.20*sin(sinscale);
				sinscale+=5;
			}
		}
		}

	}

	task SubCreateFlame (r,v,b){
	
	  if(style == 1 || style == 3 || style == 5 ){
	  
	  }else{

	  let objHalo = Obj_Create(OBJ_EFFECT);

	  let ScaleY = flameY;
	  let Alpha = 160;


	  let CircleImage = CSD ~ systemdirectory ~ "Aura.png";
	  LoadGraphic(CircleImage); 

		  ObjEffect_SetLayer(objHalo,1);
		  ObjEffect_SetRenderState(objHalo,ADD);
		  ObjEffect_SetTexture(objHalo, CircleImage);
		  ObjEffect_SetPrimitiveType(objHalo, PRIMITIVE_TRIANGLEFAN);
		  ObjEffect_CreateVertex(objHalo, 4);

		  ObjEffect_SetVertexXY(objHalo, 0, -24,32);
		  ObjEffect_SetVertexXY(objHalo, 1, 24,32);
		  ObjEffect_SetVertexXY(objHalo, 2, 24,-32);
		  ObjEffect_SetVertexXY(objHalo, 3, -24,-32);

		  ObjEffect_SetVertexUV(objHalo, 0, 0, 0);
		  ObjEffect_SetVertexUV(objHalo, 1, 48, 0);
		  ObjEffect_SetVertexUV(objHalo, 2, 48, 64);
		  ObjEffect_SetVertexUV(objHalo, 3, 0, 64);
		  ObjEffect_SetAngle(objHalo, 0, 0, 180+rand(-15,15));
	 

	  while(!Obj_BeDeleted(objHalo)){
		  Obj_SetX(objHalo, GetEnemyInfo(enemyID,ENEMY_X));
		  Obj_SetY(objHalo, GetEnemyInfo(enemyID,ENEMY_Y)-13);
		  ObjEffect_SetScale(objHalo, flameX,ScaleY);
		  ObjEffect_SetVertexColor(objHalo,0,Alpha,r+33,v+33,b+33);	
		  ObjEffect_SetVertexColor(objHalo,1,Alpha,r+66,v+66,b+66);		
		  ObjEffect_SetVertexColor(objHalo,2,Alpha,r+33,v+33,b+33);		
		  ObjEffect_SetVertexColor(objHalo,3,Alpha,r+66,v+66,b+66);
		 
		

		  ScaleY+=0.03+rand(0,0.01);
		  Alpha-=3+rand(-0.5,1);
		  yield;
		  if(Alpha <= 0){Obj_Delete(objHalo);}

		}
		
		}
	}

	task SubCreateOrigin (r,v,b){
	
		if(style == 1 || style == 3 || style == 5 ){
	  
	    }else{

		let objHalo = Obj_Create(OBJ_EFFECT);

		let Scale = originScale;
		let Alpha = 160;


		let CircleImage = CSD ~ systemdirectory ~ "Aura.png";
		LoadGraphic(CircleImage); 

		ObjEffect_SetLayer(objHalo,1);
		ObjEffect_SetRenderState(objHalo,ADD);
		ObjEffect_SetTexture(objHalo, CircleImage);
		ObjEffect_SetPrimitiveType(objHalo, PRIMITIVE_TRIANGLEFAN);
		ObjEffect_CreateVertex(objHalo, 4);

		ObjEffect_SetVertexXY(objHalo, 0, -24,32);
		ObjEffect_SetVertexXY(objHalo, 1, 24,32);
		ObjEffect_SetVertexXY(objHalo, 2, 24,-32);
		ObjEffect_SetVertexXY(objHalo, 3, -24,-32);

		ObjEffect_SetVertexUV(objHalo, 0, 48, 0);
		ObjEffect_SetVertexUV(objHalo, 1, 96, 0);
		ObjEffect_SetVertexUV(objHalo, 2, 96, 64);
		ObjEffect_SetVertexUV(objHalo, 3, 48, 64);
		ObjEffect_SetAngle(objHalo, 0, 0, rand(0,360));
	 

		while(!Obj_BeDeleted(objHalo)){
			Obj_SetX(objHalo, GetEnemyInfo(enemyID,ENEMY_X));
			Obj_SetY(objHalo, GetEnemyInfo(enemyID,ENEMY_Y)+16);
			ObjEffect_SetScale(objHalo, Scale,Scale);
			ObjEffect_SetVertexColor(objHalo,0,Alpha,r+66,v+66,b+66);	
			ObjEffect_SetVertexColor(objHalo,1,Alpha,r+33,v+33,b+33);		
			ObjEffect_SetVertexColor(objHalo,2,Alpha,r+66,v+66,b+66);		
			ObjEffect_SetVertexColor(objHalo,3,Alpha,r+33,v+33,b+33);
		
			Scale+=0.02;
			Alpha-=5+rand(-0.5,1);
			yield;
			if(Alpha <= 0){Obj_Delete(objHalo);}
		}
		
		}
	}
}

//Don't delete this function. It needs for custom color.
function ToNumber(number){ 
    let str = 0;	
	alternative(number)
			case('1'){
				str = 1;
		
			}
			case('2'){
				str = 2;
		
			}
			case('3'){
				str = 3;
		
			}
			case('4'){
				str = 4;
		
			}
			case('5'){
				str = 5;
		
			}
			case('6'){
				str = 6;
		
			}
			case('7'){
				str = 7;
		
			}
			case('8'){
				str = 8;
		
			}
			case('9'){
				str = 9;
		
			}
			case('0'){
				str = 0;
		
			}
			others {
				str = -1;
			}

    return str;
}