#東方弾幕風
#Title[No.076　死符「死桜の桜吹雪　-Lunatic-」]
#Text[]
#Image[]
#BackGround[]
#PlayLevel[]
#Player[FREE]
#ScriptVersion[2]

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

	let name    = "死符「死桜の桜吹雪　-Lunatic-」";

	//初期位置
	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(6500000 + spellbonus * 2);
	SetDamageRate(50,10);
	SetInvincibility(120);

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

	@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(7){
	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 / 7;}
	speed = 2;
	Wait(80 - level * 15);
	loop(7){
	CreateShotA(2,GetX,GetY,10);
	SetShotDataA(2,0,2,180,0,0,0,GREEN22);
	SetShotDirectionType(PLAYER);
	SetShotDataA(2,30,speed,0,0,0,0,GREEN22);
	SetShotDirectionType(ABSOLUTE);
	FireShot(2);
	speed -= 1.5 / 7;}
	speed = 2;
	Wait(80 - level * 15);
	}
	}

	let angle = 0;
	let atk = [2,4,7,9];
	let mx =GetClipMinX();
	let Mx =GetClipMaxX();

	JikiBatafry(level);
	loop{
	loop(atk[level]){CreateShot01((Mx - mx)*sin(angle),GetY + rand(-32,32),1.45,90 + rand(-8,8),RED23,25);
	angle += 73.47;}
	Wait(12);
	}
	}
}