#搶曽抏枊晽
#Title[No.071丂巰挶乽壺泔偺塱柊丂-Hard-乿]
#Text[]
#Image[]
#BackGround[]
#PlayLevel[]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main
{
#include_function ".\抏枊廤.txt"

	let name    = "巰挶乽壺泔偺塱柊丂-Hard-乿";

	//弶婜埵抲
	let xini    =GetCenterX;
	let yini    =GetCenterY;

	@Initialize{
	SetCommonData("ON_SPELL",1);
	CutIn(YOUMU,name,"",0,0,0,0);
	SetX(GetCenterX);
	SetY(GetClipMinY + 64);
	SetLife(2250);
	SetTimer(59);
	SetScore(6000000 + spellbonus * 2);
	SetDamageRate(50,10);
	SetInvincibility(120);

	LoadGraphic(imgboss53);
	SetTexture(imgboss53);
	SetGraphicRect(0,0,127,127);
	Shot(2);
	}

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

	yield;
	}

	@DrawLoop{
	DrawGraphic(GetX,GetY);
	}

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

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

	task JikiBatafry(level){
	let speed = 2;
	loop{
	loop(level * 3 + 5){
	CreateShotA(1,GetX,GetY,10);
	SetShotDataA(1,0,2,0,0,0,0,RED22);
	SetShotDirectionType(PLAYER);
	SetShotDataA(1,30,speed,0,0,0,0,RED22);
	SetShotDirectionType(ABSOLUTE);
	FireShot(1);
	speed -= 1.5 / (level * 3 + 5);}
	Wait(80 - level * 15);
	loop(level * 3 + 5){
	CreateShotA(2,GetX,GetY,10);
	SetShotDataA(2,0,2,180,0,0,0,GREEN22);
	SetShotDirectionType(PLAYER);
	SetShotDataA(2,30,speed,180,0,0,0,GREEN22);
	SetShotDirectionType(ABSOLUTE);
	FireShot(2);
	speed -= 1.5 / (level * 3 + 5);}
	Wait(80 - level * 15);
	}
	}

	function AllBatafry(angle,level){
	let way = [20,25,25,30];
	loop(way[level]){
	CreateShotA(1,GetX,GetY,0);
	SetShotDataA(1,0,1,angle,0,0,2,BLUE22);
	SetShotDataA(1,30,NULL,NULL,0.25,0.2,2,BLUE22);
	CreateShotA(2,GetX,GetY,0);
	SetShotDataA(2,0,1,angle,0,0,2,RED22);
	SetShotDataA(2,30,NULL,NULL,-0.25,0.2,2,RED22);
	FireShot(1);
	FireShot(2);
	angle += 360 / way[level];
	}
	}

	let angle = 0;
	let mx =GetClipMinX();
	let Mx =GetClipMaxX();
	let waitA = [40,35,30,25];

	loop{
	Wait(waitA[level]);
	AllBatafry(angle,level);
	angle += 11.7;
	Wait(waitA[level]);
	AllBatafry(angle,level);
	angle -= 5.7;
	Wait(waitA[level]);
	AllBatafry(angle,level);
	angle += 21.1;
	Wait(waitA[level]);
	AllBatafry(angle,level);
	angle -= 18.2;
	}
	}
}