
#TouhouDanmakufu
#Title[TEST THIS]
#Text[]
#Image[]
#Player[REIMU,MARISA]
#ScriptVersion[2]

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

		//shotinit;
		Init(2000,4,"Momiji Inubashiri");		
		BossInit(false,99,2200000,false,[255,64,64],[255,64,64]);
		SetInvincibility(400);
		SetDamageRate(100,0);
		mainTask;
		Border;
		LoadUserShotData(CSD~"supershot.txt");
		SetMovePosition03(GetCenterX,GetCenterY-120,10,5);
		cutin("NAZRIN","Sword Sign [Edgeless Obsession]",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~"spell8.txt",GetX,GetY,0,0,0);
		DeleteEnemyShotToItem(ALL);
		loop(55){
		let a = rand(0,360);
		let x = rand(30,80)*sin(a);   
		let y = rand(30,80)*cos(a);
		CreateMOFItem("POINT",GetX+x,GetY+y);
		}
	}
	
	task laser(rx,ry,angle,delay){
	PlaySEEx(CSD~"se\shadow.wav");
	CreateLaserA(1,GetX+rx,GetY+ry,512,10,BLUE01,999);
	SetLaserDataA(1,0,angle,0,0,0,0);
	SetShotKillTime(1,10);
	FireShot(1);
	let x = GetX+rx;
	let y = GetY+ry;
	wait(delay);
	PlaySEEx(CSD~"se\lazer01.wav");
	CreateLaser01(x,y,5,angle,300,13,YELLOW01,0);
	}
	
	task fire{
		wait(200);
			let a = 30;
			let a2 = 0;
			wait(50);
		
			let i = 0;
		loop{
		if(a2==1){
		a+=4;
		} else {
		a-=4;
		}
		if(a>=169){
		a2=0;
		}
		if(a<=30){
		a2=1;
		}
		i+=23;
		let x = a*sin(i);
		let y = a*cos(i);
		ascent(v in 0..6){
		CreateShot01(GetX+x,GetY+y,3,i+360/6*v,67,10);
		}
		let x = a*sin(i+180);
		let y = a*cos(i+180);
		ascent(v in 0..6){
		CreateShot01(GetX+x,GetY+y,3,i+180+360/6*v,67,10);
		}
		PlaySEEx(CSD~"se\se_tan00.wav");
		wait(3);
		}
	}
	




}