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

script_enemy_main {

	#include_function ".\Sunnyinclude.txt";
	let i = 0;
	let onee = 1;
	let anim3 = 0;
	let x = 0;
let y = 0;
	@Initialize{
	shotinit;
	LoadSE(time1);
	LoadGraphic(imageFile);
	LoadSE(time2);
	LoadSE(charge);
	LoadSE(familiarspawn);
	InitializeAction;
	SetLife(1500);
	LoadSE(ping);
	LoadSE(shot);
	DelayedStart;
	LoadSE(shot2);
	LoadSE(die);
	SetTimer(99);
	SetEnemyMarker(true);
	SetInvincibility(2700);
	SetDamageRate(30, 25);
	SetMovePosition02(GetCenterX, GetClipMinY + 120, 60);
	SetAction(ACT_MOVE, 60);
	SetShotAutoDeleteClip(30, 30, 30, 40);
	LoadGraphic(SP);
	LoadGraphic(MC);
	LoadGraphic(CBG1);
	LoadGraphic(CBG2);
	LoadSE(shot4);
	LoadSE(die);
	LoadGraphic(Cut);
	SetAction(ACT_MOVE, 60);
	SetCommonData("lastattack", true);
	loop(10){
	CreateItem(ITEM_SCORE, GetX+rand(-60, 60), GetY+rand(-30, 30));
	}
	}

task DelayedStart {
let radius = 30;

wait(90);
SetScore(275000);
PlaySE(GetCurrentScriptDirectory~"cardcall.wav");
cutin("Blinding Light "\""Dual Expansive Halo"\", Cut, 0, 1, 256, 260);
SetAction(ACT_SPELL, 90);
attack1;
//Shiny;
SetTimer(47);
}


task attack1 {
wait(180);
SetInvincibility(30);
loop{
SetAction(ACT_SHOT_A, 210);
x = GetPlayerX;
y = GetPlayerY;
ascent(i in 0..8){
angle+=7;
radius = 90+(i*5);
SetShotColor(255, 255-(i*2), 255-(i*40));
PlaySE(shot);
loop(18){
	
	CreateShotA(1, x+radius*cos(angle), y+radius*sin(angle), 10);
	SetShotDataA(1, 0, 0, angle-180+((i+4)*2.5)+rand(i*3, -i*3), 0, 0.02, 1.5-(i/5.5), YELLOW12);
	SetShotDataA(1, 400, NULL, NULL, 0, 0.02, 3, NULL);
	FireShot(1);
	CreateShotA(1, GetX+(radius-70)*cos(angle), GetY+(radius-70)*sin(angle), 10);
	SetShotDataA(1, 0, 0, angle-180+((i+4)*2.5)+rand(i*3, -i*3), 0, 0.02, 1.5-(i/5.5), YELLOW12);
	SetShotDataA(1, 400, NULL, NULL, 0, 0.02, 3, NULL);
	FireShot(1);
	
	angle+=360/18;
	}
wait(20);

}
wait(60);
angle = rand(-100, 35349859);
Concentration01(120);
PlaySE(charge);
SetAction(ACT_SHOT_B, 130);
wait(120);
ExMove;
loop(2){
PlaySE(shot3);
ascent(i in 0..4){
	ascent(r in -1..2){
CreateShot01(GetX, GetY, 2+(i/3), GetAngleToPlayer+(r*30), YELLOW03, 10);
}
}
wait(50);
}
wait(60);
ExMove;
wait(60);
SetAction(ACT_SHOT_B, 120);
wait(140);
}
}



@BackGround{


SetTexture(CBG2);
SetRenderState(ALPHA);
SetGraphicAngle(0, 0, 0);
SetColor(255, 255, 255);
SetGraphicScale(1.5, 2);
SetGraphicRect(0+anim2*1.25, 0-(anim2*4), 256+anim2*1.25, 256-(anim2*4));
SetAlpha(120);
DrawGraphic(GetCenterX, GetCenterY);
SetTexture(CBG1);
SetRenderState(ALPHA);
SetGraphicAngle(0, 0, 0);
SetGraphicScale(1.5, 2);
SetGraphicRect(0+anim2, 0-(anim2*0.2), 256+anim2, 256-(anim2*0.2));
SetAlpha(255);
DrawGraphic(GetCenterX, GetCenterY);

SetGraphicScale(1, 1);
anim2 += 1.5;
acc1 = 6;


}




	
}