task TExplosionA(x, y, z, dAlpha, dScale, dScale2){
	let path = "";
	let obj = ObjPrim_Create(OBJ_SPRITE_2D);
	ObjPrim_SetTexture(obj, "");
	Obj_SetRenderPriority(obj, 0.65);
	ObjRender_SetBlendType(obj, BLEND_ADD_RGB);
	ObjSprite2D_SetSourceRect(obj, 1, 1, 63, 63);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetPosition(obj, x, y, 0);
	ObjRender_SetAngleZ(obj ,z);

	let scale = 0;
	let scale2 = 0;
	let alpha = 255;
	while(alpha > 0){
		ObjRender_SetColor(obj,alpha,alpha,alpha);
		ObjRender_SetScaleXYZ(obj, scale, scale2, 1);

		scale2 += dScale2;
		scale += dScale;
		alpha -= dAlpha;
		yield;}
	Obj_Delete(obj);}

task TExplosionB(x,y,color){
	let obj = ObjPrim_Create(OBJ_SPRITE_2D);
	ObjPrim_SetTexture(obj, "");
	Obj_SetRenderPriority(obj,0.65);
	ObjRender_SetBlendType(obj, BLEND_ADD_ARGB);
	if(color == "RED"){ObjSprite2D_SetSourceRect(obj,128,15,192,80);}
	if(color == "BLUE"){ObjSprite2D_SetSourceRect(obj,192,15,256,80);}
	if(color == "YELLOW"){ObjSprite2D_SetSourceRect(obj,0,80,64,144);}
	if(color == "GREEN"){ObjSprite2D_SetSourceRect(obj,64,80,128,144);}
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetPosition(obj,x,y,0);
	ObjRender_SetAngleZ(obj,rand(0,360));

	let scale1 = 0;
	let scale2 = 0;
	let dScale1 = 0.3;
	let dScale2 = 0.1;
	let alpha = 255;
	while(alpha > 0){
		ObjRender_SetAlpha(obj,alpha);
		ObjRender_SetScaleXYZ(obj,scale1,scale2,1);
		scale1+=dScale1;
		scale2+=dScale2;
		dScale1-=0.01;
		dScale2-=0.005;
		alpha-=10;
		yield;}
	Obj_Delete(obj);}

task TEtama{
	let obj = ObjPrim_Create(OBJ_SPRITE_2D);
	ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./../resource/img/spellcircle.png");
	Obj_SetRenderPriorityI(obj,29);
	ObjSprite2D_SetSourceRect(obj,0,0,256,256);
	ObjSprite2D_SetDestCenter(obj);
	let ro = 0;
	let zah = 4;
	let mov = 0;
	let fern = 0;
	let scale = 0;
	loop(45){
		ObjRender_SetScaleXYZ(obj,scale,scale,0);
		ObjRender_SetPosition(obj,ObjMove_GetX(bossObj),ObjMove_GetY(bossObj),0);
		ObjRender_SetAngleZ(obj,ro);
		ro+=8; scale+=1/45; yield;}
	loop(60){
		ObjRender_SetPosition(obj,ObjMove_GetX(bossObj),ObjMove_GetY(bossObj),0);
		ObjRender_SetAngleZ(obj,ro);
		ro+=zah; zah-=7/60; yield;}
		let num = ObjRender_GetScaleX(obj);
		while(ObjEnemy_GetInfo(bossObj,INFO_LIFE) > 0){
			ObjRender_SetScaleXYZ(obj,num-fern*cos(scale),num-fern*cos(scale),0);
			ObjRender_SetPosition(obj,ObjMove_GetX(bossObj),ObjMove_GetY(bossObj),0);
			ObjRender_SetAngleZ(obj,ro);
			ObjRender_SetAngleX(obj,-30*sin(mov/2));
			ObjRender_SetAngleY(obj,-30*sin(mov));
				if(fern >= 0.1){fern=0.1;}
			mov+=1; ro+=zah; scale+=1; fern+=0.001;
			yield;}
		Obj_Delete(obj);}

task BossAura(obj,r,g,b,r2,g2,b2){
	while(ObjEnemy_GetInfo(bossObj,INFO_LIFE) > 0){
		FireAura();
		MainAura();
	loop(15){yield;}}
	
	task FireAura(){ let alpha = 255;
		let x = 24;let y = 24;
		let aura = ObjPrim_Create(OBJ_SPRITE_2D);
		ObjPrim_SetTexture(aura,GetCurrentScriptDirectory ~ "./../resource/img/aura.png");
		Obj_SetRenderPriorityI(aura,30);
		ObjSprite2D_SetSourceRect(aura,0,0,48,48);
		ObjRender_SetAngleXYZ(aura,0,0,rand(-25,25));
		ObjRender_SetBlendType(aura,BLEND_ADD_ARGB);
		loop(45){
			if(ObjEnemy_GetInfo(bossObj,INFO_LIFE) <= 0){break;}
			ObjSprite2D_SetDestRect(aura,-15-x,-24-y,15+x,24);
			ObjRender_SetPosition(aura,ObjMove_GetX(obj),ObjMove_GetY(obj),0);
			ObjRender_SetAlpha(aura,alpha);
			ObjRender_SetColor(aura,r,g,b);
			alpha-=255/45;y+=1.5;x+=0.2;yield;}
		Obj_Delete(aura);}

	task MainAura(){ let alpha = 255;let s = 1;
		let size = 0;let z = rand(0,180)*2;
		let rad = rand(-2,2);
		let aura = ObjPrim_Create(OBJ_SPRITE_2D);
		ObjPrim_SetTexture(aura,GetCurrentScriptDirectory ~ "./../resource/img/aura.png");
		Obj_SetRenderPriorityI(aura,31);
		ObjSprite2D_SetSourceRect(aura,48,0,96,48);
		ObjSprite2D_SetDestCenter(aura);
		ObjRender_SetBlendType(aura,BLEND_ADD_ARGB);
		loop(45){
			if(ObjEnemy_GetInfo(bossObj,INFO_LIFE) <= 0){break;}
			ObjRender_SetPosition(aura,ObjMove_GetX(obj),ObjMove_GetY(obj),0);
			ObjRender_SetScaleXYZ(aura,2.5+1.2*sin(s),2.5+1.2*sin(s),0);
			ObjRender_SetAngleXYZ(aura,0,0,z);
			ObjRender_SetColor(aura,r2,g2,b2);
			ObjRender_SetAlpha(aura,alpha);
			alpha-=255/50;s+=4;z+=rad;yield;}
		Obj_Delete(aura);}}