script_enemy_main
{
	let frame=-100;
	#include_function ".\spellcard.txt";
	#include_function ".\boss1anim.txt";
	
task attack{
	loop(4){
		PlaySE(GetCurrentScriptDirectory~"sound\Shot1.wav");
		ascent(i in -2..3){
			CreateShot01(GetX, GetY, 3, GetAngleToPlayer+i*15, 37, 10);
		}
		loop(10){yield;}
	}
	ascent(i in 0..6){
		PlaySE(GetCurrentScriptDirectory~"sound\Shot1.wav");
		PlaySEDelay(GetCurrentScriptDirectory~"sound\BulletWave.wav", 60);
		PlaySEDelay(GetCurrentScriptDirectory~"sound\BulletWave.wav", 80);
		ascent(j in 0..15){
			CreateShotA(1, GetX, GetY, 10);
			SetShotDataA(1, 0, 4, i*4+j*24, 0, -0.075, 0, 111);
			SetShotDataA(1, 60, 3, i*8+j*24, 0, 0, 0, 111);
			SetShotDataA(1, 80, 3, rand(0, 359), 0, 0, 0, 111);
			FireShot(1);
		}
		loop(5){yield;}
	}
	loop(25){yield;}
	move;
	loop(25){yield;}
	loop(4){
		PlaySE(GetCurrentScriptDirectory~"sound\Shot1.wav");
		ascent(i in -2..3){
			CreateShot01(GetX, GetY, 3, GetAngleToPlayer+i*15, 37, 10);
		}
		loop(10){yield;}
	}
	ascent(i in 0..6){
		PlaySE(GetCurrentScriptDirectory~"sound\Shot1.wav");
		PlaySEDelay(GetCurrentScriptDirectory~"sound\BulletWave.wav", 60);
		PlaySEDelay(GetCurrentScriptDirectory~"sound\BulletWave.wav", 80);
		ascent(j in 0..15){
			CreateShotA(1, GetX, GetY, 10);
			SetShotDataA(1, 0, 4, -i*4+j*24, 0, -0.075, 0, 111);
			SetShotDataA(1, 60, 3, -i*8+j*24, 0, 0, 0, 111);
			SetShotDataA(1, 80, 3, rand(0, 359), 0, 0, 0, 111);
			FireShot(1);
		}
		loop(5){yield;}
	}
	loop(25){yield;}
	move;
	loop(25){yield;}
	attack;
}

sub move{
	let x=GetPlayerX+rand(-100, 100);
	let y=rand(70, 130);
	while(x>GetClipMaxX-20 || x<GetClipMinX+20){
		x=GetPlayerX+rand(-100, 100);
	}
	SetMovePosition03(x, y, 10, 4);
}

task PlaySEDelay(string, time){
	loop(time){yield;}
	PlaySE(string);
}

	@Initialize
	{
		SetInvincibility(200);
		SetLife(700);
		SetDamageRate(100,100);
		SetMovePosition02(GetCenterX,120,20);
		LoadUserShotData(GetCurrentScriptDirectory~"supershot.txt");

		timer;
		SetCommonData("timercount", 4500);
	}
	
	@MainLoop
	{
		SetCollisionA(GetX(),GetY(),24);
		SetCollisionB(GetX(),GetY(),24);
		frame++;
		if(frame==0){attack;}
		yield;
}
	
	@Finalize
	{
	}
	
	@DrawLoop
	{
		anim_idle;
	}
}