
script_enemy_main
{
    let count=0;
    let count2=0;
    let count3=0;
    let FE=0;
    let get;
    let try;

    let pass=GetCurrentScriptDirectory~"Spell.dat";

    let cx=GetCenterX();
    let img=GetCurrentScriptDirectory~"img\dot_remilia.png";
    let bg=GetCurrentScriptDirectory~"img\st00.png";
    let bg2=GetCurrentScriptDirectory~"img\moon3-1.png";
    let bg3=GetCurrentScriptDirectory~"img\cloud.png";
    let sh00=GetCurrentScriptDirectory~"\se\Shot00.wav";
    let mm=0;
    let shot=0;
    let tame=0;
    let tame2=0;
    let d=70;
    let ang=0;
    let move=0;

    @Initialize()
    {
        MagicCircle(false);
        SetEnemyMarker(true);
        SetLife(3800);
        SetDamageRate(148,64);
        SetTimer(49);
        SetInvincibility(150);
        SetNormPoint(-1);
        LoadGraphic(img);
        SetShotAutoDeleteClip(32,32,32,32);
        LoadGraphic(bg);
        LoadGraphic(bg2);
        LoadGraphic(bg3);
        FE+=rand(0,20);
        LoadGraphic(GetCurrentScriptDirectory~"\img\circle_l.png");
        LoadUserShotData(GetCurrentScriptDirectory~".\shot_All.txt");

    }

    @MainLoop()
    {
        SetCollisionA(GetX(),GetY()-16,28);
        SetCollisionB(GetX(),GetY(),14);

        SetCommonData("Black",244);

        if (count>=21&&count%4==0&&count<=110) {
            PlaySE(GetCurrentScriptDirectory~"\se\Shot01.wav");
            ascent(let t in 0..72) {
                CreateShot02(GetX(),GetY()-55,0,90+t*5,0.1,6,41,34);
            }
        }

        if (count>=21&&count%15==0&&count%160>=80) {
            PlaySE(GetCurrentScriptDirectory~"\se\Shot02.wav");
            ascent( let t in 0..18 ) {
                CreateShotA(shot,GetX(),GetY()-55,35);
                SetShotDataA(shot,0,2.5,count*6+t*20,0,0,3,49);
                SetShotDataA(shot,15,NULL,NULL,-0.3,-0.04,0.5,49);
                SetShotDataA(shot,85,NULL,NULL,0.32,0.04,5,49);
                FireShot(shot);
            }
            ascent( let t in 0..18 ) {
                CreateShotA(shot,GetX(),GetY()-55,35);
                SetShotDataA(shot,0,2.5,count*6+t*20,0,0,3,41);
                SetShotDataA(shot,15,NULL,NULL,-0.3,-0.04,0.5,41);
                SetShotDataA(shot,85,NULL,NULL,0.32,0.036,4,41);
                FireShot(shot);
            }
        }
        if (count>=21&&count%15==0&&count%160<80) {
            PlaySE(GetCurrentScriptDirectory~"\se\Shot02.wav");
            ascent( let t in 0..18 ) {
                CreateShotA(shot,GetX(),GetY()-55,35);
                SetShotDataA(shot,0,2.5,count*6+t*20,0,0,3,49);
                SetShotDataA(shot,15,NULL,NULL,0.3,-0.04,0.5,49);
                SetShotDataA(shot,85,NULL,NULL,-0.32,0.04,5,49);
                FireShot(shot);
            }
            ascent( let t in 0..18 ) {
                CreateShotA(shot,GetX(),GetY()-55,35);
                SetShotDataA(shot,0,2.5,count*6+t*20,0,0,3,41);
                SetShotDataA(shot,15,NULL,NULL,0.3,-0.04,0.5,41);
                SetShotDataA(shot,85,NULL,NULL,-0.32,0.036,4,41);
                FireShot(shot);
            }
        }
        if (count>=80&&count%2==0&&OnBomb==false) {
            CreateLaserB(shot,1028,14+rand(-8,22),185,20);
            SetLaserDataB(shot,0,0,55,0,270,0,rand(98,442),0);
            SetShotKillTime(shot,70);
            FireShot(shot);
        }
        if (count>=80&&count%8==0&&OnBomb==false) {
            PlaySE(GetCurrentScriptDirectory~"\se\Laser3.wav");
        }

        if (count2==70) {
            SetMovePositionRandom01(0,200,8,cx,158,cx,158);
            move=60;
        }

        if (count2>=120) {
            count++;
        }count2++;
        move--;
        if (count>=10) {
            count3++;
        }

        if (count>=120&&count%15==0) {
            PlaySE(GetCurrentScriptDirectory~"\se\Shot01.wav");
        }

        if (count2==20) {
            SetColor(255,0,0);
            Concentration01(125);
            PlaySE(GetCurrentScriptDirectory~"\se\puu81.wav");
        }
        if (count2>=110) {
            tame++;
        }
    }

    @Finalize()
    {}

    @DrawLoop()
    {
        SetTexture(img);
        SetAlpha(255);
        SetGraphicAngle(0,0,0);
        SetColor(255,255,255);
        SetRenderState(ALPHA);
        SetGraphicScale(1,1);
        SetGraphicRect(0,0,128,128);
        if (int(GetSpeedX())==0&&count2/12%4>=0) {
            SetGraphicRect(0,0,128,128);
        }
        if (int(GetSpeedX())==0&&count2/12%4>=1) {
            SetGraphicRect(0,128,128,256);
        }
        if (int(GetSpeedX())==0&&count2/12%4>=2) {
            SetGraphicRect(0,256,128,384);
        }
        if (int(GetSpeedX())==0&&count2/12%4>=3) {
            SetGraphicRect(0,384,128,512);
        }
        if (int(GetSpeedX())==0&&tame>0) {
            SetGraphicRect(128*5,0,128*6,128);
        }
        if (int(GetSpeedX())==0&&tame>12) {
            SetGraphicRect(128*5,128,128*6,256);
        }
        if (GetSpeedX()<0&&move>0) {
            SetGraphicRect(256,0,384,128);
        }
        if (GetSpeedX()<0&&move>8) {
            SetGraphicRect(256,128,384,256);
        }
        if (GetSpeedX()>=0&&move>0) {
            SetGraphicRect(256,256,384,384);
        }
        if (GetSpeedX()>=0&&move>8) {
            SetGraphicRect(256,384,384,512);
        }
        DrawGraphic(GetX(),GetY());

    }

}

