#TouhouDanmakufu
#Title[YukaN4_H]
#Text[YukaN4_H]
#Player[FREE]
#ScriptVersion[2]
#BGM[.\mu\bgm.mp3]

script_enemy_main {
#include_function ".\Yukainclude.txt";
let one = -1;
	@Initialize{
	InitializeAction;
	LoadMusic(bgm);
	PlayMusic(bgm);
	LoadSE(shot3);
	LoadSE(time1);
	LoadSE(teleport);
	LoadGraphic(imageFile);
	LoadSE(time2);
	LoadSE(wtf);
	shotinit;
	LoadGraphic(familiar);
	LoadSE(charge);
	SetAction(ACT_MOVE, 120);
	LoadSE(shot);
	LoadSE(laser);
	LoadSE(familiarspawn);
	LoadGraphic(imglifebar); 
	SetLife(6000);
	LoadSE(shot2);
	SetTimer(42);
	SetInvincibility(180);
	SetDamageRate(140, 75);
	//SetMovePosition03(GetCenterX, GetClipMinY + 120, 10, 2);
	LoadGraphic(SP);
	LoadGraphic(MC);
	attack1;
	MagicCircle(false);
	SetShotAutoDeleteClip(60, 20, 60, 10);
	SetEnemyMarker(true);
	//SetCommonData("lastattack", true);
	}

task attack1 {
wait(30);
PlaySE(teleport);
SetAction(ACT_TURN, 180);
loop(60){
alpha-=4;
wait(1);
}
alpha = 0;
CreateEnemyFromScript("clone", GetX, GetY, 0, 0, 0);
SetY(GetClipMinY+165);
SetX(GetClipMinX+70);
PlaySE(teleport);
SetAction(ACT_TURN, 180);
loop(85){
alpha+=3;
wait(1);
}
loop{
one*=-1;
wait(5);
SetAction(ACT_SHOT_B, 240);
wait(10);
loop(16){
	loop(16){
		CreateShotA(1, GetX-2, GetY+20, 10);
		SetShotDataA(1, 0, 2.5, angle, 0.6*one, 0, 2, YELLOW04);
		SetShotDataA(1, 90, NULL, NULL, 0, 0, 2.5, NULL);
		FireShot(1);
		angle+=360/16;
		}
one*=-1;
angle+=rand(-360, 360);
wait(15);
}
wait(30);
SetMovePosition02(GetClipMaxX-70, GetY, 80);
SetAction(ACT_MOVE, 80);
loop(10){
CreateLaser01(GetX, GetY, 4, GetAngleToPlayer, 100, 12, ORANGE50, 5);
wait(9);
}

SetAction(ACT_SHOT_A, 240);
wait(10);
loop(24){
	loop(4){
		CreateShot02(GetX, GetY, 4, angle, -0.03, 1.75, BLUE03, 10);	
		angle+=360/4;
		}
	angle+=rand(18, 19)*one;
wait(10);
}
wait(30);
SetMovePosition02(GetClipMinX+70, GetY, 80);
SetAction(ACT_MOVE, 80);
loop(10){
CreateLaser01(GetX, GetY, 4, GetAngleToPlayer, 100, 12, ORANGE50, 5);
wait(9);
}
}
}



}
}




script_enemy clone {

	#include_function ".\Yukainclude.txt";
	let i = 0;
	let one = 1;
	let anim3 = 0;
	clone = true;
	alpha = 0;
	@Initialize{
	shotinit;
	LoadSE(time1);
	LoadGraphic(imageFile);
	LoadSE(time2);
	LoadSE(charge);
	LoadSE(familiarspawn);
	InitializeAction;
	SetLife(15000000);
	LoadSE(ping);
	LoadSE(shot);
	LoadSE(laser2);
	LoadSE(shot2);
	LoadSE(die);
	SetTimer(99);
	SetEnemyMarker(false);
	SetInvincibility(240);
	SetDamageRateEx(140, 75, 100, 50);
	SetAction(ACT_MOVE, 60);
	SetShotAutoDeleteClip(30, 30, 30, 30);
	LoadGraphic(SP);
	LoadGraphic(MC);
	LoadGraphic(CBG1);
	LoadGraphic(CBG2);
	LoadSE(shot4);
	LoadSE(die);
	LoadGraphic(Cut);
	SetAction(ACT_MOVE, 60);
	attack1;
	location;
	}

task location{
loop{
SetCommonData("clonex", GetX);
SetCommonData("cloney", GetY);
wait(1);
}
}


task attack1 {
SetY(GetClipMinY+85);
SetX(GetClipMaxX-70);
PlaySE(teleport);
SetAction(ACT_TURN, 180);
loop(85){
alpha+=3;
wait(1);
}

loop{

one=one*-1;
wait(5);
SetAction(ACT_SHOT_A, 240);
wait(10);
loop(24){
	loop(4){
		CreateShot02(GetX, GetY, 4, angle, -0.03, 1.75, RED03, 10);	
		angle+=360/4;
		}
	angle+=rand(18, 19)*one;
wait(10);
}
wait(30);
SetMovePosition02(GetClipMinX+70, GetY, 80);
SetAction(ACT_MOVE, 80);
loop(10){
CreateLaser01(GetX, GetY, 4, GetAngleToPlayer, 100, 12, YELLOW50, 5);
wait(9);
}


SetAction(ACT_SHOT_B, 240);
wait(10);
loop(16){
	loop(16){
		CreateShotA(1, GetX-2, GetY+20, 10);
		SetShotDataA(1, 0, 2.5, angle, 0.6*one, 0, 2.5, ORANGE04);
		SetShotDataA(1, 90, NULL, NULL, 0, 0, 2.5, NULL);
		FireShot(1);
		angle+=360/16;
		}
one*=-1;
angle+=rand(-360, 360);
wait(15);
}
wait(30);
SetMovePosition02(GetClipMaxX-70, GetY, 80);
SetAction(ACT_MOVE, 80);
loop(10){
CreateLaser01(GetX, GetY, 4, GetAngleToPlayer, 100, 12, YELLOW50, 5);
wait(9);
}
}
}



}
