#“Œ•û’e–‹•—[Single]
#ScriptVersion[3]
#Title["NonSpell3"]
#Text["NonSpell3"]
#Background["./BG.txt"]
#Player[DEFAULT]
#BGM["./Benben.mp3"]
#System["./system/Default_System.txt"]
#Player["./MoF_Reimu/Reimu.txt"]
#include"./Functions/Index.txt"
#include"./SetBoss.txt"
#include"script/VsKirisameMarisa/Shot/Default_ShotConst.txt"
#include"script/Default_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;
}

@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);
	}
}

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

task TShot1{
	let c = 0;
	let s = 1;
	while(!Obj_IsDeleted(objBoss)){
	let r = rand(10,15);
	let ang = rand(0.9,0.7)*s;
	descent(n in 0..18){
	PlaySound("BulletWave",90,0);
	ascent(i in 0..27){
	let dir = i*360/27+10*sin(n*47+c*37);
	let shot = ShotA2(GetEnemyX+r*cos(dir),GetEnemyY+r*sin(dir),0,dir,0.0295,4,131,0,8);
	ObjMove_SetAngularVelocity(shot,ang);
	ObjMove_AddPatternA2(shot,90,NO_CHANGE,NO_CHANGE,-0.02,-ang/2,0.5);
	ObjMove_AddPatternA2(shot,150,NO_CHANGE,NO_CHANGE,-0.03,ang/2,0.5);
	Manage(shot,0.01+(n%4)/500);
	}
	wait(6);
	}
	s = -s;
	c++;
	if(c%2==0){TMovement(35,5,5);}
	wait(120);
	}
		task Manage(shot,max){
		wait(150);
		if(!Obj_IsDeleted(shot)){
		ShotA2(ObjMove_GetX(shot),ObjMove_GetY(shot),0,ObjMove_GetAngle(shot),max,1.25,221,0,12);
		effbreak(shot,0,10);
		Obj_Delete(shot);
		}
		}
}

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

task TRender
{
	DrawBoss;
}

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

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