#東方弾幕風
#Title[禁弾「破壊の人形」]
#Text[]
#Image[]
#BackGround[]
#PlayLevel[]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main
{
#include_function ".\フランドール.txt"


	let name    = "禁弾「破壊の人形」";

	//初期位置
	let xini    =GetCenterX;
	let yini    =GetCenterY;

	@Initialize{
	CutIn(YOUMU,name,"",0,0,0,0);
	SetX(GetCenterX);
	SetY(GetClipMinY + 120);
	SetLife(1500);
	SetTimer(100);
	SetScore(500000);
	SetDamageRate(66,0);
	SetInvincibility(300);

	LoadGraphic(imgboss);
	SetTexture(imgboss);
	SetGraphicRect(0,0,63,63);
	BreakShot2(0,45,4,8,5);
	Shot();
	}

	@MainLoop{
	if(OnBomb() == false){
	SetCollisionA(GetX,GetY,24);
	SetCollisionB(GetX,GetY,24);}
	yield;
	}

	@DrawLoop{
	DrawGraphic(GetX,GetY);
	}

	@Finalize{
	DeleteGraphic(imgboss);
	CreateItem(ITEM_1UP,GetX,GetY);
	}

	task BreakShot2(minangle,addangle,way,atk1,atk2){
	let i=minangle;
	loop(100){yield;}
	loop{
	loop(way){let shot1=1;
	CreateShotA(shot1,GetX(),GetY(),30);
	SetShotDataA(shot1,0,1.5,i,0,0,0,RED03);
	let j = 0;
		while(j<= atk1){let shot2=2;
		CreateShotA(shot2,0,0,10);
		SetShotDataA(shot2,0,rand(0.1,0.3),rand(0,360),0,rand(0,0.05),3,RED04);
		j++;
		let k = 0;
			while(k<= atk2){let shot3=3;
			CreateShotA(shot3,0,0,10);
			SetShotDataA(shot3,0,rand(0.1,0.3),rand(0,360),0,rand(0,0.05),3,RED05);
			k++;
			AddShot(45,shot2,shot3,0);
			SetShotKillTime(shot2,46);}
		AddShot(45,shot1,shot2,0);}
	SetShotKillTime(shot1,46);
	FireShot(shot1);
	i+=addangle;}
	loop(90){yield;}
	}
	}


	task Shot(){
	loop{
	yield;
	}
	}

}