script_enemy_main
{
    let count=0;//地獄陰陽球
    let MT=0;
    let mm=0;
    let N15=0;
    let N16=0;
    let N17=0;
    let life=0;
    let ten=0;
    let Level=0;

    task CreateShot021(let x, let y, let speed, let angle, let Accelerate, let MaxSpeed, let grf, let delay)
{
    let obj = Obj_Create(OBJ_SHOT);
    let N15 = 0;
    Obj_SetX(obj, x);
    Obj_SetY(obj, y);
    Obj_SetSpeed(obj, speed);
    Obj_SetAngle(obj, angle);
    ObjShot_SetGraphic(obj, grf);
    ObjShot_SetDelay(obj, delay);
    ObjShot_SetBombResist(obj,true);
    if (Accelerate<0) {
        N15=1;
    }
    if (Accelerate>0) {
        N15=2;
    }
    while ( !Obj_BeDeleted(obj) )
    {
        if (speed>MaxSpeed&&N15==1) {
            Obj_SetSpeed(obj, speed+Accelerate);
        }
        if (speed<MaxSpeed&&N15==1) {
            Obj_SetSpeed(obj, MaxSpeed);
        }
        if (speed<MaxSpeed&&N15==2) {
            Obj_SetSpeed(obj, speed+Accelerate);
        }
        if (speed>MaxSpeed&&N15==2) {
            Obj_SetSpeed(obj, MaxSpeed);
        }
        yield;
    }
}

function CreateWayShot02(Way,Gap,PosX,PosY,Dist,Speed,Angle,Accelerate,MaxSpeed,Graphic,Delay) {
    if (Graphic==100) {
        ascent(let i in 0..Way) {
            CreateShot021(PosX+Dist*cos(Angle+Gap*(i+0.5-(Way * 0.5))),PosY+Dist*sin(Angle+Gap*(i+0.5-(Way * 0.5))),Speed,Angle+Gap*(i+0.5-(Way*0.5)),Accelerate,MaxSpeed,Graphic,Delay);
        }
    }
    else {
        ascent(let i in 0..Way) {
            CreateShot02(PosX+Dist*cos(Angle+Gap*(i+0.5-(Way * 0.5))),PosY+Dist*sin(Angle+Gap*(i+0.5-(Way * 0.5))),Speed,Angle+Gap*(i+0.5-(Way*0.5)),Accelerate,MaxSpeed,Graphic,Delay);
        }
    }
}

function dead {
    SetDamageRate(0,0);

    if (N17==20) {
        if (GetArgument==4||GetArgument==4.5||GetArgument==6&&BeVanished==false) {
            loop(20) {
                CreateItem(ITEM_SCORE,GetX()+rand(-64,64),GetY()+rand(-35,85));
            }
        }
        if (GetArgument>=9&&GetArgument<10&&BeVanished==false&&GetArgument!=9.8) {
            loop(40) {
                CreateItem(ITEM_SCORE,GetX()+rand(-64,64),GetY()+rand(-35,85));
            }
        }
        if (BeVanished==false) {
            if (GetArgument<9||GetArgument>9.5) {
                if (GetArgument==9.8) {
                    loop(30) {
                        CreateItem(ITEM_SCORE,GetX()+rand(-88,88),GetY()+rand(-55,95));
                    }
                    CreateEnemyFromFile(GetCurrentScriptDirectory~"Servant10.txt",GetX,GetY,0,0,4);
                    PlaySE(GetCurrentScriptDirectory~"\se\Baaaaaaaan.wav");
                }
                else {
                    CreateEnemyFromFile(GetCurrentScriptDirectory~"Servant10.txt",GetX,GetY,0,0,2);
                    PlaySE(GetCurrentScriptDirectory~"\se\Baaaan2.wav");
                }
            }
            else {
                ascent(let t in 0..9) {
                    ascent(let tt in 0..8) {
                        CreateShot01(GetX(),GetY(),2.8-t*0.2,45*tt,72,6);
                    }
                }
                SetCommonData("Go",1);
                AddScore(3000000);
                CreateEnemyFromFile(GetCurrentScriptDirectory~"Servant10.txt",GetX,GetY,0,0,4);
                PlaySE(GetCurrentScriptDirectory~"\se\Baaaaaaaan.wav");
            }
            SetCommonData("ii1",GetCommonDataDefault("ii1",0)+GetCommonDataDefault("ii2",0));
            SetCommonData("ii3",1);
            loop(10) {
                CreateItem(ITEM_SCORE,GetX()+rand(-44,44),GetY()+rand(15,75));
            }
            if (GetArgument==9.8&&Level==15) {
                loop(60) {
                    CreateItem(ITEM_SCORE,GetX()+rand(-128,128),GetY()+rand(-75,115));
                }
                CreateItem(ITEM_BOMB,GetX(),GetY()+22);
            }
        }
    }

    if (N17<100) {
        N17+=20;
    }
    if (N17>=100) {
        VanishEnemy;
    }
    if (count%3<=0) {
        Explosion01(GetX+rand(-10,10),GetY+rand(-10,10),24,0.1,20);
    }
}

@Initialize
{
    SetLife(5434);
    SetDamageRate(200,5);
    SetScore(50000);
    Level+=GetPlayerLife();
}


@MainLoop
{
    if (count%5==0) {
        life=GetLife();
    }if (ten==1&&count%5==1) {
        ten=0;
    }
    if (count%5==4&&GetLife()<life&&GetLife()>200) {
        ten=1;
    }


    if (GetArgument==0) {
        if (count<=50) {
            SetColor(0,0,0);
            N16++;
        }
        if (count>=50&&count<=112) {
            SetColor((count-50)*3,(count-50)*3,(count-50)*3);
            N16++;
        }
        if (count>420) {
            VanishEnemy;
        }
        if (count%6==0&&count>88&&count<200&&GetSpeed()==0&&N15!=0) {
            PlaySE(GetCurrentScriptDirectory~"\se\Shot02.wav");
            CreateShot01(GetX(),GetY(),4.7,N15,170,0);
        }
        if (count%8==0&&count>138&&count<250&&GetX%4>1) {
            PlaySE(GetCurrentScriptDirectory~"\se\Shot00.wav");
            ascent(let t in 0..mm+1) {
                ascent(let tt in 0..4) {
                    CreateShot01(GetX()-(40-t*16)*cos(90*tt),GetY()-(40-t*6)*sin(90*tt),3.2,90+90*tt,9,10);
                }
            }if (mm<8) {
                mm++;
            }
        }
        if (count%8==0&&count>138&&count<250&&GetX%4<=1) {
            PlaySE(GetCurrentScriptDirectory~"\se\Shot00.wav");
            ascent(let t in 0..mm+1) {
                ascent(let tt in 0..4) {
                    CreateShot01(GetX()+(40+t*4)*cos(90*tt),GetY()+(40+t*4)*sin(90*tt),3.2,90+90*tt,9,10);
                }
            }if (mm<12) {
                mm++;
            }
        }
        if (count>=0&&count<=15) {
            SetAngle(90);
            SetLife(5520);
            if (GetPlayerType()==REIMU_A) {
                SetLife(5560);
            }SetSpeed(3.2);
            SetDamageRate(50,5);
        }
        if (GetX()==GetCenterX+87||GetX()==GetCenterX+133&&count<=20) {
            SetLife(5560);
        }
        if (count>=50&&GetSpeed()==0&&N15==0) {
            N15+=GetAngleToPlayer();
            SetDamageRate(122,26);
        }
        if (count==90) {
            SetSpeed(0);
        }
        if (count>=300) {
            SetSpeed(-3.2);
            if (N16>0) {
                N16-=3;
            }
        }
        if (GetLife<5400) {
            dead;
        }
        else {
            SetCollisionA(GetX(),GetY(),15);
            SetCollisionB(GetX(),GetY(),8);
        }
    }

    if (GetArgument==1) {
        if (count<=50) {
            SetColor(0,0,0);
            N16++;
        }
        if (count>=50&&count<=112) {
            SetColor((count-50)*3,(count-50)*3,(count-50)*3);
            N16++;
        }
        if (count>420) {
            VanishEnemy;
        }
        if (count%6==0&&count>88&&count<200&&GetSpeed()==0&&N15!=0) {
            PlaySE(GetCurrentScriptDirectory~"\se\Shot02.wav");
            CreateShot01(GetX(),GetY(),4.7,N15,170,0);
        }
        if (count%8==0&&count>138&&count<250&&GetX%4>1) {
            PlaySE(GetCurrentScriptDirectory~"\se\Shot00.wav");
            ascent(let t in 0..mm+1) {
                ascent(let tt in 0..4) {
                    CreateShot01(GetX()-(40+t*4)*cos(90*tt),GetY()+(40+t*4)*sin(90*tt),3.2,90-90*tt,9,10);
                }
            }if (mm<12) {
                mm++;
            }
        }
        if (count%8==0&&count>138&&count<250&&GetX%4<=1) {
            PlaySE(GetCurrentScriptDirectory~"\se\Shot00.wav");
            ascent(let t in 0..mm+1) {
                ascent(let tt in 0..4) {
                    CreateShot01(GetX()+(40-t*16)*cos(90*tt),GetY()-(40-t*6)*sin(90*tt),3.2,90-90*tt,9,10);
                }
            }if (mm<8) {
                mm++;
            }
        }
        if (count>=0&&count<=20) {
            SetAngle(90);
            SetLife(5520);
            if (GetPlayerType()==REIMU_A) {
                SetLife(5560);
            }SetSpeed(3.2);
            SetDamageRate(50,5);
        }
        if (GetX()==GetCenterX-87||GetX()==GetCenterX-133&&count<=20) {
            SetLife(5560);
        }
        if (count>=50&&GetSpeed()==0&&N15==0) {
            N15+=GetAngleToPlayer();
            SetDamageRate(122,26);
        }
        if (count==90) {
            SetSpeed(0);
        }
        if (count>=300) {
            SetSpeed(-3.2);
            if (N16>0) {
                N16-=3;
            }
        }
        if (GetLife<5400) {
            dead;
        }
        else {
            SetCollisionA(GetX(),GetY(),15);
            SetCollisionB(GetX(),GetY(),8);
        }
    }

    if (GetArgument==2) {
        if (count==0) {
            SetLife(5645);
            SetAngle(90);
        }
        if (count>360) {
            VanishEnemy;
        }
        if (count>0&&count<=80) {
            SetSpeed(1.9-count*0.02);
            SetAngle(90);
        }
        if (count>80&&count<=300) {
            SetSpeed(0);
            SetAngle(-90);
        }
        if (count>300&&count<=450) {
            SetSpeed((count-300)*0.1);
            SetAngle(-90);
        }
        if (count>=80&&count<=260&&count%4==0) {
            PlaySE(GetCurrentScriptDirectory~"\se\Shot00.wav");
            ascent(let t in 0..2) {
                CreateShot01(GetX()-20+t*40,GetY()+20,3.6+GetPlayerLife(),90,BLUE01,32);
                CreateShot01(GetX()-20+t*40,GetY()+20,3.6+GetPlayerLife(),90,BLUE01,32);
                CreateShot01(GetX()-40+t*80,GetY(),2.7+GetPlayerLife(),90,RED01,24);
                CreateShot01(GetX()-58+t*116,GetY(),2.7+GetPlayerLife(),90,RED01,24);
                CreateShot01(GetX()-75+t*150,GetY(),2.7+GetPlayerLife(),90,RED01,24);
            }
        }
        if (count>=80&&count<=170&&count%6==0) {
            PlaySE(GetCurrentScriptDirectory~"\se\Laser.wav");
            CreateLaser01(GetX()-20,GetY()+20,4.2,-50-count,200,8,17,12);
            CreateLaser01(GetX()+20,GetY()+20,4.2,-130+count,200,8,17,12);
            CreateLaser01(GetX()-20,GetY()+20,4.2,-100-count,200,8,17,12);
            CreateLaser01(GetX()+20,GetY()+20,4.2,-80+count,200,8,17,12);
        }
        if (GetLife<5400) {
            dead;
        }
        else {
            if (count>=70) {
                SetCollisionA(GetX(),GetY(),18);
                SetCollisionB(GetX(),GetY(),9);
            }
        }
    }

    if (GetArgument==3) {
        if (count==0) {
            SetLife(5528);
            SetAngle(90);
        }
        if (count>260) {
            VanishEnemy;
        }
        if (count>0&&count<=80) {
            SetSpeed(1.9-count*0.02);
            SetAngle(90);
        }
        if (count>80&&count<=200) {
            SetSpeed(0);
            SetAngle(-90);
        }
        if (count>200&&count<=350) {
            SetSpeed((count-200)*0.1);
            SetAngle(-90);
        }
        if (count>=80&&count<=160&&count%6==0) {
            PlaySE(GetCurrentScriptDirectory~"\se\Shot02.wav");
            ascent(let t in 0..6) {
                CreateShot01(GetX(),GetY(),1+(count-80)*(0.02+Level*0.008),GetAngleToPlayer()+t*60,BLUE01,10);
            }
        }
        if (GetLife<5400) {
            dead;
        }
        else {
            if (count>=70) {
                SetCollisionA(GetX(),GetY(),18);
                SetCollisionB(GetX(),GetY(),9);
            }
        }
    }

    if (GetArgument==4) {
        mm+=7+2*sin(count*2);
        if (count==0) {
            SetLife(5600);
        }
        SetDamageRate(240,32);
        if (GetX>GetPlayerX+60||GetX<GetPlayerX-60) {
            SetDamageRate(120,11);
        }
        if (count>0) {
            SetSpeed(2.5);
        }if (count>300) {
            VanishEnemy;
        }
        if (count>10&&count%18==0) {
            N15=0;
            N15+=rand(-24,24);
            ascent( let t in 0..5 ) {
                PlaySE(GetCurrentScriptDirectory~"\se\Shot02.wav");
                CreateShot01(GetX(),GetY(),2.5+t*0.3,90+N15,176,10);
            }
        }
        if (GetLife<5400) {
            dead;
        }
        else {
            if (count>=22) {
                SetCollisionA(GetX(),GetY()-5,25);
                SetCollisionB(GetX(),GetY(),13);
            }if (count>=60) {
                SetDamageRate(100,25);
            }
        }
    }

    if (GetArgument==4.5) {
        mm+=7+2*sin(count*2);
        if (count==0) {
            SetLife(5600);
        }
        SetDamageRate(380,33);
        if (GetX>GetPlayerX+60||GetX<GetPlayerX-60) {
            SetDamageRate(222,22);
        }
        if (count>0) {
            SetSpeed(2.2);
        }if (count>270) {
            VanishEnemy;
        }
        if (count>10&&count%18==0) {
            ascent( let t in 0..8 ) {
                PlaySE(GetCurrentScriptDirectory~"\se\Shot02.wav");
                CreateShot01(GetX(),GetY(),2+t*0.2,90,249,10);
            }
        }
        if (GetLife<5400) {
            dead;
        }
        else {
            if (count>=22) {
                SetCollisionA(GetX(),GetY()-5,25);
                SetCollisionB(GetX(),GetY(),13);
            }if (count>=60) {
                SetDamageRate(100,25);
            }
        }
    }

    if (GetArgument==5) {
        if (count==0) {
            SetLife(5568);
            SetAngle(90);
            if (GetPlayerType()==REIMU_A) {
                SetLife(5526);
            }SetDamageRate(64,5);
            if (Level<4) {
                Level=4;
            }
        }
        if (count>400) {
            VanishEnemy;
        }
        if (count>0&&count<=80) {
            SetSpeed(1.9-count*0.02);
            SetAngle(90);
        }
        if (count>80&&count<=280&&GetX<GetCenterX) {
            SetSpeed(0);
            SetAngle(GetAngleToPlayer-12);
        }
        if (count>80&&count<=280&&GetX>GetCenterX) {
            SetSpeed(0);
            SetAngle(GetAngleToPlayer+12);
        }
        if (count>280&&count<=400) {
            SetSpeed((count-280)*0.1);
        }
        if (count>=80&&count<=130&&count%4==0) {
            CreateShot01(GetX()+20,GetY()-20,1+Level*0.5,85,RED04,20);
            CreateShot01(GetX()-20,GetY()-20,1+Level*0.5,95,RED04,20);
        }
        if (count>=80&&count<=130&&count%3==0) {
            PlaySE(GetCurrentScriptDirectory~"\se\Shot01.wav");
            CreateShot01(GetX(),GetY()+30,1+Level*0.8,90,RED04,20);
        }
        if (count>=130&&count<=180&&count%6==0) {
            PlaySE(GetCurrentScriptDirectory~"\se\Shot02.wav");
            ascent(let t in 0..6) {
                CreateShot01(GetX(),GetY(),1+(count-130)*(0.02+Level*0.01),GetAngleToPlayer()+t*60,72,10);
            }
        }
        if (count==180||count==210&&GetCommonDataDefault("ii1",0)>=500) {
            PlaySE(GetCurrentScriptDirectory~"\se\Shot01.wav");
            ascent(let t in 0..36) {
                CreateShot01(GetX(),GetY(),0.8+Level*0.1,GetAngleToPlayer()+t*10,RED01,10);
            }
        }
        if (GetLife<5400) {
            dead;
        }
        else {
            if (count>=70) {
                SetCollisionA(GetX(),GetY(),18);
                SetCollisionB(GetX(),GetY(),9);
            }
        }
    }

    if (GetArgument==5.5) {
        if (count==0) {
            SetLife(5455);
            SetAngle(90);
            if (GetPlayerType()==REIMU_A) {
                SetLife(5526);
            }SetDamageRate(100,5);
        }
        if (count>500) {
            VanishEnemy;
        }
        if (count>0&&count<=80) {
            SetSpeed(1.9-count*0.02);
            SetAngle(90);
        }
        if (count>80&&count<=280) {
            SetSpeed(0);
            SetAngle(-90);
        }
        if (count>350&&count<=440) {
            SetSpeed((count-350)*0.1);
            SetDamageRate(440,15);
        }
        if (count==350&&count<=440) {
            SetAngle(50+80*(GetX>GetCenterX));
        }
        if (count>=80&&count<=130&&count%4==0) {
            CreateShot01(GetX()+20,GetY()-20,3,85,RED01,20);
            CreateShot01(GetX()-20,GetY()-20,3,95,RED01,20);
        }
        if (count>=80&&count<=130&&count%3==0) {
            PlaySE(GetCurrentScriptDirectory~"\se\Shot01.wav");
            CreateShot01(GetX(),GetY()+30,4,90,RED01,20);
        }
        //if(count>=130&&count<=210&&count%6==0){PlaySE(GetCurrentScriptDirectory~"\se\Shot02.wav");
        //	      ascent(let t in 0..6){CreateShot01(GetX(),GetY(),0.7+(count-130)*(0.02+Level*0.01),GetAngleToPlayer()+t*60,RED01,10);}}
        if (count==240) {
            N15=0;
            N15+=GetAngleToPlayer;
        }
        if (count>=180&&count<=460&&count%12==0&&GetCommonDataDefault("ii1",0)>=500) {
            PlaySE(GetCurrentScriptDirectory~"\se\Shot01.wav");
            CreateShot01(GetX(),GetY(),3.4,GetAngleToPlayer(),72,10);
        }
        if (GetLife<5400) {
            dead;
        }
        else {
            if (count>=70) {
                SetCollisionA(GetX(),GetY(),20);
                SetCollisionB(GetX(),GetY(),9);
            }
        }
    }

    if (GetArgument>=6&&GetArgument<7) {
        if (count==0) {
            SetLife(5600);
            SetSpeed(1.8);
            SetAngle(90);
            PlaySE(GetCurrentScriptDirectory~"\se\mizu08.wav");
        }
        if (GetLife<5400) {
            dead;
        }
        else {
            SetCollisionA(GetX(),GetY(),38);
            SetCollisionB(GetX(),GetY(),12);
        }
        if (count<80) {
            SetDamageRate(20,10);
        }
        if (count>=80) {
            SetDamageRate(120,40);
        }
        if (count>=200) {
            SetDamageRate(300,40);
        }
        if (GetArgument==6) {
            if (count>=20&&count%8==0) {
                PlaySE(GetCurrentScriptDirectory~"\se\Shot02.wav");
                CreateShot02(GetX()-1,GetY(),4.4,90,0.1,3.5,249,0);
                CreateShot02(GetX()-1,GetY(),3,-90,0.1,1.3,249,0);
            }
            if (count%3==0) {
                PlaySE(GetCurrentScriptDirectory~"\se\Shot00.wav");
            }
            if (count<170&&count%4==0) {
                CreateShot02(GetX(),GetY(),4,31,0.1,3.5,249,0);
                CreateShot02(GetX(),GetY(),4,149,0.1,3.5,249,0);
            }
        }
        else {
            SetSpeed(1.8);
            if (count>=20&&count%5==0) {
                PlaySE(GetCurrentScriptDirectory~"\se\Shot02.wav");
                ascent(let t in 0..8) {
                    CreateShot01(GetX(),GetY(),4,count*4+t*45,249,0);
                }
            }
        }
        if (count>380) {
            VanishEnemy;
        }
    }

    if (GetArgument==7) {
        if (count==0) {
            SetLife(5528);
            SetAngle(90);
            if (GetPlayerType()==REIMU_A) {
                SetLife(5556);
            }SetDamageRate(64,5);
        }
        if (count>400) {
            VanishEnemy;
        }
        if (count>0&&count<=80) {
            SetSpeed(1.9-count*0.02);
            SetAngle(90);
        }
        if (count>80&&count<=280) {
            SetSpeed(0);
            SetAngle(-90);
        }
        if (count>280&&count<=400) {
            SetSpeed((count-280)*0.1);
            SetAngle(-90);
        }
        if (count>=80&&count<=130&&count%4==0) {
            CreateShot01(GetX()+20,GetY()-20,1+Level*0.5,85,BLUE01,20);
            CreateShot01(GetX()-20,GetY()-20,1+Level*0.5,95,BLUE01,20);
        }
        if (count>=80&&count<=130&&count%3==0) {
            PlaySE(GetCurrentScriptDirectory~"\se\Shot01.wav");
            CreateShot01(GetX(),GetY()+30,1+Level*0.8,90,BLUE01,20);
        }
        if (count>=130&&count<=180&&count%6==0) {
            PlaySE(GetCurrentScriptDirectory~"\se\Shot02.wav");
            ascent(let t in 0..6) {
                CreateShot01(GetX(),GetY(),1+(count-130)*(0.02+Level*0.01),GetAngleToPlayer()+t*60,BLUE01,10);
            }
        }
        if (count==180||count==210) {
            PlaySE(GetCurrentScriptDirectory~"\se\Shot01.wav");
            ascent(let t in 0..36) {
                CreateShot01(GetX(),GetY(),0.8+Level*0.1,GetAngleToPlayer()+t*10,BLUE01,10);
            }
        }
        if (GetLife<5400) {
            dead;
        }
        else {
            if (count>=70) {
                SetCollisionA(GetX(),GetY(),18);
                SetCollisionB(GetX(),GetY(),9);
            }
        }
    }

    if (GetArgument==8) {
        if (count>949) {
            VanishEnemy;
        }
        //if(count==100){SetColor(255,0,0);Concentration01(180);PlaySE(GetCurrentScriptDirectory~"\se\puu811.wav");}
        if (count==600) {
            SetColor(255,0,0);
            Concentration01(180);
            PlaySE(GetCurrentScriptDirectory~"\se\puu811.wav");
        }
        if (count>=0&&count<=5) {
            SetAngle(90);
            SetLife(7500);
            SetSpeed(3.2);
            SetDamageRate(100,80);
        }
        if (count>20&&count<=100) {
            SetSpeed(3.4-count*0.034);
            SetAngle(90);
        }
        if (count==100) {
            SetSpeed(0);
        }
        /*if(count>=280&&count<=668){
        if(count%2<=0){PlaySE(GetCurrentScriptDirectory~"\se\Shot02.wav");}
        if(count%40>=0&&count%40<=12&&count%2<=0){
        //if(count<=657){ascent(let t in 0..6){CreateShotA(N15,GetX()+32*cos(count*0.3+t*60),GetY()+32*sin(count*0.3+t*60),15);SetShotDataA(N15,0,5,count*0.3+t*60,-0.2,-0.07,3.0,201);FireShot(N15);}}
        ascent(let t in 0..6){CreateShotA(N15,GetX()+25*cos(15-count*1.3+t*60),GetY()+25*sin(15-count*1.3+t*60),8);SetShotDataA(N15,0,3,45-count*1.3+t*60,0.5,-0.01,2.8-t*0.1,169);FireShot(N15);}}
        if(count%40>=20&&count%40<=32&&count%2<=0){
        //if(count<=657){ascent(let t in 0..6){CreateShotA(N15,GetX()+32*cos(-count*0.3+t*60),GetY()+32*sin(-count*0.3+t*60),15);SetShotDataA(N15,0,5,-count*0.3+t*60,0.2,-0.07,3.0,201);FireShot(N15);}}
        ascent(let t in 0..6){CreateShotA(N15,GetX()+25*cos(15+count*1.3+t*60),GetY()+25*sin(15+count*1.3+t*60),8);SetShotDataA(N15,0,3,45+count*1.3+t*60,-0.5,-0.01,2.8-t*0.1,169);FireShot(N15);}}
        if(count%6==0&&count<=660){PlaySE(GetCurrentScriptDirectory~"\se\Shot00.wav");ascent(let t in 0..10){CreateShotA(N15,GetX()+16*cos(GetAngleToPlayer()+t*30),GetY()+16*sin(GetAngleToPlayer()+t*30),12);
        SetShotDataA(N15,0,5,GetAngleToPlayer()+rand(-2,2)+t*36,rand(-0.27,0.27),-0.06,0.8,201);
        SetShotDataA(N15,60,NULL,NULL,0,0.1,4,NULL);FireShot(N15);}}}*/
        if (count==720) {
            SetMovePositionHermite(450,120,0,250,544,200,80);
            /*ascent(let t in 0..24){CreateShot02(GetX(),GetY(),0,t*15,0.042,4.2,49,0);
            CreateShot02(GetX(),GetY(),0,t*15,0.038,3.8,41,0);
            CreateShot02(GetX(),GetY(),0,t*15+7.5,0.034,3.4,41,0);
            CreateShot02(GetX(),GetY(),0,t*15+7.5,0.031,3.1,41,0);
            CreateShot02(GetX(),GetY(),0,t*15+7.5,0.025,2.8,41,0);
            CreateShot02(GetX(),GetY(),0,t*15+7.5,0.023,2.3,41,0);
            CreateShot02(GetX(),GetY(),0,t*15+7.5,0.020,2.0,41,0);
            CreateShot02(GetX(),GetY(),0,t*15,0.015,1.8,41,0);
            CreateShot02(GetX(),GetY(),0,t*15,0.013,1.3,49,0);}PlaySE(GetCurrentScriptDirectory~"\se\Shot01.wav");*/
        }
        if (count==780) {
            SetMovePositionHermite(-150,120,1226,350,22,200,180);
        }
        if (count>=720&&count<=800) {
            SetLife(5200);
        }
        if (count>840&&count<=946) {
            SetLife(5200);
            CreateItem(ITEM_SCORE,GetX()+rand(-34,34),GetY()+rand(-25,25));
            CreateItem(ITEM_SCORE,GetX()+rand(-24,24),GetY()+rand(-35,35));
        }
        SetCollisionA(GetX(),GetY(),15);
        SetCollisionB(GetX(),GetY(),16);
    }
    if (count>=770) {
        PlaySE(GetCurrentScriptDirectory~"\se\Shot00.wav");
    }

    if (GetArgument>=9&&GetArgument<=9.5) {
        let toAngle=atan2(GetPlayerY()-GetY(), GetPlayerX()-GetX());
        if (toAngle>=360) {
            toAngle-=360;
        }
        if (toAngle<0) {
            toAngle+=360;
        }
        let ret=toAngle-mm;
        if ((ret>0&&ret<=180)||(ret<=0&&ret<=-180)) {
            mm+=0.25;
        }
        if ((ret>0&&ret>180)||(ret<=0&&ret>-180)) {
            mm-=0.25;
        }
        if (mm>=360) {
            mm-=360;    //360°以上なら0〜360内に補正
        }
        if (mm<0) {
            mm+=360;    //0°未満なら0〜360内に補正
        }
        if (count>1270) {
            VanishEnemy;
        }
        if (count==70) {
            N15=0;
            N15+=GetAngleToPlayer;
            if (GetArgument==9.5) {
                mm=270;
            } else {
                mm=90;
            }
        }
        if (count>=70&&count<=90&&count%5==0) {
            PlaySE(GetCurrentScriptDirectory~"\se\Shot04.wav");
            CreateShot01(GetX()+6.5,GetY()+8,4.3,N15,89,20);
            CreateShot01(GetX()-6.5,GetY()+8,4.3,N15,89,20);
        }
        if (count>70&&count<1020&&count%52==0)
        {
            SetSpeed(0);
            SetMovePositionRandom01(rand(10,100),rand(10,40),0.3,GetCenterX()-70,121,GetCenterX()+70,143);
        }
        if (count==0) {
            SetDamageRate(0.1,0.1);
            SetLife(6700);
            if (GetArgument==9) {
                SetMovePositionRandom01(0,200,8,GetCenterX,170,GetCenterX,170);
            }
            if (GetArgument==9.4) {
                SetMovePositionRandom01(0,200,8,GetCenterX,45,GetCenterX,55);
            }
            if (GetArgument==9.5) {
                SetMovePositionRandom01(0,200,8,GetCenterX,440,GetCenterX,400);
            }
        }
        if (count==1140) {
            SetMovePositionRandom01(0,200,3,GetCenterX,-80,GetCenterX,-80);
        }
        if (count>=150) {
            SetDamageRate(0.1,0.1);
        }
        if (count>=1140) {
            SetDamageRate(0,0);
        }
        if (count>=70&&count<=120) {
            N16+=1.1;
        }
        if (count>=120&&count<1080) {
            if (count%120==0) {
                N15=0;
                N15+=GetAngleToPlayer;
            }
            if (count>=1000&&count<=1080&&N16>0) {
                N16-=0.5;
            }
            if (count%5==0&&count%120<=20) {
                PlaySE(GetCurrentScriptDirectory~"\se\Shot04.wav");
                CreateShot01(GetX()+6.5,GetY()+8,4.3,N15,89,20);
                CreateShot01(GetX()-6.5,GetY()+8,4.3,N15,89,20);
            }
            if (count>=300&&count<=400&&count%4==0&&count%20>8&&GetArgument!=9.5) {
                PlaySE(GetCurrentScriptDirectory~"\se\Shot02.wav");
                ascent(let tt in 1..4) {
                    CreateShot01(GetX()+tt*N16*cos(mm+90),GetY()+tt*N16*sin(mm+90),4,70,72,15);
                    CreateShot01(GetX()+tt*N16*cos(mm-90),GetY()+tt*N16*sin(mm-90),4,70,72,15);
                    CreateShot01(GetX()+tt*N16*cos(mm+90),GetY()+tt*N16*sin(mm+90),4,250,72,15);
                    CreateShot01(GetX()+tt*N16*cos(mm-90),GetY()+tt*N16*sin(mm-90),4,250,72,15);
                }
            }
            if (count>=500&&count<=600&&count%4==0&&count%20>8&&GetArgument!=9.5) {
                PlaySE(GetCurrentScriptDirectory~"\se\Shot02.wav");
                ascent(let tt in 1..4) {
                    CreateShot01(GetX()+tt*N16*cos(mm+90),GetY()+tt*N16*sin(mm+90),4,110,72,15);
                    CreateShot01(GetX()+tt*N16*cos(mm-90),GetY()+tt*N16*sin(mm-90),4,110,72,15);
                    CreateShot01(GetX()+tt*N16*cos(mm+90),GetY()+tt*N16*sin(mm+90),4,290,72,15);
                    CreateShot01(GetX()+tt*N16*cos(mm-90),GetY()+tt*N16*sin(mm-90),4,290,72,15);
                }
            }
            if (count>=700&&count<=800&&count%4==0&&count%20>8&&GetArgument!=9.5) {
                PlaySE(GetCurrentScriptDirectory~"\se\Shot02.wav");
                ascent(let tt in 1..4) {
                    CreateShot01(GetX()+tt*N16*cos(mm+90),GetY()+tt*N16*sin(mm+90),4,70,72,15);
                    CreateShot01(GetX()+tt*N16*cos(mm-90),GetY()+tt*N16*sin(mm-90),4,70,72,15);
                    CreateShot01(GetX()+tt*N16*cos(mm+90),GetY()+tt*N16*sin(mm+90),4,250,72,15);
                    CreateShot01(GetX()+tt*N16*cos(mm-90),GetY()+tt*N16*sin(mm-90),4,250,72,15);
                }
            }
            if (count>=900&&count<=1000&&count%4==0&&count%20>8&&GetArgument!=9.5) {
                PlaySE(GetCurrentScriptDirectory~"\se\Shot02.wav");
                ascent(let tt in 1..4) {
                    CreateShot01(GetX()+tt*N16*cos(mm+90),GetY()+tt*N16*sin(mm+90),4,110,72,15);
                    CreateShot01(GetX()+tt*N16*cos(mm-90),GetY()+tt*N16*sin(mm-90),4,110,72,15);
                    CreateShot01(GetX()+tt*N16*cos(mm+90),GetY()+tt*N16*sin(mm+90),4,290,72,15);
                    CreateShot01(GetX()+tt*N16*cos(mm-90),GetY()+tt*N16*sin(mm-90),4,290,72,15);
                }
            }
            if (count%4==0&&count%120>20) {
                PlaySE(GetCurrentScriptDirectory~"\se\Shot06.wav");
                ascent(let tt in 1..4) {
                    CreateShot01(GetX()+tt*N16*cos(mm+90),GetY()+tt*N16*sin(mm+90),3,N15,196,15);
                    CreateShot01(GetX()+tt*N16*cos(mm-90),GetY()+tt*N16*sin(mm-90),3,N15,196,15);
                }
            }
        }
        if (GetLife<5400) {
            dead;
        }
        if (count>=1370) {
            SetAngle(mm);
            SetSpeed((count-1370)*0.05)
        }
        if (count%4==3&&GetLife()<life&&GetLife()>200&&GetY+50<GetPlayerY) {
            AddLife(-15-15*(GetArgument!=9)-15*(GetArgument==9.5));
        }
        if (count%4==3&&GetLife()<life&&GetLife()>200&&GetY+50>=GetPlayerY) {
            AddLife(-36-30*(GetArgument!=9)-30*(GetArgument==9.5));
        }
        SetCollisionA(GetX(),GetY(),12);
        SetCollisionB(GetX(),GetY(),10);
    }

    if (GetArgument==9.7||GetArgument==9.8) {
        let toAngle=atan2(GetPlayerY()-GetY(), GetPlayerX()-GetX());
        if (toAngle>=360) {
            toAngle-=360;
        }
        if (toAngle<0) {
            toAngle+=360;
        }
        let ret=toAngle-mm;
        if ((ret>0&&ret<=180)||(ret<=0&&ret<=-180)) {
            mm+=N15;
        }
        if ((ret>0&&ret>180)||(ret<=0&&ret>-180)) {
            mm-=N15;
        }
        if (mm>=360) {
            mm-=360;    //360°以上なら0〜360内に補正
        }
        if (mm<0) {
            mm+=360;    //0°未満なら0〜360内に補正
        }
        if (count>560) {
            VanishEnemy;
        }
        if (count==0) {
            SetDamageRate(0.1,0.1);
            if (GetX==GetCenterX) {Level=15;}
            SetLife(5820-64*(GetArgument==9.8)+800*(GetX==GetCenterX));
            SetMovePositionRandom01(0,200,8,GetX,GetY+220,GetX,GetY+220);
        }
        if (GetLife<5400) {
            dead;
        }
        if (count==79) {
            SetSpeed(0);
        }
        if (count>=70&&GetArgument==9.7) {
            SetAngle(mm);
        }
        if (count<1) {
            mm=toAngle;
        }
        if (count==78&&GetArgument==9.8) {
            SetSpeed(0);
        }
        if (count>=78&&count<=165&&GetArgument==9.8) {
            SetAngle(mm);
        }
        if (count>=235&&count<=525&&GetArgument==9.8) {
            SetAngle(mm);
        }
        if (count>45&&count<585&&count%3==0&&GetArgument==9.8) {
            PlaySE(GetCurrentScriptDirectory~"\se\Shot00.wav");
        }
        if (count>45&&count<85&&count%5==0&&GetArgument==9.8) {
            PlaySE(GetCurrentScriptDirectory~"\se\Shot04.wav");
            CreateWayShot02(1,15,GetX+5*cos(mm)+6*cos(mm+90),GetY+5*sin(mm)+6*sin(mm+90),0,6,mm,0,8,196,3);
            CreateWayShot02(1,15,GetX+5*cos(mm)+6*cos(mm-90),GetY+5*sin(mm)+6*sin(mm-90),0,6,mm,0,8,196,3);
            CreateWayShot02(1,15,GetX+5*cos(mm)+6*cos(mm+90),GetY+5*sin(mm)+6*sin(mm+90),0,6,mm,0,8,100,3);
            CreateWayShot02(1,15,GetX+5*cos(mm)+6*cos(mm-90),GetY+5*sin(mm)+6*sin(mm-90),0,6,mm,0,8,100,3);
        }
        if (count>75&&count<105&&count%3==0&&GetArgument==9.8) {
            let t=(count-70);
            PlaySE(GetCurrentScriptDirectory~"\se\Shot06.wav");
            CreateWayShot02(3,7,GetX+10*cos(mm)+55*cos(mm+90),GetY+10*sin(mm)+55*sin(mm+90),0,2.5+t*0.2,mm,0,8,196,1+t*1);
            CreateWayShot02(3,7,GetX+10*cos(mm)+55*cos(mm-90),GetY+10*sin(mm)+55*sin(mm-90),0,2.5+t*0.2,mm,0,8,196,1+t*1);
            CreateWayShot02(1,15,GetX+10*cos(mm)+95*cos(mm+110),GetY+10*sin(mm)+95*sin(mm+110),0,2.5+t*0.2,mm,0,8,196,1+t*1);
            CreateWayShot02(1,15,GetX+10*cos(mm)+95*cos(mm-110),GetY+10*sin(mm)+95*sin(mm-110),0,2.5+t*0.2,mm,0,8,196,1+t*1);
            CreateWayShot02(3,7,GetX+10*cos(mm)+55*cos(mm+90),GetY+10*sin(mm)+55*sin(mm+90),0,2.5+t*0.2,mm,0,8,100,1+t*1);
            CreateWayShot02(3,7,GetX+10*cos(mm)+55*cos(mm-90),GetY+10*sin(mm)+55*sin(mm-90),0,2.5+t*0.2,mm,0,8,100,1+t*1);
            CreateWayShot02(1,15,GetX+10*cos(mm)+95*cos(mm+110),GetY+10*sin(mm)+95*sin(mm+110),0,2.5+t*0.2,mm,0,8,100,1+t*1);
            CreateWayShot02(1,15,GetX+10*cos(mm)+95*cos(mm-110),GetY+10*sin(mm)+95*sin(mm-110),0,2.5+t*0.2,mm,0,8,100,1+t*1);
        }
        if (count>115&&count<170&&count%38==0&&GetArgument==9.8) {
            PlaySE(GetCurrentScriptDirectory~"\se\Shot04.wav");
            CreateWayShot02(23,8,GetX+20*cos(mm),GetY+20*sin(mm),0,4.0,mm,0,8,72,4);
        }
        if (count>165&&count<235&&count%22==0&&GetArgument==9.8) {
            PlaySE(GetCurrentScriptDirectory~"\se\Shot06.wav");
            CreateWayShot02(3,34,GetX+10*cos(mm)+55*cos(mm+90),GetY+10*sin(mm)+55*sin(mm+90),0,3.5,mm,0,8,196,4);
            CreateWayShot02(3,34,GetX+10*cos(mm)+55*cos(mm-90),GetY+10*sin(mm)+55*sin(mm-90),0,3.5,mm,0,8,196,4);
            CreateWayShot02(3,34,GetX+10*cos(mm)+95*cos(mm+110),GetY+10*sin(mm)+95*sin(mm+110),0,3.5,mm,0,8,196,4);
            CreateWayShot02(3,34,GetX+10*cos(mm)+95*cos(mm-110),GetY+10*sin(mm)+95*sin(mm-110),0,3.5,mm,0,8,196,4);
            CreateWayShot02(3,34,GetX+10*cos(mm)+55*cos(mm+90),GetY+10*sin(mm)+55*sin(mm+90),0,3.5,mm,0,8,100,4);
            CreateWayShot02(3,34,GetX+10*cos(mm)+55*cos(mm-90),GetY+10*sin(mm)+55*sin(mm-90),0,3.5,mm,0,8,100,4);
            CreateWayShot02(3,34,GetX+10*cos(mm)+95*cos(mm+110),GetY+10*sin(mm)+95*sin(mm+110),0,3.5,mm,0,8,100,4);
            CreateWayShot02(3,34,GetX+10*cos(mm)+95*cos(mm-110),GetY+10*sin(mm)+95*sin(mm-110),0,3.5,mm,0,8,100,4);
        }
        if (count>285-55*(Level==15)&&count<315+15*(Level==15)&&count%12==0&&GetArgument==9.8) {
            PlaySE(GetCurrentScriptDirectory~"\se\Shot04.wav");
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Missiles.txt",GetX(),GetY(),0,mm,0.5);
        }
        if (count>365&&count<525&&count%6==0&&GetArgument==9.8) {
            PlaySE(GetCurrentScriptDirectory~"\se\Shot06.wav");
            CreateWayShot02(2,6,GetX+10*cos(mm)+55*cos(mm+90),GetY+10*sin(mm)+55*sin(mm+90),0,2,mm,0,8,72,4);
            CreateWayShot02(2,6,GetX+10*cos(mm)+55*cos(mm-90),GetY+10*sin(mm)+55*sin(mm-90),0,2,mm,0,8,72,4);
            CreateWayShot02(2,6,GetX+10*cos(mm)+95*cos(mm+110),GetY+10*sin(mm)+95*sin(mm+110),0,2,mm,0,8,72,4);
            CreateWayShot02(2,6,GetX+10*cos(mm)+95*cos(mm-110),GetY+10*sin(mm)+95*sin(mm-110),0,2,mm,0,8,72,4);
        }
        if (count>70&&count<320&&count%25==0&&GetArgument==9.7) {
            PlaySE(GetCurrentScriptDirectory~"\se\Laser.wav");
            ascent(let t in 1..12) {
                CreateWayShot02(1,35,GetX+30*cos(mm),GetY+30*sin(mm),0,6.5,mm,0,8,196,5+t*1);
            }
        }
        if (count>=81&&count<=130) {
            SetSpeed(GetSpeed+0.01+0.01*(GetArgument==9.8));
            N15+=0.01;
        }
        if (count>=151&&count<=330) {
            SetSpeed(GetSpeed-0.01);
            N15+=0.01;
        }
        if (count>=331&&count<=440) {
            SetSpeed(GetSpeed+0.05);
            if (N15>0.03) {
                N15-=0.03;
            }
        }
        if (count%4==3&&GetLife()<life&&GetLife()>200&&GetY+70<GetPlayerY) {
            AddLife(-22);
        }
        if (count%4==3&&GetLife()<life&&GetLife()>200&&GetY+70>=GetPlayerY&&GetX+52>=GetPlayerX&&GetX-52<=GetPlayerX) {
            AddLife(-130);
        }
        SetCollisionA(GetX(),GetY(),36);
        SetCollisionB(GetX(),GetY(),16);
    }

    if (GetArgument==10) {
        if (count<70) {
            SetAngle(90);
            SetSpeed(7-count*0.1);
            SetLife(5800);
            SetDamageRate(50,20);
        }
        if (count>70) {
            SetSpeed(0);
        }
        if (count>320) {
            SetAngle(-90);
            SetSpeed(7);
        }if (count>450) {
            VanishEnemy;
        }
        if (count>150) {
            SetDamageRate(280,80);
        }
        if (count>=60&&count<=131) {
            PlaySE(GetCurrentScriptDirectory~"\se\Laser.wav");
            CreateLaserB(N15,640,8,187,80);
            SetLaserDataB(N15,0,0,150,0,205+(count-60)*5,0,205+(count-60)*5+rand(-20,20),0);
            SetShotKillTime(N15,120);
            FireShot(N15);
        }
        if (GetLife<5400) {
            dead;
        }
        else {
            SetCollisionA(GetX(),GetY(),15);
            SetCollisionB(GetX(),GetY(),10);
        }
    }

    if (GetArgument==11) {
        if (count<=50) {
            SetColor(0,0,0);
            N16++;
        }
        if (count>=50&&count<=112) {
            SetColor((count-50)*3,(count-50)*3,(count-50)*3);
            N16++;
        }
        if (count>570) {
            VanishEnemy;
        }
        if (count%17==0&&count>108&&count<160&&GetSpeed()==0&&N15!=0&&GetCommonDataDefault("Mode",0)>=2) {
            PlaySE(GetCurrentScriptDirectory~"\se\Shot02.wav");
            ascent(let t in 0..7) {
                CreateShot01(GetX(),GetY(),3.6,N15-60+t*20,33,0);
            }
        }
        if (count>=0&&count<=10) {
            SetAngle(90);
            SetLife(5480);
            SetSpeed(3.2);
            SetDamageRate(102,5);
        }
        if (count>=50&&GetSpeed()==0&&N15==0) {
            N15+=GetAngleToPlayer();
            SetDamageRate(175,26);
        }
        if (count>88) {
            N15=0;
            N15+=GetAngleToPlayer()+rand(-4,4);
            SetDamageRate(175,26);
        }
        if (count==90) {
            SetSpeed(0);
        }
        if (count>=300) {
            SetSpeed(-0.3);
        }
        if (count==300) {
            SetAngle(rand(70,110));
        }
        if (count>=450) {
            SetSpeed(-3.2);
            if (N16>0) {
                N16-=3;
            }
            //if(count%6==0){PlaySE(GetCurrentScriptDirectory~"\se\Shot04.wav");
            //CreateShot01(GetX(),GetY(),4.3,GetAngleToPlayer(),72,2);
            //CreateShot01(GetX(),GetY(),4.3,GetAngleToPlayer(),72,5);}
        }
        if (GetLife<5400) {
            dead;
        }
        else {
            SetCollisionA(GetX(),GetY(),15);
            SetCollisionB(GetX(),GetY(),8);
        }
    }

    if (GetArgument==12||GetArgument==14) {
        if (count<=50) {
            SetColor(0,0,0);
            N16++;
        }
        if (count>=50&&count<=112) {
            SetColor((count-50)*3,(count-50)*3,(count-50)*3);
            N16++;
        }
        if (count>570) {
            VanishEnemy;
        }
        if (count%17==0&&count>138&&count<260&&GetSpeed()==0&&N15!=0&&GetArgument!=14) {
            PlaySE(GetCurrentScriptDirectory~"\se\Shot02.wav");
            ascent(let t in 0..6) {
                CreateShot01(GetX()+10*cos(MT),GetY()+10*sin(MT),1.6+t*0.3,MT,196,10);
            }
        }
        if (GetCommonDataDefault("Mode",0)>=2) {
            if (count==186&&GetCommonDataDefault("Mode",0)>=3&&GetArgument==12) {
                PlaySE(GetCurrentScriptDirectory~"\se\Shot06.wav");
                ascent(let t in 0..4) {
                    CreateShot01(GetX(),GetY(),1.6+t,90,33,5);
                }
                ascent(let t in 0..4) {
                    CreateShot01(GetX(),GetY(),1.6+t,270,33,5);
                }
            }
            if (count==186&&GetArgument==14) {
                PlaySE(GetCurrentScriptDirectory~"\se\Shot06.wav");
                ascent(let t in 0..4) {
                    CreateShot01(GetX(),GetY(),1.6+t,90,33,5);
                }
                ascent(let t in 0..4) {
                    CreateShot01(GetX(),GetY(),1.6+t,270,33,5);
                }
            }
            if (count==186&&GetArgument==14) {
                ascent(let t in 0..4) {
                    CreateShot01(GetX(),GetY(),5.2+t,90,33,5);
                }
                ascent(let t in 0..4) {
                    CreateShot01(GetX(),GetY(),5.2+t,270,33,5);
                }
            }
        }
        //if(count%8==0&&count>88&&count<230&&GetSpeed()==0&&N15!=0){
        //PlaySE(GetCurrentScriptDirectory~"\se\Shot00.wav");
        //ascent(let t in 0..4){CreateShot01(GetX(),GetY(),4.4,45+t*90,RED01,15);}}
        if (count==125&&GetArgument==14&&GetCommonDataDefault("Mode",0)<=3) {
            PlaySE(GetCurrentScriptDirectory~"\se\Shot06.wav");
            ascent(let t in 0..5) {
                CreateShot01(GetX(),GetY(),0.9+t,90,33,5);
            }
            ascent(let t in 0..5) {
                CreateShot01(GetX(),GetY(),0.9+t,270,33,5);
            }
        }
        if (count>=0&&count<=10) {
            SetAngle(90);
            SetLife(5480);
            SetSpeed(3.2);
            SetDamageRate(100,5);
        }
        if (count>=138&&GetSpeed()==0&&N15==0) {
            N15+=GetAngleToPlayer();
            SetDamageRate(165,26);
        }
        if (count>=138) {
            MT=0;
            MT+=N15+rand(-3,3);
            SetDamageRate(190,26);
        }
        if (count>88) {
            SetDamageRate(222,26);
        }
        if (count==90) {
            SetSpeed(0);
        }
        if (count>=280) {
            SetSpeed(-0.3);
        }
        if (count==280) {
            SetAngle(rand(70,110));
        }
        if (count>=450) {
            SetSpeed(-3.2);
            if (N16>0) {
                N16-=3;
            }if (GetY<0) {
                SetDamageRate(0,0);
            }
            //if(count%6==0){PlaySE(GetCurrentScriptDirectory~"\se\Shot04.wav");
            //CreateShot01(GetX(),GetY(),4.3,GetAngleToPlayer(),72,2);
            //CreateShot01(GetX(),GetY(),4.3,GetAngleToPlayer(),72,5);}
        }
        if (GetLife<5400) {
            dead;
        }
        else {
            SetCollisionA(GetX(),GetY(),15);
            SetCollisionB(GetX(),GetY(),8);
        }
    }

    if (GetArgument==13) {
        if (count<=50) {
            SetColor(0,0,0);
            N16++;
        }
        if (count>=50&&count<=112) {
            SetColor((count-50)*3,(count-50)*3,(count-50)*3);
            N16++;
        }
        if (count>600) {
            VanishEnemy;
        }
        if (count==135&&GetCommonDataDefault("Mode",0)>=3) {
            PlaySE(GetCurrentScriptDirectory~"\se\Shot02.wav");
            ascent(let t in 1..5) {
                CreateShot01(GetX(),GetY(),2.5+t*0.09,90+2+t*3,RED04,10+t);
                CreateShot01(GetX(),GetY(),2.5+t*0.09,90-2-t*3,RED04,10+t);
            }
        }
        if (count%17==0&&count>120&&count<158&&GetCommonDataDefault("Mode",0)<3) {
            PlaySE(GetCurrentScriptDirectory~"\se\Shot02.wav");
            ascent(let t in 0..4) {
                CreateShot01(GetX()+10*cos(GetAngleToPlayer()),GetY()+10*sin(GetAngleToPlayer()),1.6+t*0.4,GetAngleToPlayer(),196,10);
            }
        }
        if (GetCommonDataDefault("Mode",0)==2&&count%30==0&&count>158&&count<260&&GetSpeed()==0&&N15!=0&&GetLife>5540) {
            PlaySE(GetCurrentScriptDirectory~"\se\Shot02.wav");
            ascent(let tt in 0..4) {
                ascent(let t in 0..6) {
                    CreateShot01(GetX()+50*cos(45+tt*90),GetY()+50*sin(45+tt*90),2+t*0.3,MT+rand(-4,4),65,10);
                }
            }
        }
        if (GetCommonDataDefault("Mode",0)>=2&&count%12==0&&count>260&&count<360&&GetSpeed()==0&&N15!=0) {
            PlaySE(GetCurrentScriptDirectory~"\se\Shot02.wav");
            ascent(let t in 0..7) {
                CreateShot01(GetX(),GetY(),5.6-1*(GetCommonDataDefault("Mode",0)<2),N15-60+t*20,33,0);
            }
        }
        if (GetCommonDataDefault("Mode",0)>=3&&count%4==0&&count>280&&count<360&&GetSpeed()==0&&N15!=0) {
            PlaySE(GetCurrentScriptDirectory~"\se\Shot06.wav");
            ascent(let t in 0..7) {
                CreateShot01(GetX(),GetY(),12.6,N15-60+t*20,49,5);
            }
        }
        if (count>=0&&count<=10) {
            SetAngle(90);
            SetLife(5640);
            SetSpeed(3.2);
            SetDamageRate(50,5);
        }
        if (count>=158&&GetSpeed()==0&&N15==0) {
            N15+=GetAngleToPlayer();
            SetDamageRate(130,26);
        }
        if (count>=88) {
            MT=0;
            MT+=N15+rand(-8,8);
            SetDamageRate(180,26);
        }
        if (count>88) {
            SetDamageRate(170,30);
        }
        if (count>=260) {
            N15=GetAngleToPlayer();
        }
        if (count==90) {
            SetSpeed(0);
        }
        if (count>=510) {
            SetDamageRate(195,26);
            SetSpeed(-3.2);
            if (N16>0) {
                N16-=3;
            }
            if (count%6==0) {
                PlaySE(GetCurrentScriptDirectory~"\se\Shot04.wav");
                CreateShot01(GetX(),GetY(),4.3,GetAngleToPlayer(),72,2);
                CreateShot01(GetX(),GetY(),4.3,GetAngleToPlayer(),72,5);
            }
        }
        if (GetLife<5400) {
            SetDamageRate(0,0);
            dead;
        }
        else {
            SetCollisionA(GetX(),GetY(),23);
            SetCollisionB(GetX(),GetY(),8);
        }
    }

    count++;

}

@Finalize
{
}

@DrawLoop
{
    if (GetArgument<=1||GetArgument==11||GetArgument==12||GetArgument==14) {
        SetTexture(GetCurrentScriptDirectory~"\img\familiar.png");
        Level=255*((100-N17)/100);
        if (count>=112) {
            SetColor(Level,Level,Level);
        }
        SetGraphicAngle(0,0,0);
        SetGraphicScale(0.7,0.7);
        SetAlpha(255);
        SetRenderState(ADD);
        SetGraphicRect(0,48,48,96);
        ascent( let t in 1..2 ) {
            ascent( let tt in 0..4 ) {
                DrawGraphic(GetX()+0.2*N16*t*cos(45+tt*90),GetY()+0.2*N16*t*sin(45+tt*90));
            }
        }
    }

    if (GetArgument>9.5&&GetArgument<10&&count>3) {
        SetTexture(GetCurrentScriptDirectory~"\img\familiar.png");
        SetColor(211,211,211);
        SetGraphicAngle(0,0,count*8);
        SetGraphicScale(1.2+0.2*sin(count*3),1.2+0.2*sin(count*3));
        SetAlpha(255);
        SetRenderState(ADD);
        SetGraphicRect(144-96*(Level==15),48,192-96*(Level==15),96);
        DrawGraphic(GetX(),GetY());
        if (Level==15) {
            DrawGraphic(GetX(),GetY());
        }
        SetGraphicAngle(0,0,mm+90);
        SetGraphicScale(0.3,1.2);
        DrawGraphic(GetX+15*cos(mm),GetY+15*sin(mm));
        if (Level==15) {
            DrawGraphic(GetX+15*cos(mm),GetY+15*sin(mm));
        }
        if (GetArgument==9.8) {
            SetGraphicAngle(0,0,count*12);
            SetGraphicScale(0.3,1.7);
            DrawGraphic(GetX,GetY-14);
            SetGraphicAngle(0,0,count*12+90);
            SetGraphicScale(0.3,1.7);
            DrawGraphic(GetX,GetY-14);
            if (Level==15) {
                SetGraphicAngle(0,0,count*12);
                SetGraphicScale(0.3,1.7);
                DrawGraphic(GetX,GetY-14);
                SetGraphicAngle(0,0,count*12+90);
                SetGraphicScale(0.3,1.7);
                DrawGraphic(GetX,GetY-14);
            }
            SetGraphicAngle(0,0,mm+90);
            SetGraphicScale(0.6,0.6);
            DrawGraphic(GetX+10*cos(mm)+55*cos(mm+90),GetY+10*sin(mm)+55*sin(mm+90));
            DrawGraphic(GetX+10*cos(mm)+95*cos(mm+110),GetY+10*sin(mm)+95*sin(mm+110));
            DrawGraphic(GetX+10*cos(mm)+55*cos(mm-90),GetY+10*sin(mm)+55*sin(mm-90));
            DrawGraphic(GetX+10*cos(mm)+95*cos(mm-110),GetY+10*sin(mm)+95*sin(mm-110));
            if (Level==15) {
                DrawGraphic(GetX+10*cos(mm)+55*cos(mm+90),GetY+10*sin(mm)+55*sin(mm+90));
                DrawGraphic(GetX+10*cos(mm)+95*cos(mm+110),GetY+10*sin(mm)+95*sin(mm+110));
                DrawGraphic(GetX+10*cos(mm)+55*cos(mm-90),GetY+10*sin(mm)+55*sin(mm-90));
                DrawGraphic(GetX+10*cos(mm)+95*cos(mm-110),GetY+10*sin(mm)+95*sin(mm-110));
                DrawGraphic(GetX+10*cos(mm)+55*cos(mm+90),GetY+10*sin(mm)+55*sin(mm+90));
                DrawGraphic(GetX+10*cos(mm)+95*cos(mm+110),GetY+10*sin(mm)+95*sin(mm+110));
                DrawGraphic(GetX+10*cos(mm)+55*cos(mm-90),GetY+10*sin(mm)+55*sin(mm-90));
                DrawGraphic(GetX+10*cos(mm)+95*cos(mm-110),GetY+10*sin(mm)+95*sin(mm-110));
            }
        }
    }

    if (GetArgument==13) {
        SetTexture(GetCurrentScriptDirectory~"\img\familiar.png");
        Level=255*((100-N17)/100)*((GetLife-5400)/250);
        if (count>=0) {
            SetColor(Level,Level,Level);
        }
        SetGraphicAngle(0,0,0);
        SetGraphicScale(0.6,0.6);
        SetAlpha(255);
        SetRenderState(ADD);
        SetGraphicRect(48,48,96,96);
        if (GetLife>5400) {
            ascent( let t in 1..3 ) {
                ascent( let tt in 0..4 ) {
                    DrawGraphic(GetX()+0.2*N16*t*cos(45+tt*90),GetY()+0.2*N16*t*sin(45+tt*90));
                }
            }
        }
    }

    if (GetArgument>=9&&GetArgument<=9.5) {
        SetTexture(GetCurrentScriptDirectory~"\img\familiar.png");
        if (count>=112) {
            SetColor(255*((100-N17)/100),255*((100-N17)/100),255*((100-N17)/100));
        }
        SetGraphicAngle(0,0,0);
        SetGraphicScale((0.8+0.015*N16)*sin(count*4),0.7+0.001*N16);
        SetAlpha(245);
        SetRenderState(ADD);
        SetGraphicRect(48,48,96,96);
        ascent( let tt in 0..4 ) {
            DrawGraphic(GetX()+tt*N16*cos(mm+90),GetY()+tt*N16*sin(mm+90));
            DrawGraphic(GetX()+tt*N16*cos(mm-90),GetY()+tt*N16*sin(mm-90));
        }
        SetGraphicAngle(0,0,count*4);
        SetGraphicScale(2.2-0.016*N16,2.2-0.016*N16);
        SetAlpha(245);
        DrawGraphic(GetX(),GetY());
    }

    if (GetArgument==2&&count<=260) {
        SetTexture(GetCurrentScriptDirectory~"\img\familiar.png");
        if (count<=50) {
            SetColor(0,0,0);
        }
        if (count>=50&&count<=112) {
            SetColor((count-50)*3,(count-50)*3,(count-50)*3);
        }
        if (count>=112) {
            SetColor(211*((100-N17)/100),211*((100-N17)/100),211*((100-N17)/100));
        }
        SetGraphicAngle(0,0,0);
        SetGraphicScale(1,1);
        SetAlpha(255);
        SetRenderState(ADD);
        SetGraphicRect(48,48,96,96);
        ascent( let t in 0..2 ) {
            DrawGraphic(GetX()-20+t*40,GetY()+20);
        }

        if (count<=50) {
            SetColor(0,0,0);
        }
        if (count>=50&&count<=112) {
            SetColor((count-50)*3,(count-50)*3,(count-50)*3);
        }
        if (count>=112) {
            SetColor(211*((100-N17)/100),211*((100-N17)/100),211*((100-N17)/100));
        }
        SetGraphicAngle(0,0,0);
        SetGraphicScale(1,1);
        SetAlpha(255);
        SetRenderState(ADD);
        SetGraphicRect(0,48,48,96);
        ascent( let t in 0..3 ) {
            DrawGraphic(GetX()+20+t*20,GetY());
            DrawGraphic(GetX()-20-t*20,GetY());
        }
    }



    if (GetArgument==4||GetArgument==4.5||GetArgument==6||GetArgument==6.1) {
        SetTexture(GetCurrentScriptDirectory~"\img\familiar.png");
        SetColor(182*((100-N17)/100),182*((100-N17)/100),182*((100-N17)/100));
        if (count==0&&GetAngle()>=120) {
            N15=-3;
        }
        if (count==0&&GetAngle()<=60) {
            N15=3;
        }
        SetGraphicAngle(0,0,count*N15);
        SetGraphicScale(2.5-0.01*(600-(GetLife()-5000)),2.5-0.01*(600-(GetLife()-5000)));
        if (count<25) {
            SetGraphicScale(0.1*count,0.1*count);
        }SetAlpha(255);
        SetRenderState(ADD);
        SetGraphicRect(0,48,48,96);
        DrawGraphic(GetX(),GetY());
    }



    if (GetArgument<6&&GetArgument>=5&&count<=130) {
        SetTexture(GetCurrentScriptDirectory~"\img\familiar.png");
        if (count<=50) {
            SetColor(0,0,0);
        }
        if (count>=50&&count<=80) {
            SetColor((count-50)*6,(count-50)*6,(count-50)*6);
        }
        if (count>=80) {
            SetColor(182*((100-N17)/100),182*((100-N17)/100),182*((100-N17)/100));
        }
        SetGraphicAngle(0,0,0);
        SetGraphicScale(1,1);
        SetAlpha(255);
        SetRenderState(ADD);
        SetGraphicRect(0,48,48,96);
        DrawGraphic(GetX(),GetY()+30);
        DrawGraphic(GetX()-20,GetY()-20);
        DrawGraphic(GetX()+20,GetY()-20);
    }


    if (GetArgument==7&&count<=130) {
        SetTexture(GetCurrentScriptDirectory~"\img\familiar.png");
        if (count<=50) {
            SetColor(0,0,0);
        }
        if (count>=50&&count<=80) {
            SetColor((count-50)*6,(count-50)*6,(count-50)*6);
        }
        if (count>=80) {
            SetColor(182*((100-N17)/100),182*((100-N17)/100),182*((100-N17)/100));
        }
        SetGraphicAngle(0,0,0);
        SetGraphicScale(1,1);
        SetAlpha(255);
        SetRenderState(ADD);
        SetGraphicRect(48*2,48,48*3,96);
        DrawGraphic(GetX(),GetY()+30);
        DrawGraphic(GetX()-20,GetY()-20);
        DrawGraphic(GetX()+20,GetY()-20);
    }


    SetTexture(GetCurrentScriptDirectory~"\img\dot-kaze-ti.png");
    if (count<=50) {
        SetAlpha(0);
    }
    if (count>=50&&count<=112) {
        SetAlpha((count-50)*4*((100-N17)/100));
    }
    if (count>=112||GetArgument==4||GetArgument<=1||GetArgument>=8) {
        SetAlpha(255*((100-N17)/100));
    }
    SetGraphicRect(64,0,128,64);
    if (GetArgument==2||GetArgument==3||GetArgument==4||GetArgument==6||GetArgument==6.1||GetArgument==10) {
        SetGraphicRect(192,0,256,64);
    }
    if (GetArgument>=8&&GetArgument<10) {
        SetGraphicRect(64,64,128,128);
    }
    SetRenderState(ALPHA);
    SetColor(225+count%4*30,225+count%4*30,225+count%4*30);
    if (ten==1) {
        SetColor(60,60,120);
    }
    SetGraphicScale(1.12,1.12);
    SetGraphicAngle(0,0,-count*5);
    DrawGraphic(GetX(),GetY());
    SetGraphicScale(0.8,0.8);
    SetGraphicAngle(0,0,count*5);
    DrawGraphic(GetX(),GetY());

    SetGraphicRect(0,0,64,64);
    if (GetArgument==2||GetArgument==3||GetArgument==4||GetArgument==6||GetArgument==6.1||GetArgument==10) {
        SetGraphicRect(128,0,192,64);
    }
    if (GetArgument>=8&&GetArgument<10) {
        SetGraphicRect(0,64,64,128);
    }
    SetColor(255*((100-N17)/100),255*((100-N17)/100),255*((100-N17)/100));
    if (ten==1) {
        SetColor(60,60,120);
    }
    SetGraphicScale(0.65,0.65);
    SetGraphicAngle(0,0,90);
    DrawGraphic(GetX(),GetY());

}
}