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

script_enemy_main {

	#include_function ".\Shinkiinclude.txt";
	let i = 0;
	let one = 0;
	let anim3 = 0;
	let color = 0;
	let x = 0;
let angle2 = 0;
let y = 0;
let one = 1;
	@Initialize{
	shotinit;
	LoadSE(time1);
	LoadGraphic(background);
	LoadGraphic(imageFile);
	LoadSE(time2);
	LoadSE(charge);
	LoadSE(familiarspawn);
	InitializeAction;
	SetLife(1500);
	LoadSE(ping);
	LoadSE(shot);
	DelayedStart;
	LoadSE(shot2);
	LoadSE(die);
	LoadGraphic(background);
	SetTimer(99);
	SetEnemyMarker(true);
	SetInvincibility(270);
	SetDamageRate(30, 30);
	SetMovePosition02(GetCenterX, GetClipMinY + 120, 60);
	SetAction(ACT_MOVE, 60);
	SetShotAutoDeleteClip(30, 50, 30, 40);
	LoadGraphic(SP);
	LoadGraphic(MC);
	LoadGraphic(CBG1);
	LoadGraphic(CBG2);
	LoadSE(shot4);
	LoadSE(dream);
	LoadSE(die);
	LoadGraphic(Cut);
	SetAction(ACT_MOVE, 60);
	SetCommonData("lastattack", false);
	
	}

task DelayedStart {
let radius = 30;

wait(90);
SetScore(275000);
PlaySE(GetCurrentScriptDirectory~"cardcall.wav");
cutin("God Art "\""Red Sea of Makai"\", Cut, 0, 0, 256, 512);
SetAction(ACT_SPELL, 90);
GenericSpell;
//Shiny;
SetTimer(62);
}


task GenericSpell{
wait(120);
loop{
	angle = 0;
	let oldangle = GetAngleToPlayer+2.75;
	one = one*-1;
	let num = 20;
	SetAction(ACT_SHOT_B, 60);
	wait(10);
	ascent(i in 2..45){
		PlaySE(shot2);
		loop(num-5){
		CreateShot01(GetX, GetY, i/6, oldangle+angle+angle2, RED04, 2);
		angle+=360/(num-5);
		}
		angle2+=6*one;
		wait(1);
		}
	ExMove;
	wait(60);
	loop(16){
	let randnum = rand(10, 20);
	PlaySE(shot);
	loop(3){
	CreateShot01(GetX, GetY, 2, angle2+angle, RED03, 0);
	CreateShot01(GetX, GetY, 2.5, angle2+angle, RED03, 0);
	angle+=360/3;
	angle2+=21*one;

	}
	wait(10);
	}
wait(60);
}
}





    @BackGround{
	 SetTexture(background);
   SetGraphicRect(0, 0 - y, 256, 256 - y);
   SetGraphicScale(2, 2);
   DrawGraphic(GetCenterX, GetCenterY);
   y+=1;




	
}
}

