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

script_enemy_main
{
#include_function ".\抏枊廤.txt"

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

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

	@Initialize{
	CutIn(YOUMU,name,"",0,0,0,0);
	SetX(GetCenterX);
	SetY(GetClipMinY + 120);
	SetLife(10000);
	SetTimer(140);
	SetScore(20000000 + 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(0);
	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 + 64,GetClipMinY,GetClipMaxX - 64,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(27 + level * 9){
	ReflectShot(GetX,GetY,2,angle,2,true,true,true,false,WHITE23,0);
	angle += 360 / (27 + level * 9);
	}
	loop(160 - Rank / 200){yield;}
	}
	}
}