
#Title[flannon1]
#Text[flannon1]
#Image[.\img\spellcard0103.jpg]
#PlayLevel[Hard]
#ScriptVersion[2]

script_enemy_main
{
#include_function ".\draweverything.txt";
#include_function ".\system\Effects3.txt";
#include_function ".\cutin.txt";
let ImgBoss = GetCurrentScriptDirectory~"img\Flandre_Main.png";
let imgExRumiaBack=GetCurrentScriptDirectory~"img\ExRumiaBack.png";
let back=GetCurrentScriptDirectory~"img\back.png";
let CSD = GetCurrentScriptDirectory;
let ci = CSD ~ "system\NMM.png";
let bg1 = CSD ~ "system\bg8.png";
let bg2 = CSD ~ "system\bg3.png";
//let cx=GetCenterX();
let dwait = 5;
let randa = 0;
let angle = 0;
let switch = 1;
let count = 0;
let arr = [67,71];
let color = 0;
let Cut = GetCurrentScriptDirectory~"img\cut5.png";
let ThisShot = GetCurrentScriptDirectory~"ZUN's shotdata.txt";

@Initialize
{
drawcc(GetX,GetY+120,0,0);
SetLife(2200);
SetDamageRate(100,50);
SetTimer(60);
mainTask;

SetInvincibility(120);
SetMovePosition03(GetCenterX, GetCenterY-120, 5, 4);
LoadGraphic(ImgBoss);
LoadUserShotData(ThisShot);
LoadGraphic(Cut);
LoadGraphic(ci);
LoadGraphic(bg1);
LoadGraphic(back);
LoadGraphic(bg2);
SetTexture(ImgBoss);
SetGraphicRect(0, 0, 64, 64);
Aura;
}

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

@MainLoop 
{
SetCollisionA(GetX, GetY, 32);
SetCollisionB(GetX, GetY, 16);
yield;

}

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

@DrawLoop
{
drawall;
}
//---------------------------------------------------------------

@BackGround
{
	
}	

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

@Finalize
{
DeleteGraphic(ImgBoss);
}

// main task
task mainTask{
	wait(60);
	fire;
	//bossmove;
}

task fire{
	Concentration01(60);
	PlaySE(CSD~"sound\charge2.wav");
	wait(60);
	loop{
	ascent(n in 0..7){
	PlaySE(CSD~"sound\shot1.wav");
	ascent(i in 0..5){
	ascent(a in 0..12){
	CreateShot01(GetX,GetY,1+a/2,i*72+n*10+30,arr[color%2],10);
	}
	}
	wait(6);
	}
	wait(30);
	SetMovePositionRandom01(rand(20,30),0,5,GetClipMinX+100,rand(120,130),GetClipMaxX-100,rand(100,150));
	checkmove;
	wait(30);
	ascent(n in 0..7){
	PlaySE(CSD~"sound\shot1.wav");
	ascent(i in 0..5){
	ascent(a in 0..12){
	CreateShot01(GetX,GetY,1+a/2,i*72-n*10+115,arr[color%2],10);
	}
	}
	wait(6);
	}
	wait(60);
	count++;
	loop(count){
	PlaySE(CSD~"sound\shot4.wav");
	ascent(i in 0..12){
	ascent(a in 0..7){
	CreateShot01(GetX,GetY,0.7+a/3,i*30+360*sin(a*80),25+a,30);
	}
	}
	wait(30);
	}
	color++;
	wait(90);
	}
	}

task bossmove{
		loop{
		wait(120);
		SetMovePositionRandom01(rand(50,100),0,5,GetClipMinX+50,rand(100,150),GetClipMaxX-50,rand(100,150));
		checkmove;
		fire;
		yield;
		    }
	     }




	function wait(w){
		loop(w){yield;}
			}

sub spawn{
	PlaySE(CSD~"sound\fam.wav");
	//CreateEnemyFromScript("starFam",GetX,GetY,0,0,0);
	//CreateEnemyFromScript("starFam",GetX,GetY,0,0,180);
	  }
}
