#e
#Title[No.031@uX[tFCg@-Normal-v]
#Text[]
#Image[]
#BackGround[]
#PlayLevel[]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main
{
#include_function ".\eW.txt"

	let name    = "uX[tFCg@-Normal-v";

	//ʒu
	let xini    =GetCenterX;
	let yini    =GetCenterY;

	@Initialize{
	SetCommonData("ON_SPELL",1);
	CutIn(YOUMU,name,"",0,0,0,0);
	SetX(GetCenterX);
	SetY(GetClipMinY + 120);
	SetLife(1750);
	SetTimer(49);
	SetScore(3500000 + spellbonus);
	SetDamageRate(40,5);
	SetInvincibility(180);

	LoadGraphic(imgboss32);
	SetTexture(imgboss32);
	SetGraphicRect(0,0,127,127);
	Shot(1);
	Move(1);
	}

	@MainLoop{
	ChackBonus;
	SetCollisionA(GetX,GetY,24);
	SetCollisionB(GetX,GetY,24);

	yield;
	}

	@DrawLoop{
	DrawGraphic(GetX,GetY);
	}

	@Finalize{
	DeleteGraphic(imgboss32);
	MasicPointAddSpellCard;
	loop(24 + scorebonus){
	let x = rand(GetX-32,GetX+32);
	let y = rand(GetY-32,GetY+32);
	CreateItem(ITEM_SCORE,x,y);}
	SetCommonData("ON_SPELL",0);
	}

	task Move(level){
	function Wait(time){loop(time){yield;}}

	Wait(30);
	loop{
	Wait(180 + level * 30);
	SetMovePositionRandom01(rand_int(-1,1)*64,rand(-16,16),1,GetClipMinX + 64,GetClipMinY,GetClipMaxX - 64,128);
	Wait(90 + level * 30);
	}
	}

	task Shot(level){
	function Wait(time){loop(time){yield;}}

	function RShot(atk,angle,speed){
	let angleA = angle;
	loop(atk){ReflectShot( GetX, GetY, 1, angleA , 1, true, true, true, false, BLUE32, 0 );
	angleA++;}
	}

	Wait(30);
	loop{
	loop(10 + level * 5){Allshot(3+level,rand(0,360),20 + 10 * level,RED32,15);Wait(6);}
	Slow(1);
	Wait(120);
	Slow(0);
	loop(10 + level * 5){RShot(rand_int(2,3+level*2),rand(0,360),1);Wait(6);}
	Wait(30);
	}
	}
}