#“Œ•û’e–‹•—[Single]
#ScriptVersion[3]
#Title["NonSpell"]
#Text["NonSpell"]
#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(2000);
	}
	case(EV_REQUEST_TIMER)
	{
		SetScriptResult(60);
	}
}

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

task TShot1{
	let c = 0;
	while(!Obj_IsDeleted(objBoss)){
	PlaySound("um3",70,0);
	let px = GetEnemyX+rand(-100,100);
	let py = GetEnemyY+rand(-100,50);
	let r = rand(10,20);
	let ang = rand(-0.5,0.5);
	ascent(i in 0..9){
	let shot = ShotA2(px+r*cos(i*40),py+r*sin(i*40),0.5,i*40,0.015,5,256,0,8);
	ObjMove_SetAngularVelocity(shot,ang);
	ObjMove_AddPatternA2(shot,120,NO_CHANGE,NO_CHANGE,-0.015,rand(-0.5,0.5),0.5);
	}
	c++;
	if(c%15==0){TMovement(35,5,5);}
	wait(15);
	}
}

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

task TRender
{
	DrawBoss;
}

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

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