TouhouDanmakufu
#Title[Magic Space "굍굍굍괶"]
#Text[Lunatic]
#Image[]
#PlayLevel[Lunatic]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main{

	#include_function ".\lib\lib_anime_marisa.txt"
        #include_function ".\lib\Func.txt"

	@Initialize{
		SetLife(4000);
                SetInvincibility(260);
		SetTimer(65);
		SetScore(15000000);
                SetEnemyMarker(true);
                MagicCircle(true);
                SetMovePosition02(GetCenterX, GetClipMinY + 120, 60);
                LoadUserShotData(shot);
                InitializeAction();
	CutIn(YOUMU,"Magic Space "\""굍굍굍괶"\",cut,0,0,203,360);
	
		mainTask;
	}

	@MainLoop{
		SetCollisionA(GetX,GetY,32);
		SetCollisionB(GetX,GetY,16);
		yield;

	}

	@DrawLoop{

	if(GetSpeedX()>0){SetAction(ACT_MOVE,0)}
	if(GetSpeedX()<0){SetAction(ACT_MOVE,0)}		
	DrawBoss(imgBoss);
        DrawText("Marisa Kirisame", 40, 30, 11, 255);

	}

	@BackGround{
        fondue;
	}

	@Finalize{
	}

	// main task, activates stuff.
	task mainTask{
		yield;
                wait(60);
                MagicC;
                wait(120);
		fire;
		fire2;
                kirari;
	}

	task fire{
PlaySE(op);
     	let i = 0;
        	while( i < 4 )
        	{
        		BeltBlue(i*90,2.8);
        		i++;
        	}
        	let i = 0;
        	while( i < 5 )
        	{
        		BeltRed(i*72,2);
        		i++;
        	}
        	let i = 0;
        	while( i < 6 )
        	{
        		BeltBlue(i*60,1.4);
        		i++;
        	}
        	let i = 0;
        	while( i < 8 )
        	{
        		BeltRed(i*45,1.2);
        		i++;
        	}
        	let i = 0;
        	while( i < 10 )
        	{
        		BeltBlue(i*36,1);
        		i++;
        	}
        	let i = 0;
        	while( i < 12 )
        	{
        		BeltRed(i*30,0.9);
        		i++;
        	}
        	let i = 0;
        	while( i < 20 )
        	{
        		BeltBlue(i*18,0.8);
        		BeltRed(i*18,0.7);
        		BeltBlue(i*18,0.6);
        		i++;
        		}
		
	}

task kirari{
loop{
wait(100);
wait(160);
PlaySE(kira);
wait(1);
}
}

task fire2{

loop{
wait(100);
		loop(2){
			ConcentrationEx( 60, 243 );
			ConcentrationEx( 60, 243 );
		}
	        PlaySE(imachargingup);
wait(80);
			ascent(i in 0..20) {
PlaySE(diss);
				let ang=GetAngleToPlayer()+i*18;
                                let sw=1;
				CreateShotA(0,GetX,GetY,0);
				SetShotDataA(0,0,1+i%2,ang,sw*5,1/80,3,200);
				SetShotDataA(0,80,2+i%2,NULL,sw*3,0,0,NULL);
				SetShotDataA(0,80+80,NULL,NULL,0,0.01,99,NULL);
				ascent(i in 1..30) {
					CreateShotA(1,0,0,0);
					SetShotDataA(1,0,1+i%2,ang+(400+i*20)*sw,0,0.01,99,192);
					AddShot(80+i*5,0,1,0);
				}
				FireShot(0);
			}
wait(80);
}
}



    	task BeltBlue(angle,speed){
		let obj = Obj_Create(OBJ_SHOT);
		let l = 0;
		ObjShot_SetBombResist(obj,true);
		Obj_SetPosition(obj,GetX,GetY);
		Obj_SetSpeed(obj,2);
		Obj_SetAutoDelete(obj,false);
		//Obj_SetCollisionToPlayer(obj,false);
		//Obj_SetAlpha(obj,50);
		ObjShot_SetGraphic(obj,196);
		ObjShot_SetDelay(obj,0);
	loop(180/speed){
		Obj_SetAngle(obj,angle);
		angle=angle+speed;
		yield;}
	loop{
		Obj_SetCollisionToPlayer(obj,true);
		Obj_SetAlpha(obj,255);
		Obj_SetAngle(obj,angle);
		angle=angle+speed/2;
		yield;}
	}

    	task BeltRed(angle,speed){
		let obj = Obj_Create(OBJ_SHOT);
		let l = 0;
		ObjShot_SetBombResist(obj,true);
		Obj_SetPosition(obj,GetX,GetY);
		Obj_SetSpeed(obj,2);
		Obj_SetAutoDelete(obj,false);
		//Obj_SetCollisionToPlayer(obj,false);
		//Obj_SetAlpha(obj,50);
		ObjShot_SetGraphic(obj,195);
		ObjShot_SetDelay(obj,0);
	loop(180/speed){
		Obj_SetAngle(obj,angle);
		angle=angle-speed;
		yield;}
	loop{
		Obj_SetCollisionToPlayer(obj,true);
		Obj_SetAlpha(obj,255);
		Obj_SetAngle(obj,angle);
		angle=angle-speed/2;
		yield;}
	}

}


