#東方弾幕風
#Title[No.023　「主守りし上海人形　-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(1750);
	SetTimer(49);
	SetScore(2000000 + spellbonus);
	SetDamageRate(50,10);
	SetInvincibility(240);

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

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

	yield;
	}

	@DrawLoop{
	DrawGraphic(GetX,GetY);
	}

	@Finalize{
	DeleteGraphic(imgboss2);
	MasicPointAddSpellCard();
	loop(18 + 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(){
	loop{
	loop(100){yield;}
	SetMovePosition02(GetPlayerX,GetClipMinY + 120,30);
	}
	}

	task Shot(level){
	function Wait(time){loop(time){yield;}}
	Wait(60);
	CreateEnemyFromScript("SYANHAIDOLL",0,0,0,0,level);
	loop{
	yield;
	}
	}
}

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

	@Initialize{
	SetX(GetCenterX);
	SetY(GetCenterY);
	SetLife(1000);
	SetScore(10000);
	SetDamageRate(0,0);

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

	@MainLoop{
	ChackBonus;

	yield;
	}

	@DrawLoop{
	DrawGraphic(GetX,GetY);
	}

	@Finalize{
	MasicPointAddNormal(3);
	}

	task Move(){
	loop{
	yield;
	}
	}

	task Shot(level){
	let angle = 90;
	function Wait(time){loop(time){yield;}}
	function Laser(angle){
	CreateLaserB(100,350,60,RED12,60);
	SetLaserDataB(100,0,0,0,0,0,0,angle,0);
	SetLaserDataB(100,40,0,0,0,0,0,NULL,0.2);
	FireShot(100);}
	Wait(30);
	loop(level + 1){
	Laser(angle);
	angle += 360 / (level + 1);
	}
	Wait(170);
	angle = 90;
	loop{
	Allshot(2,angle,level * 8 + 24,BLUE21,15);
	Wait(40 - level * 5);
	angle -= 10 - level * 2;
	}
	}
}