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

script_enemy_main {

	#include_function ".\Yukainclude.txt";
	let i = 0;
	let color = 0;
	let onee = 1;
	let anim3 = 0;
	let one = 1;
	@Initialize{
	shotinit;
	LoadSE(time1);
	LoadGraphic(imageFile);
	LoadSE(time2);
	LoadSE(charge);
	LoadSE(familiarspawn);
	InitializeAction;
	SetLife(6000);
	LoadSE(shot);
	DelayedStart;
	LoadSE(shot2);
	LoadSE(die);
	SetTimer(99);
	SetEnemyMarker(true);
	SetInvincibility(240);
	SetDamageRate(300, 75);
	SetMovePosition02(GetCenterX, GetClipMinY + 120, 60);
	SetAction(ACT_MOVE, 60);
	SetShotAutoDeleteClip(10, 10, 10, 10);
	LoadGraphic(SP);
	LoadGraphic(MC);
	Clouds;
	LoadGraphic(CBG1);
	LoadGraphic(CBG2);
	LoadSE(shot4);
	LoadSE(die);
	LoadGraphic(Cut);
	LoadSE(orb);
	LoadSE(warp);
	LoadSE(caution);
	LoadSE(border);
	SetAction(ACT_MOVE, 60);
	}


task DelayedStart {
wait(60);
attack1;
SetTimer(43);
}

task attack1 {
wait(30);
loop{
SetAction(ACT_SHOT_B, 300);
wait(15);

ascent(i in 0..9){
	//PlaySE(shot3);
	angle = rand(0, 360);
	loop(19+(i*3)){
		color++;
		CreateShot02(GetX-2, GetY+20, 1.15, angle, 0.045, 4.75, [YELLOW04, ORANGE04][color%2], 10);
		angle+=360/(19+(i*3));
		}
wait(15);
} 

Shrink;
SetAction(ACT_TURN, 60);
wait(30);
hurtbox=false;
ExMove2;
loop(9){
		ascent(i in 0..7){
	PC98(GetX, GetY, 3.25+(i/2), GetAngleToPlayer, BLUE12, 0, 3.18);
		}
	loop(6){
		ascent(i in 0..4){
		CreateShot01(GetX, GetY, 1.5+((i/3)), angle+(i*5.1), BLUE05, 0);
		CreateShot01(GetX, GetY, 2.5+((i/2.5)), angle+(i*5.1), BLUE05, 0);
		}
		angle+=360/6;
	}
	angle+=360/6/3.5;	
	PlaySE(shot);

	wait(12);
}
SetAction(ACT_TURN, 60);
Grow;
hurtbox=true;
wait(30);
SetAction(ACT_STAND, 12000);
wait(35);
}
}


task Shrink{
loop(30){
scale-=1/30;
wait(1);
}
}

task Grow{
loop(30){
scale+=1/30;
wait(1);
}
}

task Clouds{
wait(30);
loop{
if(scale<1){
	if(!OnPlayerMissed){
loop(3){
		CreateShotA(1, GetX+rand(-20, 20), GetY+rand(-25, 25), 15);
		SetShotDataA(1, 0, rand(0, 0.5), rand(260, 270), 0, 0, 0, BLUE03);
		SetShotKillTime(1, 0); 
		FireShot(1);
		}
}
}

wait(1);
}
}

	
}