#東方弾幕風
#Title[No.117 禁魔「心壊しの扉-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{
	CutIn(YOUMU,name,"",0,0,0,0);
	SetX(xini);
	SetY(yini);
	SetLife(1);
	SetTimer(69);
	SetScore(10000000 + spellbonus * 3);
	SetDamageRate(0,0);
	SetDurableSpellCard();

	LoadGraphic(imgboss62);
	SetTexture(imgboss62);
	SetGraphicRect(0,0,127,127);
	Shot();
	}

	@MainLoop{
	ChackBonus;
	yield;
	}

	@DrawLoop{
	DrawGraphic(GetX,GetY);
	}

	@Finalize{
	DeleteGraphic(imgboss62);
	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 GateA(){
	let x;
	let x1 = GetClipMinX;
	let x2 = GetClipMaxX;
	let x3;
	let x4;
	let y = GetClipMinY;
	let angle = 90;
	loop(100){yield;}
	x3 = 179;
	loop{
	x4 = x3 + 90;
	x = x1;
	while(x < x3){
	CreateShot01(x,y,2,angle,BLUE31,10);
	x += 8;
	}
	x = x4;
	while(x < x2){
	CreateShot01(x,y,2,angle,BLUE31,10);
	x += 8;
	}
	loop(300){yield;}
	x3 -= 10;
	}
	}

	task GateB(){
	let x;
	let x1 = GetClipMinX;
	let x2 = GetClipMaxX;
	let x3;
	let x4;
	let y = GetClipMaxY;
	let angle = -90;
	loop(250){yield;}
	x3 = GetClipMaxX - 100;
	loop{
	x4 = x3 + 90;
	x = x1;
	while(x < x3){
	CreateShot01(x,y,2,angle,BLUE31,10);
	x += 8;
	}
	x = x4;
	while(x < x2){
	CreateShot01(x,y,2,angle,BLUE31,10);
	x += 8;
	}
	loop(300){yield;}
	x3 -= 10;
	}
	}

	task GateC(){
	let y;
	let y1 = GetClipMinY;
	let y2 = GetClipMaxY;
	let y3;
	let y4;
	let x = GetClipMinX;
	let angle = 0;
	loop(175){yield;}
	y3 = 280;
	loop{
	y4 = y3 + 90;
	y = y1;
	while(y < y3){
	CreateShot01(x,y,2,angle,BLUE31,10);
	y += 8;
	}
	y = y4;
	while(y < y2){
	CreateShot01(x,y,2,angle,BLUE31,10);
	y += 8;
	}
	loop(300){yield;}
	y3 -= 6.357;
	}
	}

	task GateD(){
	let y;
	let y1 = GetClipMinY;
	let y2 = GetClipMaxY;
	let y3;
	let y4;
	let x = GetClipMaxX;
	let angle = 180;
	loop(325){yield;}
	y3 = GetClipMinY + 104;
	loop{
	y4 = y3 + 90;
	y = y1;
	while(y < y3){
	CreateShot01(x,y,2,angle,BLUE31,10);
	y += 8;
	}
	y = y4;
	while(y < y2){
	CreateShot01(x,y,2,angle,BLUE31,10);
	y += 8;
	}
	loop(300){yield;}
	y3 += 12;
	}
	}

	task Shot(){
	let angle = 0;
	let angleA = 0;
	let time = GetTimer;
	GateA();
	GateB();
	GateC();
	GateD();
	loop(200){yield;}
	loop{
	Allshot(0.3,angle,16,RED21,10);
	loop(40){
	loop(15){time = GetTimer;yield;}
	if(time <= 60){CreateShot01(GetX+120,GetClipMinY,1,angleA,GREEN04,10);}
	if(time <= 50){CreateShot01(GetX-120,GetClipMaxY,1,180+angleA,GREEN04,10);}
	if(time <= 40){CreateShot01(GetClipMinX,GetY+120,1,-90+angleA,GREEN04,10);}
	if(time <= 30){CreateShot01(GetClipMaxX,GetY-120,1,90+angleA,GREEN04,10);}
	if(time <= 15){
	CreateShot01(GetX+120,GetClipMinY,1,-angleA,BLUE04,10);
	CreateShot01(GetX-120,GetClipMaxY,1,180-angleA,BLUE04,10);
	CreateShot01(GetClipMinX,GetY+120,1,-90-angleA,BLUE04,10);
	CreateShot01(GetClipMaxX,GetY-120,1,90-angleA,BLUE04,10);}
	angleA += 9;
	}
	angleA = 0;
	angle += 5;
	}
	}
}