#“Œ•û’e–‹•—
#Title[Nothing Can Damn My Soul]
#Text[]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main {
	#include_function ".\lib\lib_anime_Reisen.txt"
	#include_function ".\lib\function.txt"
	#include_function ".\boss.txt"
	let csd		=GetCurrentScriptDirectory;
	let shotData	=csd ~ ".\shot.txt";
	let imgBoss	=csd ~ "img\dot_reisen.png";
	let imgBG1	=csd ~ "img\maho1.png";
	let imgBG2	=csd ~ "img\maho2.png";
	let BGn		=0;
	let xIni	=GetCenterX;
	let yIni	=GetClipMinY + 100;
	let count	=0;
	@Initialize {
        CutIn(YOUMU,"Nothing Can Damn My Soul", "", 0, 0, 0, 0);
        SetLife(2800);
	SetTimer(40);
	SetScore(100000);
	SetDamageRate(5, 5);
	InitializeAction();
	LoadUserShotData(shotData);
	LoadGraphic(imgBoss);
	LoadGraphic(imgBG1);
	LoadGraphic(imgBG2);
        TMain;
	}

	@MainLoop {
	BGn++;
        SetCollisionA(GetX, GetY, 32);
        SetCollisionB(GetX, GetY, 16);
	count++;
	yield;
	}

	@DrawLoop {
	SetColor(255,255,255);
	SetGraphicScale(1,1);
	SetAlpha(255);
	SetGraphicAngle(0,0,0);
	DrawBoss(imgBoss);
	BG;
	}

	@Finalize{
	}

    task TMain {
	yield;
	SetMovePosition02(GetCenterX, GetClipMinY + 100, 90);
	wait(90);
	SetDamageRate(80,100);
	moveA;
	shotA;
	wait(180);
	shotC;
	wait(180);
	loop{
	shotB(1);
	wait(60);
	shotB(-1);
	wait(60);
	}
	}

	task shotA{
	loop{
			wayShot(GetX+20,GetY,2.5,GetAngleToPlayer,5,72,30,22,10);
			wayShot(GetX+20,GetY,2.6,GetAngleToPlayer,5,72,30,22,10);
			wayShot(GetX-20,GetY,2,GetAngleToPlayer,5,72,30,46,10);
			wayShot(GetX-20,GetY,2.1,GetAngleToPlayer,5,72,30,46,10);

		wait(50);
	}
	}

	task shotC{
	let A=30;
	loop{
		loop(6){
		A+=60;
			wayShot(GetX,GetY,3,GetAngleToPlayer+A,2,23,30,14,10);
			wayShot(GetX,GetY,3.2,GetAngleToPlayer+A,2,23,30,14,10);
			wayShot(GetX,GetY,3.4,GetAngleToPlayer+A,2,23,30,14,10);
			wayShot(GetX,GetY,3.6,GetAngleToPlayer+A,2,23,30,14,10);
		}
		wait(60);
	}
	}

	task shotB(A){
	let Ang=-90;
	let S=3;
		loop(180){
			wayShot(GetX,GetY,S,Ang,3,3,40,62,10);
		wait(2);
		Ang+=1*A;
		if(S<=7){S+=0.1;}
		}
	}



	task moveA {
		let angle=90;
		let len=0;
		let A=rand(-1,1);
		loop{
			SetX(GetCenterX+cos(angle)*50);
			SetY(GetClipMinY+100+sin(angle)*len);
		yield;
		if(A>0){angle+=1;}
		if(A<=0){angle-=1;}
		if(len<=20){len+=0.1;}
		}
	}

function GetGapAngle(
	let x1,
	let y1,
	let x2,
	let y2
){
	return atan2(y2-y1,x2-x1);
}

}
