
#ScriptVersion[3]
#Title["NonSpell2"]
#Text["NonSpell2"]
#Background["./BG.txt"]
#Player[DEFAULT]
#System["./system/Default_System.txt"]
#Player["./MoF_Reimu/Reimu.txt"]
#include"./Functions/Index.txt"
#include"./SetBoss.txt"
#include"./Shot/Default_ShotConst.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(4000);
	}
	case(EV_REQUEST_TIMER)
	{
		SetScriptResult(60);
	}
}

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

task TShot1{
	let px = 0;
	let py = 0;
	while(!Obj_IsDeleted(objBoss)){
	ascent(m in 0..2){
	ascent(n in 1..10){
		PlaySound("Shot1",90,0);
		ascent(i in 0..n){
		ascent(j in 0..4){
		ShotOA1(objBoss,5-n/2.5,j*90+i*12+m*45,264+m,154,12);
		ShotOA1(objBoss,5-n/2.5,j*90-i*12+m*45,264+m,154,12);
		}
		}
		wait(5);
	}
	TAccel(50,5,0.05,60);
	wait(90);
	}
	wait(30);
	ascent(n in 0..12){
		PlaySound("Shot1",90,0);
		ascent(a in 0..8){
		let angle = a*3+n*17;
		ShotA1(GetEnemyX+1*cos(angle),GetEnemyY+1*sin(angle),1+a/2,angle,261,151,12);
		}
		wait(7);
	}
	ascent(n in 0..24){
		PlaySound("Shot1",90,0);
		ascent(a in 0..8){
		let angle = -a*3-n*17;
		ShotA1(GetEnemyX+1*cos(angle),GetEnemyY+1*sin(angle),1+a/2,angle,266,156,12);
		}
		wait(3);
	}
	maple(2);
	wait(55);
	ascent(m in 0..20){
	ascent(n in 0..3){
		PlaySound("Shot1",90,0);
		ascent(i in 0..n){
		ascent(j in 0..7){
		ShotA2(GetEnemyX,GetEnemyY,0,j*360/7+i*2+(n%2)-1+72*sin(m*47),0.05,5,268,154,12);
		ShotA2(GetEnemyX,GetEnemyY,0,j*360/7-i*2-(n%2)+1+72*sin(m*47),0.05,5,268,154,12);
		}
		}
		wait(2);
	}
	}
	ascent(i in 0..30){
		ascent(a in 0..5){
		ShotA2(GetEnemyX,GetEnemyY,0,i*12,0.005+a/100,6,265,0,12);
		}
	}
	TAccel(50,5,0.05,60);
	wait(120);
	}
	}

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

task TRender
{
	DrawBoss;
}

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

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