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

script_enemy_main {
#include_function ".\Yuyukoinclude.txt";

	@Initialize{
	InitializeAction;
	LoadMusic(bgm);
	PlayMusic(bgm);
	LoadSE(shot3);
	LoadSE(time1);
	LoadSE(teleport);
	LoadGraphic(imageFile);
	LoadGraphic(imageFile2);
	LoadSE(time2);
	LoadSE(wtf);
	shotinit;
	LoadSE(charge);
	SetAction(ACT_MOVE, 120);
	LoadSE(shot);
	LoadSE(laser);
	LoadSE(familiarspawn);
	LoadGraphic(imglifebar); 
	SetLife(6000);
	LoadSE(shot2);
	SetTimer(45);
	SetInvincibility(260);
	SetDamageRate(100, 55);
	SetMovePosition03(GetCenterX, GetClipMinY + 120, 10, 2);
	LoadGraphic(SP);
	LoadGraphic(MC);
	attack1;
	MagicCircle(false);
	SetShotAutoDeleteClip(10, 10, 10, 10);
	SetEnemyMarker(true);
	SetCommonData("lastattack", false);
	}



task attack1 {
let x = 200;
let y = 0;
let i = 0;
CreateEnemyFromScript("Youmu", GetX, GetY+100, 0, 0, 0);
let angle = 0;
let angle2 = 20;
let angle3 = 0;
let sine = 0;
let b = 20;
let a = -5;

wait(90);
Concentration01(120);
SetAction(ACT_SHOT_A, 3239483294892);
PlaySE(charge);
wait(120);
fan;
wait(30);
CreateEnemyFromScript("Fan", GetX+100, GetY, 0, 0, 0);
CreateEnemyFromScript("Fan", GetX-100, GetY, 0, 0, 0);
wait(60);
loop{
PlaySE(shot4);
if(i>=300){
ExMove;
i = 0;
SetAction(ACT_SHOT_A, 1000000);
}
loop(4){
loop(2){
CreateShot01(GetX+rand(x, -x), GetY-10-rand(y-40, y+40), rand(0.9, 2), rand(88, 92)+angle, [PURPLE12, BLUE12][i%2], 15);
angle+=360/2;
}
i++;
}

if(x<(GetClipMaxX-GetClipMinX)/2){
x+=1;
}
if(y<30){
y+=1;
}
wait(10);
}
}

}

script_enemy Youmu{
	
	let Player = 0;
	
	#include_function ".\Youmuinclude.txt"


	@Initialize {
	InitializeAction;
	SetAction(ACT_MOVE, 120);
	SetX(GetCommonDataDefault("YoumuX", (GetCenterX+GetClipMinX)/2));
	SetY(GetCommonDataDefault("YoumuY", GetClipMinY+160));
	SetMovePosition02((GetCenterX+GetClipMinX)/2, GetClipMinY + 120, 60);
	LoadSE(shot);
	LoadSE(shot2);
	LoadSE(slash);
	LoadSE(shot3);
	LoadGraphic(imageFile);
	LoadGraphic(Cut);
	SetLife(150000);
	SetInvincibility(240);
	SetDamageRateEx(35, 25, 165, 10);
	attack1;
	}

	task attack1 {
	wait(180);
	loop{
	SetAction(ACT_CHARGE, 60);
	wait(15);
	SetAction(ACT_SLASH_V, 360);
	Player = GetAngleToPlayer;
	PlaySE(shot3);
	ascent(i in 0..24){
	//PlaySE(shot3);
		loop(4){
		CreateLaser01(GetX-9, GetY-40, 2+(i/12), angle, 200, 10, GREEN54, 0);
		angle+=360/4;
		}
		
	angle+=9;
	wait(5);
	}
	wait(90);
	ExMoveLower;
	wait(90);
	}
	
	

}
}


script_enemy Fan{
	
	let imageFile = GetCurrentScriptDirectory~"sprites\fan.png";

	@Initialize {
	
	LoadGraphic(imageFile);
	SetLife(1500000000);
	SetInvincibility(120);
	SetDamageRateEx(35, 25, 50, 10);
	}

	@MainLoop {
	yield;
	SetCollisionA(GetX, GetY, 80);
	}

	@DrawLoop{
	
	}
	@Finalize{
	}


}







