Пример #1
0
        private void MarkRockSmash()
        {
            Frame_Tiny.thershold = 1;
            int idxmax = ReferenceList.Count - 6;

            results = results.TakeWhile(r => r.HitIndex < idxmax).ToList();  // Remove tail data
            foreach (var rt in results)
            {
                int j = rt.HitIndex;
                rt.enctr = (byte)((ReferenceList[j++].rand * 3ul) >> 32);
                rt.sync  = ReferenceList[j++].R2;
                rt.slot  = WildRNG.getSlot(ReferenceList[j++].R100, 4);
                if (IsORAS)
                {
                    rt.flute = WildRNG.getFluteBoost(ReferenceList[j++].R100);
                }
                rt.item = Wild6.getHeldItem(ReferenceList[++j].R100);
            }
        }
Пример #2
0
        private void MarkEncounter(bool FS = false, bool Fishing = false, bool Check = true)
        {
            Frame_Tiny.thershold = (byte)(!Check ? 0 : EncounterRate);
            byte SlotType = (byte)(FS ? SlotNum + 47 : Fishing ? 3 : 2);
            int  idxmax   = ReferenceList.Count - 6;

            results = results.TakeWhile(r => r.HitIndex < idxmax).ToList();  // Remove tail data
            foreach (var rt in results)
            {
                int j = rt.HitIndex;
                rt.sync = ReferenceList[j++].R2;
                if (Check)
                {
                    rt.enctr = ReferenceList[j++].R100;
                }
                rt.slot = WildRNG.getSlot(ReferenceList[j++].R100, SlotType);
                if (IsORAS)
                {
                    rt.flute = WildRNG.getFluteBoost(ReferenceList[j++].R100);
                }
                rt.item = Wild6.getHeldItem(ReferenceList[++j].R100);
            }
        }
Пример #3
0
        public static DexNavResult Generate(TinyMT rng)
        {
            var rt = new DexNavResult();

            // Something
            rng.Next();

            // Boost
            bool Boost = ChainLength > 0 && (ChainLength + 1) % 5 == 0 || (rng.Nextuint() * 100ul) >> 32 < 4;  // sub_40295C
            byte Grade = GetGrade;

            // Sync
            rt.Lead = (byte)((rng.Nextuint() * 100ul) >> 32);

            // Something
            rng.Next();

            // Level
            rt.LevelBoost = ChainLength / 5 + (Boost ? 10 : 0);
            rt.FluteBoost = Wild6.getFluteBoost((rng.Nextuint() * 100ul) >> 32);

            // Hidden Ability
            rt.HA = ((rng.Nextuint() * 100ul) >> 32) < HARate[Grade];

            // IVs
            int Index;

            for (Index = 2; Index >= 0; Index--)
            {
                if (((rng.Nextuint() * 100ul) >> 32) < IVRate[3 * Grade + Index])
                {
                    break;
                }
            }
            Index       += Boost ? 2 : 1;
            rt.Potential = (byte)Math.Min(3, Index);

            // Egg Move
            rt.EggMove = ((rng.Nextuint() * 100ul) >> 32) < EggMoveRate[Grade] || Boost;

            // Held Item
            int tmp = (int)((rng.Nextuint() * 100ul) >> 32);

            for (Index = 0; Index < 2; Index++)
            {
                tmp -= HeldItemRate[Grade * 2 + Index];
                if (CompoundEyes)
                {
                    tmp -= 5;
                }
                if (tmp < 0)
                {
                    break;
                }
            }
            if (Index >= 2)
            {
                Index = 3;
            }
            rt.HeldItem = (byte)Index;

            // Shiny Checks
            int CheckCount = ShinyCharm ? 3 : 1;

            if (Boost)
            {
                CheckCount += 4;
            }
            if (ChainLength == 49)
            {
                CheckCount += 5;
            }
            else if (ChainLength == 99)
            {
                CheckCount += 10;
            }

            int TargetValue = 0;

            if (SearchLevel > 200)
            {
                TargetValue = SearchLevel + 600;
            }
            else if (SearchLevel > 100)
            {
                TargetValue = 2 * SearchLevel + 400;
            }
            else
            {
                TargetValue = 6 * SearchLevel;
            }

            for (int i = 0; i < CheckCount; i++)
            {
                if (((rng.Nextuint() * 10000ul) >> 32) < TargetValue * 0.01)
                {
                    rt.ForcedShiny = true;
                }
            }

            return(rt);
        }