#東方弾幕風
#Title[No.035　「スローコンフュ　-Normal-」]
#Text[]
#Image[]
#BackGround[]
#PlayLevel[]
#Player[FREE]
#ScriptVersion[2]

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

	let name    = "「スローコンフュ　-Normal-」";

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

	@Initialize{
	SetCommonData("ON_SPELL",1);
	CutIn(YOUMU,name,"",0,0,0,0);
	SetX(GetCenterX);
	SetY(GetClipMinY + 120);
	SetLife(4000);
	SetTimer(99);
	SetScore(3500000 + spellbonus);
	SetDamageRate(50,10);
	SetInvincibility(180);

	LoadGraphic(imgboss32);
	SetTexture(imgboss32);
	SetGraphicRect(0,0,127,127);
	Shot(1);
	Move(1);
	}

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

	yield;
	}

	@DrawLoop{
	DrawGraphic(GetX,GetY);
	}

	@Finalize{
	DeleteGraphic(imgboss32);
	MasicPointAddSpellCard;
	loop(24 + scorebonus){
	let x = rand(GetX-32,GetX+32);
	let y = rand(GetY-32,GetY+32);
	CreateItem(ITEM_SCORE,x,y);}
	SetCommonData("ON_SPELL",0);
	}

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

	Wait(30);
	loop{
	Wait(180 + level * 30);
	SetMovePositionRandom01(rand_int(-2,2)*32,rand(-16,16),1,GetClipMinX + 64,GetClipMinY,GetClipMaxX - 64,128);
	Wait(90 + level * 30);
	}
	}

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

	function RShot(atk,angle,speed){
	let angleA = angle;
	loop(atk){ReflectShot( GetX, GetY, 1, angleA , 1, true, true, true, false, BLUE32, 0 );
	angleA++;}
	}

	task KoteiKnife(level){
	let angle = 90;
	loop{
	CreateShot01(GetX,GetY,4,angle,PURPLE32,10);
	CreateShot01(GetX,GetY,4,angle+180,PURPLE32,10);
	if(level == 1||level == 3){
	CreateShot01(GetX,GetY,4,angle+90,PURPLE32,10);
	CreateShot01(GetX,GetY,4,angle-90,PURPLE32,10);
	}
	if(level == 2){
	CreateShot01(GetX,GetY,4,angle+60,PURPLE32,10);
	CreateShot01(GetX,GetY,4,angle-60,PURPLE32,10);
	CreateShot01(GetX,GetY,4,angle+120,PURPLE32,10);
	CreateShot01(GetX,GetY,4,angle-120,PURPLE32,10);
	}
	if(level == 3){
	CreateShot01(GetX,GetY,4,angle+45,PURPLE32,10);
	CreateShot01(GetX,GetY,4,angle-45,PURPLE32,10);
	CreateShot01(GetX,GetY,4,angle+135,PURPLE32,10);
	CreateShot01(GetX,GetY,4,angle-135,PURPLE32,10);
	}
	angle += 3.4;
	loop(6 - level){yield;}
	}
	}

	Wait(120);
	KoteiKnife(level);
	loop{
	Allshot(0.5+level,rand(0,360),20 + 10 * level,RED32,15);
	Allshot(3+level,rand(0,360),20 + 10 * level,RED32,15);
	Slow(1);
	Wait(60);
	Slow(2);
	loop(4 + level * 6){RShot(rand_int(2,3+level*2),rand(0,360),1);Wait(6);}
	Wait(30);
	Slow(1);
	Wait(30);
	Allshot(0.5+level,rand(0,360),20 + 10 * level,RED32,15);
	Allshot(3+level,rand(0,360),20 + 10 * level,RED32,15);
	Slow(0);
	Wait(60);
	Slow(2);
	loop(4 + level * 6){RShot(rand_int(2,3+level*2),rand(0,360),1);Wait(6);}
	Wait(30);
	Allshot(0.5+level,rand(0,360),20 + 10 * level,RED32,15);
	Allshot(3+level,rand(0,360),20 + 10 * level,RED32,15);
	Slow(0);
	Wait(60);
	Slow(1);
	loop(4 + level * 6){RShot(rand_int(2,3+level*2),rand(0,360),1);Wait(6);}
	Wait(30);
	Slow(2);
	Wait(30);
	Allshot(0.5+level,rand(0,360),20 + 10 * level,RED32,15);
	Allshot(3+level,rand(0,360),20 + 10 * level,RED32,15);
	Slow(0);
	Wait(120);
	Slow(1);
	loop(4 + level * 6){RShot(rand_int(2,3+level*2),rand(0,360),1);Wait(6);}
	Wait(30);
	Allshot(0.5+level,rand(0,360),20 + 10 * level,RED32,15);
	Allshot(3+level,rand(0,360),20 + 10 * level,RED32,15);
	Slow(0);
	Wait(60);
	Slow(2);
	loop(4 + level * 6){RShot(rand_int(2,3+level*2),rand(0,360),1);Wait(6);}
	Wait(30);
	Slow(0);
	Wait(30);
	Allshot(0.5+level,rand(0,360),20 + 10 * level,RED32,15);
	Allshot(3+level,rand(0,360),20 + 10 * level,RED32,15);
	Slow(2);
	Wait(60);
	Slow(1);
	loop(4 + level * 6){RShot(rand_int(2,3+level*2),rand(0,360),1);Wait(6);}
	Wait(30);
	Allshot(0.5+level,rand(0,360),20 + 10 * level,RED32,15);
	Allshot(3+level,rand(0,360),20 + 10 * level,RED32,15);
	Slow(2);
	Wait(60);
	Slow(0);
	loop(4 + level * 6){RShot(rand_int(2,3+level*2),rand(0,360),1);Wait(6);}
	Wait(30);
	Slow(1);
	Wait(30);
	Allshot(0.5+level,rand(0,360),20 + 10 * level,RED32,15);
	Allshot(3+level,rand(0,360),20 + 10 * level,RED32,15);
	Slow(2);
	Wait(60);
	Slow(0);
	loop(4 + level * 6){RShot(rand_int(2,3+level*2),rand(0,360),1);Wait(6);}
	Wait(30);
	}
	}
}