Example #1
0
    public static void Execute(this RbyStrat strat, Rby gb)
    {
        bool yellow = gb is Yellow;

        Debug.Assert(!(yellow && ((strat >= RbyStrat.Hop0 && strat <= RbyStrat.Hop6) || (strat > RbyStrat.NoPal && strat <= RbyStrat.PalRel))), "Tried to use red/blue exclusive intro strats!");
        Debug.Assert(!(!yellow && strat >= RbyStrat.Intro0 && strat <= RbyStrat.IntroWait), "Tried to use yellow exclusive intro strats!");

        switch (strat)
        {
        case RbyStrat.NoPal:
            gb.RunUntil(0x100);
            break;

        case RbyStrat.NoPalAB:
            gb.Hold(Joypad.A, 0x100);
            break;

        case RbyStrat.Pal:
            gb.RunUntil(BiosJoypad);
            gb.AdvanceFrame(Joypad.Up);
            gb.RunUntil(0x100);
            break;

        case RbyStrat.PalHold:
            gb.Hold(Joypad.Up, 0x100);
            break;

        case RbyStrat.PalAB:
            gb.RunUntil(BiosJoypad);
            gb.AdvanceFrames(70, Joypad.Up);
            gb.RunUntil(BiosJoypad);
            gb.Hold(Joypad.Up | Joypad.A, 0x100);
            break;

        case RbyStrat.PalRel:
            gb.RunUntil(BiosJoypad);
            gb.AdvanceFrame(Joypad.Up);
            gb.AdvanceFrames(70);
            gb.Hold(Joypad.Up | Joypad.A, 0x100);
            break;

        case RbyStrat.GfSkip:
            gb.Press(yellow ? Joypad.Start : Joypad.Up | Joypad.B | Joypad.Select);
            break;

        case RbyStrat.GfWait:
            gb.RunUntil("PlayShootingStar.next");
            break;

        case RbyStrat.Hop0:
        case RbyStrat.Hop1:
        case RbyStrat.Hop2:
        case RbyStrat.Hop3:
        case RbyStrat.Hop4:
        case RbyStrat.Hop5:
            for (int i = 0; i < strat - RbyStrat.Hop0; i++)
            {
                gb.RunUntil("AnimateIntroNidorino");
                gb.RunUntil("CheckForUserInterruption");
            }
            gb.Press(Joypad.Up | Joypad.Select | Joypad.B);
            break;

        case RbyStrat.Intro0:
        case RbyStrat.Intro1:
        case RbyStrat.Intro2:
        case RbyStrat.Intro3:
        case RbyStrat.Intro4:
        case RbyStrat.Intro5:
        case RbyStrat.Intro6:
            if (strat > RbyStrat.Intro0)
            {
                gb.RunUntil("YellowIntroScene" + (strat - RbyStrat.Intro0) * 2);
            }
            gb.Press(Joypad.A);
            break;

        case RbyStrat.Hop6:
        case RbyStrat.IntroWait:
            gb.RunUntil("DisplayTitleScreen");
            break;

        case RbyStrat.TitleSkip:
            gb.Press(Joypad.Start);
            break;

        case RbyStrat.Continue:
        case RbyStrat.NewGame:
            gb.Press(Joypad.A);
            break;

        case RbyStrat.Backout:
            gb.Press(Joypad.B);
            break;
        }
    }
Example #2
0
    public static void Execute(this RbyStrat strat, Rby gb)
    {
        switch (strat)
        {
        case RbyStrat.NoPal:
            gb.RunUntil(0x100);
            break;

        case RbyStrat.NoPalAB:
            gb.Hold(Joypad.A, 0x100);
            break;

        case RbyStrat.Pal:
            gb.RunUntil(BiosJoypad);
            gb.AdvanceFrame(Joypad.Up);
            gb.RunUntil(0x100);
            break;

        case RbyStrat.PalHold:
            gb.Hold(Joypad.Up, 0x100);
            break;

        case RbyStrat.PalAB:
            gb.RunUntil(BiosJoypad);
            gb.AdvanceFrames(70, Joypad.Up);
            gb.RunUntil(BiosJoypad);
            gb.Hold(Joypad.Up | Joypad.A, 0x100);
            break;

        case RbyStrat.PalRel:
            gb.RunUntil(BiosJoypad);
            gb.AdvanceFrame(Joypad.Up);
            gb.AdvanceFrames(70);
            gb.Hold(Joypad.Up | Joypad.A, 0x100);
            break;

        case RbyStrat.GfSkip:
            gb.Press(gb.IsYellow ? Joypad.Start : Joypad.Up | Joypad.Select | Joypad.B);
            break;

        case RbyStrat.GfWait:
            gb.RunUntil("PlayShootingStar.next");
            break;

        case RbyStrat.Hop0:
        case RbyStrat.Hop1:
        case RbyStrat.Hop2:
        case RbyStrat.Hop3:
        case RbyStrat.Hop4:
        case RbyStrat.Hop5:
            for (int i = 0; i < strat - RbyStrat.Hop0; i++)
            {
                gb.RunUntil("AnimateIntroNidorino");
                gb.RunUntil("CheckForUserInterruption");
            }
            gb.Press(Joypad.Up | Joypad.Select | Joypad.B);
            break;

        case RbyStrat.Hop0Reset:
        case RbyStrat.Hop1Reset:
        case RbyStrat.Hop2Reset:
        case RbyStrat.Hop3Reset:
        case RbyStrat.Hop4Reset:
        case RbyStrat.Hop5Reset:
            for (int i = 0; i < strat - RbyStrat.Hop0Reset; i++)
            {
                gb.RunUntil("AnimateIntroNidorino");
                gb.RunUntil("CheckForUserInterruption");
            }
            break;

        case RbyStrat.Intro0:
        case RbyStrat.Intro1:
        case RbyStrat.Intro2:
        case RbyStrat.Intro3:
        case RbyStrat.Intro4:
        case RbyStrat.Intro5:
        case RbyStrat.Intro6:
            if (strat > RbyStrat.Intro0)
            {
                gb.RunUntil("YellowIntroScene" + (strat - RbyStrat.Intro0) * 2);
            }
            gb.Press(Joypad.A);
            break;

        case RbyStrat.Intro1Reset:
        case RbyStrat.Intro2Reset:
        case RbyStrat.Intro3Reset:
        case RbyStrat.Intro4Reset:
        case RbyStrat.Intro5Reset:
        case RbyStrat.Intro6Reset:
            gb.RunUntil("YellowIntroScene" + (strat - RbyStrat.Intro0Reset) * 2);
            break;

        case RbyStrat.Hop6:
        case RbyStrat.IntroWait:
            gb.RunUntil("DisplayTitleScreen");
            break;

        case RbyStrat.Title0:
        case RbyStrat.Title1:
        case RbyStrat.Title2:
        case RbyStrat.Title3:
        case RbyStrat.Title4:
        case RbyStrat.Title5:
        case RbyStrat.Title6:
        case RbyStrat.Title7:
            for (int i = 0; i < strat - RbyStrat.Title0; i++)
            {
                gb.RunUntil("TitleScreenPickNewMon");
                gb.AdvanceFrame();
            }
            gb.Press(Joypad.Start);
            break;

        case RbyStrat.Title0Scroll:
        case RbyStrat.Title1Scroll:
        case RbyStrat.Title2Scroll:
        case RbyStrat.Title3Scroll:
        case RbyStrat.Title4Scroll:
        case RbyStrat.Title5Scroll:
        case RbyStrat.Title6Scroll:
        case RbyStrat.Title7Scroll:
            for (int i = 0; i < strat - RbyStrat.Title0Scroll + 1; i++)
            {
                gb.RunUntil("TitleScreenScrollInMon");
                gb.RunUntil("CheckForUserInterruption");
            }
            gb.Press(Joypad.Start);
            break;

        case RbyStrat.Title0Reset:
        case RbyStrat.Title1Reset:
        case RbyStrat.Title2Reset:
        case RbyStrat.Title3Reset:
        case RbyStrat.Title4Reset:
        case RbyStrat.Title5Reset:
        case RbyStrat.Title6Reset:
        case RbyStrat.Title7Reset:
            for (int i = 0; i < strat - RbyStrat.Title0Reset; i++)
            {
                gb.RunUntil("TitleScreenPickNewMon");
                gb.RunUntil("CheckForUserInterruption");
            }
            break;

        case RbyStrat.Title0Usb:
        case RbyStrat.Title1Usb:
        case RbyStrat.Title2Usb:
        case RbyStrat.Title3Usb:
        case RbyStrat.Title4Usb:
        case RbyStrat.Title5Usb:
        case RbyStrat.Title6Usb:
        case RbyStrat.Title7Usb:
            for (int i = 0; i < strat - RbyStrat.Title0Usb; i++)
            {
                gb.RunUntil("TitleScreenPickNewMon");
                gb.RunUntil("CheckForUserInterruption");
            }
            gb.Press(Joypad.Up | Joypad.Select | Joypad.B);
            break;

        case RbyStrat.Title:
            gb.Press(Joypad.Start);
            break;

        case RbyStrat.TitleUsb:
            gb.Press(Joypad.Up | Joypad.Select | Joypad.B);
            break;

        case RbyStrat.Continue:
        case RbyStrat.NewGame:
            gb.Press(Joypad.A);
            break;

        case RbyStrat.Backout:
            gb.Press(Joypad.B);
            break;

        case RbyStrat.Options:
            gb.Press(Joypad.Down | Joypad.A, Joypad.Start);
            break;

        case RbyStrat.OptionsReset:
            gb.Press(Joypad.Down | Joypad.A);
            break;
        }

        if (strat.LogString().Contains("reset"))
        {
            gb.Hold(Joypad.A | Joypad.B | Joypad.Start | Joypad.Select, "SoftReset");
            gb.RunFor(1);
        }
    }