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

script_enemy_main {
	let variable = 0;
	let xpos = 0;
	let undulate = 0;
	let color = 0;
	#include_function ".\Yukainclude.txt";
	let i = 0;
	let onee = 1;
	let anim3 = 0;
	let plax = 0;
	let blah = 0;
	@Initialize{
	shotinit;
	LoadSE(capture);
	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(300);
	SetDamageRate(47.5, 25);
	SetMovePosition02(GetCenterX, GetClipMinY + 120, 60);
	SetAction(ACT_MOVE, 60);
	SetShotAutoDeleteClip(40, 50, 40, 50);
	LoadGraphic(SP);
	LoadGraphic(MC);
	LoadGraphic(CBG1);
	LoadGraphic(CBG2);
	LoadSE(shot4);
	LoadSE(die);
	LoadGraphic(Cut);
	SetAction(ACT_MOVE, 60);
	MagicCircle(false);
	}

task DelayedStart {
wait(60);
SetScore(275000);
PlaySE(GetCurrentScriptDirectory~"cardcall.wav");
cutin("Garden Path "\""Hidden Falling Petals"\", Cut, 0, 0, 256, 512);
SetAction(ACT_SPELL, 90);
attack1;
//attack2;
attack3;
SetTimer(53);
}

	let backRED = 255;
	let backGREEN = 255;
	let backBLUE = 255;



task attack1{
wait(120);
SetAction(ACT_SHOT_B, 10000000);
plax = 90;
wait(15);
attack2;
rain;
loop{
SetShotColor(255, 255, 255);
loop(10){
	CreateShot01((GetX+2)+10*cos(angle+plax+(360/10/2)), (GetY+10)+10*sin(angle+plax+(360/10/2)), 4.25, angle+plax+(360/10/2), ORANGE02, 10);
	angle+=360/10;
	}


wait(5);
}
}

task rain{
let xpos = 0;
wait(180);
loop{
SetShotColor(225+rand(-30, 30), 225+rand(-30, 30), 225+rand(-30, 30));
loop(2){
CreateShot01(GetCenterX+xpos, GetClipMinY-10, rand(2, 2.75), 90+8*sin(undulate)+rand(-2, 2), [PURPLE12][color%1], 10);
xpos = (GetClipMaxX/1.25)*sin(variable);
variable+=5;
undulate+=0.85;
}
color++;
wait(2);
}
}


task attack2{
wait(90);
loop{
plax+=(cos(blah))/(1.45+(GetEnemyLife/4000));
blah+=1.25;
wait(1);
}
}

	task attack3 {
		let w = 60;
		wait(w);
		loop(w){
			backGREEN-=255/w;
			backBLUE-=255/w;
			wait(1);
		}
		loop{
			loop(w){
				backGREEN+=128/w;
				wait(1);
			}
			loop(w){
				backGREEN+=127/w;
				wait(1);
			}
			loop(w){
				backRED-=255/w;
				wait(1);
			}
			loop(w){
				backBLUE+=255/w;
				wait(1);
			}
			loop(w){
				backGREEN-=255/w;
				wait(1);
			}
			loop(w){
				backRED+=255/w;
				wait(1);
			}
			loop(w){
				backBLUE-=255/w;
				wait(1);
			}
		}
	}




@BackGround{
SetTexture(CBG1);
SetRenderState(ALPHA);
SetGraphicAngle(0, 0, 0);
SetGraphicScale(1, 1);
SetColor(backRED/3, backGREEN/3, backBLUE/3);
SetGraphicRect(19, 0+(anim2*5), 474, 455+(anim2*5));
SetAlpha(255);
DrawGraphic(GetCenterX, GetCenterY);
SetTexture(CBG2);
SetRenderState(ALPHA);
SetGraphicAngle(0, 0, 0);
SetColor(255, 255, 255);
SetGraphicScale(1, 1);
SetGraphicRect(0, 0-(anim2*4), 512, 512-(anim2*4));
SetAlpha(60);
DrawGraphic(GetCenterX, GetCenterY);
SetColor(255, 255, 255);
i+=1; i%=360;
anim2 += 0.75;
acc1 = 6;


}




	
}