#e
#Title[z剃V]
#Text[]
#BackGround[User(.\img\Sky.png,0,0)]
#BGM[]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main {
	let csd		=GetCurrentScriptDirectory;
	let shotData	=csd ~ "img\shot_All.txt";
	let imgBoss	=csd ~ "img\Boss\.png";
	let Back	=csd ~ "img\Sky.png";

	@Initialize {
        SetLife(1);
	SetScore(40000);
	SetDamageRate(0, 0);
	InitializeAction();
	LoadUserShotData(shotData);
	LoadGraphic(imgBoss);
	LoadGraphic(Back);
	Load;
	Expert;
        CutIn(YOUMU,"uȉiv", NULL, 0, 0, 0, 0);
        Main;
	}

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

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

	@BackGround {
	SetTexture(Back);
	SetGraphicRect(0, 0, 384, 457);
	SetGraphicAngle(0, 0, 0);
	DrawGraphic(224, 240);
	}

    task Main {
	yield;
	Att;
}

task Att{
	CreateEnemyFromScript("TEWI", 84, 484, 0, 0, 0);
	CreateEnemyFromScript("REISEN", 364, 484, 0, 0, 0);
	CreateEnemyFromScript("EIRIN", 124, -20, 0, 0, 0);
	CreateEnemyFromScript("KAGUYA", 324, -20, 0, 0, 0);
	wait(590);
	AddLife(-1);	
}

	@Finalize{
	DeleteGraphic(imgBoss);
	Delete;
	}

	#include_function ".\lib\lib_anime_Sakuya.txt"
	#include_function ".\lib_Functions.txt"
}


script_enemy TEWI{
	let csd     = GetCurrentScriptDirectory;
	let shotData	=csd ~ "img\shot_All.txt";
	let imgBoss  = csd ~ "img\Boss\dot_tewi.png";

	@Initialize{
        SetLife(1);
	SetDamageRate(0, 0);
	InitializeAction();
	LoadUserShotData(shotData);
	LoadGraphic(imgBoss);
	Load;
	Main;
	}

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

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

task	Main{
	yield;
	standBy;
	Att;	
}

	sub standBy{
		SetMovePosition03(94, 120, 10, 7);
		SetAction(ACT_MOVE, 60);
		wait(60);
}

task Att{
	SetAction(ACT_SHOT_A, 240);
	shot;
	wait(240);
	SetAngle(-45);
	SetSpeed(7);
	SetAction(ACT_MOVE_R, 600);
}

task shot{
	let A=0;
	loop(8){
	let angle=0;
	while(angle<360){
	CreateShotA(1, GetX, GetY, 0);
	SetShotDataA(1, 0, 4, angle+A, 0, 0, 1, 67);
	SetShotDataA(1, 60, 2, NULL, 0.5, 0, 1, 68);
	FireShot(1);
	angle+=10;
	}
	A+=2;
	wait(20);
	}
}

	@Finalize{
	DeleteGraphic(imgBoss);
	Delete;
	}

	#include_function ".\lib\lib_anime_Tewi.txt"
	#include_function ".\lib_Functions.txt"
}


script_enemy REISEN{
	let csd     = GetCurrentScriptDirectory;
	let shotData	=csd ~ "img\shot_All.txt";
	let imgBoss  = csd ~ "img\Boss\dot_reisen.png";

	@Initialize{
        SetLife(1);
	SetDamageRate(0, 0);
	InitializeAction();
	LoadUserShotData(shotData);
	LoadGraphic(imgBoss);
	Load;
	Main;
	}

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

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

task	Main{
	yield;
	standBy;
	Att;	
}

	sub standBy{
		SetMovePosition03(354, 120, 10, 7);
		SetAction(ACT_MOVE, 60);
		wait(60);
}

task Att{
	SetAction(ACT_SHOT_A, 240);
	shot;
	wait(240);
	SetAngle(-45);
	SetSpeed(7);
	SetAction(ACT_MOVE_R, 600);
}

task shot{
	let A=0;
	loop(8){
	let angle=0;
	while(angle<360){
	CreateShotA(1, GetX, GetY, 0);
	SetShotDataA(1, 0, 8, angle+A, 0, 0, 1, 57);
	SetShotDataA(1, 30, 1, NULL, 0, 0, 1, 62);
	FireShot(1);
	angle+=5;
	}
	A+=2;
	wait(20);
	}
}

	@Finalize{
	DeleteGraphic(imgBoss);
	Delete;
	}

	#include_function ".\lib\lib_anime_Reisen.txt"
	#include_function ".\lib_Functions.txt"
}


script_enemy EIRIN{
	let csd     = GetCurrentScriptDirectory;
	let shotData	=csd ~ "img\shot_All.txt";
	let imgBoss  = csd ~ "img\Boss\dot_eirin.png";

	@Initialize{
        SetLife(1);
	SetDamageRate(0, 0);
	InitializeAction();
	LoadUserShotData(shotData);
	LoadGraphic(imgBoss);
	Load;
	Main;
	}

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

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

task	Main{
	yield;
	wait(180);
	standBy;
	Att;	
}

	sub standBy{
		SetMovePosition03(224, 150, 10, 7);
		SetAction(ACT_MOVE, 60);
		wait(60);
}

task Att{
	SetAction(ACT_SHOT_B, 220);
	wait(220);
	let angle=GetAngleToPlayer;
	CreateLaser01(GetX, GetY, 6, angle, 400, 40, AQUA01, 0);
	CreateLaser01(GetX, GetY, 6, angle+60, 400, 40, AQUA01, 0);
	CreateLaser01(GetX, GetY, 6, angle-60, 400, 40, AQUA01, 0);
	wait(40);
	SetAngle(-45);
	SetSpeed(7);
	SetAction(ACT_MOVE_R, 600);
}

	@Finalize{
	DeleteGraphic(imgBoss);
	Delete;
	}

	#include_function ".\lib\lib_anime_Yuyuko.txt"
	#include_function ".\lib_Functions.txt"
}


script_enemy KAGUYA{
	let csd     = GetCurrentScriptDirectory;
	let shotData	=csd ~ "img\shot_All.txt";
	let imgBoss  = csd ~ "img\Boss\dot_kaguya.png";

	@Initialize{
        SetLife(1);
	SetDamageRate(0, 0);
	InitializeAction();
	LoadUserShotData(shotData);
	LoadGraphic(imgBoss);
	Load;
	Main;
	}

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

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

task Main{
	yield;
	wait(180);
	standBy;
	Att;	
}

	sub standBy{
		SetMovePosition03(224, 60, 10, 7);
		SetAction(ACT_MOVE, 60);
		wait(60);
}

task Att{
	SetAction(ACT_SHOT_B, 240);
	shotA;
	shotB;
	shotC;
	shotD;
	wait(280);
	SetAngle(-135);
	SetSpeed(7);
	SetAction(ACT_MOVE_L, 600);
}

task shotA{
	loop{
	let angle=0;
	while(angle<360){
	CreateGravityShot( 224+220*sin(angle), 16, 0, 90, 9, 0.1, 2);
	wait(3);
	angle+=5;
	}
	yield;
	}
}

task shotB{
	loop{
	let angle=0;
	while(angle<360){
	CreateGravityShot( 224-220*sin(angle), 16, 0, 90, 11, 0.1, 2);
	wait(2);
	angle+=12;
	}
	yield;
	}
}

task shotC{
	loop{
	let angle=0;
	while(angle<360){
	CreateGravityShot( 224-220*sin(angle), 16, 0, 270, 12, 0.1, 1.5);
	wait(3);
	angle+=6;
	}
	yield;
	}
}

task shotD{
	loop{
	let angle=0;
	while(angle<360){
	CreateGravityShot( 224+220*sin(angle), 16, 0, 90, 14, 0.1, 2.5);
	wait(1);
	angle+=9;
	}
	yield;
	}
}

task CreateGravityShot( x, y, speed, angle, color, gravity, limit) {
	let Obj = Obj_Create(OBJ_SHOT);
	let g   = gravity;

	Obj_SetPosition(Obj, x, y);
	Obj_SetAngle(Obj, angle);
	ObjShot_SetGraphic(Obj, color);
	ObjShot_SetDelay(Obj, 10);

	let vX = speed * cos(angle);
	let vY = speed * sin(angle);

	wait(10);

	while(Obj_BeDeleted(Obj)==false) {
		Obj_SetPosition(Obj, Obj_GetX(Obj) + vX, Obj_GetY(Obj) + vY);
		Obj_SetAngle(Obj, atan2(vY, vX));

		if(vY < limit) { vY = vY + g;
		} else { vY = limit;
		}

		yield;
	}
}

	@Finalize{
	DeleteGraphic(imgBoss);
	Delete;
	}

	#include_function ".\lib\lib_anime_Eiki.txt"
	#include_function ".\lib_Functions.txt"
}