
#ScriptVersion[3]
#Title["DoremyN3"]
#Text["DoremyN3"]
#Player[DEFAULT]
#System["./system/Default_System.txt"]
#Background["./BG.txt"]
#Player["./MoF_Reimu/Reimu.txt"]
#include"./Functions/Index.txt"
#include"./SetBoss.txt"
#include"./Shot/AllStarShot_Const.dnh"
#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 color = [0,0];
@Initialize
{
SetBoss("Doremy",false);
}

@MainLoop
{
	ObjEnemy_SetIntersectionCircleToPlayer(objBoss,ObjMove_GetX(objBoss),ObjMove_GetY(objBoss),18);
	ObjEnemy_SetIntersectionCircleToShot(objBoss,ObjMove_GetX(objBoss),ObjMove_GetY(objBoss),26);
	yield;

}

@Event
{
	alternative(GetEventType())
	case(EV_REQUEST_LIFE)
	{
		SetScriptResult(3750);
	}
	case(EV_REQUEST_TIMER)
	{
		SetScriptResult(40);
	}
		case(EV_REQUEST_SPELL_SCORE)
	{
		SetScriptResult(35000000);
	}
}

//----------------------------------------------------
task mainTask{
	ObjMove_SetDestAtWeight(objBoss,stgx,120,10,10);
	magiccircle(objBoss,1,-1);
	wait(60);
	TShot1;
	DamageRateAtFrame(100,50,60);
	yield;
	}

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

task TShot1
{
	let r = 0;
	let angle = rand(0,80);
	let dir = 0;
	let s = 1;
	maple;
	wait(70);
	while(ObjEnemy_GetInfo(objBoss,INFO_LIFE)>0)
	{
		dir = 0;
		r = 0+Level*10;
		ascent(n in 0..120+Level*60)
		{
			PlaySound("Shot1",100,0);
			ascent(i in 0..2)
			{
				ShotA1(GetEnemyX+(120+Level*20-r)*cos(angle+i*180),GetEnemyY+(120+Level*20-r)*sin(angle+i*180),1.75+n/60,dir+i*180,278,0,12);
			}
			ascent(i in 0..2)
			{
				ShotA1(GetEnemyX+r*cos(angle+i*180),GetEnemyY+r*sin(angle+i*180),1.5+n/60,dir+i*180,39,0,12);
			}
			angle += 80;
			dir+= (3-Level/3)*s;
			wait(3-Level);
			r+= 1-Level/3;
		}
		TMovement(35,10,5);
		wait(45);
		s = -s;
		dir = 0;
		r = 0+Level*10;
		ascent(n in 0..120+Level*60)
		{
			PlaySound("Shot1",100,0);
			ascent(i in 0..2)
			{
				ShotA1(GetEnemyX+r*cos(angle+i*180),GetEnemyY+r*sin(angle+i*180),1.75+n/60,dir+i*180,279,0,12);
			}
			ascent(i in 0..2)
			{
				ShotA1(GetEnemyX+(120+Level*20-r)*cos(angle+i*180),GetEnemyY+(120+Level*20-r)*sin(angle+i*180),1.5+n/60,dir+i*180,40,0,12);
			}
			angle += 80;
			dir+= (3-Level/3)*s;
			wait(3-Level);
			r+= 1-Level/3;
		}
		TMovement(35,10,5);
		wait(45);
		s = -s;
	}
}

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

task SizeCircle
{
	ascent(i in 0..60)
	{
		SetCommonData("CircleSize",sin(i*1.5));
		yield;
	}
}	

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

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