task FlameAura(tobj,color,scale){	
	let angle = rand(0,360);
	
	while(!Obj_IsDeleted(tobj)){
		flame(tobj,color,scale);
		flamebase(tobj,color,scale,angle);
		angle+=rand(45,90);
		wait(10);}
}

task flame(tobj,color,scale){
	let frame = 0;
	let obj = ObjPrim_Create(OBJ_SPRITE_2D);
	let Xscale = scale/2;
	let Yscale = scale/6;
	let trans = 255;
	
	ObjPrim_SetTexture(obj, GetCurrentScriptDirectory~"./img/Aura.png");
	ObjSprite2D_SetSourceRect(obj,0, 0, 48, 64);
	ObjRender_SetScaleXYZ(obj,Xscale,Yscale,1);
	Obj_SetRenderPriorityI(obj,23);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetBlendType(obj,BLEND_ADD_ARGB);
	ObjRender_SetPosition(obj,ObjMove_GetX(tobj),ObjMove_GetY(tobj),0);
	ObjRender_SetAngleXYZ(obj,0,0,rand(-5,5));
	ObjRender_SetColor(obj,color[0],color[1],color[2]);
	loop(30){
		ObjRender_SetScaleXYZ(obj,Xscale,Yscale,1);
		ObjRender_SetAlpha(obj,trans);
		ObjRender_SetPosition(obj,ObjMove_GetX(tobj),ObjMove_GetY(tobj),0);
		trans-=255/30;
		Xscale+=(scale/4)/30;
		Yscale+=(scale*2)/30;
		yield;
	}
	Obj_Delete(obj);
}

task flamebase(tobj,color,scale,angle){
	let frame = 0;
	let obj = ObjPrim_Create(OBJ_SPRITE_2D);
	let Xscale = scale/6;
	let Yscale = scale/6;
	let trans = 255;
	
	ObjPrim_SetTexture(obj, GetCurrentScriptDirectory~"./img/Aura.png");
	ObjSprite2D_SetSourceRect(obj,48, 0, 96, 48);
	ObjRender_SetScaleXYZ(obj,Xscale,Yscale,1);
	Obj_SetRenderPriorityI(obj,23);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetBlendType(obj,BLEND_ADD_ARGB);
	ObjRender_SetPosition(obj,ObjMove_GetX(tobj),ObjMove_GetY(tobj),0);
	ObjRender_SetAngleXYZ(obj,0,0,angle);
	ObjRender_SetColor(obj,color[0],color[1],color[2]);
	loop(30){
		ObjRender_SetScaleXYZ(obj,Xscale,Yscale,1);
		ObjRender_SetAlpha(obj,trans);
		ObjRender_SetPosition(obj,ObjMove_GetX(tobj),ObjMove_GetY(tobj)+20,0);
		trans-=255/30;
		Xscale+=scale*1.1/30;
		Yscale+=scale*1.1/30;
		yield;
	}
	Obj_Delete(obj);
}

task DamageReduction(tar, spell){
ObjEnemy_SetDamageRate(tar, 0, 0);
if(spell == 0){wait(60);}
if(spell == 1){wait(180);}
ObjEnemy_SetDamageRate(tar, 90, 60);
}