#搶曽抏枊晽
#Title[No.120 俻俤俢怴乽僽儔僢僪僂僃乕僽係俋俆 -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{
	CutIn(YOUMU,name,"",0,0,0,0);
	SetX(GetCenterX);
	SetY(GetClipMinY + 120);
	SetLife(10000);
	SetTimer(140);
	SetScore(22000000 + spellbonus * 3);
	if(GetPlayerType()==REIMU_A)
	{SetDamageRate(100,0);}
	else{SetDamageRate(150,0);}

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

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

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

	@DrawLoop{
	DrawGraphic(GetX,GetY);
	}


	@Finalize{
	DeleteGraphic(imgboss62);
	MasicPointAddSpellCard;
	loop(180 + scorebonus * 6){
	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(){
	loop{
	loop(180){yield;}
	SetMovePositionRandom01(rand_int(-4,4)*16,rand(-16,16),1,GetClipMinX + 128,GetClipMinY,GetClipMaxX - 128,128);
	}
	}

	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(level){
	BloodShot(30 + level * 20);
	let angle;
	let Rank;
	loop(90){yield;}
	loop{
	Rank = 10000 - GetLife + (GetPlayerLife * (2000 - level * 250));
	if(GetTimer <= 30){Rank = 22500 + level * 2500;}
	angle = rand(0,360);
	loop(2){
	let x = GetX + rand(-64,64);
	let y = GetY + rand(-64,64);
	loop(9 + level * 9){
	ReflectShot(x,y,2,angle,2,true,true,true,false,WHITE23,0);
	angle += 360 / (9 + level * 9);
	}
	}
	loop(160 - Rank / 200){yield;}
	}
	}
}