
#Title[őuMkXv]
#Text[]
#ScriptVersion[2]


script_enemy_main{let name="őuMkXv";
let csd = GetCurrentScriptDirectory;

    let imgBoss   = csd ~ "Boss.png";
    let frame     =  0;
    let angleBase = 90;
let angle2 = 0;
        let count;//eoԊu𐧌䂷邽߂̕ϐ;
	let count2;//eoԊu𐧌䂷邽߂̕ϐ;
	let cx;//ϐcxɐ^񒆂̍W;
	let kari=1;
        let angle=90;
let count3;
let count4;
let wIni    = 120;
let angle3=120;
let angle4=240;

//ʒu
let xIni = GetCenterX;
let yIni = GetClipMaxY - 32;
let i=0;

 @Initialize {CutIn(KOUMA, name, "", 0, 0, 0, 0);
        SetLife(1);
        SetTimer(104);
        SetScore(20000000);
        LoadGraphic(imgBoss);
        SetTexture(imgBoss);
SetGraphicRect(1, 1, 64, 64);
//ForbidShot(true);
SetInvincibility(175);
SetDamageRate(0, 0);
SetMovePosition02(GetCenterX, GetClipMinY + 120, wIni);
TMain;
SetDurableSpellCard();}
count=0;
count2=0;
count3=0;
@MainLoop {SetCollisionB(0, 0, 0);
count3++;
if(count3==120){TConcentration;}
if(count3>=180){
frame++;
if((frame/60<4)&&(frame%60==0)){
CreateShot01(GetX,GetY,6.3,GetAngleToPlayer,RED03,0);
loop(16){CreateShot01(GetX+rand(-30,30),GetY+rand(-30,30),rand(2.5,5.9),GetAngleToPlayer,RED02,rand(3,18))}
loop(16){CreateShot01(GetX+rand(-30,30),GetY+rand(-30,30),rand(2.5,5.9),GetAngleToPlayer,RED01,rand(3,18))}
loop(24){CreateShot01(GetX+rand(-30,30),GetY+rand(-30,30),rand(2.5,5.9),GetAngleToPlayer,RED05,rand(3,18))}
loop(19){CreateShot01(GetX+rand(-30,30),GetY+rand(-30,30),rand(2,5.9),GetAngleToPlayer,RED31,rand(3,18))}
loop(25){CreateShot01(GetX+rand(-30,30),GetY+rand(-30,30),rand(2,5.9),GetAngleToPlayer,RED32,rand(3,18))}
}

if(frame==240){TimeStop(40,1,1,1);
MagicCircle(false);}

if((frame>=280)&&(frame<=640)){
if(frame%40==0){
CreateLaserA(0,416,GetPlayerY,1000,5,RED11,6);
SetLaserDataA(0,0,180,0,0,0,0);
SetShotKillTime(0,25);
FireShot(0);}
if(frame%40==10){
CreateLaserA(1,GetPlayerX,16,1000,5,RED11,6);
SetLaserDataA(1,0,90,0,0,0,0);
SetShotKillTime(1,25);
FireShot(1);}
if(frame%40==20){
CreateLaserA(2,32,GetPlayerY,1000,5,RED11,6);
SetLaserDataA(2,0,0,0,0,0,0);
SetShotKillTime(2,25);
FireShot(2);}
if(frame%40==30){
CreateLaserA(3,GetPlayerX,464,1000,5,RED11,6);
SetLaserDataA(3,0,-90,0,0,0,0);
SetShotKillTime(3,25);
FireShot(3);}
}


if((frame>=260)&&(frame<=700)){SetMovePosition02(-100,-100,0);
}
if(frame==700){TimeStop(40,1,1,1)}
if(frame==720){SetMovePosition02(GetCenterX, GetClipMinY + 120, 0)}
if(frame==740){frame=0;}
count++;
if(count==90)
{SetMovePosition02(rand(100,400),rand(GetClipMinY + 80,GetClipMinY + 140),30);
count = 30;
}
}}

@DrawLoop {DrawGraphic(GetX, GetY);}
@Finalize {DeleteGraphic(imgBoss);
loop(10){CreateItem(ITEM_SCORE,GetX+rand(-100,100),GetY+rand(-50,30))}
ForbidShot(false);}

task TMain{
yield;
standBy;}
sub standBy{
SetMovePosition02(GetCenterX, GetClipMinY + 120, wIni);}

task TConcentration{concentration;}
sub concentration {
    let wConc = 60;
    Concentration01(wConc);
    wait(wConc);}

function wait(wConc){loop(wConc){yield;}}}