
#Title[EirinS3_H]
#Text[Laser in this case is a term for an extract, and not a LASER.]
#Player[FREE]
#ScriptVersion[2]
#BGM[.\mu\bgm.mp3]

script_enemy_main {
let c = 0;
let life = 0;
let one = 1;
let angle2 = 0;
let angle3 = 0;
let angle2 = 0;
	#include_function ".\Eirininclude.txt";

	@Initialize{
	DeleteSE("se\seEnemyExplode01.wav");
	shotinit;
	LoadGraphic(imglifebar); 
	LoadSE(time1);
	LoadSE(capture);
	LoadGraphic(imageFile);
	LoadSE(time2);
	LoadSE(charge);
	LoadSE(laser2);
	LoadSE(familiarspawn);
	InitializeAction;
	SetLife(1500);
	LoadSE(shot);
	DelayedStart;
	LoadSE(shot2);
	SetTimer(99);
	SetEnemyMarker(true);
	SetInvincibility(180);
	SetDamageRate(45, 25);
	SetMovePosition02(GetCenterX, GetClipMinY + 120, 60);
	SetAction(ACT_MOVE, 60);
	SetShotAutoDeleteClip(50, 100, 50, 50);
	LoadGraphic(SP);
	LoadGraphic(MC);
	MagicCircle(false);
	LoadGraphic(CBG1);
	LoadGraphic(CBG2);
	LoadGraphic(CBG3);
	LoadGraphic(CBG4);
	LoadGraphic(CBG5);
	LoadGraphic(Cut);
	LoadSE(orb);
	LoadSE(warp);
	LoadSE(caution);
	LoadSE(border);
	SetAction(ACT_MOVE, 60);
	}


task DelayedStart {
wait(60);
SetCommonData("spells", GetCommonDataDefault("spells", 0)+1);
SetScore(5000000);
PlaySE(GetCurrentScriptDirectory~"cardcall.wav");
cutin("Lost Cure "\""Luminous Laser"\", Cut, 0, 0, 256, 512);
SetAction(ACT_SPELL, 90);
attack1;
attack2;
attack3;
SetTimer(53);
wait(120);
SetCommonData("spells", GetCommonDataDefault("spells", 0)+1);
}



task CreateLaser(angle, turn, graphic, delay){
let obj = Obj_Create(OBJ_LASER);
		let width = 15;
		let count = 0;
		let length = 0;
		Obj_SetPosition(obj,GetX,GetY);
		ObjLaser_SetLength(obj,0);
		ObjLaser_SetWidth(obj,width);
		Obj_SetAngle(obj,angle);
		ObjShot_SetGraphic(obj,graphic);
		ObjShot_SetDelay(obj,delay);
		ObjLaser_SetSource(obj, false);
		while(!Obj_BeDeleted(obj)) {
		if(length<700){ length+=7.5; }
		ObjLaser_SetLength(obj,length);
		if(count==90){
		PlaySE(ping);
		}
		if(count>=230){
		width-=1.5;
		}
		if(width<=7.5){
		Obj_SetCollisionToPlayer(obj, false);
		}
		
		if(count>=240){
		Obj_Delete(obj);
		}
		ObjLaser_SetWidth(obj,width);
		Obj_SetAngle(obj,angle);
		count++;
		angle+=turn;
		yield;
		}
	}

		

task attack1 {
wait(210);
loop{
loop(2){
SetAction(ACT_SHOT_B, 240);
PlaySE(laser);
loop(16){
CreateLaser(angle, 0.15*one, GREEN60, 90);
angle+=360/16;
}
angle = rand(0, 360);
one = one*-1;
wait(180);
}
ExMove;
wait(90);

}
}

task attack2{
wait(120);
loop{

PlaySE(shot4);
	loop(2){
		ascent(i in -5..5){
			CreateShot01(GetX, GetY, 2, angle2+(i*11), PURPLEI02, 10);
			}
			angle2+=360/2;
		}
angle2+=17.5670984302;
wait(20);
}
}


task attack3{
wait(270);
Concentration01(60);
wait(60);
loop{
	loop(2){
		ascent(i in -6..6){
			CreateShot01(GetX, GetY, 2.25, angle3+(i*9), BLUE01, 10);
			}
			angle3+=360/2;
		}
angle3-=22.5670984302;
wait(20);
}
}
		
			 


@BackGround{
SetTexture(CBG1);
SetGraphicRect(0, anim2/-2, 512, 512+(anim2/-2));
DrawGraphic(GetCenterX, GetCenterY);
SetTexture(CBG2);
SetAlpha(130);
SetGraphicScale(0.5, 1);
SetGraphicRect(0, anim2*3, 512, 512 + anim2*3);
DrawGraphic(GetCenterX-130, GetCenterY);
DrawGraphic(GetCenterX+130, GetCenterY);
SetGraphicScale(1, 1);
SetAlpha(255);
SetTexture(CBG3);
SetGraphicRect( 0, 0, 512, 512 );
DrawGraphic(GetCenterX, GetCenterY);
SetTexture(CBG4);
SetRenderState(ADD);
SetGraphicRect(0, 0, 512, 512);
SetGraphicScale(0.9, 0.9);
SetColor(80, 80, 80);
DrawGraphic(GetCenterX, GetCenterY-70);
SetColor(255, 255, 255);
SetRenderState(ALPHA);
SetGraphicScale(1, 1);



anim2 += 1;
acc1 = 6;


}




}





