
#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 transition = false;
	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(25, 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);
	FlashyLasers;
	GenericSpell;
	GenericSpell2;
	}


task FlashyLasers {
	SetCommonData("lastattack", true);
	let anglee = 90+180;
	PlaySE(laser);
	loop(5){
	CreateLaserB(1, 0, 10, PURPLE60, 120);
	SetLaserDataB(1, 0, 0.5, 60, 0, anglee, 0, anglee, 1.045);
	SetLaserDataB(1, 120, 0, 60, 0, anglee, 0, NULL, 0);
	
	FireShot(1);
	anglee+=360/5;
	}
}
	  

task GenericSpell2{
	let really = 0;
	let waittime = 120;
	let angg = 0;
	let ok = 90+180;
	wait(300);
	loop{
	PlaySE(shot);
	loop(15){
	CreateShot01(GetX, GetY, 0.75, GetAngleToPlayer+angg, GREEN03, 0);
	angg+=360/15;
	}
	if((GetLife<1000 || GetTimer<45) && transition == false){
	PlaySE(charge);
	Concentration01(120);
	transition = true;
	}
	if((GetLife<1000 || GetTimer<45) && transition == true){
	loop(5){
	PlaySE(shot3);
	loop(4){
	
	CreateShot01(GetX+60*cos(ok), GetY+60*sin(ok), 2, atan2(90 - GetY+60*sin(ok), 90 - GetX+60*cos(ok)) + really, PURPLE58, 0);
	CreateShot01(GetX+60*cos(ok), GetY+60*sin(ok), 2, atan2(90 - GetY+60*sin(ok), 90 - GetX+60*cos(ok)) + really+4, PURPLE58, 0);
	CreateShot01(GetX+60*cos(ok), GetY+60*sin(ok), 2, atan2(90 - GetY+60*sin(ok), 90 - GetX+60*cos(ok)) + really+8, PURPLE58, 0);
	CreateShot01(GetX+60*cos(ok), GetY+60*sin(ok), 2, atan2(90 - GetY+60*sin(ok), 90 - GetX+60*cos(ok)) + really-4, PURPLE58, 0);
	CreateShot01(GetX+60*cos(ok), GetY+60*sin(ok), 2, atan2(90 - GetY+60*sin(ok), 90 - GetX+60*cos(ok)) + really-8, PURPLE58, 0);
	really+=360/4;
	}
	ok+=360/5;
}
}
	really+=20;
	wait(waittime);
}
}


task DelayedStart {
let radius = 30;

wait(120);
SetScore(275000);
PlaySE(GetCurrentScriptDirectory~"cardcall.wav");
cutin("God Art "\""Pentagram Crest"\", Cut, 0, 0, 256, 512);
SetAction(ACT_SPELL, 90);

SetTimer(62);
wait(120);
SetAction(ACT_SHOT_B, 1000000);
}




task GenericSpell{
	let otherthings = 1;
	let speed = 2;
	wait(300);
	loop{
	
	CreateShotA(1, GetX+50*cos(angle-90), GetY+50*sin(angle-90), 10);
	SetShotDataA(1, 0, 0, (angle-90)*otherthings, 0, 0, 0, SP01);
	SetShotDataA(1, 30, 1, NULL, 0, 0, 1, SP01);
	FireShot(1);
	CreateShotA(1, GetX+50*cos(angle-90), GetY+50*sin(angle-90), 10);
	SetShotDataA(1, 0, 0, (angle-90)*otherthings, 0, 0, 0, SP01);
	SetShotDataA(1, 30, 1.25, NULL, 0, 0, 1, SP01);
	FireShot(1);
	CreateShotA(1, GetX+50*cos(angle-90), GetY+50*sin(angle-90), 10);
	SetShotDataA(1, 0, 0, (angle-90)*otherthings, 0, 0, 0, SP01);
	SetShotDataA(1, 30, 0.75, NULL, 0, 0, 1, SP01);
	FireShot(1);
	
	CreateShotA(1, GetX+50*cos((-angle*1.5)-90), GetY+50*sin((-angle*1.5)-90), 10);
	SetShotDataA(1, 0, 0, ((-angle*1.5)-90)*otherthings, 0, 0, 0, SP01);
	SetShotDataA(1, 30, 1*speed, NULL, 0, 0, 1*speed, SP01);
	FireShot(1);
	CreateShotA(1, GetX+50*cos((-angle*1.5)-90), GetY+50*sin((-angle*1.5)-90), 10);
	SetShotDataA(1, 0, 0, ((-angle*1.5)-90)*otherthings, 0, 0, 0, SP01);
	SetShotDataA(1, 30, 1.5*speed, NULL, 0, 0, 1*speed, SP01);
	FireShot(1);
	
	angle+=8.3434;
	if(GetLife<1000){
	speed = 2;
	
	}
	wait(5);
	}
	
	 
}




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




	
}
}

