예제 #1
0
        public ResultW6[] Generate_Horde(HordeResults Hrt = null)
        {
            var results = new ResultW6[5];

            for (int i = 0; i < 5; i++)
            {
                results[i] = new ResultW6();
            }

            // Use results from tiny
            if (Hrt != null)
            {
                for (int i = 0; i < 5; i++)
                {
                    results[i].Synchronize = Hrt.Sync;
                    results[i].Item        = Hrt.HeldItems[i];
                    results[i].ItemStr     = getitemstr(Hrt.HeldItems[i], CompoundEye);
                }
                if (Hrt.HA != 0)
                {
                    results[Hrt.HA - 1].Ability = 3;
                }
            }

            // Something
            Advance(60);
            for (int i = 0; i < 5; i++)
            {
                slot = results[i].Slot = (byte)(i + 1);
                Generate_Once(results[i]);
            }
            return(results);
        }
예제 #2
0
        public override RNGResult Generate()
        {
            var rt = new ResultW6();

            Prepare(rt);
            Advance(60);
            Generate_Once(rt);
            return(rt);
        }
예제 #3
0
        private void Generate_Once(ResultW6 rt)
        {
            //Level
            rt.Level = SlotLevel[slot];

            //Encryption Constant
            rt.EC = getrand;

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

            //IV
            rt.IVs = new int[6];
            for (int i = PerfectIVCount; i > 0;)
            {
                uint tmp = rand(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 >> 27);
                }
            }

            //Ability
            rt.Ability = (byte)(rt.Ability < 3 ? (HA ? rand(3) : (getrand >> 31)) + 1 : 3);

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

            //Gender
            rt.Gender = (byte)(RandomGender[slot] ? (rand(252) >= Gender[slot] ? 1 : 2) : Gender[slot]);
        }
예제 #4
0
        public ResultW6[] Generate_Horde(Horde Hrt = null)
        {
            var results = new ResultW6[5];

            for (int i = 0; i < 5; i++)
            {
                results[i] = new ResultW6();
            }

            // Use results from tiny
            if (Hrt != null)
            {
                CheckLeadAbility(Hrt.Lead);
                for (int i = 0; i < 5; i++)
                {
                    results[i].Synchronize = SynchroPass;
                    results[i].Item        = getHeldItem(Hrt.HeldItems[i], CompoundEye);
                }
                if (Hrt.HA != 0)
                {
                    results[Hrt.HA - 1].Ability = 3;
                }
            }
            else
            {
                for (int i = 0; i < 5; i++)
                {
                    results[i].Synchronize = RNGPool.TinySynced;
                }
            }

            // Something
            Advance(60);
            for (int i = 0; i < 5; i++)
            {
                slot       = results[i].Slot = (byte)(i + 1);
                FluteBoost = Hrt?.FluteBoosts[i] ?? 0;
                Generate_Once(results[i]);
            }
            return(results);
        }
예제 #5
0
        private void Prepare(ResultW6 rt)
        {
            if (RNGPool.tinystatus == null)
            {
                rt.Slot        = slot = 1;
                rt.Synchronize = RNGPool.AssumeSynced;
                return;
            }
            // Delay
            switch (Wildtype)
            {
            case EncounterType.RockSmash:
                RNGPool.time_elapse6(16);
                tiny_Advance(3);
                RNGPool.time_elapse6(RNGPool.DelayTime - 228);
                tiny_Advance(1);
                RNGPool.time_elapse6(212);
                rt.IsPokemon = TinyRand(100) <= 30;     // To-do
                break;

            case EncounterType.CaveShadow:
                RNGPool.time_elapse6(32);
                tiny_Advance(1);
                RNGPool.time_elapse6(46);
                break;

            case EncounterType.OldRod:
            case EncounterType.GoodRod:
            case EncounterType.SuperRod:
                RNGPool.time_elapse6(RNGPool.DelayTime);
                tiny_Advance(3 * PartyPKM);
                RNGPool.time_elapse6(132);
                Advance(132);
                var fishingdelay = TinyRand(7) * 30 + 60;
                RNGPool.time_elapse6(fishingdelay);
                Advance(fishingdelay);
                break;

            default:
                RNGPool.time_elapse6(RNGPool.DelayTime);
                break;
            }
            // Sync
            rt.Synchronize = getSync;

            // Encounter Slot and Others
            switch (Wildtype)
            {
            case EncounterType.FriendSafari:
                rt.IsPokemon = TinyRand(100) < 13;
                rt.Slot      = slot = (byte)(TinyRand(SlotNum) + 1);
                break;

            case EncounterType.OldRod:
            case EncounterType.GoodRod:
            case EncounterType.SuperRod:
                rt.IsPokemon = TinyRand(100) < EncounterRate;
                rt.Slot      = slot = getslot(TinyRand(100));
                break;

            case EncounterType.PokeRadar:
                rt.Slot = IsShinyLocked ? slot = 1 : getslot(TinyRand(100));
                break;

            default:
                rt.Slot = getslot(TinyRand(100));
                break;
            }

            // Something before generation
            tiny_Advance(1);

            // Item generated after pkm
            rt.Item    = TinyRand(100);
            rt.ItemStr = getitemstr(rt.Item, CompoundEye);
        }
예제 #6
0
        private void Prepare(ResultW6 rt)
        {
            if (RNGPool.tinystatus == null)
            {
                rt.Synchronize = RNGPool.TinySynced;
                return;
            }
            // Delay
            switch (Wildtype)
            {
            case EncounterType.RockSmash:
                RNGPool.time_elapse6(16);
                tiny_Advance(3);
                RNGPool.time_elapse6(RNGPool.DelayTime - 228);
                tiny_Advance(1);
                RNGPool.time_elapse6(212);
                RNGResult.IsPokemon = TinyRand(3) == 0;     // 0 for Pokemon, 1 for item, 2 for nothing
                break;

            case EncounterType.CaveShadow:
                RNGPool.time_elapse6(32);
                tiny_Advance(1);
                RNGPool.time_elapse6(46);
                break;

            case EncounterType.Fishing:
                RNGPool.time_elapse6(RNGPool.DelayTime);
                tiny_Advance(3 * PartyPKM);
                RNGPool.time_elapse6(132);
                var fishingdelay = TinyRand(7) * 30 + 60;
                RNGPool.time_elapse6(fishingdelay);
                Advance(132 + fishingdelay);     // Main RNG Advance due to the RANDOM delay
                break;

            default:
                RNGPool.time_elapse6(RNGPool.DelayTime);
                break;
            }

            CheckLeadAbility(TinyRand(100));
            rt.Synchronize = SynchroPass;

            // Encounter Slot and Others
            switch (Wildtype)
            {
            case EncounterType.PokeRadar when IsShinyLocked:     // Not first encounter, skip slot check
                break;

            case EncounterType.Normal:
            case EncounterType.Fishing:
            case EncounterType.FriendSafari:      // 13%
                RNGResult.IsPokemon = TinyRand(100) < EncounterRate;
                goto default;

            default:
                rt.Slot = getslot6();
                break;
            }

            // Flute
            if (IsORAS)
            {
                FluteBoost = getFluteBoost(TinyRand(100));
            }

            // Something
            tiny_Advance(1);

            // Item generated after pkm
            rt.Item = getHeldItem(TinyRand(100), CompoundEye);
        }
예제 #7
0
        private void Generate_Once(ResultW6 rt)
        {
            //Species
            rt.Species = (short)(SpecForm[slot] & 0x7FF);

            //Level
            rt.Level = SlotLevel[slot];
            ModifyLevel(rt);

            //Encryption Constant
            rt.EC = getrand;

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

            //IV
            rt.IVs = new int[6];
            for (int i = PerfectIVCount; i > 0;)
            {
                uint tmp = rand(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 >> 27);
                }
            }

            //Ability
            rt.Ability = (byte)(rt.Ability < 3 ? (HA ? rand(3) : (getrand >> 31)) + 1 : 3);

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

            //Form
            if (IsUnown)
            {
                rt.Forme = (byte)rand(28);
            }

            //Gender
            rt.Gender = (byte)(RandomGender[slot] ? CuteCharmPass ? CuteCharmGender : (rand(252) >= Gender[slot] ? 1 : 2) : Gender[slot]);
        }