
#ScriptVersion[3]
#Title["DoremyS1"]
#Text["DoremyS1"]
#Player[DEFAULT]
#System["./system/Default_System.txt"]
#Background["./BG.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 action = false;
let objScene=GetEnemyBossSceneObjectID();
let color = [276,277,278];
let color2 = [51,53,55];
let dcolor = [308,309,310];
@Initialize
{
SetBoss("Doremy",true);
SetCommonData("Bomb",1);
}

@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(1200);
	}
	case(EV_REQUEST_TIMER)
	{
		SetScriptResult(45);
	}
		case(EV_REQUEST_SPELL_SCORE)
	{
		SetScriptResult(35000000);
	}
}

//----------------------------------------------------
task mainTask{
	magiccircle(objBoss,1,-1);
	DamageRateAtFrame(10,20,200);
	ObjMove_SetDestAtWeight(objBoss,stgx,140,10,7);
	Cutin("Pinkish Dream 'Baku Baku Spin'",15,"SHINKI");
	ObjEnemyBossScene_StartSpell(objScene);
	Sound(GCSD ~ "Butterfly.mp3");
	wait(120);
	TShot1;
	wait(1200);
	DamageRateAtFrame(75,40,0);
	}
//----------------------------------------------------

task TShot1
{
	let s = 1;
	while(ObjEnemy_GetInfo(objBoss,INFO_LIFE)>0){
		MapleExplode(GetEnemyX,GetEnemyY,1.5,"PINK");
	attack(30,1);
		TrapWave;
		wait(50);
		attack(30,1);
		nicWave;
		wait(50);
		nicWave;
		TMovement(0,0,0);
		wait(50);
	}
}

task TrapWave
{
	let r = 120;
	let angle = 90;
	let dir = 0;
	let s = 1;
	let degree = 0;
	descent(n in -18..15)
	{
		ascent(j in 0..1)
		{
			r = 0;
			PlaySound("Shot1",100,0);
			ascent(i in 0..2)
			{
				ShotA1(GetEnemyX+0,GetEnemyY+0,5,dir+i*180,277,0,12);
			}
			angle += 90;
			dir+= (8);
			wait(1);
		}
		yield;
	}
}


task nicWave
{
	let r = 30;
	let angle = 90;
	let num =20;
	let num2 = 200;
	let curve = 0;
	let acc = 1;
	let multi = 10;
	let c = 0;
	let c2 = 0;
	let count = 0;
	let degree = 0;
	let dir = 0;
	let s = 1;
	descent(n in -18..15)
	{
		ascent(j in 0..3)
		{
			r = 0;
			PlaySound("Shot1",100,0);
			ascent(i in 0..1)
			{

			let angle = i*360/num+180/num+c+count;
				ShotA1(GetEnemyX+r*cos(0),GetEnemyY+r*sin(angle),3,rand(0,360),309,0,12);
		}
			angle += 90;
			dir+= (8);
			wait(0);
		}
		yield;
	}
}

task ImmuneDelay(obj)
{
	ObjShot_SetAutoDelete(obj,true);
	wait(300);
	ObjShot_SetAutoDelete(obj,false);
}


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

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