TouhouDanmakufu
#Title[Non Spellcard 1]
#Text[Lunatic]
#Image[]
#PlayLevel[Lunatic]
#Player[FREE]
#ScriptVersion[2]
#BGM[]

script_enemy_main{

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

        let hit = 1;

	@Initialize{
                SetInvincibility(230);
		SetLife(3000);
		SetTimer(44);
                SetEnemyMarker(true);
                MagicCircle(true);
                SetX(GetCenterX-300);
	        SetY(GetClipMinY-200);
                SetMovePosition02(GetCenterX, GetClipMinY + 120, 120);
                LoadUserShotData(shot);
                InitializeAction();
	
		mainTask;
	}

	@MainLoop{

	if(((|GetX-GetPlayerX|)^2+(|GetY-GetPlayerY|)^2)^0.5 < 20){
                SetCommonData("robado",1);
	}

if (hit==1){
		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{

	}

	@Finalize{

	}

	task mainTask{
                wait(150);
                SetCommonData("notrans",true);
		yield;
		fire;
	}

task buba{
        let angles=0;
loop(10){
CreateShotA(0, GetCenterX, GetClipMinY + 120, 30);
SetShotDataA(0, 0, 1, angles, 0.25, 0, 0, BLUE03);
FireShot(0);
CreateShotA(0, GetCenterX, GetClipMinY + 120, 30);
SetShotDataA(0, 0, 1, angles+30, -0.25, 0, 0, BLUE03);
FireShot(0);
}
angles+=360/10;
}

	task movement{

		wait(200);
                SetMovePosition02(GetClipMinX-170, rand(GetPlayerY,GetCenterY - 100), 60);
		wait(70);
                hit=0;
	        SetY(GetPlayerY);
		wait(30);
                SetMovePosition02(GetClipMaxX+150, GetPlayerY, 30);
                PlaySE(onmyway);
		wait(50);
                hit=1;
                SetMovePosition02(GetCenterX, GetCenterY - 100, 60);
		wait(70);
                fire2;
		wait(30);
	}

	task fire2 {

			ascent (let i in 0..6) {
				ascent (let j in 0..30) {
PlaySE(diss);
					CreateShotA(0, GetX, GetY, 25);
	SetShotDataA(0, 0, 1.5, j*15, [-0.1, 0.2,-0.3, 0.4,-0.5,0.6][i], 0, 0, [199,198,199,198,199,198][i]);
					SetShotDataA(0, 150, NULL, NULL, 0, 0, 0, NULL);
					FireShot(0);
				}
				wait(40);
			}
			//wait(80);
	
	}

	task fire{

	let count=0;
	let color=[134,135,136,137,138,139,140,141,142,143,144,145,146,147,148];

	while(true) {
                PlaySE(imachargingup);
		loop(2){
			ConcentrationEx( 60, 243 );
			ConcentrationEx( 60, 243 );
		}
                wait(70);
		movement;
		ascent(cnt in 0..370) {
                PlaySE(dis);
		    let ang=count*40+cnt*3492*p1m0(count);
      		    let x=GetCenterX()+cos(ang)*cnt;
		    let y=GetCenterY()+sin(ang)*cnt;
		    CreateShotA(0,x,y-100,30);
	            SetShotDataA(0,0,0,ang-180-cnt*p1m0(cnt),0,0,0,color[rand_int(0,14)]);
		    SetShotDataA(0,100,0,NULL,p1m0(cnt),0.005,2,NULL);
	            SetShotDataA(0,330,NULL,NULL,0,0.005,2,NULL);
		    FireShot(0);
		    wait(1);
		}
		count++;
		wait(60);
	}
}

}

