

script_enemy_main{
	
#include_function ".\Boss.txt";
let lol = 0;
	
	@Initialize{
	

		//shotinit;
		Init(2000,9,"Momiji Inubashiri");		
		BossInit(false,70,1200000,false,[255,64,64],[255,64,64]);
		SetInvincibility(300);
		SetDamageRate(100,0);
		mainTask;
		Border;
		LoadUserShotData(CSD~"supershot.txt");
		SetMovePosition03(GetCenterX,GetCenterY-120,10,5);
		cutin("NAZRIN","Deterance Sign [Blinding Spread]",imgCut,0,0,512,512);
		SetEnemyMarker(true);
		
		
	}
	@MainLoop{
		SPMainLoop;
		if(GetLife>10000){
		if(OnBomb){
	SetDamageRate(50,10);
		}
	SetCollisionA(GetX,GetY,32);
		SetCollisionB(GetX,GetY,16);
		
}
		yield;
		
	}
	task DrawTask{
		Momizi;
	}
	task mainTask{
		fire;
	}

	task SPFinalize{
		CreateEnemyFromFile(CSD~"momizi3.txt",GetX,GetY,0,0,0);
		DeleteEnemyShotToItem(ALL);
		loop(25){
		let a = rand(0,360);
		let x = rand(30,60)*sin(a);   
		let y = rand(30,60)*cos(a);
		CreateMOFItem("POINT",GetX+x,GetY+y);
		}
	}
	task flash(x,y,angle,duration,r,g,b){
		SetShotColor(r,g,b);
		let obj = Obj_Create(OBJ_SHOT);
		Obj_SetPosition(obj,x,y);
		Obj_SetAngle(obj,angle);
		Obj_SetSpeed(obj,0);
		ObjShot_SetGraphic(obj,168);
		Obj_SetCollisionToPlayer(obj,false);
		let d = 0;
		SetShotColor(255,255,255);
		while(!Obj_BeDeleted(obj)){
		d++;
		if(d==duration){
		Obj_Delete(obj);
		}
		yield;
		}
	}
	task laser(x,y,angle,duration,graphic){
		let obj = Obj_Create(OBJ_LASER);
		Obj_SetPosition(obj,x,y);
		Obj_SetAngle(obj,angle);
		ObjShot_SetGraphic(obj,graphic);
		ObjShot_SetDelay(obj,40);
		ObjLaser_SetLength(obj,512);
		ObjLaser_SetWidth(obj,30);
		ObjShot_SetBombResist(obj,true);
		let t = 0;
		while(!Obj_BeDeleted(obj)){
		t++;
		if(GetLife<10000){
		Obj_Delete(obj);
		}
		if(t>=duration+40){
		let a = 0;
		PlaySEEx(CSD~"se\se_lazer00.wav");
		ascent(i in 0..30){
		let xx = (i*15)*sin(angle-90);
		let yx = (i*15)*cos(angle-90);
		CreateShot01(Obj_GetX(obj)+xx,Obj_GetY(obj)+yx,1,a,240,20);
		CreateShot01(Obj_GetX(obj)+xx,Obj_GetY(obj)+yx,1,a+100,239,20);
		
		a+=18;
		yield;
		}
		Obj_Delete(obj);
		}
		if(t%4==0 && t>40){
		CreateShot01(Obj_GetX(obj),Obj_GetY(obj),20,angle,254,0);
		}
		yield;
		}
	}
	task fire{
		wait(200);
		Concentration01(60);
			wait(50);
		loop{
		PlaySEEx(CSD~"se\se_boon01.wav");
			ascent(i in 0..8){
			//CreateNazrinLaser in glorious blue
			
			flash(GetX,GetY,360/8*i,120,64,64,255);
			laser(GetX,GetY,360/8*i,80,152);
			wait(5);
			}
			wait(180);
			SetMovePosition03(GetCenterX+100,GetCenterY-120,10,5);
			wait(30);
			PlaySEEx(CSD~"se\se_boon01.wav");
			descent(i in 0..8){
			//CreateNazrinLaser in japanese red
			
			flash(GetX,GetY,360/8*i,120,255,64,64);
			laser(GetX,GetY,360/8*i,80,150);
			wait(5);
			}
			SetMovePosition03(GetCenterX,GetCenterY-120,10,5);
			wait(180);
			PlaySEEx(CSD~"se\se_boon01.wav");
			ascent(i in 0..8){
			//CreateNazrinLaser in glorious blue
		
			flash(GetX,GetY,360/8*i,120,64,64,255);
			laser(GetX,GetY,360/8*i,80,152);
			wait(5);
			}
			wait(180);
			SetMovePosition03(GetCenterX-100,GetCenterY-120,10,5);
			wait(30);
			PlaySEEx(CSD~"se\se_boon01.wav");
			descent(i in 0..8){
			//CreateNazrinLaser in japanese red
			
			flash(GetX,GetY,360/8*i,120,255,64,64);
			laser(GetX,GetY,360/8*i,80,150);
			wait(5);
			}
			wait(180);
			SetMovePosition03(GetCenterX,GetCenterY-120,10,5);
			wait(30);
		}
	}
	




}