script_enemy_main
{
    let count=0;//Ђ܂
    let MT=0;
    let mm=0;
    let cir=0;
    let N15=0;
    let N16=0;
    let N17=0;
    let Level=0;
    let life=0;
    let ten=0;

    task Laser(x,y,s,a,l,w,g,d,rm)
{
    let obj = Obj_Create(OBJ_LASER);
    let c = 0;
    Obj_SetX(obj,x);
    Obj_SetY(obj,y);
    Obj_SetAngle(obj,a);
    ObjShot_SetGraphic(obj,g);
    ObjShot_SetDelay(obj,d);
    ObjLaser_SetLength(obj,l);
    ObjLaser_SetWidth(obj,w);
    ObjShot_SetBombResist(obj,true);
    ObjShot_ToItem(obj,false);
    ObjLaser_SetSource(obj,false);

    while (c<rm)
    {
        ObjLaser_SetLength(obj,l);
        l+=s;
        c++;
        if (d>=c) {
            ObjLaser_SetWidth(obj,20);
        }else {
            ObjLaser_SetWidth(obj,w);
        }
        if (c==118&&d==118) {
            PlaySE(GetCurrentScriptDirectory~"\se\Laser.wav");
        }
        if (c>=rm-20) {
            Obj_SetCollisionToPlayer(obj,false);
        }
        if (c>=rm-20) {
            w=w/1.2;
            ObjLaser_SetWidth(obj,w);
        }
        if (c>=rm||GetLife<400) {
            Obj_Delete(obj);
        }
        yield;
    }

}



function dead {
    SetDamageRate(0,0);
    if (N17==4) {
        if (GetArgument==2) {
            DeleteEnemyShotToItemInCircle(CHILD,GetX(),GetY(),300);
        }
        if (GetArgument==3&&count<=320) {
            CollectItems;
            DeleteEnemyShotToItemInCircle(ALL,GetX(),GetY(),500);
        }
        if (GetArgument==7) {
            CollectItems;
            CreateEnemyFromFile(GetCurrentScriptDirectory~"Servant05.txt",GetX(),GetY(),0,0,4);
        }
        if (GetArgument==8) {
            DeleteEnemyShotToItemInCircle(CHILD,GetX(),GetY(),500);
            CollectItems;
        }
        if (MT==0&&OnBomb==false&&GetArgument<=4&&GetArgument!=3) {
            CollectItems;
            MT++;
        }
        if (BeVanished==false&&GetArgument==5&&GetCommonDataDefault("Mode",0)<=0) {
            SetCommonData("Mode",3);
        }
        if (BeVanished==false&&GetArgument==6&&GetCommonDataDefault("Mode",0)<=0) {
            SetCommonData("Mode",2);
        }
        CreateEnemyFromFile(GetCurrentScriptDirectory~"Servant10.txt",GetX,GetY,0,0,3);
        PlaySE(GetCurrentScriptDirectory~"\se\Baaaan2.wav");
        SetCommonData("ii1",GetCommonDataDefault("ii1",0)+GetCommonDataDefault("ii2",0));
        SetCommonData("ii3",1);
        loop(30) {
            CreateItem(ITEM_SCORE,GetX()+rand(-75,75),GetY()+rand(-20,85));
        }
        if (GetArgument==2) {
            loop(10) {
                CreateItem(ITEM_SCORE,GetX()+rand(-86,86),GetY()+rand(0,80));
            }
        }
        if (GetArgument==4) {
            loop(5) {
                CreateItem(ITEM_SCORE,GetX()-180+rand(-24,24),GetPlayerY()+rand(-24,24));
                CreateItem(ITEM_SCORE,GetX()+180+rand(-24,24),GetPlayerY()+rand(-24,24));
            }
        }
        Explosion01(GetX,GetY,16,0.2,40);
        PlaySE(GetCurrentScriptDirectory~"\se\Baaaan.wav");
    }
    if (GetArgument==8&&N17<20) {
        DeleteEnemyShotToItemInCircle(CHILD,GetX(),GetY(),500);
    }
    if (N17<100) {
        N17+=4;
    }
    if (N17>=100) {
        VanishEnemy;
    }
    if (count%3<=0) {
        Explosion01(GetX+rand(-10,10),GetY+rand(-10,10),24,0.1,20);
    }
}


@Initialize
{
    SetLife(502);
    if (GetPlayerType()==REIMU_A) {
        SetLife(656);
    }
    SetScore(75000);
    SetGraphicRect(256,0,320,64);
    Level+=GetPlayerLife();
    SetDamageRate(100,50);
    LoadUserShotData(GetCurrentScriptDirectory~".\shot_All.txt");
}

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

    if (GetArgument<=1) {
        if (count<=100) {
            SetSpeed(7-count*0.073);
        }
        if (count>=100&&count<=220&&count%12==0) {
            SetSpeed(0);
            PlaySE(GetCurrentScriptDirectory~"\se\Shot01.wav");
            if (GetArgument==0) {
                CreateShot02(GetX()-(count-102)*5*sin(172+rand(-10,10)),GetY()-(count-102)*5*cos(172+rand(-10,10)),0,240+rand(-35,35),0.005,9,55,45);
            }
            if (GetArgument==1) {
                CreateShot02(GetX()-(count-102)*5*sin(188+rand(-10,10)),GetY()-(count-102)*5*cos(188+rand(-10,10)),0,300+rand(-35,35),0.005,9,55,45);
            }
        }
        if (count>=100&&count<=220&&count%3==0) {
            SetSpeed(0);
            PlaySE(GetCurrentScriptDirectory~"\se\Shot00.wav");
            if (GetArgument==0) {
                CreateShot02(GetX()-(count-102)*5*sin(176+rand(-9,9)),GetY()-(count-102)*5*cos(176+rand(-9,9)),0,0,0.007,2,196,25);
            }
            if (GetArgument==1) {
                CreateShot02(GetX()-(count-102)*5*sin(184+rand(-9,9)),GetY()-(count-102)*5*cos(184+rand(-9,9)),0,180,0.007,2,196,25);
            }
        }
        if (count==0&&GetCenterX()-GetX()>0) {
            SetAngle(55);
        }
        if (count==0&&GetCenterX()-GetX()<0) {
            SetAngle(125);
        }
        if (count>=180&&count<=210&&GetCenterX()-GetX()>0) {
            SetAngle(270+70+rand(-22,22));
            SetDamageRate(600,60);
        }
        if (count>=180&&count<=210&&GetCenterX()-GetX()<0) {
            SetAngle(270-70+rand(-22,22));
            SetDamageRate(600,60);
        }
        if (count>=180) {
            SetSpeed((count-180)*0.12);
        }
        if (count>300) {
            VanishEnemy;
        }
        if (GetLife<400) {
            dead;
        }
        else {
            SetCollisionA(GetX(),GetY(),15);
            SetCollisionB(GetX(),GetY(),5);
        }
    }

    if (GetArgument==2) {
        if (count==0) {
            SetLife(1110+Level*10);
        }
        if (count<=70) {
            SetSpeed(6-count*0.08);
            SetAngle(90);
        }if (count>70) {
            SetSpeed(0);
        }if (count>380) {
            SetSpeed(-(count-380)*0.3);
        }
        if (count<=90&&count%2==0) {
            PlaySE(GetCurrentScriptDirectory~"\se\Shot00.wav");
            ascent(let t in 0..4) {
                CreateShot02(GetX()+rand(-60,60),GetY()+rand(-60,60),0,rand(-120,-60),0.1,4,22,5+4*t);
            }
        }
        if (count>=70&&count%3==0&&count<320) {
            PlaySE(GetCurrentScriptDirectory~"\se\Shot00.wav");
            ascent(let t in 0..3) {
                CreateShot02(GetX(),GetY()-8,4,count*12+t*120+rand(-40,40),-0.1,2+Level*0.2,110,0);
            }
        }
        if (count>=70&&count%24==0&&count<320) {
            PlaySE(GetCurrentScriptDirectory~"\se\Shot05.wav");
            ascent(let t in 0..8) {
                CreateShot02(GetX(),GetY()-8,0,count*8+t*45,0.03,2,54,15);
            }
        }
        if (count>=78&&count%4==0&&count<260) {
            PlaySE(GetCurrentScriptDirectory~"\se\Laser3.wav");
            CreateLaserB(N15,440,14,197,50);
            SetLaserDataB(N15,0,0,0,0,0,0,rand(30,150),0);
            SetShotKillTime(N15,70);
            FireShot(N15);
        }
        if (count>440) {
            VanishEnemy;
        }
        if (GetLife<400) {
            dead;
        }
        else {
            SetCollisionA(GetX(),GetY(),15);
            SetCollisionB(GetX(),GetY(),5);
        }
    }

    if (GetArgument==3) {
        if (count%30==0&&count>=60&&count<=200) {
            cir=30;
            PlaySE(GetCurrentScriptDirectory~"\se\Shot01.wav");
        }
        if (count%15==0&&count>=200&&count<=290) {
            cir=30;
            PlaySE(GetCurrentScriptDirectory~"\se\Shot01.wav");
        }
        if (count<=100) {
            SetSpeed(5-count*0.0501);
        }
        if (count%8==0&&count>70&&count<300) {
            PlaySE(GetCurrentScriptDirectory~"\se\Shot00.wav");
            ascent( let t in 0..8 ) {
                CreateShot01(GetX()+25,GetY(),3+t,0+10*sin(count),169,16);
            }
            ascent( let t in 0..8 ) {
                CreateShot01(GetX()-25,GetY(),3+t,180+10*sin(count),169,16);
            }
        }
        if (count==300) {
            PlaySE(GetCurrentScriptDirectory~"\se\Shot04.wav");
            ascent( let tt in 0..12 ) {
                ascent( let t in 0..6 ) {
                    CreateShot01(GetX(),GetY()+2,rand(5.2,7.9),GetAngleToPlayer()+tt*30+rand(-3,3),33,10);
                }
                ascent( let t in 0..12 ) {
                    CreateShot01(GetX(),GetY()+2,rand(1.2,7.9),GetAngleToPlayer()+tt*30+rand(-3,3),196,rand(10,16));
                }
                CreateShot02(GetX(),GetY()+2,7,GetAngleToPlayer()+tt*30,-0.2,8.5,49,10);
            }
        }
        if (count<=60) {
            SetAngle(90);
            SetLife(560);
            if (GetCommonDataDefault("Mode",0)>=3) {
                SetLife(520);
            }
        }
        if (count>=380) {
            SetAngle(270);
            SetSpeed((count-380)*0.1);
        }
        if (count>=300) {
            SetDamageRate(200,40);
        }
        if (count>440) {
            VanishEnemy;
        }
        if (GetLife<400) {
            dead;
        }
        else {
            SetCollisionA(GetX(),GetY()-12,26);
            SetCollisionB(GetX(),GetY(),8);
        }
        cir--;
    }

    if (GetArgument==4) {
        if (count<=100) {
            SetSpeed(5-count*0.051);
        }
        if (count%6==0&&count>100&&count<520) {
            PlaySE(GetCurrentScriptDirectory~"\se\Shot01.wav");
            CreateShot02(GetX()+52,GetY()-60,5,270,0.1,6,70,12);
            CreateShot02(GetX()-52,GetY()-60,5,270,0.1,6,70,12);
            ascent(let t in 0..12) {
                CreateShotA(N15,GetX()+50,GetY()-7,20);
                SetShotDataA(N15,0,9,10+t*30,-8,-0.1,5,196);
                SetShotDataA(N15,20+5*sin(count),NULL,NULL,0,-0.1,3,196);
                FireShot(N15);
                CreateShotA(N15,GetX()-50,GetY()-7,20);
                SetShotDataA(N15,0,9,-10+t*30,8,-0.1,5,196);
                SetShotDataA(N15,20+5*sin(count),NULL,NULL,0,-0.1,3,196);
                FireShot(N15);
            }
        }
        if (count%6==0&&count>110&&count<580) {
            PlaySE(GetCurrentScriptDirectory~"\se\Shot01.wav");
            CreateShot02(GetX()+160,GetPlayerY(),1,177-count*1.1,0.1,2.2,70,12);
            CreateShot02(GetX()+160,GetPlayerY(),1,177-count*1.1,0.1,1.8,70,12);
            CreateShot02(GetX()-160,GetPlayerY(),1,3+count*1.1,0.1,2.2,70,12);
            CreateShot02(GetX()-160,GetPlayerY(),1,3+count*1.1,0.1,1.8,70,12);
        }
        if (count==0) {
            SetAngle(90);
            SetLife(1900);
            if (GetPlayerType()==REIMU_A) {
                SetLife(1600);
            }
        }
        if (count>=580) {
            SetAngle(270);
            SetSpeed((count-580)*0.1);
        }
        if (count>640) {
            VanishEnemy;
        }SetDamageRate(100,22);
        if (GetLife<400) {
            dead;
        }
        else {
            SetCollisionA(GetX(),GetY()-16,32);
            SetCollisionB(GetX(),GetY(),12);
        }
    }

    if (GetArgument==5) {

        if (count<=100) {
            SetSpeed(5-count*0.051);
        }
        /*if(count<=205&&count%103<=80&&count%6==0){
        if(count>=105){PlaySE(GetCurrentScriptDirectory~"\se\Shot04.wav");
        ascent( let t in 1..4 ){CreateShot01(GetX(),GetY()+2,9-t,70-27-t*12,RED04,10);}
        ascent( let t in 1..4 ){CreateShot01(GetX(),GetY()+2,9-t,66+27+t*12,RED02,10);}}}
        if(count<=225&&count%123<=80&&count%4==0){
        if(count>=105){PlaySE(GetCurrentScriptDirectory~"\se\Shot00.wav");
        CreateShot01(GetX(),GetY()+22,2+(count-105)*0.07,GetAngleToPlayer(),RED01,20);
        CreateShot01(GetX(),GetY()+22,2+(count-105)*0.07,GetAngleToPlayer()+55,RED01,20);
        CreateShot01(GetX(),GetY()+22,2+(count-105)*0.07,GetAngleToPlayer()-55,RED01,20);}}

        if(count>=225&&count<=350&&count%3==0){PlaySE(GetCurrentScriptDirectory~"\se\Shot00.wav");
        ascent( let t in 0..6 ){CreateShot02(GetX(),GetY()+2,7,90+t*60,-0.2,4.6,RED04,20);}}*/

        if (count==0) {
            SetAngle(90);
            SetLife(350);
            if (GetPlayerType()==REIMU_A) {
                SetLife(250);
            }
        }
        if (count>=440) {
            SetAngle(270);
            SetSpeed((count-440)*0.12);
        }
        if (count>500) {
            VanishEnemy;
        }SetDamageRate(115,20);
        if (GetCommonDataDefault("Mode",0)>0) {
            SetDamageRate(178,22);
        }
        SetCollisionA(GetX(),GetY()-16,32);
        SetCollisionB(GetX(),GetY(),12);
    }

    if (GetArgument==6) {

        if (count<=100) {
            SetSpeed(5-count*0.051);
        }

        if (count==0) {
            SetAngle(90);
            SetLife(350);
            if (GetPlayerType()==REIMU_A) {
                SetLife(250);
            }
        }
        if (count>=440) {
            SetAngle(270);
            SetSpeed((count-440)*0.12);
        }
        if (count>500) {
            VanishEnemy;
        }SetDamageRate(128,22);
        if (GetCommonDataDefault("Mode",0)>0) {
            SetDamageRate(178,22);
        }
        SetCollisionA(GetX(),GetY()-16,32);
        SetCollisionB(GetX(),GetY(),12);
    }

    if (GetArgument==7) {
        if (count<=100&&GetCommonDataDefault("miss2",0)!=2) {
            SetSpeed(6-count*0.06);
        }
        if (count<=100&&GetCommonDataDefault("miss2",0)==2) {
            SetSpeed(8-count*0.08);
        }
        if (count<=50) {
            SetLife(520-50*(GetCommonDataDefault("miss2",0)==2));
        }
        if (GetPlayerLife<=5&&GetCommonDataDefault("miss2",0)!=2) {
            if (count<=265&&count>=100&&count%4==0) {
                if (GetX()<GetCenterX()) {
                    PlaySE(GetCurrentScriptDirectory~"\se\Shot00.wav");
                    CreateShot01(GetX()+37*cos(count*4.8+8+N15),GetY()+37*sin(count*4.8+8+N15),1.4,count*4.8+N15,95,6);
                    CreateShot01(GetX()+37*cos(count*4.8-8+N15),GetY()+37*sin(count*4.8-8+N15),1.5,count*4.8+N15,95,6);
                    CreateShot01(GetX()+37*cos(180+count*4.8+8+N15),GetY()+37*sin(180+count*4.8+8+N15),1.4,180+count*4.8+N15,95,6);
                    CreateShot01(GetX()+37*cos(180+count*4.8-8+N15),GetY()+37*sin(180+count*4.8-8+N15),1.5,180+count*4.8+N15,95,6);
                }
                if (GetX()>=GetCenterX()) {
                    PlaySE(GetCurrentScriptDirectory~"\se\Shot00.wav");
                    CreateShot01(GetX()+37*cos(-count*4.8+8+N15),GetY()+37*sin(-count*4.8+8+N15),1.5,-count*4.8+N15,95,6);
                    CreateShot01(GetX()+37*cos(-count*4.8-8+N15),GetY()+37*sin(-count*4.8-8+N15),1.4,-count*4.8+N15,95,6);
                    CreateShot01(GetX()+37*cos(-180-count*4.8+8+N15),GetY()+37*sin(-180-count*4.8+8+N15),1.5,-180-count*4.8+N15,95,6);
                    CreateShot01(GetX()+37*cos(-180-count*4.8-8+N15),GetY()+37*sin(-180-count*4.8-8+N15),1.4,-180-count*4.8+N15,95,6);
                }
            }
        }
        if (GetPlayerLife>5||GetCommonDataDefault("miss2",0)==2) {
            if (count<=265&&count>=100&&count%1==0) {
                if (GetX()<GetCenterX()) {
                    PlaySE(GetCurrentScriptDirectory~"\se\Shot00.wav");
                    CreateShot01(GetX()+37*cos(count*8.8+8+N15),GetY()+37*sin(count*8.8+8+N15),3.3,count*8.8+N15,95,36);
                    CreateShot01(GetX()+37*cos(count*8.8-8+N15),GetY()+37*sin(count*8.8-8+N15),3.2,count*8.8+N15,95,36);
                    CreateShot01(GetX()+37*cos(180+count*8.8+8+N15),GetY()+37*sin(180+count*8.8+8+N15),3.3,180+count*8.8+N15,95,36);
                    CreateShot01(GetX()+37*cos(180+count*8.8-8+N15),GetY()+37*sin(180+count*8.8-8+N15),3.2,180+count*8.8+N15,95,36);
                }
                if (GetX()>=GetCenterX()) {
                    PlaySE(GetCurrentScriptDirectory~"\se\Shot00.wav");
                    CreateShot01(GetX()+37*cos(-count*8.8+8+N15),GetY()+37*sin(-count*8.8+8+N15),3.3,-count*8.8+N15,95,36);
                    CreateShot01(GetX()+37*cos(-count*8.8-8+N15),GetY()+37*sin(-count*8.8-8+N15),3.2,-count*8.8+N15,95,36);
                    CreateShot01(GetX()+37*cos(-180-count*8.8+8+N15),GetY()+37*sin(-180-count*8.8+8+N15),3.2,-180-count*8.8+N15,95,36);
                    CreateShot01(GetX()+37*cos(-180-count*8.8-8+N15),GetY()+37*sin(-180-count*8.8-8+N15),3.3,-180-count*8.8+N15,95,36);
                }
            }
        }
        if (count==0) {
            if (GetX()>GetCenterX()) {
                SetAngle(120);
                N16=120;
            }else {
                SetAngle(60);
                N16=60;
            }N15+=rand(0,360);
        }
        if (count>=290) {
            SetAngle(90);
            SetSpeed((count-290)*0.1);
        }
        if (count>400) {
            VanishEnemy;
        }
        if (GetLife<400) {
            dead;
        }
        else {
            SetCollisionA(GetX(),GetY()-16,32);
            SetCollisionB(GetX(),GetY(),18);
        }
    }

    if (GetArgument==8) {
        if (GetLife>=400) {
            if (count<=100) {
                SetSpeed(6-count*0.06);
                SetDamageRate(130,30);
            }
            if (count<=120) {
                N15=0;
                N15+=GetAngleToPlayer();
            }

            if (count==120) {
                ascent( let t in 0..3 ) {
                    Laser(GetX()+26*cos(N15+12-45+t*45),GetY()+26*sin(N15+12-45+t*45),8,N15-2+t*2,12,11,41,121,95);
                    Laser(GetX()+26*cos(N15-12-45+t*45),GetY()+26*sin(N15-12-45+t*45),8,N15-2+t*2,12,11,41,121,95);
                }
            }

            if (count<=185&&count>=140&&count%18==0) {
                ascent( let t in 0..3 ) {
                    CreateShot01(GetX()+26*cos(N15+12-45+t*45),GetY()+26*sin(N15+12-45+t*45),5,N15-2+t*2,95,0);
                    CreateShot01(GetX()+26*cos(N15-12-45+t*45),GetY()+26*sin(N15-12-45+t*45),5,N15-2+t*2,95,0);
                }
            }
            if (count<=185&&count>=120&&count%5==0) {
                PlaySE(GetCurrentScriptDirectory~"\se\Shot01.wav");
                ascent( let t in 0..3 ) {
                    CreateShot01(GetX()+26*cos(N15+12-45+t*45),GetY()+26*sin(N15+12-45+t*45),10,N15-2+t*2,95,31);
                    CreateShot01(GetX()+26*cos(N15-12-45+t*45),GetY()+26*sin(N15-12-45+t*45),10,N15-2+t*2,95,31);
                }
            }

            if (count==0) {
                if (GetX()>GetCenterX()) {
                    SetAngle(130);
                    N16=130;
                }else {
                    SetAngle(50);
                    N16=50;
                }SetLife(570);
                N15+=rand(0,360);
            }
            if (count==180) {
                SetAngle(90);
            }
            if (count>=184) {
                SetSpeed((count-184)*0.1);
            }
            if (count>=62) {
                SetDamageRate(150,30);
            }
            if (count>=202) {
                SetDamageRate(350,30);
            }
            if (count>380) {
                VanishEnemy;
            }
        }

        if (GetLife<400) {
            dead;
        }
        else {
            SetCollisionA(GetX(),GetY()-12,32);
            if (count>=10) {
                SetCollisionB(GetX(),GetY(),8);
            }
        }
    }

    if (count>2&&GetArgument==13) {
        VanishEnemy;
    }

    if (GetLife<5) {
        SetDamageRate(0,0);
        AddLife(300);
    }

    count++;
    yield;

}

@Finalize
{
    if (GetArgument==2&&BeVanished==false) {
        DeleteEnemyShotToItemInCircle(CHILD,GetX(),GetY(),300);
    }
    if (GetArgument==3&&BeVanished==false&&count<=300) {
        CollectItems;
        DeleteEnemyShotToItemInCircle(ALL,GetX(),GetY(),500);
    }
    if (GetArgument==7&&BeVanished==false) {
        CollectItems;
        CreateEnemyFromFile(GetCurrentScriptDirectory~"Servant05.txt",GetX(),GetY(),0,0,4);
    }//DeleteEnemyShotToItemInCircle(SHOT,GetX(),GetY(),500);}
    if (GetArgument==8&&BeVanished==false) {
        DeleteEnemyShotToItemInCircle(CHILD,GetX(),GetY(),500);
        CollectItems;
    }
    if (MT==0&&OnBomb==false&&BeVanished==false&&GetArgument<=4&&GetArgument!=3) {
        CollectItems;
        MT++;
    }
    if (BeVanished==false&&GetArgument==5&&GetCommonDataDefault("Mode",0)<=0) {
        SetCommonData("Mode",3);
    }
    if (BeVanished==false&&GetArgument==6&&GetCommonDataDefault("Mode",0)<=0) {
        SetCommonData("Mode",2);
    }
    if (BeVanished==false) {
        CreateEnemyFromFile(GetCurrentScriptDirectory~"Servant10.txt",GetX,GetY,0,0,3);
        PlaySE(GetCurrentScriptDirectory~"\se\Baaaan2.wav");
        SetCommonData("ii1",GetCommonDataDefault("ii1",0)+GetCommonDataDefault("ii2",0));
        SetCommonData("ii3",1);
        loop(10) {
            CreateItem(ITEM_SCORE,GetX()+rand(-55,55),GetY()+rand(0,80));
        }
        if (GetArgument==2) {
            loop(10) {
                CreateItem(ITEM_SCORE,GetX()+rand(-86,86),GetY()+rand(0,80));
            }
        }
        if (GetArgument==4) {
            loop(5) {
                CreateItem(ITEM_SCORE,GetX()-180+rand(-24,24),GetPlayerY()+rand(-24,24));
                CreateItem(ITEM_SCORE,GetX()+180+rand(-24,24),GetPlayerY()+rand(-24,24));
            }
        }
    }
}

@DrawLoop
{
    if (GetArgument==5||GetArgument==6) {
        SetTexture(GetCurrentScriptDirectory~"\img\circle_l.png");
        if (GetArgument==5) {
            SetGraphicRect(0,0,256,256);
            SetGraphicAngle(0,0,-count*7);
        }
        if (GetArgument==6) {
            SetGraphicRect(256,0,512,256);
            SetGraphicAngle(0,0,count*7);
        }
        SetAlpha(255);
        SetRenderState(ADD);
        SetColor((170+20*sin(count))*((100-N17)/100),(20+20*sin(count))*((100-N17)/100),(170+20*sin(count))*((100-N17)/100));
        if (count<=1) {
            SetGraphicScale(0,0);
        }
        if (count>1) {
            SetGraphicScale(0.1+0.01*count*(GetLife()/350),0.1+0.01*count*(GetLife()/350));
        }
        if (count>=80) {
            SetGraphicScale(0.1+0.8*(GetLife()/350),0.1+0.8*(GetLife()/350));
        }
        DrawGraphic(GetX(),GetY());
    }

    if (GetArgument==4&&count<=570) {
        SetTexture(GetCurrentScriptDirectory~"\img\familiar.png");
        if (count<=0) {
            SetColor(0,0,0);
        }
        if (count>=0&&count<21) {
            SetColor((count)*10,(count)*10,(count)*10);
        }
        if (count>=21) {
            SetColor(211,211,211);
        }
        if (count>=500) {
            SetColor((211-(count-500)*3)*((100-N17)/100),(211-(count-500)*3)*((100-N17)/100),(211-(count-500)*3)*((100-N17)/100));
            if (211-(count-500)*3<=0) {
                SetColor(0,0,0);
            }
        }
        SetGraphicScale(1,1);
        SetAlpha(255);
        SetRenderState(ADD);
        SetGraphicRect(0,48,48,96);
        SetGraphicAngle(0,0,0);
        ascent( let t in 0..2 ) {
            DrawGraphic(GetX()-52+t*104,GetY()-60);
        }
        SetGraphicAngle(0,0,count*7);
        ascent( let t in 0..2 ) {
            DrawGraphic(GetX()-160+t*320,GetPlayerY()+8*sin(count*2));
        }
        SetGraphicScale(2,2);
        SetGraphicAngle(0,0,count*5);
        DrawGraphic(GetX()+50,GetY()-3);
        SetGraphicAngle(0,0,-count*5);
        DrawGraphic(GetX()-50,GetY()-3);
    }

    if (GetArgument==7||GetArgument==8) {
        SetTexture(GetCurrentScriptDirectory~"\img\familiar.png");
        if (count<=0) {
            SetColor(0,0,0);
        }
        if (count>=0&&count<21) {
            SetColor((count)*10,(count)*10,(count)*10);
        }
        if (count>=21) {
            SetColor(211*((100-N17)/100),211*((100-N17)/100),211*((100-N17)/100));
        }
        if (GetArgument==8) {
            SetGraphicScale(2,2);
        }
        else {
            SetGraphicScale(3,2);
        }
        SetAlpha(255);
        SetRenderState(ADD);
        if (N16>=90) {
            SetGraphicAngle(0,0,count*7);
        }
        else {
            SetGraphicAngle(0,0,-count*7);
        }
        if (GetArgument==8) {
            SetGraphicRect(48,48,96,96);
        }
        if (GetArgument==7) {
            SetGraphicRect(0,48,48,96);
            if (count>=21) {
                SetColor((111+100*sin(count*4))*((100-N17)/100),(111+100*sin(count*4))*((100-N17)/100),(111+100*sin(count*4))*((100-N17)/100));
            }
        }
        DrawGraphic(GetX(),GetY());
    }

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

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

    if (GetArgument<=1) {
        SetTexture(GetCurrentScriptDirectory~"\img\familiar.png");
        SetColor(182*((100-N17)/100),182*((100-N17)/100),182*((100-N17)/100));
        if (count>=120) {
            SetColor((182-count*4+480)*((100-N17)/100),(182-count*4+480)*((100-N17)/100),(182-count*4+480)*((100-N17)/100));
        }
        if (182-count*4+480<=0) {
            SetColor(0,0,0);
        }
        if (count==15&&GetX()>GetCenterX()) {
            N15=3;
        }
        if (count==15&&GetX()<GetCenterX()) {
            N15=-3;
        }
        SetGraphicAngle(0,0,count*N15);
        SetGraphicScale(2,2);
        SetRenderState(ADD);
        SetGraphicRect(49,48,96,96);
        DrawGraphic(GetX(),GetY()-4);
    }



    SetTexture(GetCurrentScriptDirectory~"\img\dot-kaze-ti.png");
    SetColor(255,255,255);
    SetGraphicAngle(0,0,0);
    SetGraphicScale(1.1,1.1);
    SetAlpha(255*((100-N17)/100));
    if (GetArgument==3||GetArgument==7) {
        SetColor(255*((100-N17)/100),255*((100-N17)/100),255*((100-N17)/100));
        SetRenderState(ADD);
    }
    else {
        SetRenderState(ALPHA);
    }

    if (count/6%4>=0) {
        SetGraphicRect(256,128,320,192);
    }
    if (count/6%4>=1) {
        SetGraphicRect(320,128,384,192);
    }
    if (count/6%4>=2) {
        SetGraphicRect(384,128,448,192);
    }
    if (count/6%4>=3) {
        SetGraphicRect(320,128,384,192);
    }

    if (GetArgument>=5) {
        if (count/6%4>=0) {
            SetGraphicRect(256,0,320,64);
        }
        if (count/6%4>=1) {
            SetGraphicRect(320,0,384,64);
        }
        if (count/6%4>=2) {
            SetGraphicRect(384,0,448,64);
        }
        if (count/6%4>=3) {
            SetGraphicRect(320,0,384,64);
        }
    }

    if (GetArgument==12) {
        if (count/6%4>=0) {
            SetGraphicRect(256,448,320,512);
        }
        if (count/6%4>=1) {
            SetGraphicRect(320,448,384,512);
        }
        if (count/6%4>=2) {
            SetGraphicRect(384,448,448,512);
        }
        if (count/6%4>=3) {
            SetGraphicRect(320,448,384,512);
        }
    }

    if (ten==1) {
        SetColor(120,120,190);
    }
    DrawGraphic(GetX(),GetY());




}
}
