
#ScriptVersion[3]
#Title["NonSpell4"]
#Text["NonSpell4"]
#Background["./BG.txt"]
#Player[DEFAULT]
#System["./system/Default_System2.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 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(2500);
	}
	case(EV_REQUEST_TIMER)
	{
		SetScriptResult(60);
	}
}

//----------------------------------------------------
task mainTask{
	DamageRateAtFrame(100,50,180);
	magiccircle(objBoss,0.8,true);
	yield;
	ObjMove_SetDestAtWeight(objBoss,stgx,120,10,7.5);
	wait(105);
	TShot1;
	}
//----------------------------------------------------

task TShot1{
	let s = 1;
	let way = 1;
	let r = 120;
	let angle = 0;
	let dir = 0;
	let c = 0;
	maple(2);
	ReverseAng;
	wait(60);
	while(!Obj_IsDeleted(objBoss)){
		PlaySound("Shot1",92,0);
		PlaySound("BulletWave",90,45);
		ascent(i in 0..36){
			dir = i*10;
			let shot = ShotA2(GetEnemyX+r*cos(dir),GetEnemyY+r*sin(dir),1.25,dir,-0.01,0,203,0,8);
			DelayShot3(shot,234,0.75,92,2.5,0,12,45);
			ObjMove_AddPatternA2(shot,45,NO_CHANGE,NO_CHANGE,0.03,sin(c*11)*1.15,2.5);
			ObjMove_AddPatternA2(shot,75,NO_CHANGE,NO_CHANGE,0.03,0,3.25);
		}
		if(r>0){r-=4;}
		wait(11);
		c++;
		PlaySound("Shot1",92,0);
		PlaySound("BulletWave",90,45);
		ascent(i in 0..36){
			dir = i*10;
			let shot = ShotA2(GetEnemyX+r*cos(dir),GetEnemyY+r*sin(dir),1.25,dir,-0.01,0,205,0,8);
			DelayShot3(shot,235,0.75,94,2.5,0,12,45);
			ObjMove_AddPatternA2(shot,45,NO_CHANGE,NO_CHANGE,0.03,sin(c*11)*1.15,2.5);
			ObjMove_AddPatternA2(shot,75,NO_CHANGE,NO_CHANGE,0.03,0,3.25);
		}
		if(r>0){r-=4;}
		wait(11);
		c++;
	}
	}

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

task TRender
{
	DrawBoss;
}

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

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