#TouhouDanmakufu
#Title[SatoriNonSpell N]
#Text[Nonspell]
#BackGround[User(.\img\stage.png,0,-0.5)]
#PlayLevel[Extra]
#Player[FREE]
#BGM[.\Heartfelt Fancy.mp3]
#ScriptVersion[2]

script_enemy_main
{
#include_function ".\Library.dnh"

let SatoriSprite = csd~"img/Satori/SatoriSprite.png";

@Initialize
	{
	LoadUserShotData(csd~"Shot.txt");
	LoadGraphic(SatoriSprite);
	SetLife(8000);
	SetEnemyMarker(true);
	SetDamageRate(10,10);
	SetTimer(71);
	//let a=0;
	SetEffectForZeroLife(60,0,0);	
	SetDurableSpellCard;
	LastSpell;

MainTask;
Vulnerable;
Timer;
IdleSatori;
//MoveAbout;
SetMovePosition03(GetCenterX, GetCenterY - 100, 30,10);
}

task Vulnerable
{
Wait(1200);
SetDamageRate(50,50);
}


task MainTask
{
Wait(120);

loop
	{
	let angle = rand(0,360);
	
	PlaySE(Shot2);

	Wait(20);
	let a=0;
	let t=0;
	loop(8000)
		{
		t++;
		if(t%400==99){ascent(j in 0..2){ascent(i in 0..16){CreateShot02(GetX,GetY,3,22.5*i,-0.2,1,229+j,180*j+30-10*(-1)^i)}};ascent(i in 0..12)
		{
		Wait(10);
		}}
		let r=30;
		let R=-90;
		let j=1;
		let s=1.724;
		let S=16.189;
		let v=1.4;
		ascent(i in 0..j){CreateShot02(GetX+cos(S*(a+v/j*i))*r+cos(s*(a+v/j*i))*R,GetY+sin(S*(a+v/j*i))*r+sin(s*(a+v/j*i))*R,2,1*(a+v/j*i),-0.1,1,56,10);
			CreateShot02(GetX-cos(S*(a+v/j*i))*r-cos(s*(a+v/j*i))*R,GetY+sin(S*(a+v/j*i))*r+sin(s*(a+v/j*i))*R,2,180-1*(a+v/j*i),-0.1,1,58,10);
			CreateShot02(GetX+cos(S*(a+v/j*i))*r+cos(s*(a+v/j*i))*R,GetY-sin(S*(a+v/j*i))*r-sin(s*(a+v/j*i))*R,2,1*(a+v/j*i),-0.1,1,60,10);
			CreateShot02(GetX-cos(S*(a+v/j*i))*r-cos(s*(a+v/j*i))*R,GetY-sin(S*(a+v/j*i))*r-sin(s*(a+v/j*i))*R,2,180-1*(a+v/j*i),-0.1,1,57,10);}
		
		
		a=a+v;
		angle += rand(0,360);
		yield;
		}
	Wait(60);
	}
}

task MoveAbout
{
SetMovePosition02(GetCenterX,GetCenterY-120,60);
MoveSatori;
loop
	{
	Wait(250);
	SetMovePositionRandom01(64,64,1,GetClipMinX+64,GetClipMinY+64,GetClipMaxX-64,GetClipMinY+128);
	MoveSatori;
	Wait(150);
	}
}

@MainLoop
	{
	SetCollisionA(GetX,GetY,16);
	SetCollisionB(GetX,GetY,20);
	yield;
	}



@DrawLoop
	{
	SetAlpha(255);
	if (bossflip==0){SetGraphicScale(1,1);}
	if (bossflip==1){SetGraphicScale(-1,1);}
	SetColor(255,255,255);
	SetGraphicAngle(0,0,0);
	SetTexture(SatoriSprite);
	SetGraphicRect(BR[0],BR[1],BR[2],BR[3]);
	DrawGraphic(GetX,GetY);
	}

@Finalize
	{
	DeleteGraphic(SatoriSprite);
	}

}