예제 #1
0
        public static void MyGCPadCallback(GCPadStatus CurrentPad, GCPadStatus PreviousPad, StreamWriter write)
        {
            /* Use A + DPAD_DOWN to clear all inputs from stream. Resets the bot in case
             * it somehow gets into a whack state */
            if (CurrentPad.A && CurrentPad.Dpad_Down && (!PreviousPad.A || !PreviousPad.Dpad_Down))
            {
                Console.WriteLine("CLEAR");
                write.WriteLine("CLEAR");
                write.Flush();
            }

            /* Use B + DPAD_DOWN to send START to controller 2 so that you cam get
             * through end game screens */
            if (CurrentPad.B && CurrentPad.Dpad_Down && (!PreviousPad.B || !PreviousPad.Dpad_Down))
            {
                Console.WriteLine("PAUSE");
                GCPadStatus startPress = new GCPadStatus(CurrentPad.Frame + 5, 1);
                startPress.Start = true;
                write.WriteLine(startPress.ToString());
                write.Flush();
            }
            else
            {
                switch (currentState)
                {
                case Nothing:
                    /* Look for grab with Z or R/L + A */
                    if ((CurrentPad.Z && !PreviousPad.Z) || (CurrentPad.A && (CurrentPad.L || CurrentPad.R) && !PreviousPad.A))
                    {
                        currentState = Grabbed;
                        joyXonGrab   = CurrentPad.Joy_Horiz;
                        joyYonGrab   = CurrentPad.Joy_Vert;
                    }
                    break;

                case Grabbed:
                    /* If a not dthrow reset back to neutral */
                    if (CurrentPad.C_Horiz < 64 ||
                        CurrentPad.C_Horiz > 191 || CurrentPad.C_Vert > 191 ||
                        (CurrentPad.Joy_Horiz < 64 && !(joyXonGrab < 64)) ||
                        (CurrentPad.Joy_Horiz > 191 && !(joyXonGrab > 191)) ||
                        (CurrentPad.Joy_Vert > 191 && !(joyYonGrab > 191)))
                    {
                        currentState = Nothing;
                    }
                    /* If dthrow is found, begin random tech reactions */
                    else if ((CurrentPad.Joy_Vert < 64 && !(joyYonGrab < 64)) || CurrentPad.C_Vert < 64)
                    {
                        currentState = Nothing;
                        Console.WriteLine("DTHROW INC");

                        write.WriteLine("CLEAR");
                        write.Flush();

                        dthrow_frame_start = CurrentPad.Frame;
                        GCPadStatus ps = new GCPadStatus(0, 1);

                        /* DI The Throw */
                        ps.Joy_Horiz = joyExtremes[rand.Next(3)];
                        if (ps.Joy_Horiz == 0)
                        {
                            Console.WriteLine("DI LEFT");
                        }
                        if (ps.Joy_Horiz == 128)
                        {
                            Console.WriteLine("NOOOOOOOOO DEEEEEEEE EYYYYYYEEEE");
                        }
                        if (ps.Joy_Horiz == 255)
                        {
                            Console.WriteLine("DI RIGHT");
                        }
                        for (int i = dthrow_frame_start + 15; i < dthrow_frame_start + 46; i++)
                        {
                            ps.Frame = i;
                            write.WriteLine(ps.ToString());
                            write.Flush();
                        }

                        /* Decide whether to tech or not */
                        if (rand.Next(4) != 0)
                        {
                            ps   = new GCPadStatus(-1, 1);
                            ps.L = true;

                            /* Choose tech direction */
                            int dir = rand.Next(3);
                            ps.Joy_Horiz = joyExtremes[dir];
                            if (ps.Joy_Horiz == 0)
                            {
                                Console.WriteLine("TECH LEFT");
                            }
                            if (ps.Joy_Horiz == 128)
                            {
                                Console.WriteLine("TECH IN PLACE");
                            }
                            if (ps.Joy_Horiz == 255)
                            {
                                Console.WriteLine("TECH RIGHT");
                            }
                            for (int i = dthrow_frame_start + 50; i < dthrow_frame_start + 71; i++)
                            {
                                ps.Frame = i;
                                write.WriteLine(ps.ToString());
                                write.Flush();
                            }

                            /* SPAM SHINE */
                            ps.clearPad();
                            ps.Joy_Horiz = 128;
                            ps.Joy_Vert  = 0;
                            for (int i = dthrow_frame_start + 71; i < dthrow_frame_start + 110; i++)
                            {
                                ps.Frame = i;
                                ps.B     = i % 2 == 0;
                                write.WriteLine(ps.ToString());
                                write.Flush();
                            }
                        }
                        else
                        {
                            Console.WriteLine("NO TECH");
                        }
                        Console.WriteLine("");
                    }
                    else if ((CurrentPad.Joy_Vert > 64 && CurrentPad.Joy_Vert < 191))
                    {
                        joyYonGrab = 128;
                    }
                    else if ((CurrentPad.Joy_Horiz > 64 && CurrentPad.Joy_Horiz < 191))
                    {
                        joyXonGrab = 128;
                    }
                    break;
                }
            }
        }
예제 #2
0
        public static void MyGCPadCallback(GCPadStatus CurrentPad, GCPadStatus PreviousPad, StreamWriter write)
        {
            /* Use A + DPAD_DOWN to clear all inputs from stream. Resets the bot in case
             * it somehow gets into a whack state */
            if (CurrentPad.A && CurrentPad.Dpad_Down && (!PreviousPad.A || !PreviousPad.Dpad_Down))
            {
                Console.WriteLine("CLEAR");
                write.WriteLine("CLEAR");
                write.Flush();
            }

            /* Use B + DPAD_DOWN to send START to controller 2 so that you cam get
             * through end game screens */
            if (CurrentPad.B && CurrentPad.Dpad_Down && (!PreviousPad.B || !PreviousPad.Dpad_Down))
            {
                Console.WriteLine("PAUSE");
                GCPadStatus startPress = new GCPadStatus(CurrentPad.Frame + 5, 1);
                startPress.Start = true;
                write.WriteLine(startPress.ToString());
                write.Flush();
            }

            /* Use X + DPAD_DOWN to send START to controller 3 so that you cam get
             * through end game screens */
            if (CurrentPad.X && CurrentPad.Dpad_Down && (!PreviousPad.X || !PreviousPad.Dpad_Down))
            {
                Console.WriteLine("PAUSE");
                GCPadStatus startPress = new GCPadStatus(CurrentPad.Frame + 10, 2);
                startPress.Start = true;
                write.WriteLine(startPress.ToString());
                write.Flush();
            }

            /* Use L/R + DPAD_DOWN to begin (or cancel if already started) shield
             * pressure sequence */
            if (CurrentPad.Dpad_Down && !PreviousPad.Dpad_Down && (CurrentPad.L || CurrentPad.R))
            {
                currentlyPressuring = !currentlyPressuring;
                if (currentlyPressuring)
                {
                    Console.WriteLine("Begin Shield Pressure Sequence");
                    nextSequenceStartFrame = CurrentPad.Frame + 10;
                }
                else
                {
                    Console.WriteLine("End Shield Pressure Sequence");
                    write.WriteLine("CLEAR");
                    write.Flush();
                }
            }
            else if (CurrentPad.Frame == nextSequenceStartFrame - 5 && currentlyPressuring)
            {
                int         f  = nextSequenceStartFrame;
                GCPadStatus ps = new GCPadStatus(f, 1);

                /* Randomly select between two pressure options:
                 *      Westballz double shine
                 *      Shine super late dair
                 * These combine to form a mix up of whether you should counter
                 * after the grounded shine (in shine nair) or after what comes
                 * after the grounded shine (Westballs double shine) */

                /* Both start with shine -> jump */
                ps.Joy_Vert = 0;
                ps.B        = true;
                write.WriteLine(ps.ToString());
                write.Flush();

                ps.Frame = f + 7;
                ps.clearPad();
                ps.Y = true;
                write.WriteLine(ps.ToString());
                write.Flush();
                if (rand.Next(2) == 0)
                {
                    /* Westballz double shine */
                    Console.WriteLine("Westballz double shine");
                    ps.Frame = f + 13;
                    ps.clearPad();
                    ps.Joy_Vert = 0;
                    ps.B        = true;
                    write.WriteLine(ps.ToString());
                    write.Flush();

                    ps.Frame = f + 20;
                    ps.clearPad();
                    ps.Y = true;
                    write.WriteLine(ps.ToString());
                    write.Flush();

                    ps.Frame = f + 21;
                    ps.clearPad();
                    ps.Joy_Vert  = 0;
                    ps.Joy_Horiz = 200;
                    ps.R         = true;
                    write.WriteLine(ps.ToString());
                    write.Flush();

                    nextSequenceStartFrame = f + 33;
                }
                else
                {
                    /* Late Dair */
                    ps.clearPad();
                    ps.Joy_Horiz = 180;
                    for (int i = f + 8; i < f + 18; i++)
                    {
                        ps.Frame = i;
                        write.WriteLine(ps.ToString());
                        write.Flush();
                    }

                    Console.WriteLine("Dair Shine");
                    ps.Frame = f + 26;
                    ps.clearPad();
                    ps.C_Vert = 0;
                    write.WriteLine(ps.ToString());
                    write.Flush();

                    ps.Frame = f + 27;
                    ps.clearPad();
                    ps.Joy_Vert = 0;
                    write.WriteLine(ps.ToString());
                    write.Flush();

                    ps.Frame = f + 30;
                    ps.clearPad();
                    ps.Z = true;
                    write.WriteLine(ps.ToString());
                    write.Flush();

                    nextSequenceStartFrame = f + 46;
                }
            }
        }