Ejemplo n.º 1
0
        private Result7 GenerateTrade(Result7 rt)
        {
            rt.IVs = (int[])IVs.Clone();
            for (int i = 0; i < 6; i++)
            {
                if (rt.IVs[i] < 0)
                {
                    rt.IVs[i] = (int)(getrand & 0x1F);
                }
            }

            // All fixed for now
            rt.Ability = Ability;
            rt.Nature  = Synchro_Stat;
            rt.Gender  = Gender;

            rt.EC  = (uint)getrand;
            rt.PID = (uint)getrand;
            if (rt.PSV == TSV)
            {
                rt.PID ^= 0x10000000;
            }

            return(rt);
        }
Ejemplo n.º 2
0
        public override RNGResult Generate()
        {
            Result7 rt = new Result7();

            rt.Level = Level;

            if (Trade)
            {
                return(GenerateTrade(rt));
            }

            //Synchronize
            if (AlwaysSync)
            {
                rt.Synchronize = true;
            }
            else
            {
                rt.Synchronize = blink_process();
                Advance(60);
            }

            //Encryption Constant
            if (IsPelago)
            {
                Advance(60 + PelagoShift);
                rt.EC = (uint)getrand;
                Advance(1); // Random TID
            }
            else
            {
                rt.EC = (uint)getrand;
            }


            //PID
            for (int i = PIDroll_count; i > 0; i--)
            {
                rt.PID = (uint)getrand;
                if (rt.PSV == TSV)
                {
                    if (IsShinyLocked)
                    {
                        rt.PID ^= 0x10000000;
                    }
                    else
                    {
                        rt.Shiny = true;
                    }
                    break;
                }
                else if (IsForcedShiny)
                {
                    rt.Shiny = true;
                    rt.PID   = (uint)((((TSV << 4) ^ (rt.PID & 0xFFFF)) << 16) + (rt.PID & 0xFFFF)); // Not accurate
                }
            }

            //IV
            rt.IVs = (int[])IVs.Clone();
            for (int i = PerfectIVCount; i > 0;)
            {
                int tmp = (int)(getrand % 6);
                if (rt.IVs[tmp] < 0)
                {
                    i--; rt.IVs[tmp] = 31;
                }
            }
            for (int i = 0; i < 6; i++)
            {
                if (rt.IVs[i] < 0)
                {
                    rt.IVs[i] = (int)(getrand & 0x1F);
                }
            }

            //Ability
            rt.Ability = Ability > 0 ? Ability : (byte)((getrand & 1) + 1);

            //Nature
            rt.Nature = rt.Synchronize && Synchro_Stat < 25 ? Synchro_Stat : (byte)(getrand % 25);

            //Gender
            rt.Gender = RandomGender ? (byte)(getrand % 252 >= Gender ? 1 : 2) : Gender;

            return(rt);
        }
Ejemplo n.º 3
0
        public override RNGResult Generate()
        {
            Result7 rt = new Result7();

            rt.Level = Level;

            //Synchronize
            if (AlwaysSync)
            {
                rt.Synchronize = true;
            }
            else
            {
                rt.Synchronize = blink_process();
                Advance(60);
            }

            //Encryption Constant
            if (IsPelago)
            {
                Advance(60 + PelagoShift);
                rt.EC = (uint)getrand;
                Advance(1);
            }
            else
            {
                rt.EC = (uint)getrand;
            }


            //PID
            for (int i = PIDroll_count; i > 0; i--)
            {
                rt.PID = (uint)getrand;
                if (rt.PSV == TSV)
                {
                    if (IsShinyLocked)
                    {
                        rt.PID ^= 0x10000000;
                    }
                    else
                    {
                        rt.Shiny = true;
                    }
                    break;
                }
            }

            //IV
            rt.IVs = (int[])IVs.Clone();
            for (int i = PerfectIVCount; i > 0;)
            {
                int tmp = (int)(getrand % 6);
                if (rt.IVs[tmp] < 0)
                {
                    i--; rt.IVs[tmp] = 31;
                }
            }
            for (int i = 0; i < 6; i++)
            {
                if (rt.IVs[i] < 0)
                {
                    rt.IVs[i] = (int)(getrand & 0x1F);
                }
            }

            //Ability
            rt.Ability = (byte)(blinkwhensync ? 1 : (getrand & 1) + 1);

            //Nature
            rt.Nature = (byte)(rt.Synchronize && Synchro_Stat < 25 ? Synchro_Stat : getrand % 25);

            //Gender
            rt.Gender = (byte)(RandomGender ? ((int)(getrand % 252) >= Gender ? 1 : 2) : Gender);

            return(rt);
        }
Ejemplo n.º 4
0
        public override RNGResult Generate()
        {
            Result7 rt = new Result7();

            rt.Level = Level;

            //Encryption Constant
            rt.EC = EC > 0 ? EC : (uint)getrand;

            //PID
            switch (PIDType)
            {
            case 0:     //Random PID
                rt.PID   = (uint)getrand;
                rt.Shiny = rt.PSV == TSV;
                break;

            case 1:     //Random NonShiny
                rt.PID = (uint)getrand;
                if (rt.PSV == TSV)
                {
                    rt.PID ^= 0x10000000;
                }
                break;

            case 2:     //Random Shiny
                rt.PID   = (uint)getrand;
                rt.Shiny = true;
                if (OtherInfo)
                {
                    rt.PID = (uint)(((TID ^ SID ^ (rt.PID & 0xFFFF)) << 16) + (rt.PID & 0xFFFF));
                }
                break;

            case 3:     //Specified
                rt.PID   = PID;
                rt.Shiny = rt.PSV == TSV;
                break;
            }

            //IV
            rt.IVs = (int[])IVs.Clone();
            for (int i = IVsCount; i > 0;)
            {
                int tmp = (int)(getrand % 6);
                if (rt.IVs[tmp] < 0)
                {
                    i--; rt.IVs[tmp] = 31;
                }
            }
            for (int i = 0; i < 6; i++)
            {
                if (rt.IVs[i] < 0)
                {
                    rt.IVs[i] = (int)(getrand & 0x1F);
                }
            }

            //Ability
            rt.Ability = AbilityLocked ? Ability : (byte)(Ability == 0 ? (getrand & 1) + 1 : getrand % 3 + 1);

            //Nature
            rt.Nature = NatureLocked ? Nature : (byte)(getrand % 25);

            //Gender
            rt.Gender = GenderLocked ? Gender : (byte)(getrand % 252 >= Gender ? 1 : 2);
            return(rt);
        }