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

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

		//shotinit;
		Init(6000,1,"Momiji Inubashiri");
		BossInit(false,150,99999999,true,[255,64,64],[255,64,64]);
		SetInvincibility(400);
		SetDamageRate(100,0);
		mainTask;
		Border;
		LoadUserShotData(CSD~"supershot.txt");
		SetMovePosition03(GetCenterX,GetCenterY-120,10,5);
		cutin("BYAKUREN","Illusionary Dominance -Speed Slash-",imgCut,0,0,512,512);
		SetEnemyMarker(true);
		caution;
		PlaySE(csd~"se\se_alert.wav");
		
	}
	@MainLoop{
		SPMainLoop;
		if(GetLife>10000){
		if(OnBomb){
	SetDamageRate(0,0);
		} else {
		SetDamageRate(100,0);
		}
	SetCollisionA(GetX,GetY,100);
		SetCollisionB(GetX,GetY,16);
		
}
		yield;
		
	}
	task DrawTask{
		Momizi;
	}
	task mainTask{
		fire;
	}

	task SPFinalize{
		CreateEnemyFromFile(CSD~"deathdummy.txt",GetX,GetY,0,0,0);
		CreateEnemyFromFile(CSD~"momizi10.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);
		}
	}
	let slashc = 0;
	task slash{
	let laser1=0;
	let shot1=1;
	let delay=0;
	let distance=0;
		slashc++;
		CreateLaserA(laser1,GetClipMinX-20,GetClipMinY+rand(40,150),500,20,RED01,0);
		SetLaserDataA(laser1,0,0+rand(-7,7),0,0,0,0);
		SetShotKillTime(laser1,30);
		loop(10){
				CreateShotA(shot1,0,rand(-20,20),0);
				if(slashc%2==1){
				SetShotDataA_XY(shot1,0,rand(0.3,2),0,-0.01,0.1,0.3,rand(2,3),AQUA12);
				} else {
				SetShotDataA_XY(shot1,0,rand(0.3,2),0,0.01,-0.1,-0.3,rand(2,3),AQUA12);
				}
				AddShot(delay,laser1,shot1,distance);
				distance+=500/10;
				delay+=1;
		}
			FireShot(laser1);
			PlaySE(CSD~"se\se_tan00.wav");
	}
	task fire{
		wait(200);
			let a = 30;
			let a2 = 0;
			wait(100);
			slash;
			wait(60);
			slash;
			wait(50);
			slash;
			wait(40);
			loop(5){
			slash;
			wait(30);
			}
			slash;
			wait(20);
			loop(10){
			slash;
			wait(15);
			}
		loop{
		
		slash;
		wait(8);
		}
	}
	




}