
#ScriptVersion[3]
#Title["S1L"]
#Text["S1L"]
#Player[DEFAULT]
#System["./system/Default_System.txt"]
#include"./Functions/Index.txt"
#include"./SetBoss.txt"
#include"./Shot/ZUNShot_Const.txt"
#include"./system/Default_Effect.Txt"


let objBoss;
let GCSD=GetCurrentScriptDirectory~"";
let enemy;
let bSpell=false;
let stgx=GetStgFrameWidth()/2;
let stgy=GetStgFrameHeight()/2;
let idle = true;
let atk = false;
let fog = 0;
let objScene=GetEnemyBossSceneObjectID();
let arr = [1,6,4,2,3,5,0];
@Initialize
{
SetBoss(false);
}

@MainLoop
{
	ObjEnemy_SetIntersectionCircleToPlayer(objBoss,ObjMove_GetX(objBoss),ObjMove_GetY(objBoss),25);
	ObjEnemy_SetIntersectionCircleToShot(objBoss,ObjMove_GetX(objBoss),ObjMove_GetY(objBoss),26);
	yield;

}

@Event
{
	alternative(GetEventType())
	case(EV_REQUEST_LIFE)
	{
		SetScriptResult(3000);
	}
	case(EV_REQUEST_TIMER)
	{
		SetScriptResult(60);
	}
}

//----------------------------------------------------
task mainTask{
	ObjMove_SetPosition(objBoss,stgx*2,-120);
	DamageRateAtFrame(100,50,120);
	magiccircle(objBoss,0.8,true);
	ObjMove_SetDestAtWeight(objBoss,stgx,140,10,7);
	wait(90);
	TShot1;
	}
//----------------------------------------------------

task TShot1{
	while(!Obj_IsDeleted(objBoss)){
	maple(2);
	wait(60);
		ascent(n in 0..24){
		PlaySound("Laser2",95,0);
		let shot = CurvyLaser(GetEnemyX,GetEnemyY,6,90-n*15,5,30,503,0);
		ObjMove_AddPatternA2(shot,0,NO_CHANGE,NO_CHANGE,-6/60,3,1);
		ObjMove_AddPatternA2(shot,60,NO_CHANGE,NO_CHANGE,2/60,0.5,6);
		}
		wait(45);
		ascent(n in 0..24){
		PlaySound("Laser2",95,0);
		let shot = CurvyLaser(GetEnemyX,GetEnemyY,6,270-n*15,5,30,502,0);
		ObjMove_AddPatternA2(shot,0,NO_CHANGE,NO_CHANGE,-6/60,-3,1);
		ObjMove_AddPatternA2(shot,60,NO_CHANGE,NO_CHANGE,2/60,-0.5,6);
		}
		wait(45);
		ascent(n in -9..10){
		PlaySound("Laser2",95,0);
		let shot = CurvyLaser(GetEnemyX,GetEnemyY,6,270+n*15,5,30,502,0);
		ObjMove_AddPatternA2(shot,0,NO_CHANGE,NO_CHANGE,-6/60,-3,1);
		ObjMove_AddPatternA2(shot,60,NO_CHANGE,NO_CHANGE,2/60,-0.5,6);
		}
		ascent(n in -9..10){
		PlaySound("Laser2",95,0);
		let shot = CurvyLaser(GetEnemyX,GetEnemyY,6,270+n*15,5,30,503,0);
		ObjMove_AddPatternA2(shot,0,NO_CHANGE,NO_CHANGE,-6/60,3,1);
		ObjMove_AddPatternA2(shot,60,NO_CHANGE,NO_CHANGE,2/60,0.5,6);
		}
		wait(75);
		PlaySound("BulletWave",95,0);
		ascent(i in 0..30){
		ShotOA1(objBoss,2.5,i*12+angleToPlayer,302,0,12);
		}
		wait(60);
		TAccel(35,5,0.1,60);
		wait(60);
		}
	}

//----------------------------------------------------

task TRender
{
	DrawBoss;
}

//----------------------------------------------------

task TEnd{
	while(ObjEnemy_GetInfo(objBoss,INFO_LIFE)>0){yield;}
		EndBoss(0);
		yield;
		CloseScript(GetOwnScriptID());
	}