
#ScriptVersion[3]
#Title["N1"]
#Text["Easy"]
#Background["./BG.txt"]
#Player[DEFAULT]
#System["./system/Default_System.txt"]
#include"./Functions/Index.txt"
#include"./SetMidBoss.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(true);
}

@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);
	}
		case(EV_REQUEST_SPELL_SCORE)
	{
		SetScriptResult(3000000);
	}
}

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

task TShot1{
		maple(3);
		wait(90);
		while(!Obj_IsDeleted(objBoss)){
			Action(0);
			wait(15);
			descent(n in 1..4){
			if(n==2){Action(45);}
			Rod(-1,1);
			Rod(-1,-1);
			wait(n*12);
			}
			wait(30);
			TMovement(35,5,5);
			wait(30);
		}
	}
	
task Rod(w,way){
	let px = GetEnemyX+rand(-10,10);
	let py = GetEnemyY;
	let v = 0;
	let s = 1;
	let start = 0;
	if(way==-1){start=1;}
	ascent(n in start..10){
		PlaySound("BulletWave",95,0);
		let shot = ShotA2(px,py,1.5+n/6,90,0.02,5,46,235,12);
		ObjMove_AddPatternA2(shot,55,NO_CHANGE,NO_CHANGE,-0.05,0,0.75);
		shot = ShotA2(px,py,1.5+n/6,270,0.02,5,46,235,12);
		ObjMove_AddPatternA2(shot,55,NO_CHANGE,NO_CHANGE,-0.05,0,0.75);
		px += 25*way;
		py = GetEnemyY+(20+n)*s+rand(-3,3);
		s = -s;
		wait(3);
	}
}

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

task TRender
{
	DrawBoss;
}

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

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