script_enemy_main{

let angle=rand(0,360);

let character="Setsuko";
let cutin=character;
let dispelled=0;
let spellcards=3;
if(GetCommonData("Difficulty")==4){ spellcards=4; }
let damagerate=10;
let outfit=1;
outfit=(128*outfit)-128;
let usespell=0;
let frame=0;
let time=0;
let miny=GetClipMinY; let maxy=GetClipMaxY; let minx=GetClipMinX; let maxx=GetClipMaxX;
let cx=GetCenterX; let cy=GetCenterY;
let SEshot1=("script\SoundEffects\shots6.wav");
let GRboss=("\script\Images\CharacterSprites\Setsuko.png");

#include_function "script/Functions/HealthBarLoad.txt";

@Initialize{
	LoadUserShotData("script\shots\ShotsSetsuko1.txt");

	LoadGraphic("\script\Images\CharacterSprites\Setsuko.png");
	LoadSE("script\SoundEffects\shots6.wav");

	SetLife(125);
	SetTimer(25);
	SetGraphicRect(0,0,144,144);
	SetInvincibility(120);
	SetEnemyMarker(true);
	MagicCircle(true);
	
	SetX(GetCommonData("Boss1X"));
	SetY(GetCommonData("Boss1Y"));
	SetCommonData("Boss1Vanish",1);

	SetCommonData("Boss2Move",5);
}
	
@MainLoop{

SetCollisionA(GetX,GetY,16);
SetCollisionB(GetX,GetY,16);
SetShotAutoDeleteClip(64,64,64,64);

Weakness(character);
#include_function "script/Functions/Weakness.txt";
if(GetCommonData("BombOn")==0){ damagerate=10; }
if(GetCommonData("BombOn")==1){ damagerate=4; }
SetDamageRate(damagerate*weaken,damagerate*weaken);

HealthBar();

if(time%200==0 && time>=60){
	if(GetPlayerX>minx+50 && GetPlayerX<maxx-50){
	SetMovePosition01(GetPlayerX+rand(-30,30),rand(miny+60,miny+100),1.5);
	}
	if(GetPlayerX<=minx+50){
	SetMovePosition01(GetPlayerX+rand(15,30),rand(miny+60,miny+100),1.5);
	}
	if(GetPlayerX>=maxx-50){
	SetMovePosition01(GetPlayerX-rand(15,30),rand(miny+60,miny+100),1.5);
	}
}


if(GetCommonData("Difficulty")==1){
if(frame>60 && frame<120){
let speed=0;
let shot1=0;
	loop(3){
	CreateShotA(shot1,GetX+5,GetY-15,0);
	SetShotDataA(shot1,0,3-speed,angle,0,-0.03,0,3);
	SetShotDataA(shot1,150,0,NULL,0,0.03,3-speed,1);
	FireShot(shot1);	
	speed+=0.7;
	SetShotColor(255-(speed*40),255-(speed*40),255-(speed*40));
	}
if(time%4==0){ PlaySE(SEshot1); }
usespell=2;
SetShotColor(255,255,255);
angle+=rand(8,13);
}

if(frame==240){ frame=0; }
} //Easy

//=============================================================================================================

if(GetCommonData("Difficulty")==2){
if(frame>60 && frame<150){
let speed=0;
let shot1=0;
	loop(4){
	CreateShotA(shot1,GetX+5,GetY-15,0);
	SetShotDataA(shot1,0,4-speed,angle,0,-0.04,0,3);
	SetShotDataA(shot1,150,0,angle+rand(-2,2),0,0.04,4-speed,1);
	FireShot(shot1);	
	speed+=0.8;
	SetShotColor(255-(speed*40),255-(speed*40),255-(speed*40));
	}
if(time%4==0){ PlaySE(SEshot1); }
usespell=2;
SetShotColor(255,255,255);
angle+=rand(8,13);
}

if(frame==240){ frame=0; }
} //Normal

//=============================================================================================================

if(GetCommonData("Difficulty")==3){
if(frame>60 && frame<150){
let speed=0;
let shot1=0;
	loop(5){
	CreateShotA(shot1,GetX+5,GetY-15,0);
	SetShotDataA(shot1,0,5-speed,angle,0,-0.05,0,3);
	SetShotDataA(shot1,150,0,angle+rand(-4,4),0,0.05,5-speed,1);
	FireShot(shot1);	
	speed+=0.8;
	SetShotColor(255-(speed*40),255-(speed*40),255-(speed*40));
	}
if(time%4==0){ PlaySE(SEshot1); }
usespell=2;
SetShotColor(255,255,255);
angle+=rand(8,13);
}

if(frame==240){ frame=0; }
} //Hard

//=============================================================================================================

if(GetCommonData("Difficulty")==4){
if(frame>60 && frame<180){
let speed=0;
let shot1=0;
	loop(6){
	CreateShotA(shot1,GetX+5,GetY-15,0);
	SetShotDataA(shot1,0,5-speed,angle,0,-0.05,0,3);
	SetShotDataA(shot1,150,0,angle+rand(-6,6),0,0.05,5-speed,1);
	FireShot(shot1);	
	speed+=0.8;
	SetShotColor(255-(speed*40),255-(speed*40),255-(speed*40));
	}
if(time%4==0){ PlaySE(SEshot1); }
usespell=2;
SetShotColor(255,255,255);
angle+=rand(8,13);
}

if(frame==240){ frame=0; }
} //Lunatic



time++; frame++;
if(usespell>0){ usespell--; } if(usespell<0){ usespell++; }
SetCommonData("Boss1X",GetX); SetCommonData("Boss1Y",GetY);

#include_function "script/Functions/HealthBar.txt";
}

@DrawLoop{
	SetGraphicScale(1,1);
	SetTexture(GRboss);
	SetGraphicAngle(0,0,0);
	SetColor(255,255,255);
	SetRenderState(ALPHA);

	if(usespell>=1){
	SetGraphicRect(384,outfit,512,outfit+128);
	}
	if(usespell<=-1){
	SetGraphicRect(512,outfit,640,outfit+128);
	}

	if(usespell==0){
		if(GetSpeedX<=0.5 && GetSpeedX>=-0.5){ SetGraphicRect(0,outfit,128,outfit+128); }
		else if(GetSpeedX<-0.5){ SetGraphicRect(128,outfit,256,outfit+128); }
		else if(GetSpeedX>0.5){ SetGraphicRect(256,outfit,384,outfit+128); }
	}
	DrawGraphic(GetX,GetY);
}

@Finalize{
//	SetCommonData("Conversation",1);
}

}