script_enemy_main {
    let time = -150;
    let phase = 4;
    let sephase = 4;
    let rate = 0;
    let kaku = 80;
    let score = 0;
    let lv = 0;
    let life = 15540;
    let angle = GetAngle();
    let rank = GetSpeed();
    let arg = GetArgument();
    let ex = GetCommonData("ex");
    let houdai = 90;
    SetCommonData("bossx",GetX);
    SetCommonData("bossy",GetY);
    SetCommonData("bossphase",2);
    SetCommonData("bossparts1",0);
    SetCommonData("bossparts2",0);
    SetCommonData("bossatack",0);
    let imgEnemy = GetCurrentScriptDirectory~"img\st2boss.png";
    let tama = GetCurrentScriptDirectory~"tama.txt";
    let se1 = GetCurrentScriptDirectory~"wav\se1.wav";
    let se2 = GetCurrentScriptDirectory~"wav\se2.wav";
    let se6 = GetCurrentScriptDirectory~"wav\se6.wav";
    let seshot1 = GetCurrentScriptDirectory~"wav\shot1.wav";
    let seshot2 = GetCurrentScriptDirectory~"wav\shot2.wav";
    @Initialize(){
        SetLife( 15540 );
        SetInvincibility( 0 );
        SetTimer(240);
        LoadGraphic( imgEnemy );
        LoadUserShotData( tama );
        CreateEnemyFromScript("kata", GetX+127, GetY-30, 0, 0, 1);
        CreateEnemyFromScript("kata", GetX-127, GetY-30, 0, 0, -1);
        CreateEnemyFromScript("yoko", GetX+96, GetY+80, 0, 0, 1);
        CreateEnemyFromScript("yoko", GetX-96, GetY+80, 0, 0, -1);
        Tmain1;
        SetMovePositionHermite(224, 120, 100, 90, 100, 270, 150);
    }
    @MainLoop {
        SetCommonData("bossx",GetX);
        SetCommonData("bossy",GetY);
        if(phase==4&&GetLife<=12040){
           phase-=1;
           time=-100;
           score=130000;
           SetCommonData("bossphase",3);
           SetCommonData("bossatack",0);
           if(lv==0||GetPoint>0){DeleteEnemyShotImmediatelyInCircle(SHOT, 224, 240, 600);}
           PlaySE(se2);
           Tdeath(15,100,2,0);
           Tmain2;
           SetMovePosition02(224, 150, 100);
           SetCommonData("prerank",GetCommonData("prerank")+1);
        }
        if(phase==3&&GetLife<=7540){
           phase-=1;
           time=-100;
           score=140000;
           SetCommonData("bossphase",2);
           SetCommonData("bossatack",0);
           if(lv==0||GetPoint>0){DeleteEnemyShotImmediatelyInCircle(SHOT, 224, 240, 600);}
           PlaySE(se2);
           Tdeath(15,100,2,0);
           Tmain3;
           SetMovePosition02(224, 220, 100);
           SetCommonData("prerank",GetCommonData("prerank")+1);
        }
        if(phase==2&&GetLife<=2540){
           phase-=1;
           time=-100;
           score=150000;
           SetCommonData("bossphase",1);
           SetCommonData("bossatack",0);
           if(lv==0||GetPoint>0){DeleteEnemyShotImmediatelyInCircle(SHOT, 224, 240, 600);}
           PlaySE(se2);
           Tdeath(15,100,2,0);
           Tshot4a;Tshot4b;
           SetCommonData("prerank",GetCommonData("prerank")+1);
        }
        if(phase==1&&GetLife<=40){
           phase-=1;
           score=200000;
           SetCommonData("bossphase",0);
           SetCommonData("bossatack",0);
           if(lv==0||GetPoint>0){DeleteEnemyShotImmediatelyInCircle(SHOT, GetX, GetY, 500);}
           PlaySE(se2);
           Tdeath(0,80,2,0);
           Tbaku;
           Tbossbaku;
           SetCommonData("prerank",GetCommonData("prerank")+1);
        }
        if(phase==4&&time>=0){
           SetCollisionA(GetX, GetY+10, 40);
        }
        if(phase>0&&phase<4&&time>=0){
           SetCollisionA(GetX, GetY-80, 64);
           SetCollisionA(GetX, GetY+10, 64);
        }

        if(sephase==4&&GetLife<=12440){PlaySE(se6);sephase=3;}
        if(sephase==3&&GetLife<=7940){PlaySE(se6);sephase=2;}
        if(sephase==2&&GetLife<=2940){PlaySE(se6);sephase=1;}
        if(sephase==1&&GetLife<=440){PlaySE(se6);sephase=0;}

        lv=GetCommonData("rank");
        if(phase==2&&time%6==0&&GetPlayerY<GetY-60){
           let p=atan2( GetPlayerY()-(GetY()-45), GetPlayerX()-(GetX()))+rand(-5,5);
           let a=-1-ex;
           loop(3+ex*2){
              CreateShotFromScript( "shot1",GetX(), GetY()-45, 4+ex, p+a*5, 0, 12);
              a++;
           }
        }
        time++;
        yield;
    }
    @Finalize() {
    }
    @DrawLoop {
        if(time%5==0){
           if(life==GetLife){SetColor(255,255,255);}
           else{SetColor(210,210,255);}
           life=GetLife;
           if(phase==0||(time%30<5&&GetLife<1220)){SetColor(255,200,200);}
        }

	SetTexture( imgEnemy );
        //ԗ
        SetGraphicRect( 320, 272, 368, 304 );
        SetGraphicAngle( 0, 0, 0);
	DrawGraphic( GetX()-55, GetY()+99+sin(time*80) );
	DrawGraphic( GetX()+55, GetY()+99+sin(time*80) );
	DrawGraphic( GetX()-96, GetY()+8+sin(time*80) );
	DrawGraphic( GetX()+96, GetY()+8+sin(time*80) );

        //
        SetGraphicRect( 336, 0, 416, 96 );
        SetGraphicAngle( 0, 0, 0);
	DrawGraphic( GetX()+96, GetY()-25 );
	DrawGraphic( GetX()-96, GetY()-25 );

        //㑫
        if(phase>1){
        SetGraphicRect( 432, 0, 528, 80 );
	DrawGraphic( GetX()+96, GetY()-95 );
        SetGraphicAngle( 180, 0, 0);
	DrawGraphic( GetX()-96, GetY()-95 );
        }


        SetGraphicRect( 0, 0, 320, 320 );
        SetGraphicAngle(0,0,0);
	DrawGraphic( GetX(), GetY() );

        if(phase>1){
           /*SetGraphicRect( 400, 256, 480, 320 );
           SetGraphicAngle(0,0,0);
	   DrawGraphic( GetX(), GetY()-35 );*/
           SetGraphicRect( 512, 208, 543, 272 );
           SetGraphicAngle(0,40,houdai-90);
	   DrawGraphic( GetX(), GetY()-104 );
        }
        if(phase>3){
           SetGraphicRect( 336, 176, 400, 240 );
           SetGraphicAngle(0,0,0);
	   DrawGraphic( GetX(), GetY()-5 );
        }

        if(phase>2){
           SetGraphicRect( 572, 0, 608, 32 );
           SetGraphicAngle(0,0,0);
	   DrawGraphic( GetX()+30, GetY()+35 );
	   DrawGraphic( GetX()-30, GetY()+35 );
           SetGraphicRect( 560, 32, 624, 96 );
	   DrawGraphic( GetX()+64, GetY()-120 );
	   DrawGraphic( GetX()-64, GetY()-120 );
        }

    }

    task Tmain1{
        yield;
        wait(180);
        loop{
        if(GetCommonData("bossparts1")<2){
        if(phase<=3){return;}
        SetCommonData("bossatack",2);
        Tmove(224,120,8,4);
        wait(250);
        if(phase<=3){return;}
        SetCommonData("bossatack",0);
        wait(110);
        }

        if(phase<=3){return;}
        SetCommonData("bossatack",1);
        Tshot11;Tmove1(224,120,9,4);
        wait(300);
        if(phase<=3){return;}
        SetCommonData("bossatack",0);
        wait(80);

        if(phase<=3){return;}
        SetCommonData("bossatack",3);
        Tshot13;Tmove(224,120,9,4);
        wait(300);
        if(phase<=3){return;}
        SetCommonData("bossatack",0);
        wait(80);
        }
    }
    task Tmain2{
        yield;
        wait(120);
        loop{
        if(phase<=2){return;}
        SetCommonData("bossatack",1);
        Tshot21;Tmove1(224,150,4,3);
        wait(150);
        if(phase<=2){return;}
        SetMovePosition02(224, 180, 50);
        SetCommonData("bossatack",0);
        wait(30);

        if(phase<=2){return;}
        SetCommonData("bossatack",5);
        Tshot25;Tmove(224,180,5,3);
        wait(150);
        if(phase<=2){return;}
        SetMovePosition02(224, 180, 50);
        SetCommonData("bossatack",0);
        wait(60);

        if(phase<=2){return;}
        SetCommonData("bossatack",2);
        Tshot22a;Tshot22b;Tmove(224,180,9,3);
        wait(300);
        if(phase<=2){return;}
        SetCommonData("bossatack",0);
        wait(120);

        if(phase<=2){return;}
        SetCommonData("bossatack",3);
        SetMovePosition02(224, 460, 150);
        Tshot23;
        wait(120);
        if(phase<=2){return;}
        SetCommonData("bossatack",0);
        wait(70);

        if(phase<=2){return;}
        SetCommonData("bossatack",4);
        SetMovePosition02(224, 150, 300);
        Tshot24;
        wait(220);
        if(phase<=2){return;}
        SetCommonData("bossatack",0);
        wait(120);
        }
    }
    task Tmain3{
        yield;
        wait(120);
        loop{
        if(phase<=1){return;}
        SetCommonData("bossatack",1);
        Tshot31a;Tshot30a(1);Tmove(224,220,7,2);
        wait(200);
        if(phase<=1){return;}
        SetCommonData("bossatack",0);
        wait(80);

        if(phase<=1){return;}
        SetCommonData("bossatack",2);
        Tshot32a;Tshot30b(2);Tmove(224,220,6,2);
        wait(150);
        if(phase<=1){return;}
        SetCommonData("bossatack",0);
        wait(130);

        if(phase<=1){return;}
        SetCommonData("bossatack",3);
        Tshot33a;Tshot33b;Tshot30a(3);Tmove(224,220,6,2);
        wait(150);
        if(phase<=1){return;}
        SetCommonData("bossatack",0);
        wait(60);

        if(phase<=1){return;}
        SetCommonData("bossatack",4);
        Tshot34;Tshot30c;Tmove(224,220,6,2);
        wait(150);
        if(phase<=1){return;}
        SetCommonData("bossatack",0);
        wait(220);

        }
    }

    task Tshot11{
        yield;
        let a=0;
        while(GetCommonData("bossatack")==1){
           let p=atan2( GetPlayerY()-(GetY()+100), GetPlayerX()-(GetX()));
              if(phase<=3){return;}
              let b=-1.5;
              let c=a%20;
              if(c>10){c=20-c}
              loop(4){
                 CreateShotFromScript( "shot1",GetX()+17, GetY()+100+b*14, 3+ex*(b+1.5)/7, p+c*13-55, 0, 12);
                 CreateShotFromScript( "shot1",GetX()-17, GetY()+100+b*14, 3+ex*(b+1.5)/7, p+c*13-55, 0, 12);
                 b++;
              }
           a++;
           PlaySE(seshot1);
           wait(8-lv*1);
        }
    }

    task Tshot13{
        yield;
        while(GetCommonData("bossatack")==3){
           let c=GetCommonData("bossparts2");
           let p=atan2( GetPlayerY()-(GetY()), GetPlayerX()-(GetX()));
           let a=-2-c-ex;
           loop(5+c*2+ex*2){
              if(phase<=3){return;}
              CreateShotFromScript( "shot1",GetX(), GetY(), 2.5+ex, p+a*2.3, 0, 03);
              a++;
           }
           wait(60-lv*10);
        }
    }

    task Tshot21{
        yield;
        while(GetCommonData("bossatack")==1){
           let a=0;
           let p1=atan2( GetPlayerY()-(GetY()+35), GetPlayerX()-(GetX()+30));
           let p2=atan2( GetPlayerY()-(GetY()+35), GetPlayerX()-(GetX()-30));
           loop(6){
              if(phase<=2){return;}
              let b=0;
              loop(3+ex){
                 CreateShotFromScript( "shot1",GetX()+30, GetY()+43, 2.5+a*0.6+ex, p1-b*3, 0, 05);
                 CreateShotFromScript( "shot1",GetX()+30, GetY()+43, 2.5+a*0.6+ex, p1-b*3-35, 0, 05);
                 CreateShotFromScript( "shot1",GetX()-30, GetY()+43, 2.5+a*0.6+ex, p2+b*3, 0, 05);
                 CreateShotFromScript( "shot1",GetX()-30, GetY()+43, 2.5+a*0.6+ex, p2+b*3+35, 0, 05);
                 b++;
              }
              a++;
              PlaySE(seshot1);
              wait(2);
           }
           wait(80-lv*14);
        }
    }
    task Tshot22a{
        yield;
        let c=rand(0,30);
        let b=0;
        while(GetCommonData("bossatack")==2){
           if(phase<=2){return;}
           let a=0;
           loop(9){
              let r=rand(0,5);
              CreateShotFromScript( "shotb",GetX()+64, GetY()-105, 2+ex, a*40+b*3.5+trunc(b/(3+ex))*15, 0, 1);
              CreateShotFromScript( "shotb",GetX()-64, GetY()-105, 2+ex, a*40-b*3.5-trunc(b/(3+ex))*15+c, 0, -1);
              a++;
           }
           PlaySE(seshot1);
           wait(5-lv*0.5+trunc((b%(3+ex))/(2+ex))*(67-lv*12));
           b++;
        }
    }
    task Tshot22b{
        yield;
        let b=0;
        while(GetCommonData("bossatack")==2){
           if(phase<=2){return;}
           let a=-1-ex+rand(-1,1)/20;
           loop(3+ex*2){
              let c=90+a*(60-ex*25);
              CreateShotFromScript( "shot1",GetX(), GetY()-76, 3, c, 0, 11);
              a++;
           }
           wait(18-lv*3);
           b++;
        }
    }
    task Tshot23{
        yield;
        let b=0;
        while(GetCommonData("bossatack")==3){
           if(phase<=2){return;}
           let a=0;
           loop(1+ex){
              let c=b+a*170;
              CreateShotFromScript( "shot5",GetX()+cos(c)*10, GetY()-45+sin(c)*8, 4, c, 0, 1);
              a++;
           }
           PlaySE(seshot2);
           wait(12-lv*2);
           b+=rand(100,120);
        }
    }
    task Tshot24{
        yield;
        let b=0;
        while(GetCommonData("bossatack")==4){
           if(phase<=2){return;}
           let a=0;
           loop(20+ex*10){
              let c=a*(18-ex*6)+b*5;
              CreateShotFromScript( "shot3",GetX()+cos(c)*10, GetY()-45+sin(c)*8, 0.02, c, 0, 13);
              a++;
           }
           PlaySE(seshot2);
           wait(30-lv*5);
           b+=1+b/10;
        }
    }
    task Tshot25{
        yield;
        let b=0;
        while(GetCommonData("bossatack")==5){
           if(phase<=2){return;}
           let p=atan2( GetPlayerY()-(GetY()-45), GetPlayerX()-GetX());
           let a=-1-ex;
           loop(3+ex*2){
              CreateShotFromScript( "shot5",GetX(), GetY()-45, 5, p+a*50, 0, 2);
              a++;
           }
           PlaySE(seshot2);
           wait(70-lv*10);
        }
    }
    task Tshot30a(let z){
        yield;
        let b=0;
        while(GetCommonData("bossatack")==z){
           if(phase<=1){return;}
           let p=atan2( GetPlayerY()-(GetY()-104), GetPlayerX()-GetX());
           if(p<180&&p>0){
              if(houdai<p){houdai+=2}
              else{houdai-=2}
           }
           wait(1);
        }
    }
    task Tshot30b(let z){
        yield;
        let b=0;
        while(GetCommonData("bossatack")==z){
           while(houdai>0&&GetCommonData("bossatack")==z){
              if(phase<=1){return;}
              houdai-=3;
              wait(1);
           }
           while(houdai<180&&GetCommonData("bossatack")==z){
              if(phase<=1){return;}
              houdai+=3;
              wait(1);
           }
        }
    }
    task Tshot30c{
        yield;
        let b=0;
        while(GetCommonData("bossatack")==4){
           while(houdai>50&&GetCommonData("bossatack")==4){
              if(phase<=1){return;}
              houdai-=3;
              wait(1);
           }
           while(houdai<140&&GetCommonData("bossatack")==4){
              if(phase<=1){return;}
              houdai+=3;
              wait(1);
           }
        }
    }
    task Tshot31a{
        wait(20);
        let b=0;
        while(GetCommonData("bossatack")==1){
           if(phase<=1){return;}
           let a=-0.5;
           loop(2){
              CreateShotFromScript( "shot5",GetX()+cos(houdai)*40, GetY()-104+sin(houdai)*20, 4, houdai+a*80, 0, 6*a);
              a++;
           }
           PlaySE(seshot2);
           wait(120-lv*20);
        }
    }
    task Tshot32a{
        yield;
        let b=0;
        while(GetCommonData("bossatack")==2){
           if(phase<=1){return;}
           let a=0;
           loop(1){
              CreateShotFromScript( "shot5",GetX()+cos(houdai)*40, GetY()-104+sin(houdai)*20, 4, houdai, 0, 4);
              a++;
           }
           PlaySE(seshot1);
           wait((19-lv*3)/(1+ex*0.5));
        }
    }
    task Tshot33a{
        wait(30);
        let b=0;
        let c=0;
        while(GetCommonData("bossatack")==3){
           if(phase<=1){return;}
           let a=-3.25;
           if(b%4==0){c=0}
           if(b%8<4){a=-2.75}
           loop(7){
              CreateShotFromScript( "shot1",GetX(), GetY()-76, 4, 90+a*30+c, 0, 06);
              a++;
           }
           wait(6-lv*1);
           b++;
           c+=rand(2+ex,-2-ex)
        }
    }
    task Tshot33b{
        wait(50);
        let b=0;
        let c=0;
        while(GetCommonData("bossatack")==3){
           if(phase<=1){return;}
           let a=-1-ex*2;
           loop(3+ex*4){
              CreateShotFromScript( "shot1",GetX()+cos(houdai)*40, GetY()-104+sin(houdai)*20, 5.5, houdai+a*(40-ex*25), 0, 01);
              a++;
           }
           PlaySE(seshot2);
           wait(6-lv*1);
        }
    }
    task Tshot34{
        yield;
        let b=0;
        while(GetCommonData("bossatack")==4){
           if(phase<=1){return;}
           let a=0;
           loop(1){
              CreateShotFromScript( "shotc",GetX()+cos(houdai)*40, GetY()-104+sin(houdai)*20, 6, houdai, 0, 01);
              a++;
           }
           PlaySE(seshot1);
           wait(12-lv*2);
        }
    }
    task Tshot4a{
        wait(100);
        let b=0;
        loop{
           if(phase<=0){return;}
           let a=0;
           loop(3+ex*2){
              CreateShotFromScript( "shotd",GetX(), GetY()-45, 6, 31+a*(120-ex*48)+b*4.7, 0, 13);
              CreateShotFromScript( "shotd",GetX(), GetY()-45, 6, 149+a*(120-ex*48)-b*4.7, 0, 13);
              a++;
           }
           PlaySE(seshot1);
           wait(6-lv*1);
           b++;
        }
    }
    task Tshot4b{
           SetMovePosition02(224+rand(30,-30), 120+rand(20,-20),100);
           wait(100);
        loop{
           SetMovePosition02(224+rand(30,-30), 120+rand(20,-20),50);
           wait(50);
        }
    }

    task Tmove(let x,let y,let r,let p) {
        let a=0;
        loop{
           SetMovePosition02(x+rand(30,-30), y+rand(20,-20),50);
           wait(50);
           a++;
           if(a>=r){return;}
           if(phase<p){return;}
        }
    }
    task Tmove1(let x,let y,let r,let p) {
        let a=0;
        loop{
           SetMovePosition02(x+40+rand(20,-20), y+rand(30,-30),50);
           wait(50);
           a++;
           if(a>=r){return;}
           if(phase<p){return;}
           SetMovePosition02(x-40+rand(20,-20), y+rand(30,-30),50);
           wait(50);
           a++;
           if(a>=r){return;}
           if(phase<p){return;}
        }
    }


    #include_function".\efanction.txt"
}


script_enemy yoko {
    let time = -150;
    let phase = 1;
    let rate = 0;
    let kaku = 40;
    let score = 12000;
    let lv = 0;
    let stg = false;
    let life = 600;
    let angle = GetAngle();
    let rank = GetSpeed();
    let arg = GetArgument();
    let ex = GetCommonData("ex");
    let imgEnemy = GetCurrentScriptDirectory~"img\st2boss.png";
    let tama = GetCurrentScriptDirectory~"tama.txt";
    let se1 = GetCurrentScriptDirectory~"wav\se1.wav";
    let se2 = GetCurrentScriptDirectory~"wav\se2.wav";
    let seshot1 = GetCurrentScriptDirectory~"wav\shot1.wav";
    let seshot2 = GetCurrentScriptDirectory~"wav\shot2.wav";
    @Initialize(){
        SetLife( 600 );
        SetInvincibility( 50 );
        LoadGraphic( imgEnemy );
        LoadUserShotData( tama );
    }
    @MainLoop {
        rate=life-GetLife;
        life=GetLife;
        SetX(GetCommonData("bossx")+96*arg);SetY(GetCommonData("bossy")-40);
        if(phase==1&&GetLife<=100){
           phase-=1;
           SetCommonData("bossparts1",GetCommonData("bossparts1")+1);
           PlaySE(se2);
           Tdeath(10,30,2,1);
           CreateEnemyFromFile(GetCurrentScriptDirectory~"airitem.txt",GetX,GetY, -3, 0, 3);
           SetCommonData("prerank",GetCommonData("prerank")+0.5);
        }
        if(phase>=1&&time>=0){
           SetCollisionA(GetX, GetY, 25);
        }
        if(GetCommonData("bossphase")==3){VanishEnemy;}
        lv=GetCommonData("rank");
        if(GetCommonData("bossatack")==2&&stg==false){stg=true;Tshot1;}
        time++;
        yield;
    }
    @Finalize() {
    }
    @DrawLoop {
        if(rate==0){SetColor(255,255,255);}
        else{SetColor(200,200,255);}
        if(time%30<5&&GetLife<300){SetColor(255,180,180);}
        if(phase==0){SetColor(255,180,180);}

	SetTexture( imgEnemy );
        SetGraphicRect( 352, 112, 400, 144 );
        SetGraphicAngle( 0, 0, 0);
	DrawGraphic( GetX(), GetY() );
    }

    task Tshot1{
        yield;
        let a=0;
        while(GetCommonData("bossatack")==2){
           if(phase<=0||GetCommonData("bossphase")==3){return;}
           let p=GetAngleToPlayer;
           let c=GetCommonData("bossparts1");
           let b=0;
           loop(1){
              CreateShotFromScript( "shota",GetX(), GetY(), 4+ex/2, 90+rand(-30,+30), 0, 13);
              if(c==1){CreateShotFromScript( "shot1",GetX(), GetY(), 4+ex/2, p+rand(-30,+30), 0, 13);}
              b++;
           }
           PlaySE(seshot1);
           wait(12-lv*2);
           a++;
        }
        stg=false;
    }

    #include_function".\efanction.txt"
}
script_enemy kata {
    let time = -150;
    let phase = 1;
    let rate = 10;
    let kaku = 40;
    let score = 15000;
    let lv = 0;
    let stg = false;
    let life = 800;
    let angle = GetAngle();
    let rank = GetSpeed();
    let arg = GetArgument();
    let ex = GetCommonData("ex");
    let imgEnemy = GetCurrentScriptDirectory~"img\st2boss.png";
    let tama = GetCurrentScriptDirectory~"tama.txt";
    let se1 = GetCurrentScriptDirectory~"wav\se1.wav";
    let se2 = GetCurrentScriptDirectory~"wav\se2.wav";
    let seshot1 = GetCurrentScriptDirectory~"wav\shot1.wav";
    let seshot2 = GetCurrentScriptDirectory~"wav\shot2.wav";
    @Initialize(){
        SetLife( 800 );
        SetInvincibility( 50 );
        LoadGraphic( imgEnemy );
        LoadUserShotData( tama );
    }
    @MainLoop {
        rate=life-GetLife;
        life=GetLife;
        SetX(GetCommonData("bossx")+60*arg);SetY(GetCommonData("bossy")-10);
        if(phase==1&&GetLife<=100){
           phase-=1;
           SetCommonData("bossparts2",GetCommonData("bossparts2")+1);
           PlaySE(se2);
           Tdeath(10,40,2,1);
           CreateEnemyFromFile(GetCurrentScriptDirectory~"airitem.txt",GetX,GetY-20, -3, 0, 1);
           CreateEnemyFromFile(GetCurrentScriptDirectory~"airitem.txt",GetX,GetY+0, -3, 0, 1);
           CreateEnemyFromFile(GetCurrentScriptDirectory~"airitem.txt",GetX,GetY+20, -3, 0, 1);
           CreateEnemyFromFile(GetCurrentScriptDirectory~"airitem.txt",GetX,GetY+40, -3, 0, 1);
           CreateEnemyFromFile(GetCurrentScriptDirectory~"airitem.txt",GetX,GetY+60, -3, 0, 1);
           SetCommonData("prerank",GetCommonData("prerank")+0.5);
        }
        if(phase>=1&&time>=0){
           SetCollisionA(GetX, GetY-10, 16);
           SetCollisionA(GetX, GetY+20, 16);
           SetCollisionA(GetX, GetY+50, 16);
        }
        if(GetCommonData("bossphase")==3){VanishEnemy;}
        lv=GetCommonData("rank");
        if(GetCommonData("bossatack")==3&&stg==false){stg=true;Tshot1;}
        time++;
        yield;
    }
    @Finalize() {
    }
    @DrawLoop {
        if(rate==0){SetColor(255,255,255);}
        else{SetColor(200,200,255);}
        if(time%30<5&&GetLife<400){SetColor(255,180,180);}
        if(phase==0){SetColor(255,180,180);}

	SetTexture( imgEnemy );
        SetGraphicRect( 416, 112, 432, 240 );
        SetGraphicAngle( 0, 0, 0);
	DrawGraphic( GetX(), GetY() );
    }

    task Tshot1{
        yield;
        while(GetCommonData("bossatack")==3){
           if(phase<=0||GetCommonData("bossphase")==3){return;}
           let p=atan2( GetPlayerY()-(GetY()+60), GetPlayerX()-(GetX()));
           CreateShotFromScript( "shot1",GetX(), GetY()+60, 6+ex, p+24, 0, 12);
           CreateShotFromScript( "shot1",GetX(), GetY()+60, 6+ex, p-24, 0, 12);
           wait(18-lv*3);
        }
        stg=false;
    }

    #include_function".\efanction.txt"
}

   script_shot shota{//玩@_
       let out=false;
       let gr=GetArgument;
       let lv=0;
       let kasoku=GetSpeed;
       let phase=2;
       let ex = GetCommonData("ex");
       @Initialize{
          SetDefault(gr+lv*20);
       }
       @MainLoop {
          if(GetX<20||GetX>428||GetY<20||GetY>460){
             out=true;
             End;
          }
          if(GetCommonData("kakusei")>0){
             lv=1;
             if(GetPoint==0){lv=2;SetSpeed(GetSpeed+0.03)}
          }
          else{lv=0}
          if(phase==2){
             SetSpeed(GetSpeed-0.1);
             if(GetSpeed<0.5){
                SetAngle(GetAngleToPlayer+(90-GetAngle)/5);
                phase=1;
                SetSpeed(4+ex);
             }
          }
          SetDefault(gr+lv*20);
          if((GetX-GetPlayerX)^2+(GetY-GetPlayerY)^2<=4){SetCommonData("gekitui",1);}
       }
       @DrawLoop {
          DrawGraphicDefault();
       }
       @Finalize{
          if(out==false&&OnBomb==false){
             if(GetCommonData("kakusei")>0){
                let a=(200+GetCommonData("kinkaiten")*100);
                CreateShotFromScript( "kinka",GetX(), GetY(), a, 270, 0, 99-GetCommonData("kinkaiten")/20);
             }
             if(OnBomb==false&&GetCommonData("kakusei")==0){
                CreateShotFromScript( "isi",GetX(), GetY(), 0, 270, 0, 0);
             }
          }
       }
    }    
   script_shot shotb{//px+
       let out=false;
       let gr=02;
       let arg=GetArgument;
       let lv=0;
       let kasoku=GetSpeed;
       let time=0;
       let ex = GetCommonData("ex");
       @Initialize{
          SetDefault(gr+lv*20);
       }
       @MainLoop {
          if(GetX<20||GetX>428||GetY<20||GetY>460){
             out=true;
             End;
          }
          if(GetCommonData("kakusei")>0){
             lv=1;
             if(GetPoint==0){lv=2;SetSpeed(GetSpeed+0.03)}
          }
          else{lv=0}
          if(time<120){
             SetAngle(GetAngle+0.9*arg);
          }
          SetSpeed(GetSpeed+0.017);
          SetDefault(gr+lv*20);
          if((GetX-GetPlayerX)^2+(GetY-GetPlayerY)^2<=4){SetCommonData("gekitui",1);}
          time++;
       }
       @DrawLoop {
          DrawGraphicDefault();
       }
       @Finalize{
          if(out==false&&OnBomb==false){
             if(GetCommonData("kakusei")>0){
                let a=(200+GetCommonData("kinkaiten")*100);
                CreateShotFromScript( "kinka",GetX(), GetY(), a, 270, 0, 99-GetCommonData("kinkaiten")/20);
             }
             if(OnBomb==false&&GetCommonData("kakusei")==0){
                CreateShotFromScript( "isi",GetX(), GetY(), 0, 270, 0, 0);
             }
          }
       }
    }    
   script_shot shotc{//d͒eo
       let out=false;
       let gr=GetArgument;
       let lv=0;
       let kasoku=GetSpeed;
       let phase=2;
       let ex = GetCommonData("ex");
       @Initialize{
          SetDefault(gr+lv*20);
       }
       @MainLoop {
          if(GetX<20||GetX>428||GetY<20||GetY>460){
             out=true;
             End;
          }
          if(GetCommonData("kakusei")>0){
             lv=1;
             if(GetPoint==0){lv=2;SetSpeed(GetSpeed+0.03)}
          }
          else{lv=0}
          if(phase==2){
             SetSpeed(GetSpeed-0.15);
             if(GetSpeed<0.5){
                let a=-3;
                loop(7+ex*7){
                   CreateShotFromScript( "shot2",GetX(), GetY(), 2.5+rand(2,-2), GetAngle-180+a%7*12+rand(15,-15), 0, 02);
                   a++;
                }
                phase=1;
                out=true;
                End;
             }
          }
          SetDefault(gr+lv*20);
          if((GetX-GetPlayerX)^2+(GetY-GetPlayerY)^2<=4){SetCommonData("gekitui",1);}
       }
       @DrawLoop {
          DrawGraphicDefault();
       }
       @Finalize{
          if(out==false&&OnBomb==false){
             if(GetCommonData("kakusei")>0){
                let a=(200+GetCommonData("kinkaiten")*100);
                CreateShotFromScript( "kinka",GetX(), GetY(), a, 270, 0, 99-GetCommonData("kinkaiten")/20);
             }
             if(OnBomb==false&&GetCommonData("kakusei")==0){
                CreateShotFromScript( "isi",GetX(), GetY(), 0, 270, 0, 0);
             }
          }
       }
    }    
   script_shot shotd{//ᑬ
       let out=false;
       let gr=GetArgument;
       let lv=0;
       let kasoku=GetSpeed;
       let phase=2;
       let ex = GetCommonData("ex");
       @Initialize{
          SetDefault(gr+lv*20);
       }
       @MainLoop {
          if(GetX<20||GetX>428||GetY<20||GetY>470){
             out=true;
             End;
          }
          if(GetCommonData("kakusei")>0){
             lv=1;
             if(GetPoint==0){lv=2;SetSpeed(GetSpeed+0.03)}
          }
          else{lv=0}
          if(phase==2){
             SetSpeed(GetSpeed-0.07);
             if(GetSpeed<0.5){
                SetAngle(90);
                phase=1;
                SetSpeed(rand(0.5,2)+ex);
             }
          }
          SetDefault(gr+lv*20);
          if((GetX-GetPlayerX)^2+(GetY-GetPlayerY)^2<=4){SetCommonData("gekitui",1);}
       }
       @DrawLoop {
          DrawGraphicDefault();
       }
       @Finalize{
          if(out==false&&OnBomb==false){
             if(GetCommonData("kakusei")>0){
                let a=(200+GetCommonData("kinkaiten")*100);
                CreateShotFromScript( "kinka",GetX(), GetY(), a, 270, 0, 99-GetCommonData("kinkaiten")/20);
             }
             if(OnBomb==false&&GetCommonData("kakusei")==0){
                CreateShotFromScript( "isi",GetX(), GetY(), 0, 270, 0, 0);
             }
          }
       }
    }    
#include_script".\escript.txt"