
#ScriptVersion[3]
#Title["NonSpell"]
#Text["NonSpell"]
#Background["./BG.txt"]
#Player["./MoF_Reimu/Reimu.txt"]
#BGM["./Emotion.mp3"]
#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);
ObjMove_SetPosition(objBoss,stgx,-200);
}

@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{
	DamageRateAtFrame(100,50,240);
	PlaySound("Charge2",95,0);
	DCharge2(stgx,130,1.5,4,165,25,45,0);
	DCharge2(stgx,130,-1.5,4,45,25,45,0);
	magiccircle(objBoss,0.8,true);
	wait(90);
	ObjMove_SetPosition(objBoss,stgx,130);
	//MapleExplode;
	wait(90);
	TShot1;
	}
//----------------------------------------------------

task TShot1{
	//SetCommonData("Difficulty","Normal");
	let n = 0;
	let spiral = 0;
	smaple(0,60,50,1.5,1,45);
	wait(60);
	TMovement(15,5,5);
	wait(30);
	if(GetLevel=="Normal"){spiral=3;}
	else if(GetLevel=="Extra"){spiral=4;}
	while(!Obj_IsDeleted(objBoss)){
	PlaySound("Shot6",90,0);
	ascent(i in 0..spiral){
	Shot(i*360/spiral+n*27);
	}
	n++;
	if(n>5&&n%5==0){
		PlaySound("Shot1",85,0);
		ascent(i in 0..6){
		Wall(i*60+n*30+5);
		}
		if(n%15==0){
		TMovement(15,5,5);
		}
	}
	wait(15);
	}
		task Shot(ang){
			ascent(i in 0..2){
			ShotOA1(objBoss,2.5,ang-5+i*10,94,0,8);
			ShotOA1(objBoss,1.5,ang-5+i*10,94,0,8);
			}
			ascent(i in 0..3){
			ShotOA1(objBoss,2,ang-10+i*10,94,0,8);
			}
		}
		task Wall(ang){
			let w = 0;
			if(GetLevel=="Normal"){w=8;}
			else if(GetLevel=="Extra"){w=12;}
			ascent(i in 0..12){
			ShotA2(GetEnemyX,GetEnemyY,4,i*2+ang,-0.05,1,337,345,8);
			}
		}
	}

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

task TRender
{
	DrawBoss;
}

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

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