#東方弾幕風
#Title[No.087　魔重「天から地への制裁　-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(GetCenterY);
	SetLife(2500);
	SetTimer(79);
	SetScore(8000000 + spellbonus * 3);
	SetDamageRate(50,1);
	SetInvincibility(320);

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

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

	yield;
	}

	@DrawLoop{
	DrawGraphic(GetX,GetY);
	}

	@Finalize{
	DeleteGraphic(imgboss61);
	MasicPointAddSpellCard;
	loop(90 + scorebonus * 3){
	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;}}

	function GravityToPlayerAllShot(x,y,n,Angle,level){
	let x1 = x + cos(Angle) * n;
	let y1 = y + sin(Angle) * n;
	let grvAngle = GetAngleToPlayer;
	let grvSpeed = level * 0.006 + 0.014;
	let angle = 90 + rand(-12,12);
	GravityShot(x1,y1,2,angle,grvSpeed,grvAngle+rand(-4,4),RED04,20);
	GravityShot(x1,y1,2,angle+45,grvSpeed,grvAngle+rand(-4,4),ORANGE04,20);
	GravityShot(x1,y1,2,angle+90,grvSpeed,grvAngle+rand(-4,4),YELLOW04,20);
	GravityShot(x1,y1,2,angle+135,grvSpeed,grvAngle+rand(-4,4),GREEN04,20);
	GravityShot(x1,y1,2,angle+180,grvSpeed,grvAngle+rand(-4,4),AQUA04,20);
	GravityShot(x1,y1,2,angle+225,grvSpeed,grvAngle+rand(-4,4),BLUE04,20);
	GravityShot(x1,y1,2,angle+270,grvSpeed,grvAngle+rand(-4,4),PURPLE04,20);
	GravityShot(x1,y1,2,angle+315,grvSpeed,grvAngle+rand(-4,4),WHITE04,20);
	GravityShot(x1,y1,2,angle+22.5,grvSpeed,grvAngle+rand(-4,4),RED04,20);
	GravityShot(x1,y1,2,angle+67.5,grvSpeed,grvAngle+rand(-4,4),ORANGE04,20);
	GravityShot(x1,y1,2,angle+112.5,grvSpeed,grvAngle+rand(-4,4),YELLOW04,20);
	GravityShot(x1,y1,2,angle+157.5,grvSpeed,grvAngle+rand(-4,4),GREEN04,20);
	GravityShot(x1,y1,2,angle+202.5,grvSpeed,grvAngle+rand(-4,4),AQUA04,20);
	GravityShot(x1,y1,2,angle+247.5,grvSpeed,grvAngle+rand(-4,4),BLUE04,20);
	GravityShot(x1,y1,2,angle+292.5,grvSpeed,grvAngle+rand(-4,4),PURPLE04,20);
	GravityShot(x1,y1,2,angle+337.5,grvSpeed,grvAngle+rand(-4,4),WHITE04,20);
	if(level >= 2){
	GravityShot(x1,y1,1,angle,grvSpeed/3,grvAngle+rand(-4,4),RED05,20);
	GravityShot(x1,y1,1,angle+45,grvSpeed/3,grvAngle+rand(-4,4),ORANGE05,20);
	GravityShot(x1,y1,1,angle+90,grvSpeed/3,grvAngle+rand(-4,4),YELLOW05,20);
	GravityShot(x1,y1,1,angle+135,grvSpeed/3,grvAngle+rand(-4,4),GREEN05,20);
	GravityShot(x1,y1,1,angle+180,grvSpeed/3,grvAngle+rand(-4,4),AQUA05,20);
	GravityShot(x1,y1,1,angle+225,grvSpeed/3,grvAngle+rand(-4,4),BLUE05,20);
	GravityShot(x1,y1,1,angle+270,grvSpeed/3,grvAngle+rand(-4,4),PURPLE05,20);
	GravityShot(x1,y1,1,angle+315,grvSpeed/3,grvAngle+rand(-4,4),WHITE05,20);
	GravityShot(x1,y1,1,angle+22.5,grvSpeed,grvAngle+rand(-4,4),RED05,20);
	GravityShot(x1,y1,1,angle+67.5,grvSpeed,grvAngle+rand(-4,4),ORANGE05,20);
	GravityShot(x1,y1,1,angle+112.5,grvSpeed,grvAngle+rand(-4,4),YELLOW05,20);
	GravityShot(x1,y1,1,angle+157.5,grvSpeed,grvAngle+rand(-4,4),GREEN05,20);
	GravityShot(x1,y1,1,angle+202.5,grvSpeed,grvAngle+rand(-4,4),AQUA05,20);
	GravityShot(x1,y1,1,angle+247.5,grvSpeed,grvAngle+rand(-4,4),BLUE05,20);
	GravityShot(x1,y1,1,angle+292.5,grvSpeed,grvAngle+rand(-4,4),PURPLE05,20);
	GravityShot(x1,y1,1,angle+337.5,grvSpeed,grvAngle+rand(-4,4),WHITE05,20);
	}
	}

	Wait(200);
	loop{
	loop(level + 2){
	if(level <= 1){
	GravityToPlayerAllShot(GetX,GetY,0,0,level);
	GravityToPlayerAllShot(GetX,GetY,96,0,level);
	GravityToPlayerAllShot(GetX,GetY,96,300,level);
	GravityToPlayerAllShot(GetX,GetY,96,240,level);
	GravityToPlayerAllShot(GetX,GetY,96,180,level);
	}
	if(level == 1){
	GravityToPlayerAllShot(GetX,GetY,128,240,level);
	GravityToPlayerAllShot(GetX,GetY,128,300,level);
	}
	if(level >= 2){
	GravityToPlayerAllShot(GetX,GetY,0,0,level);
	GravityToPlayerAllShot(GetX,GetY,72,0,level);;
	GravityToPlayerAllShot(GetX,GetY,72,180,level);
	GravityToPlayerAllShot(GetX,GetY,72,240,level);
	GravityToPlayerAllShot(GetX,GetY,72,300,level);
	GravityToPlayerAllShot(GetClipMinX,GetClipMinY,0,0,level);
	GravityToPlayerAllShot(GetClipMaxX,GetClipMinY,0,0,level);
	GravityToPlayerAllShot(GetCenterX,GetClipMinY,0,0,level);
	}
	if(level == 3){
	GravityToPlayerAllShot(GetX,GetY,100,0,level);;
	GravityToPlayerAllShot(GetX,GetY,100,180,level);
	GravityToPlayerAllShot(GetX,GetY,100,240,level);
	GravityToPlayerAllShot(GetX,GetY,100,300,level);
	GravityToPlayerAllShot(GetX,GetY,72,60,level);
	GravityToPlayerAllShot(GetX,GetY,72,120,level)
	}
	loop(70){yield;}
	}
	if(level >= 3){Allshot(2,90,18+level*9,PURPLE03,20);}
	if(level >= 2){Allshot(1.5,90,18+level*9,PURPLE03,20);}
	if(level >= 1){Allshot(1,90,18+level*9,PURPLE03,20);}
	loop(110){yield;}
	}
	}

}