
#Title[幻影咲夜ボス通常]
#Text[]
#Image[]
#BackGround[]
#PlayLevel[]
#Player[FREE]
#ScriptVersion[2]

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

	@Initialize{
	SetX(GetCenterX);
	SetY(GetClipMinY + 120);
	SetLife(7400);
	SetTimer(69);
	SetDamageRate(200,30);

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

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

	@DrawLoop{
	DrawGraphic(GetX,GetY);
	}

	@Finalize{
	MasicPointAddNormal(4);
	DeleteGraphic(imgboss32);
	DeleteGraphic(imgmagic);
	}

	task Move(){
	loop{
	yield;
	}
	}

	task Shot(level){
	function Wait(time){loop(time){yield;}}
	Wait(60);

	loop{
	let x = GetX;
	let y = GetY;
	CreateEnemyFromScript("MAGICCIRCLE",x,y,0,15,level);
	CreateEnemyFromScript("MAGICCIRCLE",x,y,0,165,level);
	CreateEnemyFromScript("MAGICCIRCLE",x,y,0,30,level);
	CreateEnemyFromScript("MAGICCIRCLE",x,y,0,150,level);
	if(level >= 2){
	CreateEnemyFromScript("MAGICCIRCLE",x,y,0,45,level);
	CreateEnemyFromScript("MAGICCIRCLE",x,y,0,135,level);
	CreateEnemyFromScript("MAGICCIRCLE",x,y,0,-90,level);
	}
	Wait(180);
	let speed = 1;
	while(speed <= 3){
	CreateShot01(GetX+8,GetY,speed,90,RED32,15);
	CreateShot01(GetX+8,GetY,speed,105,RED32,15);
	CreateShot01(GetX+8,GetY,speed,120,RED32,15);
	CreateShot01(GetX-8,GetY,speed,90,RED32,15);
	CreateShot01(GetX-8,GetY,speed,75,RED32,15);
	CreateShot01(GetX-8,GetY,speed,60,RED32,15);
	if(level == 1||level == 3){
	CreateShot01(GetX+8,GetY,speed,-90,RED32,15);
	CreateShot01(GetX+8,GetY,speed,-105,RED32,15);
	CreateShot01(GetX+8,GetY,speed,-120,RED32,15);
	CreateShot01(GetX-8,GetY,speed,-90,RED32,15);
	CreateShot01(GetX-8,GetY,speed,-75,RED32,15);
	CreateShot01(GetX-8,GetY,speed,-60,RED32,15);
	}
	if(level >= 2){
	CreateShot01(GetX,GetY+8,speed,0,RED32,15);
	CreateShot01(GetX,GetY+8,speed,15,RED32,15);
	CreateShot01(GetX,GetY+8,speed,30,RED32,15);
	CreateShot01(GetX,GetY-8,speed,0,RED32,15);
	CreateShot01(GetX,GetY-8,speed,-15,RED32,15);
	CreateShot01(GetX,GetY-8,speed,-30,RED32,15);
	CreateShot01(GetX,GetY+8,speed,180,RED32,15);
	CreateShot01(GetX,GetY+8,speed,195,RED32,15);
	CreateShot01(GetX,GetY+8,speed,210,RED32,15);
	CreateShot01(GetX,GetY-8,speed,180,RED32,15);
	CreateShot01(GetX,GetY-8,speed,165,RED32,15);
	CreateShot01(GetX,GetY-8,speed,150,RED32,15);
	}
	speed += 0.5;
	}
	Wait(60);
	}
	}
}

script_enemy MAGICCIRCLE
{
#include_function ".\弾幕集.txt"

	@Initialize{
	SetX(GetX+64*cos(GetAngle));
	SetY(GetY+64*sin(GetAngle));
	SetLife(1000);
	SetScore(1000);
	SetDamageRate(0,0);

	SetTexture(imgmagic);
	SetGraphicRect(766,0,798,32);
	Shot(GetArgument);
	Move();
	}

	@MainLoop{
	ChackBonus;

	yield;
	}

	@DrawLoop{
	DrawGraphic(GetX,GetY);
	}

	@Finalize{
	}

	task Move(){

	function GetGapX(xA,gapLength,gapAngle){
	return xA + gapLength * cos( gapAngle );
	}

	function GetGapY(xA,gapLength,gapAngle){
	return xA + gapLength * sin( gapAngle );
	}


	loop{
	SetMovePosition02(GetGapX(GetX,2,GetAngle),GetGapY(GetY,2,GetAngle),3);
	loop(3){yield;}
	}
	}

	task Shot(level){
	function Wait(time){loop(time){yield;}}

	task ShotA(level){
	let angle	= 90;
	let way		= [4,6,4,6];
	let speed	= [1,1.5,2,2.5];
	let wait	= [35,30,25,20];
	let bullet	= PURPLE31;

	loop{
	ascent(let i in 0..way[level]){
	CreateShot01(GetX,GetY,speed[level],angle+(360/way[level]*i),bullet,20);
	}
	loop(wait[level]){yield;}
	}
	}

	Wait(45);
	ShotA(level);
	loop{
	yield;
	}
	}
}