script_enemy_main{

if(length(GetCommonDataDefault("HighScoreTrumpCards",0))==0){
let arraysize=GetCommonDataDefault("HighScoreTrumpCards",[0]);
	loop(18){
	arraysize=arraysize~[0];
	SetCommonData("HighScoreTrumpCards",arraysize);
	}
}

let effect1=0;
let object1=[];
let count1=[];
let angle1=[];
let fanangle=0;

let size=1;
let speed1=0;

let character="Setsuko";
let cutin=character;
let dispelled=0;
let spellcards=1;
let spellcardnumber=71;
let damagerate=10;
let outfit=1;
outfit=(128*outfit)-128;
let usespell=0;
let bgfade=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 SEfocus=("script\SoundEffects\charge1.wav");
let SEshots6=("script\SoundEffects\shots6.wav");
let SEfan=("script\SoundEffects\fan1.wav");

let GRfan=("\script\Images\OtherEffects\Fan1.png");

let BG1=("\script\Images\BackgroundLayers\Setsuko1.png");
let BG2=("\script\Images\BackgroundLayers\Setsuko2.png");
let GRboss=("\script\Images\CharacterSprites\Setsuko.png");

#include_function "script/Functions/SetSpellcardCommonData.txt";
#include_function "script/Functions/SpellcardNameLoad.txt";
#include_function "script/Functions/HealthBarLoad.txt";
#include_function "script/Functions/CutInLoad.txt";

@Initialize{
	LoadUserShotData("script\shots\ShotsSetsuko1.txt");
	
	LoadSE("script\SoundEffects\charge1.wav");
	LoadSE("script\SoundEffects\shots6.wav");
	LoadSE("script\SoundEffects\fan1.wav");
	
	LoadGraphic("\script\Images\OtherEffects\Fan1.png");

	LoadGraphic("\script\Images\BackgroundLayers\Setsuko1.png");
	LoadGraphic("\script\Images\BackgroundLayers\Setsuko2.png");
	LoadGraphic("\script\Images\CharacterSprites\Setsuko.png");

	SetScore(2500000);
	SetLife(700);
	SetTimer(60);
	SetInvincibility(120);
	SetDamageRate(10,10);
	SetEnemyMarker(true);
	MagicCircle(true);
	#include_function "script/Functions/Focus.txt";
	Focus(character);
	SetEffectForZeroLife(60,100,1);
	SetMovePosition02(cx,miny+100,50);

	SetDurableSpellCard;
}
	
@MainLoop{

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

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

let difficulty="";
if(GetCommonDataDefault("Difficulty",2)==1){ difficulty="Easy"; }
if(GetCommonDataDefault("Difficulty",2)==2){ difficulty="Normal"; }
if(GetCommonDataDefault("Difficulty",2)==3){ difficulty="Hard"; }
if(GetCommonDataDefault("Difficulty",2)==4){ difficulty="Lunatic"; }

SpellcardName("Verdict [Last Word]",spellcardnumber); 
HealthBar();
Portrait(cutin,1);

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


if(time%10==0 && time>=60){
let shot1=0;
let shot2=1;
let speed1=3;
let speed2=3.5;
let angle=time*2.5;
let angle3=0;
let color=255;
let bend=80;

if(time%20==0){
	loop(3){
	SetShotColor(color,color,color);
		loop(5){
		CreateShotA(shot1,GetX,GetY,0);
		SetShotDataA(shot1,0,speed1+1*cos(time+angle*4),angle+angle3,0,-0.04,-1,51);
		SetShotDataA(shot1,150,0,angle+bend+angle3,0,0.05,speed2,39);
		let angle2=0;
			loop(size){
			angle2+=1.5;
			CreateShotA(shot2,0,0,0);
			SetShotDataA(shot2,0,0,angle+bend+angle2+angle3,0,0.05,speed2,39);
			AddShot(150,shot1,shot2,0);
			}
		FireShot(shot1);
		angle+=360/5;
		}
	angle3+=30;
	speed2-=0.35;
	color-=50;
	SetShotColor(color,color,color);
	}
}

let shot1=0;
let shot2=1;
let speed1=3;
let speed2=3.5;
let angle=time*2.5;
let angle3=0;
let color=255;
let bend=80;
if(time%20!=0){
	loop(3){
	SetShotColor(color,color,color);
		loop(5){
		CreateShotA(shot1,GetX,GetY,0);
		SetShotDataA(shot1,0,speed1+1*cos(time+angle*4),angle-angle3,0,-0.04,-1,51);
		SetShotDataA(shot1,150,0,angle-bend-angle3,0,0.05,speed2,39);
		let angle2=0;
			loop(size){
			angle2+=1.5;
			CreateShotA(shot2,0,0,0);
			SetShotDataA(shot2,0,0,angle-bend-angle2-angle3,0,0.05,speed2,39);
			AddShot(150,shot1,shot2,0);
			}
		FireShot(shot1);
		angle+=360/5;
		}
	angle3+=30;
	speed2-=0.35;
	color-=50;
	SetShotColor(color,color,color);
	}
}
PlaySE(SEshots6);
SetShotColor(255,255,255);
}


if(time==600 || GetLife<525 && size==1){ SetColor(255,200,0); Concentration01(90); SetColor(255,255,255); PlaySE(SEfocus); size++; }
if(time==1200 || GetLife<400 && size==2){ SetColor(255,200,0); Concentration01(90); SetColor(255,255,255); PlaySE(SEfocus); size++; }
if(time==1800 || GetLife<275 && size==3){ SetColor(255,200,0); Concentration01(90); SetColor(255,255,255); PlaySE(SEfocus); size++; }
if(time==2400 || GetLife<150 && size==4){ SetColor(255,200,0); Concentration01(90); SetColor(255,255,255); PlaySE(SEfocus); size++; }



if(time==60){
let picture=0;
let i=0;
	loop(16){
	effect1=(Obj_Create(OBJ_EFFECT));
	Obj_SetPosition(effect1,GetX,GetY);
	ObjEffect_SetScale(effect1,1,1); ObjEffect_SetAngle(effect1,0,0,-90);
	ObjEffect_SetLayer(effect1,1); ObjEffect_SetTexture(effect1,GRfan); ObjEffect_SetRenderState(effect1,ALPHA);
	ObjEffect_SetPrimitiveType(effect1,PRIMITIVE_TRIANGLESTRIP); ObjEffect_CreateVertex(effect1,4);
	ObjEffect_SetVertexXY(effect1,0,-25,-175); ObjEffect_SetVertexUV(effect1,0,0+picture,0);
	ObjEffect_SetVertexXY(effect1,1,25,-175); ObjEffect_SetVertexUV(effect1,2,0+picture,350);
	ObjEffect_SetVertexXY(effect1,2,-25,175); ObjEffect_SetVertexUV(effect1,1,50+picture,0);
	ObjEffect_SetVertexXY(effect1,3,25,175); ObjEffect_SetVertexUV(effect1,3,50+picture,350);
	ObjEffect_SetVertexColor(effect1,0,255,255,255,255); ObjEffect_SetVertexColor(effect1,1,255,255,255,255);
	ObjEffect_SetVertexColor(effect1,2,125,255,255,255); ObjEffect_SetVertexColor(effect1,3,125,255,255,255);
	object1=object1~[effect1];
	count1=count1~[effect1];
	count1[length(object1)-1]=i*12;
	angle1=angle1~[effect1];
	angle1[length(object1)-1]=0;
	if((i+1)%2==0){ picture=0; }
	if((i+0)%2==0){ picture=50; }
	i++;
	}
}

if(time>=60){
let i=0;
	loop(16){
	Obj_SetPosition(object1[i],GetX,GetY);
	ObjEffect_SetAngle(object1[i],0,0,-90+angle1[i]+fanangle);
	if(angle1[i]<count1[i]){ angle1[i]=angle1[i]+4; fanangle+=1; }
	if(angle1[i]==count1[i] && time>=80 && time%3==0){ PlaySE(SEfan); angle1[i]=count1[i]+0.01; }
	i++;
	}
}


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

#include_function "script/Functions/SpellcardName.txt";
#include_function "script/Functions/HealthBar.txt";
#include_function "script/Functions/CutIn.txt";

if(GetLife==0 && dispelled==0){ CreateEnemyFromFile("script\Functions\dispel.txt",GetX,GetY,0,0,character); dispelled=1; }
}

@BackGround{
	if(bgfade<255){bgfade+=5;}

	SetGraphicRect(0,0,300,400);
	SetGraphicScale(1.3,1.3);
	SetTexture(BG1);
	SetAlpha(bgfade/2);
	SetColor(255,255,255);
	SetRenderState(ALPHA);
	SetGraphicAngle(0,0,0);
	DrawGraphic(cx,cy);
	
	SetGraphicRect(0,0,250,320);
	SetGraphicScale(1.25,1.25);
	SetAlpha(bgfade);
	SetColor(180,180,180);
	SetTexture(BG2);
	DrawGraphic(cx,cy);
}

@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{
	if(GotSpellCardBonus){ SetCommonData("LastTrumpCard",4); }
	NewPointData(spellcardnumber,7);
	#include_function "script/Functions/Main Menu/SpellcardDataAndPoints.txt";
}

}