
#Title[BOSS巇條楾侾]
#Text[]
#ScriptVersion[2]


script_enemy_main {
  let imgBoss = "script\朸將\dotwolf.png";
  let frame   = 0;
  let xIni    = GetCenterX;
  let yIni    = GetClipMaxY - 360;
  let Q=1;
  let R=1;
  let a=1;
let scoa=0;
@Initialize {

    SetLife(600);
 
    SetDamageRate(0, 0);
    LoadGraphic(imgBoss);
SetShotAutoDeleteClip(60,60,60,60);
   SetTexture(imgBoss);   SetGraphicRect(0, 0, 64, 128);

    TMain;

   }
@MainLoop {
          
    SetCollisionA(GetX, GetY, 24);
    SetCollisionB(GetX, GetY, 24);
   yield;

}
@DrawLoop{
    DrawGraphic(GetX, GetY);
   }

@Finalize {
if(scoa==0){
AddScore(3000+3000*GetPlayerLife);scoa=1;}
    DeleteGraphic(imgBoss);}

function moveToPlayer(xMove, yAdd, frame, left, top, right, bottom) {
     let x;
     let y;

     if(GetPlayerX < GetX) {
         x = GetX - xMove;
         if(x < left) {
             x = GetX + xMove;
     }
     } else {
         x = GetX + xMove;
         if(right < x) {
             x = GetX - xMove;
         }
     }
     y = GetY + yAdd;
     if(y < top) {
         y = top;
     } else if(bottom > y) {
         y = bottom;
     }

     SetMovePosition02(x, y, frame);



}

 task TMain {
        yield;
      standBy;
loop{
                  Q=rand_int(1,1);
  if(GetLife<300){Q=rand_int(2,2);}



if(Q==1){    SetColor(249,166,91);
Concentration01(30);
SetColor(255,255,255);
wait(60);
fire;}
if(Q==2){ 
    SetColor(90,241,241);
Concentration01(30);
SetColor(255,255,255);
wait(30);
SetMovePosition02(GetCenterX, GetCenterY, 20);wait(20);ice;
 SetMovePosition02(GetPlayerX, GetCenterY-150, 20);wait(90);
}
if(Q==3){
SetMovePosition02(GetCenterX, GetCenterY, 20);wait(20);
spcr; SetMovePosition02(GetPlayerX, GetCenterY-150, 20);wait(90);

}
if(Q==4){
SetMovePosition02(GetCenterX, GetCenterY, 20);wait(20);
spcr2; SetMovePosition02(GetPlayerX, GetCenterY-150, 20);wait(90);

}

 sla;
     R=rand_int(1,2);

if(R==1){slashR;}
if(R==2){slashL;}
wait(90);



}


      }


    sub standBy{
            let wIni =60;
        SetMovePosition02(xIni, yIni, wIni);
    SetInvincibility(wIni);
   wait(wIni);  
CreateEventFromScript("BELa");
loop{yield;   SetInvincibility(5);if(OnEvent()==false){break;}}
   wait(30);  
intro;
setGraphicMove;
 CutIn(KOUMA, "", "script\儘僋僋儘\warn.png", 64, 0, 432, 462);
 PlaySE("\koukaonn\warp3.wav");
PlayMusic("\bgm\MMX8_Boss-KM.mid");
  wait(120); 
SetText("");
 SetDamageRate(10, 10);

             }

  sub move{
    yield;

        
       moveToPlayer(rand(90, 150), rand(-30, 20), 20,
                     GetClipMinX + 60, GetClipMinY + 32,
                     GetClipMaxX - 60, GetClipMinY + 60);
   wait(30);
          
       }
    function wait(w) {
        loop(w) { yield; }
                    }
task rshot2{
let A=0;
if(GetLife<100){
loop(36){
           CreateShot02(GetX, GetY, 7, A,0,0, RED04, 5);
A=A+10;
}
}
}
task rshot{
if(GetLife<400){
loop(20){
           CreateShot02(GetX, GetY, 7, GetAngleToPlayer-10,0,0, PURPLE21, 0);
           CreateShot02(GetX, GetY, 7, GetAngleToPlayer,0,0, PURPLE21, 0);
           CreateShot02(GetX, GetY, 7, GetAngleToPlayer+10,0,0, PURPLE21, 0);
yield;}
}

}
sub cro1{
let aa=1;
let s=rand_int(-1,1);
 CreateLaserC(359,GetX,GetClipMinY-60,20,30,PURPLE01,0);
SetLaserDataC(359,0,20,90,0,0,0);
 CreateLaserC(358,GetX+40,GetClipMinY-60,20,30,PURPLE01,0);
SetLaserDataC(358,0,20,90,0,0,0);
 CreateLaserC(357,GetX-40,GetClipMinY-60,20,30,PURPLE01,0);
SetLaserDataC(357,0,20,90,0,0,0);
let aa=1;
loop(100){
 CreateShotA(35,0,-300,15);
 SetShotDataA(35,0,0,90,0,0,0,PURPLE01);
 SetShotDataA(35,60,2,aa*180-180,0,0,0,PURPLE01);
 AddShot(aa,359,35,0);
 CreateShotA(36,0,-300,15);
 SetShotDataA(36,0,0,90,0,0,0,PURPLE01);
 SetShotDataA(36,60,2,aa*180,0,0,0,PURPLE01);
 AddShot(aa,357,36,0);
 CreateShotA(37,0,-300,15);
 SetShotDataA(37,0,0,90,0,0,0,PURPLE01);
 SetShotDataA(37,60,2,aa*180,0,0,0,PURPLE01);
 AddShot(aa,358,37,0);
 aa++;

}
FireShot(359);
FireShot(358);
FireShot(357);
}
sub cro2R{
let aa=1;
 CreateLaserC(359,GetClipMaxX+60,GetY+60,20,30,PURPLE01,0);
SetLaserDataC(359,0,20,180,0,0,0);
 CreateLaserC(358,GetClipMaxX+60,GetY+60+40,20,30,PURPLE01,0);
SetLaserDataC(358,0,20,180,0,0,0);
 CreateLaserC(357,GetClipMaxX+60,GetY+60-40,20,30,PURPLE01,0);
SetLaserDataC(357,0,20,180,0,0,0);
let aa=1;
loop(100){
 CreateShotA(35,300,0,15);
 SetShotDataA(35,0,0,180,0,0,0,PURPLE01);
 SetShotDataA(35,60,2,aa*180+90,0,0,0,PURPLE01);
 AddShot(aa,359,35,0);
 CreateShotA(36,300,0,15);
 SetShotDataA(36,0,0,180,0,0,0,PURPLE01);
 SetShotDataA(36,60,2,aa*180-90,0,0,0,PURPLE01);
 AddShot(aa,357,36,0);
 CreateShotA(37,300,0,15);
 SetShotDataA(37,0,0,180,0,0,0,PURPLE01);
 SetShotDataA(37,60,2,aa*180-90,0,0,0,PURPLE01);
 AddShot(aa,358,37,0);
 aa++;

}
FireShot(359);
FireShot(358);
FireShot(357);
}
sub cro2L{
let aa=1;
 CreateLaserC(359,GetClipMinX-60,GetY+60,20,30,PURPLE01,0);
SetLaserDataC(359,0,20,0,0,0,0);
 CreateLaserC(358,GetClipMinX-60,GetY+60+40,20,30,PURPLE01,0);
SetLaserDataC(358,0,20,0,0,0,0);
 CreateLaserC(357,GetClipMinX-60,GetY+60-40,20,30,PURPLE01,0);
SetLaserDataC(357,0,20,0,0,0,0);
let aa=1;
loop(100){
 CreateShotA(35,-300,0,15);
 SetShotDataA(35,0,0,0,0,0,0,PURPLE01);
 SetShotDataA(35,60,2,aa*180-90,0,0,0,PURPLE01);
 AddShot(aa,359,35,0);
 CreateShotA(36,-300,0,15);
 SetShotDataA(36,0,0,0,0,0,0,PURPLE01);
 SetShotDataA(36,60,2,aa*180+90,0,0,0,PURPLE01);
 AddShot(aa,357,36,0);
 CreateShotA(37,-300,0,15);
 SetShotDataA(37,0,0,0,0,0,0,PURPLE01);
 SetShotDataA(37,60,2,aa*180+90,0,0,0,PURPLE01);
 AddShot(aa,358,37,0);
 aa++;

}
FireShot(359);
FireShot(358);
FireShot(357);
}


sub slashR{
    task setGraphicPose  {

loop(20){SetGraphicAngle(0,0,0); SetGraphicRect( 192,   0, 256,  128);yield;}
loop(3){ SetGraphicAngle(0,0,0);SetGraphicRect( 256,   0, 320,  128);yield;}
loop(2){SetGraphicAngle(0,0,0); SetGraphicRect( 320,   0, 384,  128);yield;}



SetGraphicAngle(0,0,0);
loop(25){ SetGraphicRect( 0,   128, 64,  256);yield;}
SetGraphicAngle(0,0,0);
 }
a=20;
 SetMovePosition02(GetClipMaxX, GetY-60, 20);
wait(20);
roR;
rshot;
 SetMovePosition02(GetClipMinX, GetY-60, 20);
wait(20);
setGraphicPose;
rshot2;
 SetMovePosition02(GetPlayerX, yIni, 20);
wait(20);
cro1;

wait(40);
wait(20);
}
sub slashL{
    task setGraphicPose  {
loop(20){SetGraphicAngle(180,0,0); SetGraphicRect( 192,   0, 256,  128);yield;}
loop(3){ SetGraphicAngle(180,0,0);SetGraphicRect( 256,   0, 320,  128);yield;}
loop(2){SetGraphicAngle(180,0,0); SetGraphicRect( 320,   0, 384,  128);yield;}
SetGraphicAngle(180,0,0);
loop(25){ SetGraphicRect( 0,   128, 64,  256);yield;}
SetGraphicAngle(0,0,0);
 }
a=20;
 SetMovePosition02(GetClipMinX, GetY-60, 20);
wait(20);
roL;
rshot;
 SetMovePosition02(GetClipMaxX, GetY-60, 20);
wait(20);
setGraphicPose;
rshot2;
 SetMovePosition02(GetPlayerX, yIni, 20);
wait(20);
cro1;
wait(20);
wait(40);
}


sub ice{
 let angle   = 90;
  let angle2   = 90;
let A=210;
let G=0;
   task setGraphicPose  {
loop(2){SetGraphicAngle(0,0,0); SetGraphicRect( 0,   128, 64,  256);yield;yield;}
loop(3){ SetGraphicAngle(0,0,0);SetGraphicRect( 256,   0, 320,  128);yield;}

loop(50){ SetGraphicRect( 192,   0, 256,  128);yield;

}
loop(3){ SetGraphicAngle(0,0,0);SetGraphicRect( 256,   0, 320,  128);yield;}
loop(2){SetGraphicAngle(0,0,0); SetGraphicRect( 320,   0, 384,  128);yield;}
loop(205){ SetGraphicRect( 0,   128, 64,  256);yield;}
 }
sub shot{
    yield;
    setGraphicPose; 
 angle   = 90;

loop(6){

CreateShotA(11,0,0,0);
SetShotDataA(11,0,3,angle+135,0,0.01,3,BLUE23);
CreateShotA(22,0,0,0);
SetShotDataA(22,0,3,angle-135,0,0.01,3,BLUE23);
CreateShotA(33,0,0,0);
SetShotDataA(33,0,3,angle-90,0,0.01,3,BLUE23);
CreateShotA(44,0,0,0);
SetShotDataA(44,0,3,angle+90,0,0.01,3,BLUE23);
CreateShotA(3,0,0,0);
SetShotDataA(3,1,5,angle,0,0,9,WHITE01);
SetShotDataA(3,5,0,NULL,0,0,9,WHITE01);
CreateShotA(45,GetX,GetY,0);
SetShotDataA(45,1,7,angle2,0,0,9,WHITE02);
angle=angle+60;

SetShotKillTime(3,61+G);
AddShot(60+G,3,11,0);
AddShot(60+G,3,22,0);
AddShot(60+G,3,33,0);
AddShot(60+G,3,44,0);
AddShot(20,45,3,0);

SetShotKillTime(45,21);
FireShot(45);

}
loop(12){

CreateShotA(11,0,0,0);
SetShotDataA(11,0,3,angle,0,0.01,3,AQUA23);
CreateShotA(22,0,0,0);
SetShotDataA(22,0,3,angle-180,0,0.01,3,AQUA23);
CreateShotA(33,0,0,0);
SetShotDataA(33,0,3,angle+90,0,0.01,3,AQUA23);
CreateShotA(44,0,0,0);
SetShotDataA(44,0,3,angle-90,0,0.01,3,AQUA23);
CreateShotA(5,0,0,0);
SetShotDataA(5,1,5,angle+15,0,0,9,WHITE01);
angle=angle+30;
SetShotDataA(5,10,0,NULL,0,0,9,WHITE01);
CreateShotA(46,GetX,GetY,0);
SetShotDataA(46,1,7,angle2,0,0,9,WHITE02);

SetShotKillTime(5,61+G);
AddShot(60+G,5,11,0);
AddShot(60+G,5,22,0);
AddShot(60+G,5,33,0);
AddShot(60+G,5,44,0);
AddShot(20,46,5,0);

SetShotKillTime(46,21);
FireShot(46);
}
loop(6){

CreateShotA(11,0,0,0);
SetShotDataA(11,0,3,angle-210,0,0.01,3,WHITE23);
CreateShotA(22,0,0,0);
SetShotDataA(22,0,3,angle-190,0,0.01,3,WHITE23);
CreateShotA(33,0,0,0);
SetShotDataA(33,0,3,angle-160,0,0.01,3,WHITE23);
CreateShotA(44,0,0,0);
SetShotDataA(44,0,3,angle-170,0,0.01,3,WHITE23);
CreateShotA(9,0,0,0);
SetShotDataA(9,1,5,angle,0,0,9,WHITE01);
angle=angle+60;
SetShotDataA(9,15,0,NULL,0,0,9,WHITE01);
CreateShotA(47,GetX,GetY,0);
SetShotDataA(47,1,7,angle2,0,0,9,WHITE02);
SetShotKillTime(9,61+G);
AddShot(60+G,9,11,0);
AddShot(60+G,9,22,0);
AddShot(60+G,9,33,0);
AddShot(60+G,9,44,0);
AddShot(20,47,9,0);


SetShotKillTime(47,21);
FireShot(47);
}
}
 

 
setGraphicPose;
loop(3){shot; 
          angle2=angle2+120;}
G=G+150;
angle2=angle2+60;
loop(3){shot; 
          angle2=angle2+120;}
wait(300)
}

sub sla{
let S=rand_int(0,1);
    task setGraphicPose  {
SetGraphicAngle(S*180,0,0);
loop(5){ SetGraphicRect( 192,   0, 256,  128);yield;}
loop(3){ SetGraphicRect( 256,   0, 320,  128);yield;}
loop(2){ SetGraphicRect( 320,   0, 384,  128);yield;}
loop(25){ SetGraphicRect( 0,   128, 64,  256);yield;}
SetGraphicAngle(0,0,0);
 }

 SetMovePosition02(GetPlayerX, GetPlayerY-60, 20);
wait(20);
setGraphicPose;
wait(5);
if(S==0){cro2L;}
if(S==1){cro2R;}
wait(30);
}

sub fire{
task rshotf{

loop(5){
           CreateShot02(GetX, GetY, 7, GetAngleToPlayer-10,0,0, PURPLE21, 0);
           CreateShot02(GetX, GetY, 7, GetAngleToPlayer,0,0, PURPLE21, 0);
           CreateShot02(GetX, GetY, 7, GetAngleToPlayer+10,0,0, PURPLE21, 0);
yield;}


}

task rfshot{loop(4){rshotf;wait(30);}}

task setGraphicPose{loop(120){ 
SetGraphicAngle(0,0,0);
SetGraphicRect( 192,   0, 256,  128);yield;
}
wait(80);
SetGraphicAngle(180,0,0);
loop(120){ 
SetGraphicRect( 192,   0, 256,  128);yield;
}
SetGraphicAngle(0,0,0);
 }
let Angle=90; 
let G=30;
task shot{
loop(60){
CreateShotA(45,GetX+G,GetY,0);
SetShotDataA(45,0,8,Angle,0,0,9,ORANGE03);
SetShotDataA(45,1,8,Angle,rand(-1.5,1.5),0,9,ORANGE03);
SetShotDataA(45,25,8,NULL,0,0,9,ORANGE03);
SetShotDataA(45,35,2,180,0,0.1,3,ORANGE11);
CreateShotA(46,GetX+G,GetY,0);
SetShotDataA(46,0,8,Angle,0,0,9,RED03);
SetShotDataA(46,1,8,Angle,rand(-1.5,1.5),0,9,RED03);
SetShotDataA(46,25,8,NULL,0,0,9,RED03);
SetShotDataA(46,35,2,0,0,0.1,3,RED11);
FireShot(45);
FireShot(46);
yield;
yield;
}
}
 SetMovePosition02(GetClipMaxX-90, GetClipMinY+30, 20);
wait(50);
Angle=180;
G=-30;
setGraphicPose;

shot;
 SetMovePosition02(GetClipMaxX-90, GetClipMaxY-30, 120);
wait(150);
 SetMovePosition02(GetClipMinX+90, GetClipMaxY-30, 20);
wait(50);
Angle=0;
G=30;

shot;
 SetMovePosition02(GetClipMinX+90, GetClipMinY+30, 120);
wait(180);
}
sub spcr{
let aa=1;
let a=12;
  task setGraphicPose  {
SetGraphicAngle(180,0,0);
loop(10){ SetGraphicRect( 192,   0, 256,  128);yield;}
loop(3){ SetGraphicRect( 256,   0, 320,  128);yield;}
loop(2){ SetGraphicRect( 320,   0, 384,  128);yield;}

loop(30){ SetGraphicRect( 0,   128, 64,  256);yield;}
SetGraphicAngle(0,0,0);
 }
 CreateLaserC(359,GetX,GetY,20,30,PURPLE04,0);
SetLaserDataC(359,0,1,0,12,1,60);
 CreateLaserC(358,GetX,GetY,20,30,PURPLE04,0);
SetLaserDataC(358,0,1,120,12,1,60);
 CreateLaserC(357,GetX,GetY,20,30,PURPLE04,0);
SetLaserDataC(357,0,1,240,12,1,60);
let aa=1;
SetShotDirectionType(ABSOLUTE);
loop(1000){
 CreateShotA(35,0,0,15);
 SetShotDataA(35,0,0,a,0,0.05,4,PURPLE04);
 AddShot(aa,359,35,0);
 CreateShotA(36,0,0,15);
 SetShotDataA(36,0,0,a+120,0,0.05,4,PURPLE04);
 AddShot(aa,357,36,0);
 CreateShotA(37,0,0,15);
 SetShotDataA(37,0,0,a+240,0,0.05,4,PURPLE04);
 AddShot(aa,358,37,0);
a=a+24;
 aa++;
 aa++;
}
SetShotDirectionType(ABSOLUTE);
setGraphicPose;
wait(15);
FireShot(359);
FireShot(358);
FireShot(357);
wait(180);
}
sub spcr2{
let aa=1;
let a=-12;
  task setGraphicPose  {
SetGraphicAngle(0,0,0);
loop(10){ SetGraphicRect( 192,   0, 256,  128);yield;}
loop(3){ SetGraphicRect( 256,   0, 320,  128);yield;}
loop(2){ SetGraphicRect( 320,   0, 384,  128);yield;}
loop(30){ SetGraphicRect( 0,   128, 64,  256);yield;}
SetGraphicAngle(0,0,0);
 }

 CreateLaserC(359,GetX,GetY,20,30,PURPLE04,0);
SetLaserDataC(359,0,1,0,-12,1,60);
 CreateLaserC(358,GetX,GetY,20,30,PURPLE04,0);
SetLaserDataC(358,0,1,120,-12,1,60);
 CreateLaserC(357,GetX,GetY,20,30,PURPLE04,0);
SetLaserDataC(357,0,1,240,-12,1,60);
let aa=1;
SetShotDirectionType(ABSOLUTE);
loop(1000){
 CreateShotA(35,0,0,15);
 SetShotDataA(35,0,0,a,0,0.05,4,PURPLE04);
 AddShot(aa,359,35,0);
 CreateShotA(36,0,0,15);
 SetShotDataA(36,0,0,a+120,0,0.05,4,PURPLE04);
 AddShot(aa,357,36,0);
 CreateShotA(37,0,0,15);
 SetShotDataA(37,0,0,a+240,0,0.05,4,PURPLE04);
 AddShot(aa,358,37,0);
a=a-24;
 aa++;
 aa++;
}
SetShotDirectionType(ABSOLUTE);
setGraphicPose;
wait(15);
FireShot(359);
FireShot(358);
FireShot(357);
wait(180);
}

      sub setGraphicStop  {  SetGraphicRect(64*5, 128, 64*6, 256); }

    sub setGraphicRight  { SetGraphicRect(128,   0, 192,  128); }
    sub setGraphicLeft { SetGraphicRect(64,   0, 128,  128); }
      task roR {let b=0;loop(a){SetGraphicRect( 192,   128, 256,  256);SetGraphicAngle(0,0,b);b=b-18;yield;}SetGraphicAngle(0,0,0);}
      task roL {let b=0;loop(a){SetGraphicRect( 128,   128, 192,  256);SetGraphicAngle(0,0,b);b=b+18;yield;}SetGraphicAngle(0,0,0);}
sub intro{ 
loop(5){SetGraphicRect(64*6, 128, 64*7, 256);yield;}
loop(3){SetGraphicRect(64*4, 128, 64*5, 256);yield;}
  SetColor(220,0,220);
Concentration01(80);
SetColor(255,255,255);
loop(60){SetGraphicRect(64*7, 0, 64*8, 128);yield;}
loop(30){SetGraphicAngle(180,0,0);SetGraphicRect(64*0, 128, 64*1, 256);yield;}
SetGraphicAngle(0,0,0);


}


    task setGraphicMove {
     loop{yield;
        if(GetSpeedX < 0) {
            setGraphicLeft;
        } if(GetSpeedX > 0){
            setGraphicRight;
        } if(GetSpeed == 0){
          setGraphicStop;}
         }


    }



}}#include_script".\BOSS BELa.txt"