task cutin(spellcardname,cutinImg,left,top,right,bottom) {
	yield;
	let obj = Obj_Create(OBJ_EFFECT);
	let alphret = 0;
	let as = 0;
	let c = 0;
	let x = 0;
	let y = 0;
    	let XYbLR = left + right / 2;
    	let XYbTB = top + bottom / 2;
	x = GetClipMaxX+256; y = GetCenterY-120;
	PlaySE2("se_boss_cardcall");
    	SetText(spellcardname);
	summontext;
	summonhexagon;
	Obj_SetPosition(obj,x,y);
	ObjEffect_SetRenderState(obj,ALPHA);
	ObjEffect_SetTexture(obj,cutinImg);
	ObjEffect_SetLayer(obj,1);
	cutinEffect_Alphret(obj,as,alphret);
	ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLESTRIP);
	ObjEffect_CreateVertex(obj, 4);
	ObjEffect_SetVertexXY(obj, 0, -XYbLR, -XYbTB);
	ObjEffect_SetVertexUV(obj, 0, left, top);
	ObjEffect_SetVertexXY(obj, 1, XYbLR, -XYbTB);
	ObjEffect_SetVertexUV(obj, 1, right, top);
	ObjEffect_SetVertexXY(obj, 2, -XYbLR, XYbTB);
	ObjEffect_SetVertexUV(obj, 2, left, bottom);
	ObjEffect_SetVertexXY(obj, 3, XYbLR, XYbTB);
	ObjEffect_SetVertexUV(obj, 3, right, bottom);
	while(!Obj_BeDeleted(obj)){
		if(c<21){x-=20; y+=5}
		if(c>=21 && c<100){x--; y+=0.5;}
		if(c>=100){x-=20; y+=5;}
		if(c>120){ Obj_Delete(obj); }
		Obj_SetPosition(obj,x,y);
		c++;
		yield;
	}
}

task cutinEffect_Alphret(obj,as,alphret) {
	let c = 0;
	loop {
	  	ObjEffect_SetVertexColor(obj,0,alphret,255,255,255);
	 	ObjEffect_SetVertexColor(obj,1,alphret,255,255,255);
	  	ObjEffect_SetVertexColor(obj,2,alphret,255,255,255);
	  	ObjEffect_SetVertexColor(obj,3,alphret,255,255,255);
		if(as==0){alphret+=20; if(alphret>250){as=1;} }
		if(as==1){c++; if(c==90){ as=2; } }
		if(as==2){alphret-=10; if(alphret<10){as=4;} }	
		yield;
	}
}
    
task summontext {
	let yyPos = 0;
	loop(5){
		spellcardtext(GetClipMinX,GetClipMaxY-22-yyPos,1.5);
		spellcardtext(GetClipMaxX,GetClipMinY-30+yyPos,-1.5);
		yyPos+=54;
		yield;
	}
} 

task summonhexagon {
	let dir = 0;
	loop(8){
		hexagontext(GetCenterX+100,GetCenterY+150,1.5,dir,1.4,1.4);
		hexagontext(GetCenterX+100,GetCenterY+150,1.5,dir,1.2,1.2);
		hexagontext(GetCenterX+100,GetCenterY+150,-1.5,-dir,1.0,1.0);
		hexagontext(80,100,1.5,dir,0.8,0.8);
		dir+=45;
		yield;
	}
}

task hexagontext(x,y,v,draai,sx,sy) {
	let obj = Obj_Create(OBJ_EFFECT);
	let alphret = 0;
	let as = 0;
        let c = 0;
	let angle = draai;
	let speed = v;

	Obj_SetPosition(obj,x,y);	
	ObjEffect_SetRenderState(obj,ADD);
	ObjEffect_SetTexture(obj,imgSpellCardAttack);
        ObjEffect_SetScale(obj, sx, sy);
	ObjEffect_SetLayer(obj,2);

	ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLESTRIP);
	ObjEffect_CreateVertex(obj, 4);

	ObjEffect_SetVertexXY(obj, 0, -48, -128);
	ObjEffect_SetVertexUV(obj, 0, 0, 0);
	ObjEffect_SetVertexXY(obj, 1, 48, -128);
	ObjEffect_SetVertexUV(obj, 1, 128, 0);
	ObjEffect_SetVertexXY(obj, 2, -48, -104);
	ObjEffect_SetVertexUV(obj, 2, 0, 32);
	ObjEffect_SetVertexXY(obj, 3, 48, -104);
	ObjEffect_SetVertexUV(obj, 3, 128, 32);

	while(!Obj_BeDeleted(obj)) {
		ObjEffect_SetAngle(obj,0,0,angle);
	  	ObjEffect_SetVertexColor(obj,0,alphret,255,255,255);
	 	ObjEffect_SetVertexColor(obj,1,alphret,255,255,255);
	  	ObjEffect_SetVertexColor(obj,2,alphret,255,255,255);
	  	ObjEffect_SetVertexColor(obj,3,alphret,255,255,255);

		if(as==0){alphret+=20; if(alphret>185){as=1;} }
		if(as==1){c++; if(c==90){as=2;} }		
		if(as==2){alphret-=10; if(alphret<0){ Obj_Delete(obj); } }
		angle += speed;

		yield;
	}
}

task spellcardtext(x,y,v) {
	let obj = Obj_Create(OBJ_EFFECT);
	let alphret = 0;
	let as = 0;
        let c = 0;
	
	Obj_SetPosition(obj,x,y);
	Obj_SetSpeed(obj,v);
	Obj_SetAngle(obj,-35);
	ObjEffect_SetAngle(obj,0,0,-35);
	ObjEffect_SetRenderState(obj,ADD);
	ObjEffect_SetTexture(obj,imgSpellCardAttack);
	ObjEffect_SetLayer(obj,2);

	ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLESTRIP);
	ObjEffect_CreateVertex(obj, 4);
	ObjEffect_SetVertexXY(obj, 0, -1024, -16);
	ObjEffect_SetVertexUV(obj, 0, 0, 0);
	ObjEffect_SetVertexXY(obj, 1, 1024, -16);
	ObjEffect_SetVertexUV(obj, 1, 2048, 0);
	ObjEffect_SetVertexXY(obj, 2, -1024, 16);
	ObjEffect_SetVertexUV(obj, 2, 0, 32);
	ObjEffect_SetVertexXY(obj, 3, 1024, 16);
	ObjEffect_SetVertexUV(obj, 3, 2048, 32);

	while(!Obj_BeDeleted(obj)) {
	  	ObjEffect_SetVertexColor(obj,0,alphret,255,255,255);
	 	ObjEffect_SetVertexColor(obj,1,alphret,255,255,255);
	  	ObjEffect_SetVertexColor(obj,2,alphret,255,255,255);
	  	ObjEffect_SetVertexColor(obj,3,alphret,255,255,255);
		if(as==0){alphret+=20; if(alphret>185){as=1;} }
		if(as==1){c++; if(c==90){as=2;} }		
		if(as==2){alphret-=10; if(alphret<0){ Obj_Delete(obj); } }
		yield;
	}
}