#東方弾幕風
#Title[No.138 禁術「滅びの生命線　-Hard-」]
#Text[]
#Image[]
#BackGround[]
#PlayLevel[]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main
{
#include_function ".\弾幕集.txt"

	let name    = "禁術「滅びの生命線　-Hard-」";
	let count   = 0;

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

	@Initialize{
	CutIn(YOUMU,name,"",0,0,0,0);
	SetX(GetCenterX);
	SetY(GetClipMinY + 120);
	SetLife(1200);
	SetTimer(100);
	SetScore(12000000 + spellbonus);
	SetDamageRate(18,0);

	LoadGraphic(imgboss73);
	SetTexture(imgboss73);
	SetGraphicRect(0,0,127,127);
	SetInvincibility(210);
	Shot(2);
	Move(2);
	LoadUserShotData(GetCurrentScriptDirectory~"11-221Shot_データ.txt");
	}

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

	//EX風ボムバリア
	if(OnBomb() == true){SetInvincibility(2);}
	yield;
	}

	@DrawLoop{
	DrawGraphic(GetX,GetY);
	}


	@Finalize{
	DeleteGraphic(imgboss73);
	MasicPointAddSpellCard;
	loop(250 + scorebonus * 10){
	let x = rand(GetX-96,GetX+96);
	let y = rand(GetY-96,GetY+96);
	CreateItem(ITEM_SCORE,x,y);}
	SetCommonData("ON_SPELL",0);
	}

	task Move(level){
	loop{
	yield;
	}
	}

	task Shot(level){
	function CreateShot03(x,y,speed,angle,anglespeed,bullet,delay){
	CreateShotA(1,x,y,delay);
	SetShotDataA(1,0,speed,angle,anglespeed,0,0,bullet);
	FireShot(1);
	}

	let count = 0;
	let angle = 0;
	let power = 0;
	let cx = GetCenterX;
	let cy = GetCenterY;
	let angleA = 0;
	let angleB = 0;
	loop(100){yield;}
	loop{
	count++;
	angle += 7.13;
	CreateShot01(cx - 150,cy - 200,2,angleA+20*sin(angle),RED21,30);
	CreateShot01(cx - 150,cy - 200,2,angleA+90+20*sin(angle),RED21,30);
	CreateShot01(cx - 150,cy - 200,2,angleA+180+20*sin(angle),RED21,30);
	CreateShot01(cx - 150,cy - 200,2,angleA+270+20*sin(angle),RED21,30);
	CreateShot01(cx + 150,cy - 200,2,angleB+20*sin(-angle),RED21,30);
	CreateShot01(cx + 150,cy - 200,2,angleB+90+20*sin(-angle),RED21,30);
	CreateShot01(cx + 150,cy - 200,2,angleB+180+20*sin(-angle),RED21,30);
	CreateShot01(cx + 150,cy - 200,2,angleB+270+20*sin(-angle),RED21,30);
	if(level >= 2){
	CreateShot01(cx - 150,cy + 200,2,angleA+20*sin(angle),RED21,30);
	CreateShot01(cx - 150,cy + 200,2,angleA+90+20*sin(angle),RED21,30);
	CreateShot01(cx - 150,cy + 200,2,angleA+180+20*sin(angle),RED21,30);
	CreateShot01(cx - 150,cy + 200,2,angleA+270+20*sin(angle),RED21,30);
	CreateShot01(cx + 150,cy + 200,2,angleB+20*sin(-angle),RED21,30);
	CreateShot01(cx + 150,cy + 200,2,angleB+90+20*sin(-angle),RED21,30);
	CreateShot01(cx + 150,cy + 200,2,angleB+180+20*sin(-angle),RED21,30);
	CreateShot01(cx + 150,cy + 200,2,angleB+270+20*sin(-angle),RED21,30);
	}
	if(power == 35){
	let a = rand(0,360);
	loop(10){
	CreateShot03(GetX,GetY,1.75-level * 0.25,a,0.07,ORANGE03,30);
	CreateShot03(GetX,GetY,1.75-level * 0.25,a,-0.07,ORANGE03,30);
	a += 360 / 10;
	}
	power = 0;
	}
	power++;
	loop(5-level){yield;}
	}
	}
}