#東方弾幕風
#Title[「青き魔の館」]
#Text[試作]
#ScriptVersion[2]

script_enemy_main
{//Enemy01
	SetDurableSpellCard;
	let count=0;
	let cx=GetCenterX();//STGシーンの中心x座標を取得
	let cy=GetCenterY();//STGシーンの中心y座標を取得
	let imgExRumia=GetCurrentScriptDirectory~"img\ExRumia.png";
	let imgExRumiaBack=GetCurrentScriptDirectory~"img\ExRumiaBack.png";
	LoadUserShotData(GetCurrentScriptDirectory~"shot.txt");
	@Initialize
	{
		SetScore(30000);
		SetLife(500);
		SetDamageRate(10,8);
		SetTimer(90);
	
		SetGraphicRect(1,1,64,64);
		SetInvincibility(300);
		
		LoadGraphic(imgExRumia);	
		LoadGraphic(imgExRumiaBack);
		Concentration01(60);
		CutIn(YOUMU,"「青き魔の館」",0,0,0,0,0);//スペルカード名表示
	}
	@MainLoop
	{
		let s=0;
		let px=GetPlayerX;
		let py=GetPlayerY;
		SetMovePosition02(cx,cy-120,30);
		function shot(let shotid,let shott,let angle,let tipe,let sp)
		{
			CreateShotA(shotid,GetX,GetY,10);
			SetShotDirectionType(ABSOLUTE);
			SetShotDataA(shotid,0,sp,angle,0,0,2,tipe);
			FireShot(shotid);
		}
		function shot2(let shotid,let shott,let angle,let tipe,let sp)
		{
			CreateShotA(shotid,GetX,GetY,10);
			SetShotDirectionType(ABSOLUTE);
			SetShotDataA(shotid,0,0,GetAngleToPlayer,0,0,2,tipe);
			SetShotDirectionType(PLAYER);
			SetShotDataA(shotid,shott,sp,angle,0,0,2,tipe);
			FireShot(shotid);
		}
		if(GetTimer>85)
		{
			SetCollisionA(GetX(),GetY(),24);
			SetCollisionB(GetX(),GetY(),24);
		}
		if(GetTimer<=85)
		{
			SetMovePosition02(px,py,30);
		}
		if(GetTimer<=84)
		{
			if(count%3==0)
			{
					shot2(s,120,0,30,1);
			}
		}
		if(count==1110)
		{
		Concentration01(60);
		}
		if(GetTimer<=70)
		{
			if(count%3==0)
			{
					shot2(s,120,180,30,1);
			}
			if(count%3==0)
			{
					shot2(s,120,90,30,1);
			}
			if(count%3==0)
			{
					shot2(s,120,-90,30,1);
			}
		}
		if(count==2010)
		{
		Concentration01(60);
		}
		if(GetTimer<=55)
		{
			if(count%3==0)
			{
					shot2(s,120,rand(-90,90),126,1);
			}
		}
		if(count==3510)
		{
		Concentration01(60);
		}
		if(GetTimer<=30)
		{
			if(count%12==0)
			{
					shot2(s,120,0,38,0.4);
			}
		}
		if(count==4410)
		{
		Concentration01(60);
		}
		if(GetTimer<=15)
		{
			if(count%12==0)
			{
					shot2(s,120,0,102,4);
			}
		}
	count++;
	}
	@Finalize
	{//読みこんだファイルを削除
		loop(8)
		{
			CreateItem(ITEM_SCORE,cx+rand(-100,100),rand(20,100));
		}
	}
	
	@DrawLoop
	{
		//Exルーミア描画
		if(GetTimer>=86){SetGraphicRect(64,64,127,127);
		SetAlpha(255);
		SetTexture(imgExRumia);
		DrawGraphic(GetX(),GetY());
		}
	}
}