
#ScriptVersion[3]
#Title["NonSpell3"]
#Text["NonSpell3"]
#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);
}

@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,120);
	magiccircle(objBoss,0.8,true);
	ObjMove_SetDestAtWeight(objBoss,stgx,140,10,7);
	wait(60);
	TShot1;
	}
//----------------------------------------------------

task TShot1{
	//SetCommonData("Difficulty","Extra");
	let n = 0;
	let shot = [0,0,0,0]; // spiral,rotate,d of a , divide
	smaple(0,240,50,1.5,1,45);
	wait(60);
	TMovement(15,5,5);
	wait(30);
	if(GetLevel=="Normal"){
	shot = [4,27,4,1];
	}
	else if(GetLevel=="Extra"){
	shot = [5,37,8,1.25];
	}
	while(!Obj_IsDeleted(objBoss)){
	PlaySound("Shot6",90,0);
	ascent(i in 0..shot[0]){
	Shot(i*360/shot[0]-n*shot[1]);
	}
	n++;
	if(n%4==0 && n>4){
		ascent(i in 0..12){
		Wall(i*30+n*2.5);
		}
	}
	if(n%8==7){TMovement(10,2,5);}
	wait(23);
	}
		task Shot(ang){
			ascent(i in 0..2){
				ascent(j in 0..1){
				ShotOA1(objBoss,4,ang-7.5+i*15+j*2,98,0,8);
				ShotOA1(objBoss,2,ang-7.5+i*15+j*2,98,0,8);
				}
			}
			ascent(i in 0..3){
				ascent(j in 0..1){
				ShotOA1(objBoss,3,ang-15+i*15+j*2,98,0,8);
				}
			}
		}
		task Wall(ang){
			ascent(a in 0..shot[2]){
			let v = 4+a/shot[3];
			ShotA2(GetEnemyX,GetEnemyY,v,ang,-v/20,v/3,322,0,8);
			}
		}
	}

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

task TRender
{
	DrawBoss;
}

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

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