#TouhouDanmakufu
#Title[Marisa midboss nonspell]
#Text[Moo]
#Player[FREE]
#ScriptVersion[2]
#BackGround[User(.\moon.png, 0, 0)]
script_enemy_main {
    let ImgBoss = GetCurrentScriptDirectory~"MarisaSprites.png";
	let shot = GetCurrentScriptDirectory~"shot.wav";
	let shot2 = GetCurrentScriptDirectory~"shot2.wav";
	let bounce = GetCurrentScriptDirectory~"bounce.wav";
	let t = 0;
	let a = 0;
	let v = 1;
	let z = 0;
    let frame = -120;
	let frame2 = 1;
	let n = 0;
#include_function ".\lib\SHOT_REPLACE\shot_replace.dnh"
    @Initialize {
        SetLife(2350);
        SetTimer(40);
        LoadSE(shot);
	LoadSE(bounce);
	LoadSE(shot2);
	SetShotAutoDeleteClip(100, 200, 100, 100);
	shotinit;
	SetEnemyMarker(true);
	SetInvincibility(200);
	SetDamageRate(100, 40);
        SetMovePosition02(GetCenterX, GetClipMinY + 120, 120);
        
        LoadGraphic(ImgBoss);
        SetTexture(ImgBoss);
        SetGraphicRect(1, 1, 64, 70);
    }

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

	if(frame==2  || frame==8 || frame==14 || frame==20 ||frame==24 || frame==28 || frame==32 || frame == 36 || frame == 40 || frame == 44 || frame == 48 || frame == 52 || frame == 56 || frame == 60){
	let a   = 0;
        let num = 24; //Change this number here to specify the number of bullets in the ring.

	loop(num)
            {	
		PlaySE(shot);
		CreateShotA(1, GetX, GetY, 0);
		SetShotDataA(1, 0, 0, a+90+v, 0.20*z, 0.1, 2, YELLOW58);
		a +=360/num;
FireShot(1);

}
        }

if(frame==61){
z=rand_int(-1, 1);
frame=0;
}
        frame++;
	v+=2;
	
	
    }

function Wait(w){loop(w){yield;}}


sub ExMove { ExMove_(GetCenterY-100, 30, rand(15, 30)); }
function ExMove_(height, ud, length) {
	
	if(GetPlayerX < GetX) {
		if(GetX - length <= GetClipMinX) {
			SetMovePosition03(GetX + length, rand(height - ud, height + ud), 5, 11);
		} else {
			SetMovePosition03(GetX - length, rand(height - ud, height + ud), 5, 11);
		}
	} else {
		if(GetX + length >= GetClipMaxX) {
			SetMovePosition03(GetX - length, rand(height - ud, height + ud), 5, 11);
		} else {
			SetMovePosition03(GetX + length, rand(height - ud, height + ud), 5, 11);
		}
	}
}
	// Movement functions for the boss to move towards the player.

    @DrawLoop {
		
                DrawGraphic(GetX,GetY);
    }
let v = 0;
    @Finalize {
        DeleteGraphic(ImgBoss);
    }
}
