script_enemy_main
{
	let frame=-100;
	let angle=0;
	#include_function ".\spellcard.txt";
    #include_function ".\..\lib\enemyfunctions.txt"
	#include_function ".\boss1anim.txt";
	
task attack{
	control;
	loop{
		if(GetCommonData("DIFFICULTY")=="EASY"){
			ascent(i in 0..4){
				CreateShot02(GetX, GetY+30, -1, angle+i*90, 0.01, 3, 6, 5);
			}
		}
		if(GetCommonData("DIFFICULTY")=="NORMAL"){
			ascent(i in 0..8){
				CreateShot02(GetX, GetY+30, -1, angle+i*45, 0.01, 3, 6, 5);
			}
		}
		if(GetCommonData("DIFFICULTY")=="HARD"){
			ascent(i in 0..8){
				CreateShot02(GetX, GetY+30, -1, angle+i*45, 0.01, 3, 6, 5);
			}
			ascent(i in 0..4){
				CreateShot02(GetX, GetY+30, -1, -angle+i*90, 0.01, 2, 13, 5);
			}
		}
		if(GetCommonData("DIFFICULTY")=="LUNATIC"){
			ascent(i in 0..8){
				CreateShot02(GetX, GetY+30, -1, angle+i*45, 0.01, 3, 6, 5);
			}
			ascent(i in 0..12){
				CreateShot02(GetX, GetY+30, -1, -angle+i*30, 0.01, 4, 13, 5);
			}
		}
		angle+=rand(3, 7);
		PlaySE(GetCurrentScriptDirectory~"sound\Shot1.wav");
		loop(12){yield;}
	}
}
task control{
	if(GetCommonDataDefault("ROBOARM1", "ALIVE")=="ALIVE" ||
	GetCommonDataDefault("ROBOARM2", "ALIVE")=="ALIVE"){
		Concentration01(100);
		PlaySE(GetCurrentScriptDirectory~"sound\Charge.wav");
		loop(100){yield;}
		SetCommonData("ROBOARMS", "ATTACK1");
		loop(200){yield;}
	}
	if(GetCommonDataDefault("ROBOARM1", "ALIVE")=="ALIVE" ||
	GetCommonDataDefault("ROBOARM2", "ALIVE")=="ALIVE"){
		Concentration01(100);
		PlaySE(GetCurrentScriptDirectory~"sound\Charge.wav");
		loop(100){yield;}
		SetCommonData("ROBOARMS", "ATTACK2");
		loop(200){yield;}
	}
	if(GetCommonDataDefault("ROBOARM1", "ALIVE")=="ALIVE" ||
	GetCommonDataDefault("ROBOARM2", "ALIVE")=="ALIVE"){
		Concentration01(100);
		PlaySE(GetCurrentScriptDirectory~"sound\Charge.wav");
		loop(100){yield;}
		SetCommonData("ROBOARMS", "LASERS");
		loop(200){yield;}
	}
	if(GetCommonDataDefault("ROBOARM1", "ALIVE")=="ALIVE" ||
	GetCommonDataDefault("ROBOARM2", "ALIVE")=="ALIVE"){
		Concentration01(100);
		PlaySE(GetCurrentScriptDirectory~"sound\Charge.wav");
		loop(100){yield;}
		SetCommonData("ROBOARMS", "ATTACK3");
		loop(200){yield;}
	}
	if(GetCommonDataDefault("ROBOARM1", "ALIVE")=="ALIVE" ||
	GetCommonDataDefault("ROBOARM2", "ALIVE")=="ALIVE"){
	control;
	}
}
	
	@Initialize
	{
		SetInvincibility(200);
		LoadUserShotData(GetCurrentScriptDirectory~"supershot.txt");

		ClearScreen;
		EnemyInit(70, 0);
		SpellCard(7200);
		SetCommonData("ROBOARMS", "NONE");
	}
	
	@MainLoop
	{
		SetCollisionA(GetX(),GetY(),40);
		SetCollisionB(GetX(),GetY(),40);
		if(GetCommonDataDefault("ROBOARM1", "ALIVE")=="DEAD" &&
			GetCommonDataDefault("ROBOARM2", "ALIVE")=="DEAD"){
			ChangeDamageRate(10);
		}
		frame++;
		if(frame==0){attack;}
		yield;
}
	
	@Finalize
	{
	}
	
	@DrawLoop
	{
		anim_idle;
	}
}