
#ScriptVersion[3]
#Title["NonSpellN"]
#Text["NonSpellN"]
#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);
ObjMove_SetPosition(objBoss,stgx,-150);
}

@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(2225);
	}
	case(EV_REQUEST_TIMER)
	{
		SetScriptResult(60);
	}
}

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

task TShot1{
	let s = 1;
	while(!Obj_IsDeleted(objBoss)){
	maple(2);
	ReverseAng;
	wait(60);
		descent(n in 2..16){
			PlaySound("Shot1",95,0);
			PlaySound("BulletWave",95,45);
			PlaySound("Eff6",85,100);
			ascent(i in 0..20){
			let dir = i*18+n*2.5*s;
			let shot = ShotA2(GetEnemyX+n*10*cos(dir),GetEnemyY+n*10*sin(dir),1.5,dir,-0.01,0,202,0,12);
			DelayShot(shot,92,3,64,12,45);
			ObjMove_AddPatternA2(shot,45,NO_CHANGE,NO_CHANGE,0.0325,0,5);
			DelayShot2(shot,76,202,2.5,0,12,100);
			ObjMove_AddPatternA2(shot,100,NO_CHANGE,NO_CHANGE,-0.04,0,0.75);
			}
			wait(2+n%2);
		}
		descent(n in 2..16){
			PlaySound("Shot1",95,0);
			PlaySound("BulletWave",95,45);
			PlaySound("Eff6",85,100);
			ascent(i in 0..20){
			let dir = i*18-n*1.75*s;
			let shot = ShotA2(GetEnemyX+n*10*cos(dir),GetEnemyY+n*10*sin(dir),1,dir,-0.01,0,205,0,12);
			DelayShot(shot,94,3,64,12,45);
			ObjMove_AddPatternA2(shot,45,NO_CHANGE,NO_CHANGE,0.0225,0,5);
			DelayShot2(shot,78,205,2.5,0,12,100);
			ObjMove_AddPatternA2(shot,100,NO_CHANGE,NO_CHANGE,-0.03,0,0.75);
			}
			wait(2+n%2);
		}
		wait(75);
		TMovement(50,5,2);
		wait(75);
		s = -s;
		}
}

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

task TRender
{
	DrawBoss;
}

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

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