script_enemy_main
{
	let frame=-100;
	let cutin=GetCurrentScriptDirectory~"img\dai_cutin.png";
	#include_function ".\spellcard.txt";
	#include_function ".\boss1anim.txt";
	
task attack{
	Concentration01(100);
	PlaySE(GetCurrentScriptDirectory~"sound\Charge.wav");
	loop(100){yield;}
	let angle=GetAngleToPlayer;
	ascent(i in 0..100){
		PlaySE(GetCurrentScriptDirectory~"sound\Shot1.wav");
		PlaySEDelay(GetCurrentScriptDirectory~"sound\BulletWave.wav", 300-i*2);
		CreateShotA(1, GetX, GetY, 10);
		SetShotDataA(1, 0, 1, angle-90, 3, 0.02, 15, 110);
		SetShotDataA(1, 300-i*2, 2, rand(0, 359), 0, 0, 0, 111);
		FireShot(1);
		CreateShotA(1, GetX, GetY, 10);
		SetShotDataA(1, 0, 1, angle+90, -3, 0.02, 15, 110);
		SetShotDataA(1, 300-i*2, 2, rand(0, 359), 0, 0, 0, 111);
		FireShot(1);
		yield;
	}
	loop(20){yield;}
	move;
	loop(15){
		angle=rand(0, 359);
		ascent(i in 0..24){
			CreateShot01(GetX, GetY, 1, angle+i*15, 82, 10);
		}
		PlaySE(GetCurrentScriptDirectory~"sound\Shot1.wav");
		loop(5){yield;}
	}
	loop(40){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(600);
		SetLife(350);
		SetDamageRate(40,40);

		SetMovePosition02(GetCenterX,120,20);
		LoadGraphic(cutin);
		CutIn(YOUMU, "Water Sign ''Broken Water Shield''",cutin,0,0,320,439);
		LoadUserShotData(GetCurrentScriptDirectory~"supershot.txt");

		SetCommonData("ONSPELL", "TRUE");
		spellbonus(10000000);
		timer;
		SetCommonData("timercount", 6000);
	}
	
	@MainLoop
	{
		SetCollisionA(GetX(),GetY(),24);
		SetCollisionB(GetX(),GetY(),24);
		frame++;
		if(frame==100){attack;}
		yield;
}
	
	@Finalize
	{
		AddScore(spellbonustotal);
		if(spellbonustotal>0)
		{
		loop(50)
		{
			CreateItem(ITEM_SCORE,GetX+rand(-100,100),GetY+rand(20,100));
		}
		}else{
		loop(15)
		{
			CreateItem(ITEM_SCORE,GetX+rand(-100,100),GetY+rand(20,100));
		}
		}
		SetCommonData("ONSPELL", "FALSE");
	}
	
	@DrawLoop
	{
		bg;
		anim_idle;
	}
}