#e
#Title[z剃PO]
#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(70000);
	SetDamageRate(0, 0);
	InitializeAction();
	LoadUserShotData(shotData);
	LoadGraphic(imgBoss);
	LoadGraphic(Back);
	Load;
	Expert;
        CutIn(YOUMU,"uƈ߁IIv", 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("SATORI", 0, 60, 0, 0, 0);
	CreateEnemyFromScript("KOISI", 224, -20, 0, 0, 0);
	CreateEnemyFromScript("ORIN", 0, -20, 0, 0, 0);
	CreateEnemyFromScript("OKU", 448, -20, 0, 0, 0);
	CreateEnemyFromScript("SANAE", 225, -20, 0, 0, 0);
	CreateEnemyFromScript("KANAKO", 0, 60, 0, 0, 0);
	CreateEnemyFromScript("SUWAKO", 448, 60, 0, 0, 0);
	wait(1200);
	AddLife(-1);	
}

	@Finalize{
	DeleteGraphic(imgBoss);
	Delete;
	}

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


script_enemy SATORI{
	let csd     = GetCurrentScriptDirectory;
	let shotData	=csd ~ "img\shot_All.txt";
	let imgBoss  = csd ~ "img\Boss\dot_satori.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(60);
	Att;	
}

task Att{
	SetAngle(0);
	SetSpeed(2);
	SetAction(ACT_MOVE_R, 600);
	shot;
}

task shot{
	let A=0;
	loop{
	let angle=0;
	while(angle<360){
	CreateShotA(1, GetX, GetY, 0);
	SetShotDataA(1, 0, 5, angle+A, 1, 0, 3, 231);
	FireShot(1);
	angle+=20;
	}
	wait(20);
	yield;
	}
}

	@Finalize{
	DeleteGraphic(imgBoss);
	Delete;
	}

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


script_enemy KOISI{
	let csd     = GetCurrentScriptDirectory;
	let shotData	=csd ~ "img\shot_All.txt";
	let imgBoss  = csd ~ "img\Boss\dot_koisi.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(224, 150, 10, 7);
		SetAction(ACT_MOVE, 60);
		wait(60);
}

task Att{
	SetAction(ACT_SPELL, 240);
	shot;
	wait(240);
	SetAngle(190);
	SetSpeed(7);
	SetAction(ACT_MOVE_L, 600);
}

task shot{
	let A=0;
	loop(22){
	let angle=0;
	while(angle<360){
	CreateShotA(1, GetX, GetY, 0);
	SetShotDataA(1, 0, 3, angle+A, -0.5, 0, 3, 229);
	FireShot(1);
	angle+=20;
	}
	A+=2;
	wait(10);
	yield;
	}
}

	@Finalize{
	DeleteGraphic(imgBoss);
	Delete;
	}

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


script_enemy ORIN{
	let csd     = GetCurrentScriptDirectory;
	let shotData	=csd ~ "img\shot_All.txt";
	let imgBoss  = csd ~ "img\Boss\dot_orin.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(240);
	standBy;
	Att;	
}
	sub standBy{
		SetMovePosition03(104, 120, 10, 7);
		SetAction(ACT_MOVE, 60);
		wait(60);
}

task Att{
	SetAction(ACT_SPELL, 240);
	shotA;
	shotB;
	wait(240);
	SetAngle(10);
	SetSpeed(7);
	SetAction(ACT_MOVE_R, 600);
}

task shotA{
	loop(4){
	let A=0;
	while(A<20){
	let angle=0;
	while(angle<360){
	CreateShotA(1, GetX+30*cos(angle+A), GetY+30*sin(angle+A), 0);
	SetShotDataA(1, 0, 1, angle+A, 0, 0, 3, 225);
	SetShotDataA(1, 60, 1, angle+A, 0, 0.2, 3, 225);
	FireShot(1);
	angle+=20;
	}
	A+=4;
	wait(5);
	}
	wait(30);
	}
}

task shotB{
	wait(30);
	loop(3){
	let A=0;
	while(A<20){
	let angle=0;
	while(angle<360){
	CreateShotA(1, GetX+30*cos(angle+A), GetY-30*sin(angle+A), 0);
	SetShotDataA(1, 0, 1, -angle-A, 0, 0, 3, 230);
	SetShotDataA(1, 60, 1, -angle-A, 0, 0.2, 3, 230);
	FireShot(1);
	angle+=20;
	}
	A+=4;
	wait(5);
	}
	wait(30);
	}
}

	@Finalize{
	DeleteGraphic(imgBoss);
	Delete;
	}

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


script_enemy OKU{
	let csd     = GetCurrentScriptDirectory;
	let shotData	=csd ~ "img\shot_All.txt";
	let imgBoss  = csd ~ "img\Boss\dot_utuho.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(360);
	standBy;
	Att;	
}

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

task Att{
	SetAction(ACT_SUN, 60);
	Caution;
	CreateEnemyFromScript("KAKU", GetX, GetY-60, 0, 0, 0);
	wait(120);
	SetAngle(170);
	SetSpeed(7);
	SetAction(ACT_MOVE_R, 600);
}

	@Finalize{
	DeleteGraphic(imgBoss);
	Delete;
	}

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


script_enemy SANAE{
	let csd     = GetCurrentScriptDirectory;
	let shotData	=csd ~ "img\shot_All.txt";
	let imgBoss  = csd ~ "img\Boss\dot_sanae.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(600);
	standBy;
	Att;	
}
	sub standBy{
		SetMovePosition03(224, 150, 10, 7);
		SetAction(ACT_MOVE, 60);
		wait(60);
}

task Att{
	SetAction(ACT_SHOT_A, 480);
	shot(30);
	wait(30);
	shot(60);
	wait(30);
	shot(90);
	wait(100);
	shot(120);
	wait(30);
	shot(150);
	wait(30);
	shot(180);
	wait(100);
	shot(210);
	wait(30);
	shot(240);
	wait(30);
	shot(270);
	wait(100);
	SetAngle(270);
	SetSpeed(7);
	SetAction(ACT_MOVE_R, 600);
}

task shot(let A){
	shotA(A);
	shotB(A);
	shotC(A);
	shotD(A);
	shotE(A);
	shotF(A);
	shotG(A);
}

task shotA(let A){
	let angle=0;
	while(angle<360){
	CreateShotA(1, GetX, GetY, 0);
	SetShotDataA(1, 0, 1, angle+A, 0, 0, 3, 45);
	SetShotDataA(1, 30, 1, angle+A, 0, 0.1, 2, 45);
	FireShot(1);
	angle+=72;
	}
}

task shotB(let A){
	let angle=0;
	while(angle<360){
	CreateShotA(1, GetX, GetY, 0);
	SetShotDataA(1, 0, 1, angle+A+6, 0, 0, 3, 45);
	SetShotDataA(1, 30, 1, angle+A+6, 0, 0.2, 2.4, 45);
	FireShot(1);
	CreateShotA(1, GetX, GetY, 0);
	SetShotDataA(1, 0, 1, angle+A-6, 0, 0, 3, 45);
	SetShotDataA(1, 30, 1, angle+A-6, 0, 0.2, 2.4, 45);
	FireShot(1);
	angle+=72;
	}
}

task shotC(let A){
	let angle=0;
	while(angle<360){
	CreateShotA(1, GetX, GetY, 0);
	SetShotDataA(1, 0, 1, angle+A+12, 0, 0, 3, 45);
	SetShotDataA(1, 30, 1, angle+A+12, 0, 0.3, 2.8, 45);
	FireShot(1);
	CreateShotA(1, GetX, GetY, 0);
	SetShotDataA(1, 0, 1, angle+A-12, 0, 0, 3, 2);
	SetShotDataA(1, 30, 1, angle+A-12, 0, 0.3, 2.8, 45);
	FireShot(1);
	angle+=72;
	}
}

task shotD(let A){
	let angle=0;
	while(angle<360){
	CreateShotA(1, GetX, GetY, 0);
	SetShotDataA(1, 0, 1, angle+A+18, 0, 0, 3, 45);
	SetShotDataA(1, 30, 1, angle+A+18, 0, 0.4, 3.2, 45);
	FireShot(1);
	CreateShotA(1, GetX, GetY, 0);
	SetShotDataA(1, 0, 1, angle+A-18, 0, 0, 3, 45);
	SetShotDataA(1, 30, 1, angle+A-18, 0, 0.4, 3.2, 45);
	FireShot(1);
	angle+=72;
	}
}

task shotE(let A){
	let angle=0;
	while(angle<360){
	CreateShotA(1, GetX, GetY, 0);
	SetShotDataA(1, 0, 1, angle+A+24, 0, 0, 3, 45);
	SetShotDataA(1, 30, 1, angle+A+24, 0, 0.5, 3.6, 45);
	FireShot(1);
	CreateShotA(1, GetX, GetY, 0);
	SetShotDataA(1, 0, 1, angle+A-24, 0, 0, 3, 45);
	SetShotDataA(1, 30, 1, angle+A-24, 0, 0.5, 3.6, 45);
	FireShot(1);
	angle+=72;
	}
}

task shotF(let A){
	let angle=0;
	while(angle<360){
	CreateShotA(1, GetX, GetY, 0);
	SetShotDataA(1, 0, 1, angle+A+30, 0, 0, 3, 45);
	SetShotDataA(1, 30, 1, angle+A+30, 0, 0.6, 4, 45);
	FireShot(1);
	CreateShotA(1, GetX, GetY, 0);
	SetShotDataA(1, 0, 1, angle+A-30, 0, 0, 3, 45);
	SetShotDataA(1, 30, 1, angle+A-30, 0, 0.6, 4, 45);
	FireShot(1);
	angle+=72;
	}
}

task shotG(let A){
	let angle=0;
	while(angle<360){
	CreateShotA(1, GetX, GetY, 0);
	SetShotDataA(1, 0, 1, angle+A+36, 0, 0, 3, 45);
	SetShotDataA(1, 30, 1, angle+A+36, 0, 0.7, 4.4, 45);
	FireShot(1);
	angle+=72;
	}
}

	@Finalize{
	DeleteGraphic(imgBoss);
	Delete;
	}

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


script_enemy KANAKO{
	let csd     = GetCurrentScriptDirectory;
	let shotData	=csd ~ "img\shot_All.txt";
	let imgBoss  = csd ~ "img\Boss\dot_kanako.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,1.1);
	SetAlpha(255);
	DrawBoss(imgBoss);
	}

task	Main{
	yield;
	wait(600);
	standBy;
	Att;	
}
	sub standBy{
		SetMovePosition03(104, 60, 10, 7);
		SetAction(ACT_MOVE, 60);
		wait(60);
}

task Att{
	SetAction(ACT_SPELL, 480);
	shotA;
	shotB;
	shotC;
	shotD;
	shotE;
	wait(480);
	SetAngle(270);
	SetSpeed(7);
	SetAction(ACT_MOVE_R, 600);
}

task shotA{
	let A=0;
	loop(14){
	let angle=0;
	while(angle<360){
	CreateShot01(GetX+60*sin(0), GetY-60*cos(0), 3, angle+A-6, 89, 0);
	CreateShot01(GetX+60*sin(0), GetY-60*cos(0), 3, angle+A-2, 89, 0);
	CreateShot01(GetX+60*sin(0), GetY-60*cos(0), 3, angle+A+2, 89, 0);
	CreateShot01(GetX+60*sin(0), GetY-60*cos(0), 3, angle+A+6, 89, 0);
	angle+=72;
	}
	A+=10;
	wait(30);
	}
}

task shotB{
	wait(6);
	let A=0;
	loop(14){
	let angle=0;
	while(angle<360){
	CreateShot01(GetX+60*sin(72), GetY-60*cos(72), 3, angle-A-6, 92, 0);
	CreateShot01(GetX+60*sin(72), GetY-60*cos(72), 3, angle-A-2, 92, 0);
	CreateShot01(GetX+60*sin(72), GetY-60*cos(72), 3, angle-A+2, 92, 0);
	CreateShot01(GetX+60*sin(72), GetY-60*cos(72), 3, angle-A+6, 92, 0);
	angle+=72;
	}
	A+=25;
	wait(30);
	}
}

task shotC{
	wait(12);
	let A=0;
	loop(14){
	let angle=0;
	while(angle<360){
	CreateShot01(GetX+60*sin(144), GetY-60*cos(144), 3, angle+A-6, 95, 0);
	CreateShot01(GetX+60*sin(144), GetY-60*cos(144), 3, angle+A-2, 95, 0);
	CreateShot01(GetX+60*sin(144), GetY-60*cos(144), 3, angle+A+2, 95, 0);
	CreateShot01(GetX+60*sin(144), GetY-60*cos(144), 3, angle+A+6, 95, 0);
	angle+=72;
	}
	A+=30;
	wait(30);
	}
}

task shotD{
	wait(18);
	let A=0;
	loop(14){
	let angle=0;
	while(angle<360){
	CreateShot01(GetX+60*sin(-72), GetY-60*cos(-72), 3, angle-A-6, 94, 0);
	CreateShot01(GetX+60*sin(-72), GetY-60*cos(-72), 3, angle-A-2, 94, 0);
	CreateShot01(GetX+60*sin(-72), GetY-60*cos(-72), 3, angle-A+2, 94, 0);
	CreateShot01(GetX+60*sin(-72), GetY-60*cos(-72), 3, angle-A+6, 94, 0);
	angle+=72;
	}
	A+=10;
	wait(30);
	}
}

task shotE{
	wait(24);
	let A=0;
	loop(14){
	let angle=0;
	while(angle<360){
	CreateShot01(GetX+60*sin(-144), GetY-60*cos(-144), 3, angle+A-6, 91, 0);
	CreateShot01(GetX+60*sin(-144), GetY-60*cos(-144), 3, angle+A-2, 91, 0);
	CreateShot01(GetX+60*sin(-144), GetY-60*cos(-144), 3, angle+A+2, 91, 0);
	CreateShot01(GetX+60*sin(-144), GetY-60*cos(-144), 3, angle+A+6, 91, 0);
	angle+=72;
	}
	A+=20;
	wait(30);
	}
}

	@Finalize{
	DeleteGraphic(imgBoss);
	Delete;
	}

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


script_enemy SUWAKO{
	let csd     = GetCurrentScriptDirectory;
	let shotData	=csd ~ "img\shot_All.txt";
	let imgBoss  = csd ~ "img\Boss\dot_suwako.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(600);
	standBy;
	Att;	
}
	sub standBy{
		SetMovePosition03(364, 60, 10, 7);
		SetAction(ACT_MOVE, 60);
		wait(60);
}

task Att{
	SetAction(ACT_SHOT_B, 480);
	shot;
	wait(480);
	SetAngle(270);
	SetSpeed(7);
	SetAction(ACT_MOVE_R, 600);
}

task shot{
	wait(60);
	loop(12){
	Ring(0);
	}
	wait(240);
	loop(12){
	Ring(1);
	}
}

	task Ring(type) {
		let x     = rand(0, 448);
		let y     = rand(0, 50);
		let speed = 2.5;
		let angle;
		let color = [6, 1];
		let color2 = [30, 25];
		let dir   = rand(0, 360);

		if(type == 0) { angle = 90 + rand(-30, 30);
		} else { angle = atan2(GetPlayerY - y, GetPlayerX - x);
		}

		CreateShot01(x, y, speed, angle, color2[type], 10);
		loop(13) {
			ShotR(x, y, dir, speed, angle, color[type]);
			dir += 360/13;
		}
	}

	task ShotR(BaseX, BaseY, dir, speed, angle, color) {
		let Obj    = Obj_Create(OBJ_SHOT);
		let radius = -10;

		let x = BaseX + radius*cos(dir);
		let y = BaseY + radius*sin(dir);

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

		loop(10) {
			radius += 3;

			let x = BaseX + radius*cos(dir);
			let y = BaseY + radius*sin(dir);
			
			Obj_SetPosition(Obj, x, y);
			yield;
		}
	}

	@Finalize{
	DeleteGraphic(imgBoss);
	Delete;
	}

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


script_enemy KAKU{
	let csd     = GetCurrentScriptDirectory;
	let imgKaku  = csd ~ "img\s_shot.png";
	let A=0;

	@Initialize{
        SetLife(1);
	SetDamageRate(0, 0);
	LoadGraphic(imgKaku);
	Main;
	}

	@MainLoop{
        SetCollisionB(GetX, GetY, 90);
	yield;
	}

	@DrawLoop{
	SetTexture(imgKaku);
	SetColor(255,255,255);
	SetGraphicRect(256, 0, 512, 256);
	SetAlpha(A);
	SetGraphicScale(1.2,1.2);
	DrawGraphic(GetX, GetY);
	}

task Main{
	yield;
	alpha;
	let speed=9;
	wait(120);
	SetAngle(90);
	SetSpeed(speed);	
}

task alpha{
	while(A<=200){
	SetAlpha(A);
	A+=5;
	wait(2);
	}
}

	@Finalize{
	DeleteGraphic(imgKaku);
	}

	function wait(w) {
		loop(w) { yield; }
	}

}