#搶曽抏枊晽
#Title[俻俤俢夵乽係俋俆擭偺寣偺攇栦乿]
#Text[]
#Image[]
#BackGround[]
#PlayLevel[]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main
{
#include_function ".\僼儔儞僪乕儖.txt"

	let name    = "俻俤俢夵乽係俋俆擭偺寣偺攇栦乿";

	//弶婜埵抲
	let xini    =GetCenterX;
	let yini    =GetCenterY;

	@Initialize{
	CutIn(YOUMU,name,"",0,0,0,0);
	SetX(GetCenterX);
	SetY(GetClipMinY + 120);
	SetLife(9999);
	SetTimer(140);
	SetScore(5000000);
	if(GetPlayerType()==REIMU_A)
	{SetDamageRate(100,0);}
	else{SetDamageRate(200,0);}

	LoadGraphic(imgboss);
	SetTexture(imgboss);
	SetGraphicRect(0,0,127,127);
	SetInvincibility(90);
	Shot();
	Move();
	}

	@MainLoop{
	if(OnBomb() == false){
	SetCollisionA(GetX,GetY,48);
	SetCollisionB(GetX,GetY,24);}

	//EX晽儃儉僶儕傾
	if(OnBomb() == true){SetInvincibility(1);}
	yield;
	}

	@DrawLoop{
	DrawGraphic(GetX,GetY);
	}

	@Finalize{
	DeleteGraphic(imgboss);
	}

	task Move(){
	loop{
	loop(180){yield;}
	SetMovePosition02(rand(96,352),rand(70,140),60);
	}
	}

	task BloodShot(atk){
	let j = 1;
	loop(150){yield;}
	loop{
	while(j<= atk){
	CreateShotA(1,GetX,GetY,10);
	SetShotDataA(1,0,rand(0.1,0.3),rand(0,360),0,rand(0,0.05),3,RED12);
	j++;
	FireShot(1);}
	loop(120){yield;}
	j = 1;
	}
	}

	task Shot(){
	BloodShot(50);
	let angle;
	let Rank;
	loop(90){yield;}
	loop{
	Rank = 10000 - GetLife + GetPlayerLife * 2000;
	if(GetTimer <= 30){Rank = 25000;}
	angle = rand(0,360);
	loop(36){
	ReflectShot(GetX,GetY,2,angle,2,true,true,true,false,WHITE23,0);
	angle += 10;
	}
	loop(150 - Rank / 200){yield;}
	}
	}
}