let ang = 0;
	
task SetBoss(tspell){
	if(GetCommonData("ItemStart",0)==0){StartItemScript(GCSD ~"Item.txt");}
	SetCommonData("IsSpell",tspell);
	SetCommonData("Bomb",0);
	SetCommonData("Life",0);
	SetCommonData("Fight",1);
	SetCommonData("Score",0);
	SetCommonData("shot",0);
	SetCommonData("bomb",0);
	SetCommonData("Difficulty","Extra");
	SetShotAutoDeleteClip(64,64,64,64);
	LoadTexture(GCSD~"Shot/ZUNShot.png");
	LoadTexture(GCSD~"system/img/front01.png");
	LoadTexture(GCSD~"system/img/front00.png");
	LoadTexture(GCSD~"img/Dot.png");
	LoadTexture(GCSD~"img/Cutin.png");
	objBoss = ObjEnemy_Create(OBJ_ENEMY_BOSS);
	ObjEnemy_Regist(objBoss);
	ObjEnemy_SetDamageRate(objBoss,0,0);
	mainTask;
	TRender;
	TEnd;
	DrawAll;
	if(tspell==true){
	SetCommonData("Score",40);
	BombShield;
	}
	SetAutoDeleteObject(true);
	yield;
	SetAutoDeleteObject(false);
	}
	
task BombShield{
		while(!Obj_IsDeleted(objBoss)){
			if(IsPlayerSpellActive){ObjEnemy_SetDamageRate(objBoss, 0,0);}
			else{ObjEnemy_SetDamageRate(objBoss, GetCommonData("shot",0),GetCommonData("bomb",0));}
			yield;
		}
	}

task EndBoss(let type){
		let dis = 0;
		DeleteCommonData("End");
		SetCommonData("End",type);
		SetCommonData("BossX",GetEnemyX);
		SetCommonData("BossY",GetEnemyY);
		let px = GetEnemyX;
		let py = GetEnemyY;
		Obj_Delete(objBoss);
			if(type==1){
			if(ObjEnemyBossScene_GetInfo(objScene, INFO_PLAYER_SHOOTDOWN_COUNT) +ObjEnemyBossScene_GetInfo(objScene, INFO_PLAYER_SPELL_COUNT) == 0)
			{
				SetCommonData("Piece",GetCommonData("Piece",0)+1);
				if(GetCommonData("Piece",0)==4){
				SetPlayerLife(GetPlayerLife+1);
				SetCommonData("Piece",0);
				PlaySound("extend",100,0);
				}
			AddScore(ObjEnemyBossScene_GetInfo(objScene,INFO_SPELL_SCORE));
			}
			else{
			PlaySound("Shot2",95,0);
			}
			}
		}
		
task ClearBullet(type){
		let dis = 0;
		let px = GetEnemyX;
		let py = GetEnemyY;
		loop(60-type*58){
		let arr = GetShotIdInCircleA2(stgx,stgy,1000,TARGET_ENEMY);
		ascent(i in 0..length(arr)){
			if(!Obj_IsDeleted(arr[i]) && GetDistance(ObjMove_GetX(arr[i]),ObjMove_GetY(arr[i]),px,py) <dis){
			DeleteShotInCircle(TYPE_ALL,TYPE_ITEM,px,py,dis);
			}
		}
		if(type==0){dis += 20;}
		else{dis += 500;}
		yield;
			}
	}

task DrawBoss{
	let imgMiko = GetCurrentScriptDirectory~"img/boss.png";
	let f = 0;
	let t = 0;
	let px = 128;
	let py = 128;
	let c = 0;
	ObjPrim_SetTexture(objBoss, imgMiko);
	ObjRender_SetScaleXYZ(objBoss,1.1,1.1,1);
	while(!Obj_IsDeleted(objBoss))
	{
		let angle = ObjMove_GetAngle(objBoss);
		let speed = ObjMove_GetSpeed(objBoss);
		if(speed>0 && idle == true){MarisaTail(objBoss,0,0,128,128,ang);}
		if(speed <= 0 && idle == true && atk == false){
		ObjRender_SetAngleY(objBoss,180);
		if(f<8){SetImageAndTail(objBoss, px*0, 0, px*1, 128,ang);
		}
		if(f>=8 && f<16){SetImageAndTail(objBoss, px*1, 0, px*2, 128,ang);
		}
		if(f>=16 && f<24){SetImageAndTail(objBoss, px*2, 0, px*3, 128,ang);
		}
		if(f>=24 && f<32){SetImageAndTail(objBoss, px*3, 0, px*4, 128,ang);
		}
		if(f>=32){f=0;}
		f++;
		c++;
		ObjRender_SetY(objBoss,ObjMove_GetY(objBoss)+0.1*sin(c*5));
		t = 0;
		}
		else if(cos(angle) > 0 || cos(angle) < 0 && t == 0){
		idle = false;
		if(cos(angle)>0){ang=180;}
		else{ang=0;}
		manageSprite(ang);
		t = 1;
		}
		ObjSprite2D_SetDestCenter(objBoss);
		if(ang==180){ObjRender_SetAngleY(objBoss,0);}
		if(ang==0){ObjRender_SetAngleY(objBoss,0);}
		yield;
	}
}