
#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,3,"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","Law Of Mortality [Shatter Of Life]",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~"spell9.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 shatter(bullets,offset){
		ascent(i in 0..bullets){
		CreateShotA(1,GetX,GetY,0);
		SetShotDataA(1,0,5,360/bullets*i,0,0,0,157);
		SetShotDataA(1,20,0,360/bullets*i,0,0,0,157);
		SetShotDataA(1,30,0,i*12+offset,0,0.2,1,157);
		SetShotDataA(1,45,3,i*34+offset,0,0.2,1,157);
		FireShot(1);
		}
	}
	task fire{
		wait(200);
			let a = 30;
			let a2 = 0;
			wait(50);
		
			let i = 0;
		loop{
		shatter(100,180);
		wait(30);
		shatter(100,0);
		wait(30);
		shatter(100,27);
		wait(180);
		}
	}
	




}