#TouhouDanmakufu
#Title[Watatsuki Sisters -FUCKING WHAT-]
#Text[]
#Image[]
#BackGround[Default]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main
{
	let frame=0;
    let img=GetCurrentScriptDirectory~"img\Yori1.png";
    let imgb=GetCurrentScriptDirectory~"img\Toyo1.png";
    let imgc=GetCurrentScriptDirectory~"img\bg.png";
    let imgd=GetCurrentScriptDirectory~"img\black.png";
    let imge=GetCurrentScriptDirectory~"img\bgb.png";
    let imgf=GetCurrentScriptDirectory~"img\bgc.png";
    let imgg=GetCurrentScriptDirectory~"img\bgd.png";
    let imgh=GetCurrentScriptDirectory~"img\bge.png";
    let fan=GetCurrentScriptDirectory~"img\Toyo3.png";
    let imgslash=GetCurrentScriptDirectory~"img\slash.png";
    let fanscale=[0, 0.05, 255];
    let fanscaleb=[0, 0];
    let drawangle=0;
    let yori=[GetCenterX, GetClipMinY-100];
    let toyo=[GetCenterX, GetClipMinY-100];
    let bgalpha=0;
    let bgalphas=[0, 0, 0];
    let bgdrawtype=0;
    let bgrot=0;
    let bgdist=0;
    let yoriringdel=0;
    
task MovePos(type, x, y, frames){
    let dist=0;
    let angle=0;
    if(type==1){
        dist=((yori[0]-x)^2+(yori[1]-y)^2)^0.5;
        angle=atan2(y-yori[1], x-yori[0]);
        loop(frames){
            yori=[ yori[0]+dist*cos(angle)/frames, yori[1]+dist*sin(angle)/frames];
            yield;
        }
    }else{
        dist=((toyo[0]-x)^2+(toyo[1]-y)^2)^0.5;
        angle=atan2(y-toyo[1], x-toyo[0]);
        loop(frames){
            toyo=[ toyo[0]+dist*cos(angle)/frames, toyo[1]+dist*sin(angle)/frames];
            yield;
        }
    }
}

function AngleToPlayer(type){
let returnangle=0;
    if(type==1){
        returnangle=atan2(GetPlayerY-yori[1], GetPlayerX-yori[0]);
    }else{
        returnangle=atan2(GetPlayerY-toyo[1], GetPlayerX-toyo[0]);
    }
    return returnangle;
}
task Thing{
bgdrawtype=0;
    MovePos(1, GetCenterX, GetClipMinY+120, 60);
    loop(100){yield;}
    ascent(j in 0..6){
        loop(3){
            ascent(i in 0..25){
                CreateShot02(yori[0], yori[1], 4, AngleToPlayer(1)+i*36/2, i/100, 6, 8, i);
                CreateShot02(yori[0], yori[1], 4, AngleToPlayer(1)+i*36/2+6, i/100, 6, 8, i);
                CreateShot02(yori[0], yori[1], 4, AngleToPlayer(1)+i*36/2-6, i/100, 6, 8, i);
                CreateShot02(yori[0], yori[1], 4, AngleToPlayer(1)+i*36/2+3, i/100, 6, 8, i);
                CreateShot02(yori[0], yori[1], 4, AngleToPlayer(1)+i*36/2-3, i/100, 6, 8, i);
                yield;
            }
            ascent(i in 0..25){
                CreateShot02(yori[0], yori[1], 4, AngleToPlayer(1)-i*36/2, i/100, 6, 186, i); 
                CreateShot02(yori[0], yori[1], 4, AngleToPlayer(1)-i*36/2+6, i/100, 6, 186, i); 
                CreateShot02(yori[0], yori[1], 4, AngleToPlayer(1)-i*36/2-6, i/100, 6, 186, i); 
                CreateShot02(yori[0], yori[1], 4, AngleToPlayer(1)-i*36/2+3, i/100, 6, 186, i); 
                CreateShot02(yori[0], yori[1], 4, AngleToPlayer(1)-i*36/2-3, i/100, 6, 186, i); 
                yield;
            }
        }
        if(j!=5){MovePos(1, GetPlayerX+rand(-50, 50), GetClipMinY+rand(50, 120), 20);}
    }
    MovePos(1, GetCenterX, GetClipMinY+50, 20);
    MovePos(2, GetCenterX, GetClipMinY+120, 20);
    ascent(j in 0..15){
        ascent(i in 0..60){
            CreateShot01(toyo[0]+i*10*cos(AngleToPlayer(2)+30), toyo[1]+i*10*sin(AngleToPlayer(2)+30), 2, AngleToPlayer(2)+30+i*360/25, 196, 20);
            CreateShot01(toyo[0]+i*10*cos(AngleToPlayer(2)-30), toyo[1]+i*10*sin(AngleToPlayer(2)-30), 2, 180-(AngleToPlayer(2)+30+i*360/25), 196, 20);
            yield;
        }
        if(j!=14){MovePos(2, GetPlayerX+rand(-20, 20), GetClipMinY+rand(50, 120), 15);}
    }
    MovePos(1, GetCenterX-100, GetClipMinY+120, 20);
    MovePos(2, GetCenterX+100, GetClipMinY+120, 20);
    loop(20){
        ascent(i in 0..30){
            CreateShot01(yori[0], yori[1], rand(1, 3), AngleToPlayer(1)+i*12, 213, 0);
            CreateShot01(toyo[0], toyo[1], rand(1, 3), AngleToPlayer(2)+i*12, 211, 0);
        }
        loop(15){yield;}
    }
    MovePos(1, GetCenterX+100, GetClipMinY+120, 20);
    MovePos(2, GetCenterX-100, GetClipMinY+120, 20);
    loop(30){
        ascent(i in 0..30){
            CreateShot01(yori[0], yori[1], rand(1, 3), AngleToPlayer(1)+i*12, 213, 0);
            CreateShot01(toyo[0], toyo[1], rand(1, 3), AngleToPlayer(2)+i*12, 211, 0);
        }
        loop(10){yield;}
    }
    MovePos(1, GetCenterX-100, GetClipMinY+120, 20);
    MovePos(2, GetCenterX+100, GetClipMinY+120, 20);
    loop(60){
        ascent(i in 0..15){
            CreateShot01(yori[0], yori[1], rand(2, 5), AngleToPlayer(1)+i*24, 213, 0);
            CreateShot01(toyo[0], toyo[1], rand(2, 5), AngleToPlayer(2)+i*24, 211, 0);
        }
        loop(5){yield;}
    }
    loop(60){yield;}
    MovePos(1, GetPlayerX-50, GetClipMinY+120, 20);
    MovePos(2, GetPlayerX+50, GetClipMinY+120, 20);
    loop(20){
        ascent(i in 0..30){
            CreateShot01(yori[0], yori[1], rand(1, 3), AngleToPlayer(1)+i*12, 213, 0);
            CreateShot01(toyo[0], toyo[1], rand(1, 3), AngleToPlayer(2)+i*12, 211, 0);
        }
        loop(15){yield;}
    }
    MovePos(1, GetPlayerX+50, GetClipMinY+120, 20);
    MovePos(2, GetPlayerX-50, GetClipMinY+120, 20);
    loop(30){
        ascent(i in 0..30){
            CreateShot01(yori[0], yori[1], rand(1, 3), AngleToPlayer(1)+i*12, 213, 0);
            CreateShot01(toyo[0], toyo[1], rand(1, 3), AngleToPlayer(2)+i*12, 211, 0);
        }
        loop(10){yield;}
    }
    MovePos(1, GetPlayerX-50, GetClipMinY+120, 20);
    MovePos(2, GetPlayerX+50, GetClipMinY+120, 20);
    loop(60){
        ascent(i in 0..15){
            CreateShot01(yori[0], yori[1], rand(2, 5), AngleToPlayer(1)+i*24, 213, 0);
            CreateShot01(toyo[0], toyo[1], rand(2, 5), AngleToPlayer(2)+i*24, 211, 0);
        }
        loop(5){yield;}
    }
    MovePos(1, GetClipMinX, GetClipMinY, 20);
    MovePos(2, GetClipMaxX, GetClipMinY, 20);
    loop(20){yield;}
    MovePos(1, GetClipMinX, GetClipMaxY, 40);
    MovePos(2, GetClipMaxX, GetClipMaxY, 40);
    loop(40){
        ascent(i in 0..10){
            CreateShot01(yori[0], yori[1], 6, AngleToPlayer(1)+i*36, 213, 0);
            CreateShot01(toyo[0], toyo[1], 6, AngleToPlayer(2)+i*36, 211, 0);
        }
        yield;
    }
    loop(3){
        MovePos(1, GetClipMinX, GetClipMinY, 60);
        MovePos(2, GetClipMaxX, GetClipMinY, 60);
        loop(25){
            ascent(i in 0..10){
                CreateShot01(yori[0], yori[1], 6, AngleToPlayer(1)+i*36, 213, 0);
                CreateShot01(toyo[0], toyo[1], 6, AngleToPlayer(2)+i*36, 211, 0);
            }
            yield;
            yield;
        }
        loop(10){yield;}
        MovePos(1, GetClipMinX, GetClipMaxY, 60);
        MovePos(2, GetClipMaxX, GetClipMaxY, 60);
        loop(25){
            ascent(i in 0..10){
                CreateShot01(yori[0], yori[1], 6, AngleToPlayer(1)+i*36, 213, 0);
                CreateShot01(toyo[0], toyo[1], 6, AngleToPlayer(2)+i*36, 211, 0);
            }
            yield;
            yield;
        }
        loop(10){yield;}
    }
        MovePos(1, GetClipMinX+100, GetClipMinY+100, 60);
        MovePos(2, GetClipMaxX-100, GetClipMinY+100, 60);
        loop(30){
            ascent(i in 0..10){
                CreateShot01(yori[0], yori[1], 6, AngleToPlayer(1)+i*36, 213, 0);
                CreateShot01(toyo[0], toyo[1], 6, AngleToPlayer(2)+i*36, 211, 0);
            }
            yield;
            yield;
        }
    loop(3){
        MovePos(1, GetClipMaxX, GetClipMinY+rand(50, 120), 60);
        MovePos(2, GetClipMinX, GetClipMinY+rand(50, 120), 60);
        loop(30){
            ascent(i in 0..5){
                CreateShot01(yori[0], yori[1], rand(2, 4), rand(0, 359), 53+i*15, 0);
                CreateShot01(toyo[0], toyo[1], rand(2, 4), rand(0, 359), 52+i*15, 0);
            }
            loop(2){yield;}
        }
        MovePos(1, GetClipMinX, GetClipMinY+rand(50, 120), 60);
        MovePos(2, GetClipMaxX, GetClipMinY+rand(50, 120), 60);
        loop(30){
            ascent(i in 0..5){
                CreateShot01(yori[0], yori[1], rand(2, 4), rand(0, 359), 53+i*15, 0);
                CreateShot01(toyo[0], toyo[1], rand(2, 4), rand(0, 359), 52+i*15, 0);
            }
            loop(2){yield;}
        }
    }
    MovePos(1, GetClipMaxX, GetClipMinY+rand(50, 120), 60);
    MovePos(2, GetClipMinX, GetClipMinY+rand(50, 120), 60);
    loop(30){
        ascent(i in 0..7){
            CreateShot01(yori[0], yori[1], rand(2, 4), rand(0, 359), 53+i*15, 0);
            CreateShot01(toyo[0], toyo[1], rand(2, 4), rand(0, 359), 52+i*15, 0);
        }
        loop(2){yield;}
    }
    MovePos(1, GetClipMinX+45, GetClipMinY+75, 30);
    MovePos(2, GetCenterX, GetClipMinY+120, 30);
    loop(30){yield;}
    bgdrawtype=2;
    fandraw;
    loop(450){yield;}
    loop(60){
        ascent(i in 0..11){CreateShot01(toyo[0], toyo[1], 3, 180+i*18, 234, 10);}
        ascent(i in -10..11){
            CreateShotA(1, toyo[0]+i*25, toyo[1]+rand(-50, 50), 20);
            SetShotDataA(1, 0, rand_int(5, 8), 90, 0, 0, 0, 2);
            FireShot(1);
        }
        CreateShot01(GetClipMinX, rand(GetClipMinY, GetClipMaxY), 1, 0, 4, 20);
        CreateShot01(GetClipMaxX, rand(GetClipMinY, GetClipMaxY), 1, 180, 4, 20);
        loop(2){yield;}
    }
    loop(10){
        ascent(i in 0..11){CreateShot01(toyo[0], toyo[1], 3, 180+i*18, 234, 10);}
        ascent(j in 0..15){
            ascent(i in -5..6){
                CreateShotA(1, toyo[0]+i*50+rand(-5, 5), toyo[1]+rand(-50, 50), 20);
                SetShotDataA(1, 0, rand_int(2, 3), 90, rand(-0.01, 0.01), 0, 0, 2);
                SetShotDataA(1, 120, rand_int(1, 2), NULL, 0, 0, 0, 2);
                FireShot(1);
            }
        CreateShot01(GetClipMinX, rand(GetClipMinY, GetClipMaxY), 1, 0, 4, 20);
        CreateShot01(GetClipMaxX, rand(GetClipMinY, GetClipMaxY), 1, 180, 4, 20);
            loop(4){yield;}
        }
    }
    loop(10){
        ascent(i in 0..11){CreateShot01(toyo[0], toyo[1], 3, 180+i*18, 234, 10);}
        ascent(j in 0..15){
            ascent(i in -10..11){
                CreateShotA(1, toyo[0]+i*25, toyo[1]+rand(-50, 50), 20);
                SetShotDataA(1, 0, rand_int(5, 8), 90, 0, 0, 0, 2);
                FireShot(1);
            }
            ascent(i in -5..6){
                CreateShotA(1, toyo[0]+i*50+rand(-5, 5), toyo[1]+rand(-50, 50), 20);
                SetShotDataA(1, 0, rand_int(2, 3), 90, rand(-0.01, 0.01), 0, 0, 2);
                SetShotDataA(1, 120, rand_int(1, 2), NULL, 0, 0, 0, 2);
                FireShot(1);
            }
        CreateShot01(GetClipMinX, rand(GetClipMinY, GetClipMaxY), 1, 0, 4, 20);
        CreateShot01(GetClipMaxX, rand(GetClipMinY, GetClipMaxY), 1, 180, 4, 20);
            loop(4){yield;}
        }
    }
    MovePos(1, GetCenterX, GetClipMinY+120, 30);
    MovePos(2, GetClipMaxX-45, GetClipMinY+75, 30);
    loop(30){yield;}
    bgdrawtype=1;
    MovePos(1, GetCenterX, GetClipMaxY, 30);
    slash;
    loop(30){yield;}
    MovePos(1, GetPlayerX+rand(-50, 50), GetClipMinY+120, 60);
    loop(60){yield;}
    loop(12){
        MovePos(1, GetPlayerX+rand(-50, 50), GetClipMinY+120, 20);
        loop(60){yield;}
    }
    MovePos(1, GetCenterX, GetClipMinY+120, 20);
    loop(20){yield;}
    ascent(i in 0..30){
        ascent(j in 1..6){
            CreateShot01(yori[0], yori[1], j, AngleToPlayer(1)+i*12, 234, j*5);
        }
    }
    loop(40){yield;}
    loop(14){
        MovePos(1, GetPlayerX+rand(-50, 50), GetClipMinY+120, 20);
        loop(60){yield;}
    }
    MovePos(1, GetCenterX, GetClipMinY+120, 20);
    loop(20){yield;}
    ascent(i in 0..30){
        ascent(j in 1..6){
            CreateShot01(yori[0], yori[1], j, AngleToPlayer(1)+i*12, 234, j*5);
        }
    }
    loop(40){yield;}
    bgdrawtype=0;
    MovePos(1, GetCenterX-100, GetClipMinY+120, 20);
    MovePos(2, GetCenterX+100, GetClipMinY+120, 20);
    loop(20){yield;}
    ascent(i in 0..90){
        ascent(j in 0..20){
            CreateShot01(yori[0], yori[1], 3, i*5+j*18, 206, i);
            CreateShot01(toyo[0], toyo[1], 3, 180-i*5+j*18, 204, i);
        }
        loop(10){yield;}
    }
    MovePos(1, GetClipMaxX, GetCenterY, 20);
    MovePos(2, GetClipMinX, GetCenterY, 20);
    loop(20){yield;}
        CreateLaserA(1, yori[0], yori[1], 200, 20, 230, 20);
        CreateLaserA(2, yori[0], yori[1], 200, 20, 230, 20);
        CreateLaserA(3, toyo[0], toyo[1], 200, 20, 230, 20);
        CreateLaserA(4, toyo[0], toyo[1], 200, 20, 230, 20);
        SetLaserDataA(1, 0, 180, 0, 0, 0, 0);
        SetLaserDataA(2, 0, 180, 0, 0, 0, 0);
        SetLaserDataA(3, 0, 0, 0, 0, 0, 0);
        SetLaserDataA(4, 0, 0, 0, 0, 0, 0);
        SetLaserDataA(1, 20, 180, -1, 0, 0, 0);
        SetLaserDataA(2, 20, 180, 1, 0, 0, 0);
        SetLaserDataA(3, 20, 0, -1, 0, 0, 0);
        SetLaserDataA(4, 20, 0, 1, 0, 0, 0);
        SetLaserDataA(1, 110, NULL, 0, 0, 0, 0);
        SetLaserDataA(2, 110, NULL, 0, 0, 0, 0);
        SetLaserDataA(3, 110, NULL, 0, 0, 0, 0);
        SetLaserDataA(4, 110, NULL, 0, 0, 0, 0);
        SetShotKillTime(1, 45*60+150);
        SetShotKillTime(2, 45*60+150);
        SetShotKillTime(3, 45*60+150);
        SetShotKillTime(4, 45*60+150);
        FireShot(1);
        FireShot(2);
        FireShot(3);
        FireShot(4);
    loop(10){
        ascent(i in 0..30){
            CreateShot01(GetClipMinX, rand(GetClipMinY, GetClipMaxY), rand(1, 2), 0, 49, rand_int(5, 25));
            CreateShot01(GetClipMaxX, rand(GetClipMinY, GetClipMaxY), rand(1, 2), 180, 49, rand_int(5, 25));
            if(i==29){
                ascent(j in 0..20){
                    ascent(k in 1..4){
                        CreateShot01(yori[0], yori[1], k, AngleToPlayer(1)+j*18, 210, 30);
                        CreateShot01(toyo[0], toyo[1], k, AngleToPlayer(2)+j*18, 210, 30);
                    }
                }
            }
            loop(3){yield;}
        }
    }
    ascent(i in 0..60){
        ascent(j in 0..5){
            CreateShot01(GetCenterX, GetClipMinY, j+1, i*6, 208, 0);
        }
    }
    loop(10){
        ascent(i in 0..30){
            CreateShot01(GetClipMinX, rand(GetClipMinY, GetClipMaxY), rand(2, 3), 0, 49, rand_int(5, 25));
            CreateShot01(GetClipMaxX, rand(GetClipMinY, GetClipMaxY), rand(2, 3), 180, 49, rand_int(5, 25));
            if(i==29){
                ascent(j in 0..20){
                    ascent(k in 1..4){
                        CreateShot01(yori[0], yori[1], k, AngleToPlayer(1)+j*18, 210, 30);
                        CreateShot01(toyo[0], toyo[1], k, AngleToPlayer(2)+j*18, 210, 30);
                    }
                }
            }
            loop(3){yield;}
        }
    }
    ascent(i in 0..60){
        ascent(j in 0..5){
            CreateShot01(GetCenterX, GetClipMinY, j+1, i*6, 208, 0);
        }
    }
    loop(10){
        ascent(i in 0..30){
            CreateShot01(GetClipMinX, rand(GetClipMinY, GetClipMaxY), rand(3, 4), 0, 49, rand_int(5, 25));
            CreateShot01(GetClipMaxX, rand(GetClipMinY, GetClipMaxY), rand(3, 4), 180, 49, rand_int(5, 25));
            if(i==29){
                ascent(j in 0..20){
                    ascent(k in 1..4){
                        CreateShot01(yori[0], yori[1], k, AngleToPlayer(1)+j*18, 210, 30);
                        CreateShot01(toyo[0], toyo[1], k, AngleToPlayer(2)+j*18, 210, 30);
                    }
                }
            }
            loop(3){yield;}
        }
    }
    MovePos(1, GetCenterX-100, GetClipMinY+120, 20);
    MovePos(2, GetCenterX+100, GetClipMinY+120, 20);
    loop(20){yield;}
    ascent(i in 0..293){
        ascent(j in 0..4){
            CreateShot01(yori[0], yori[1], 2, i*8+j*90, 182, 10);
            CreateShot01(yori[0], yori[1], 3, i*8+j*90, 137, 10);
            CreateShot01(toyo[0], toyo[1], 2, 180-i*8+j*90, 137, 10);
            CreateShot01(toyo[0], toyo[1], 3, 180-i*8+j*90, 182, 10);
        }
        yield;
        yield;
        yield;
    }
    yield;
    MovePos(1, GetClipMinX+45, GetClipMinY+75, 30);
    MovePos(2, GetCenterX, GetClipMinY+120, 30);
    loop(30){yield;}
    bgdrawtype=2;
    loop(30){yield;}
    loop(2){
        fanshot(GetClipMinX, GetClipMinY, atan2(GetClipMaxY-GetClipMinY, GetClipMaxX-GetClipMinX));
        loop(50){yield;}
        fanshot(GetClipMaxX, GetClipMinY, atan2(GetClipMaxY-GetClipMinY, GetClipMinX-GetClipMaxX));
        loop(50){yield;}
        fanshot(GetClipMinX, GetClipMinY, 90);
        loop(50){yield;}
        fanshot(GetClipMinX+96, GetClipMinY, 90);
        loop(50){yield;}
        fanshot(GetClipMinX+192, GetClipMinY, 90);
        loop(50){yield;}
        fanshot(GetClipMaxX-96, GetClipMinY, 90);
        loop(50){yield;}
        fanshot(GetClipMinX, GetClipMinY, 0);
        loop(50){yield;}
        fanshot(GetClipMaxX, GetClipMinY+75, 180);
        loop(50){yield;}
        fanshot(GetClipMinX, GetClipMinY+150, 0);
        loop(50){yield;}
        fanshot(GetClipMaxX, GetClipMinY+225, 180);
        loop(50){yield;}
        fanshot(GetClipMaxX-96, GetClipMinY, 90);
        loop(50){yield;}
        fanshot(GetClipMinX+192, GetClipMinY, 90);
        loop(50){yield;}
        fanshot(GetClipMinX+96, GetClipMinY, 90);
        loop(50){yield;}
        fanshot(GetClipMinX, GetClipMinY, 90);
        loop(50){yield;}
        fanshot(GetClipMaxX, GetClipMinY, atan2(GetClipMaxY-GetClipMinY, GetClipMinX-GetClipMaxX));
        loop(50){yield;}
        fanshot(GetClipMinX, GetClipMinY, atan2(GetClipMaxY-GetClipMinY, GetClipMaxX-GetClipMinX));
        loop(50){yield;}
        fanshot(GetPlayerX, GetClipMinY, 90);
        loop(70){yield;}
    }
    MovePos(1, GetCenterX, GetClipMinY+120, 30);
    MovePos(2, GetClipMaxX-45, GetClipMinY+75, 30);
    loop(30){yield;}
    bgdrawtype=1;
    loop(30){yield;}
    ring;
    loop(60){yield;}
    MovePos(1, GetCenterX, GetCenterY-191, 30);
    loop(30){yield;}
    ascent(i in 0..5){
        MovePos(1, GetCenterX+191*cos(90-36+i*144), GetCenterY+191*sin(90-36+i*144), 60);
        ascent(j in -30..30){
            bullet(yori[0], yori[1], 90-36+i*144-90+j*6);
            yield;
        }
        loop(60){yield;}
    }
    loop(35){
        bullet(yori[0], yori[1], AngleToPlayer(1));
        loop(3){yield;}
    }
    MovePos(1, GetCenterX, GetCenterY+191, 30);
    loop(30){yield;}
    loop(35){
        bullet(yori[0], yori[1], AngleToPlayer(1));
        loop(3){yield;}
    }
    ascent(i in 0..5){
        MovePos(1, GetCenterX+191*cos(180+90-36+i*144), GetCenterY+191*sin(180+90-36+i*144), 60);
        ascent(j in -30..30){
            bullet(yori[0], yori[1], 90-36+i*144-90+j*6);
            yield;
        }
        loop(60){yield;}
    }
    loop(35){
        bullet(yori[0], yori[1], AngleToPlayer(1));
        loop(3){yield;}
    }
    MovePos(1, GetCenterX, GetCenterY-191, 30);
    loop(30){yield;}
    loop(35){
        bullet(yori[0], yori[1], AngleToPlayer(1));
        loop(3){yield;}
    }
    MovePos(1, GetCenterX-100, GetClipMinY+120, 30);
    MovePos(2, GetCenterX+100, GetClipMinY+120, 30);
    loop(30){yield;}
    bgdrawtype=0;
    MovePos(1, GetCenterX, GetClipMinY+120, 10);
    MovePos(2, GetCenterX, GetClipMinY+50, 10);
    ascent(j in 0..6){
        loop(3){
            ascent(i in 0..25){
                CreateShot02(yori[0], yori[1], 4, AngleToPlayer(1)+i*36/2, i/100, 6, 8, i);
                CreateShot02(yori[0], yori[1], 4, AngleToPlayer(1)+i*36/2+6, i/100, 6, 8, i);
                CreateShot02(yori[0], yori[1], 4, AngleToPlayer(1)+i*36/2-6, i/100, 6, 8, i);
                CreateShot02(yori[0], yori[1], 4, AngleToPlayer(1)+i*36/2+3, i/100, 6, 8, i);
                CreateShot02(yori[0], yori[1], 4, AngleToPlayer(1)+i*36/2-3, i/100, 6, 8, i);
                yield;
            }
            ascent(i in 0..25){
                CreateShot02(yori[0], yori[1], 4, AngleToPlayer(1)-i*36/2, i/100, 6, 186, i); 
                CreateShot02(yori[0], yori[1], 4, AngleToPlayer(1)-i*36/2+6, i/100, 6, 186, i); 
                CreateShot02(yori[0], yori[1], 4, AngleToPlayer(1)-i*36/2-6, i/100, 6, 186, i); 
                CreateShot02(yori[0], yori[1], 4, AngleToPlayer(1)-i*36/2+3, i/100, 6, 186, i); 
                CreateShot02(yori[0], yori[1], 4, AngleToPlayer(1)-i*36/2-3, i/100, 6, 186, i); 
                yield;
            }
        }
        if(j!=5){MovePos(1, GetPlayerX+rand(-50, 50), GetClipMinY+rand(50, 120), 20);}
    }
    MovePos(1, GetCenterX, GetClipMinY+50, 20);
    MovePos(2, GetCenterX, GetClipMinY+120, 20);
    ascent(j in 0..14){
        ascent(i in 0..60){
            CreateShot01(toyo[0]+i*10*cos(AngleToPlayer(2)+30), toyo[1]+i*10*sin(AngleToPlayer(2)+30), 2, AngleToPlayer(2)+30+i*360/25, 196, 20);
            CreateShot01(toyo[0]+i*10*cos(AngleToPlayer(2)-30), toyo[1]+i*10*sin(AngleToPlayer(2)-30), 2, 180-(AngleToPlayer(2)+30+i*360/25), 196, 20);
            yield;
        }
        if(j!=13){MovePos(2, GetPlayerX+rand(-20, 20), GetClipMinY+rand(50, 120), 15);}
    }
    MovePos(1, GetCenterX+100, GetClipMinY+120, 20);
    MovePos(2, GetCenterX-100, GetClipMinY+120, 20);
    loop(20){yield;}
    ascent(i in 0..60){
        ascent(j in 1..4){
            CreateShot01(yori[0], yori[1], j/2, AngleToPlayer(1)+i*6, 234, 10);
            CreateShot01(toyo[0], toyo[1], j/2, AngleToPlayer(2)+i*6, 234, 10);
        }
    }
    loop(40){yield;}
    CreateEnemyFromFile(GetCurrentScriptDirectory~"lib\death_dummy.txt", yori[0], yori[1], 0, 0, 0);
    CreateEnemyFromFile(GetCurrentScriptDirectory~"lib\death_dummy.txt", toyo[0], toyo[1], 0, 0, 0);
    loop(180){yield;}
    VanishEnemy;
}
task ring{
    let obj=Obj_Create(OBJ_EFFECT);
    let width=0;
    let counter=0;
    let angle=0;
    ObjEffect_SetTexture(obj, imgslash);
    ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLESTRIP);
    ObjEffect_CreateVertex(obj, 102);
    ascent(i in 0..51){
        ObjEffect_SetVertexUV(obj, i*2, 0, i*1024/50);
        ObjEffect_SetVertexUV(obj, i*2+1, 18, i*1024/50);
    }
    while(Obj_BeDeleted(obj)==false){
        if(width<9){width+=0.75;}
        ascent(i in 0..51){
            ObjEffect_SetVertexXY(obj, i*2, GetCenterX+(191+width)*cos(i*360/50), GetCenterY+(191+width)*sin(i*360/50));
            ObjEffect_SetVertexXY(obj, i*2+1, GetCenterX+(191-width)*cos(i*360/50), GetCenterY+(191-width)*sin(i*360/50));
        }
        if(counter%3==0){
            ascent(i in 0..8){
                CreateShot01(GetCenterX+192*cos(angle+i*45), GetCenterY+192*sin(angle+i*45), 7, angle+i*45+90, 93, 10);
                CreateShot01(GetCenterX+192*cos(angle+i*45), GetCenterY+192*sin(angle+i*45), 7, angle+i*45-90, 93, 10);
            }
        }
        angle+=2;
        counter++;
        if(counter>=1770){Obj_Delete(obj); yoriringdel=1;}
        yield;
    }
}
task bullet(x, y, angle){
    let counter=0;
    let angleb=0;
    let obj=Obj_Create(OBJ_SHOT);
    Obj_SetPosition(obj, x, y);
    Obj_SetSpeed(obj, 1);
    Obj_SetAngle(obj, angle);
    ObjShot_SetGraphic(obj, 49);
    ObjShot_SetDelay(obj, 30);
    while(Obj_BeDeleted(obj)==false){
    yield;
        if(counter!=-1){
            if(((GetCenterX-Obj_GetX(obj))^2+(GetCenterY-Obj_GetY(obj))^2)^0.5>=192 && counter<3 && yoriringdel==0){
                angleb=atan2(Obj_GetY(obj)-GetCenterY, Obj_GetX(obj)-GetCenterX);
                Obj_SetAngle(obj, angleb*2-Obj_GetAngle(obj)+180);
                counter++;
            }
        }
    }
        yield;
}
task fanshot(x, y, angle){
    let shotangle=angle;
    ascent(i in 0..50){
        ascent(j in -1..2){
            CreateShot01(x+20*cos(shotangle+j*5), y+20*sin(shotangle+j*5), 3, shotangle+180+j*5, 224, 10);
        }
        x+=12*cos(angle);
        y+=12*sin(angle);
        shotangle+=15;
        loop(5){yield;}
    }
}
task slash{
    let width=0;
    let counter=0;
    let shotangle=0;
    let shotdist=0;
    let obj=Obj_Create(OBJ_EFFECT);
    Obj_SetPosition(obj, GetCenterX, GetCenterY);
    ObjEffect_SetTexture(obj, imgslash);
    ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLESTRIP);
    ObjEffect_CreateVertex(obj, 4);
    ObjEffect_SetVertexUV(obj, 0, 0, 0);
    ObjEffect_SetVertexUV(obj, 1, 18, 0);
    ObjEffect_SetVertexUV(obj, 2, 0, 256);
    ObjEffect_SetVertexUV(obj, 3, 18, 256);
    let objb=Obj_Create(OBJ_EFFECT);
    Obj_SetPosition(objb, GetCenterX, GetCenterY);
    ObjEffect_SetTexture(objb, imgslash);
    ObjEffect_SetPrimitiveType(objb, PRIMITIVE_TRIANGLESTRIP);
    ObjEffect_CreateVertex(objb, 4);
    ObjEffect_SetVertexUV(objb, 0, 0, 0);
    ObjEffect_SetVertexUV(objb, 1, 18, 0);
    ObjEffect_SetVertexUV(objb, 2, 0, 256);
    ObjEffect_SetVertexUV(objb, 3, 18, 256);
    ObjEffect_SetAngle(obj, 0, 0, 45);
    ObjEffect_SetAngle(objb, 0, 0, 135);
    while(Obj_BeDeleted(obj)==false){
        if(width<9){width+=0.75;}
        ObjEffect_SetScale(obj, 2, 2);
        ObjEffect_SetScale(objb, 2, 2);
        ObjEffect_SetVertexXY(obj, 0, -width/2, -128);
        ObjEffect_SetVertexXY(obj, 1, width/2, -128);
        ObjEffect_SetVertexXY(obj, 2, -width/2, 128);
        ObjEffect_SetVertexXY(obj, 3, width/2, 128);
        ObjEffect_SetVertexXY(objb, 0, -width/2, -128);
        ObjEffect_SetVertexXY(objb, 1, width/2, -128);
        ObjEffect_SetVertexXY(objb, 2, -width/2, 128);
        ObjEffect_SetVertexXY(objb, 3, width/2, 128);
        counter++;
        if(counter%2==0){
            shotangle=45+rand_int(0, 1)*180;
            shotdist=rand(-256, 256);
            CreateShot01(GetCenterX+shotdist*cos(shotangle), GetCenterY+shotdist*sin(shotangle), rand(0.5, 1.5), -45+rand_int(0, 1)*180, 224, rand_int(5, 15));
            shotangle=135+rand_int(0, 1)*180;
            shotdist=rand(-256, 256);
            CreateShot01(GetCenterX+shotdist*cos(shotangle), GetCenterY+shotdist*sin(shotangle), rand(0.5, 1.5), 45+rand_int(0, 1)*180, 224, rand_int(5, 15));
        }
        if(counter>=1770){Obj_Delete(obj); Obj_Delete(objb);}
        yield;
    }
}
task fandraw{
    loop(25){
        fanscale[0]=fanscale[0]+0.04;
        yield;
    }
    loop(19){
        fanscale[1]=fanscale[1]+0.05;
        yield;
    }
    fire;
}
task fire{
    loop(80){yield;}
    laser;
    loop(50){yield;}
    fandrawred;
}
task laser{
    let obj=Obj_Create(OBJ_LASER);
    let width=20;
    let counter=0;
    Obj_SetPosition(obj, toyo[0], toyo[1]);
    Obj_SetAngle(obj, 90);
    ObjShot_SetGraphic(obj, 255);
    ObjShot_SetDelay(obj, 30);
    ObjLaser_SetWidth(obj, 20);
    ObjLaser_SetLength(obj, 512);
    ObjLaser_SetSource(obj, false);
    while(Obj_BeDeleted(obj)==false){
        counter++;
        ObjLaser_SetWidth(obj, width);
        if(counter<100){
            width+=2;
            loop(3){
            CreateShot01(toyo[0]+width/2, GetClipMaxY, rand(6, 9), rand(260, 280), 32, 20);
            CreateShot01(toyo[0]-width/2, GetClipMaxY, rand(6, 9), rand(260, 280), 32, 20);
            }
        }else{
        width-=2;
        }
        if(width<=0){Obj_Delete(obj);}
        yield;
    }
}
task fandrawred{
    ascent(i in 0..200){
        fanscaleb=[fanscaleb[0]+0.005, fanscaleb[1]+0.005];
        yield;
    }
    ascent(i in 0..12){
        fanscale=[fanscale[0]+0.05, fanscale[1]+0.05, fanscale[2]-255/25];
        yield;
    }
    ascent(i in 12..25){
        fanscale=[fanscale[0]+0.05, fanscale[1]+0.05, fanscale[2]-255/25];
        yield;
    }
    loop(40){yield;}
    while(bgdrawtype!=1){yield;}
    fanscale=[0, 0, 0];
    fanscaleb=[0, 0];
}

	@Initialize
	{
		SetInvincibility(200);
		SetLife(500);
		SetDamageRate(10,10);
        LoadGraphic(img);
        LoadGraphic(imgb);
        LoadGraphic(imgc);
        LoadGraphic(imgd);
        LoadGraphic(imge);
        LoadGraphic(imgf);
        LoadGraphic(imgg);
        LoadGraphic(imgh);
        LoadGraphic(fan);
        LoadGraphic(imgslash);

		SetMovePosition02(GetCenterX,GetClipMinY-300,20);
		LoadUserShotData(GetCurrentScriptDirectory~"supershot.txt");
        Thing;
        ForbidBomb(true);
	}
	
	@MainLoop
	{
		SetCollisionB(yori[0],yori[1],24);
		SetCollisionB(toyo[0],toyo[1],24);
		frame++;
		yield;
        if(frame==100){
            PlayMusic(GetCurrentScriptDirectory~"bgm.mp3");
        }
}
	
	@Finalize
	{
	}
	
	@DrawLoop
	{
        if(bgalpha<255){bgalpha+=15;}
        if(bgdist>=256){bgdist-=256;}
        if(bgdrawtype==0){
            if(bgalphas[0]<255){bgalphas[0]=bgalphas[0]+15;}
            if(bgalphas[1]>0){bgalphas[1]=bgalphas[1]-15;}
            if(bgalphas[2]>0){bgalphas[2]=bgalphas[2]-15;}
        }
        if(bgdrawtype==1){
            if(bgalphas[1]<255){bgalphas[1]=bgalphas[1]+15;}
            if(bgalphas[0]>0){bgalphas[0]=bgalphas[0]-15;}
            if(bgalphas[2]>0){bgalphas[2]=bgalphas[2]-15;}
        }
        if(bgdrawtype==2){
            if(bgalphas[2]<255){bgalphas[2]=bgalphas[2]+15;}
            if(bgalphas[1]>0){bgalphas[1]=bgalphas[1]-15;}
            if(bgalphas[0]>0){bgalphas[0]=bgalphas[0]-15;}
        }
        SetTexture(imgd);
        SetGraphicRect(0, 0, 384, 448);
        SetGraphicScale(1, 1);
        SetGraphicAngle(0, 0, 0);
        SetAlpha(bgalpha);
        DrawGraphic(GetCenterX, GetCenterY);
        
        SetTexture(imgc);
        SetGraphicRect(0, 0, 384, 448);
        SetGraphicScale(1, 1);
        SetGraphicAngle(0, 0, 0);
        SetAlpha(bgalphas[0]*192/255);
        DrawGraphic(GetCenterX, GetCenterY);
        SetTexture(imgg);
        SetGraphicRect(0, 0, 384, 448);
        SetGraphicScale(1, 1);
        SetGraphicAngle(0, 0, 0);
        SetAlpha(bgalphas[1]*192/255);
        DrawGraphic(GetCenterX, GetCenterY);
        SetTexture(imgh);
        SetGraphicRect(0, 0, 384, 448);
        SetGraphicScale(1, 1);
        SetGraphicAngle(0, 0, 0);
        SetAlpha(bgalphas[2]*192/255);
        DrawGraphic(GetCenterX, GetCenterY);
        
        SetTexture(imgf);
        SetGraphicRect(0, 0, 512, 512);
        SetGraphicScale(0.8, 0.8);
        SetGraphicAngle(0, 0, bgrot);
        SetAlpha(bgalpha*128/255);
        DrawGraphic(GetCenterX, GetCenterY);
        
        SetTexture(imge);
        SetGraphicRect(-768, -1024, 768, 1024);
        SetGraphicScale(0.5, 0.5);
        SetGraphicAngle(0, 0, 0);
        SetAlpha(bgalpha*128/255);
        DrawGraphic(GetCenterX, GetCenterY-bgdist);
        
        SetTexture(fan);
        SetGraphicRect(0, 256, 512, 512);
        SetGraphicScale(fanscale[0]*0.75, fanscale[1]*0.75);
        SetGraphicAngle(0, 0, 0);
        SetAlpha(fanscale[2]);
        DrawGraphic(GetCenterX, GetClipMinY+120);
        
        SetTexture(fan);
        SetGraphicRect(256-fanscaleb[0]*256, 256, 256+fanscaleb[1]*256, 512);
        SetGraphicScale(0.75, 0.75);
        SetGraphicAngle(0, 0, 0);
        SetAlpha(255);
        SetColor(255, 64, 64);
        DrawGraphic(GetCenterX, GetClipMinY+120);
        
        SetTexture(img);
        SetGraphicRect(0, 0, 694, 770);
        SetGraphicScale(0.15, 0.15);
        SetGraphicAngle(0, 0, 0);
        SetAlpha(255);
        SetColor(255, 255, 255);
        DrawGraphic(yori[0], yori[1]+8*sin(drawangle));
        
        SetTexture(imgb);
        SetGraphicRect(0, 0, 850, 1395);
        SetGraphicScale(0.075, 0.075);
        SetGraphicAngle(0, 0, 0);
        SetAlpha(255);
        DrawGraphic(toyo[0], toyo[1]+8*sin(drawangle));
        drawangle++;
        bgdist++;
        bgrot+=0.5;
	}
}