예제 #1
0
 private void getspecialinfo(Frame_Misc f)
 {
     RNGPool.time_elapse7(Timedelay);
     f.frameused = RNGPool.index;
     if (FestivalPlaza)
     {
         f.frt = FPFacility.Generate();
     }
     else if (BattleTree)
     {
         RNGPool.modelnumber = 2;
         RNGPool.ResetModelStatus();
         RNGPool.time_elapse7(2);
         f.frameused = RNGPool.index;
         f.trt       = BTTrainer.Generate();
     }
     else if (filter.Random)
     {
         f.RandN = (int)(RNGPool.getrand64 % N);
     }
     else if (filter.Pokerus)
     {
         f.Pokerus = Pokerus7.getStrain();
     }
 }
예제 #2
0
        private void Search6()
        {
            MersenneTwister MT        = new MersenneTwister(Seed.Value);
            int             frame     = (int)StartingFrame.Value;
            int             loopcount = (int)MaxResults.Value;
            int             delay     = (int)Delay.Value;
            ulong           N         = (ulong)Range.Value;

            for (int i = 0; i < frame; i++)
            {
                MT.Next();
            }

            RNGPool.CreateBuffer(MT);

            for (int i = 0; i < loopcount; i++, RNGPool.AddNext(MT))
            {
                var f = new Frame_Misc();
                f.Frame    = frame++;
                f.Rand32   = RNGPool.getcurrent;
                f.realtime = i;
                f.st       = RNGPool.getcurrentstate;

                RNGPool.Rewind(0);
                RNGPool.Advance(delay);
                if (filter.Random)
                {
                    f.RandN = (int)((RNGPool.getrand * N) >> 32);
                }
                else if (filter.Pokerus)
                {
                    f.Pokerus = Pokerus6.getStrain();
                }

                if (!filter.check(f))
                {
                    continue;
                }

                Frames.Add(f);
            }
        }
예제 #3
0
        private void Search6_Battle()
        {
            TinyMT tiny      = TTT.Checked ? new TinyMT(Program.mainform.TinySeeds) : new TinyMT(Seed.Value);
            int    frame     = (int)StartingFrame.Value;
            int    loopcount = (int)MaxResults.Value;
            int    delay     = (int)Delay.Value;
            ulong  N         = (ulong)Range.Value;

            CaptureResult.Details = CB_Detail.Checked || Filters.SelectedTab == TP_Misc;
            var capture6 = new Capture();

            if (Filters.SelectedTab == TP_Capture)
            {
                capture6.Gen6        = true;
                capture6.HPCurr      = (uint)HPCurr.Value;
                capture6.HPMax       = (uint)HPMax.Value;
                capture6.CatchRate   = (byte)CatchRate.Value;
                capture6.StatusBonus = (uint)(int)Status.SelectedValue;
                capture6.BallBonus   = (uint)(int)BallBonus.SelectedValue;
                capture6.DexBonus    = (uint)(int)DexBonus.SelectedValue;
                capture6.OPowerBonus = OPowerList[OPower.SelectedIndex];
                capture6.Calc();
                var criticalchance = capture6.CriticalRate / 256.0;
                var shakechance    = capture6.ShakeRate / 65536.0;
                var capturechance  = criticalchance * shakechance + (1 - criticalchance) * Math.Pow(shakechance, 4);
                L_output.Text = CB_Detail.Checked ? string.Format("Critical {0:P}  \tShake {1:P}", criticalchance, shakechance)
                    : string.Format("Critical {0:P}  \tSuccess {1:P}", criticalchance, capturechance);
            }

            for (int i = 0; i < frame; i++)
            {
                tiny.Next();
            }

            RNGPool.CreateBuffer(tiny);

            for (int i = 0; i < loopcount; i++, RNGPool.AddNext(tiny, AutoCheck: false))
            {
                var f = new Frame_Misc();
                f.Frame  = frame++;
                f.Rand32 = RNGPool.getcurrent;
                f.st     = RNGPool.getcurrentstate;

                RNGPool.Rewind(0);
                RNGPool.Advance(delay);
                if (filter.Random)
                {
                    f.RandN = (int)((RNGPool.getrand * N) >> 32);
                }
                if (ShowCapture)
                {
                    RNGPool.Rewind(0);
                    f.Crt = capture6.Catch();
                }

                if (!filter.check(f))
                {
                    continue;
                }

                Frames.Add(f);
            }
        }
예제 #4
0
        private void Search7_Battle()
        {
            SFMT  sfmt      = new SFMT(Seed.Value);
            int   frame     = (int)StartingFrame.Value;
            int   loopcount = (int)MaxResults.Value;
            int   delay     = (int)Delay.Value;
            ulong N         = (ulong)Range.Value;

            CaptureResult.Details = SOSResult.Details = CB_Detail.Checked || Filters.SelectedTab == TP_Misc;
            var capture7 = new Capture();

            if (Filters.SelectedTab == TP_Capture)
            {
                capture7.HPCurr      = (uint)HPCurr.Value;
                capture7.HPMax       = (uint)HPMax.Value;
                capture7.CatchRate   = (byte)CatchRate.Value;
                capture7.StatusBonus = (uint)(int)Status.SelectedValue;
                capture7.BallBonus   = (uint)(int)BallBonus.SelectedValue;
                capture7.DexBonus    = (uint)(int)DexBonus.SelectedValue;
                capture7.OPowerBonus = RotoCatch.Checked ? 2.5f : 1.0f;
                capture7.Calc();
                var criticalchance = capture7.CriticalRate / 256.0;
                var shakechance    = capture7.ShakeRate / 65536.0;
                var capturechance  = criticalchance * shakechance + (1 - criticalchance) * Math.Pow(shakechance, 4);
                L_output.Text = CB_Detail.Checked ? string.Format("Critical {0:P}  \tShake {1:P}", criticalchance, shakechance)
                    : string.Format("Critical {0:P}  \tSuccess {1:P}", criticalchance, capturechance);
            }
            else if (SOS)
            {
                SOSRNG.ChainLength = (int)ChainLength.Value;
                SOSRNG.Weather     = L_Weather.Checked;

                int Rate1 = (int)CB_CallRate.SelectedValue * (int)HPBarColor.SelectedValue;
                if (AO.Checked)
                {
                    Rate1 *= 2;
                }
                if (Rate1 > 100)
                {
                    Rate1 = 100;
                }
                SOSRNG.Rate1 = (byte)Rate1;

                double Rate2 = (int)CB_CallRate.SelectedValue * (Intimidate.Checked ? 0x4CCC : 0x4000) / 4096.0;
                if (SameCaller.Checked)
                {
                    Rate2 *= 1.5;
                }
                if (SupperEffective.Checked)
                {
                    Rate2 *= 2;
                }
                if (LastCallFail.Checked)
                {
                    Rate2 *= 3;
                }
                if (Rate2 > 100)
                {
                    Rate2 = 100.0;
                }
                SOSRNG.Rate2 = (byte)Math.Round(Rate2);
            }

            for (int i = 0; i < frame; i++)
            {
                sfmt.Nextuint();
            }

            RNGPool.CreateBuffer(sfmt, AutoCheck: false); // Force 32bit

            for (int i = 0; i < loopcount; i++, RNGPool.AddNext(sfmt, AutoCheck: false))
            {
                var f = new Frame_Misc();
                f.Frame  = frame++;
                f.Rand32 = RNGPool.getcurrent;

                RNGPool.Rewind(0);
                RNGPool.Advance(delay);
                if (filter.Random)
                {
                    f.RandN = (int)(RNGPool.getrand % N);
                }
                if (ShowCapture)
                {
                    RNGPool.Rewind(0);
                    f.Crt = capture7.Catch();
                }
                if (ShowSOS)
                {
                    RNGPool.Rewind(0);
                    f.Srt = SOSRNG.Generate();
                }

                if (!filter.check(f))
                {
                    continue;
                }

                Frames.Add(f);
            }
        }
예제 #5
0
        private void Search7_Timeline()
        {
            SFMT sfmt      = new SFMT(Seed.Value);
            int  frame     = (int)StartingFrame.Value;
            int  loopcount = (int)MaxResults.Value;
            int  frameadvance;
            int  FirstJumpFrame = (int)JumpFrame.Value;

            FirstJumpFrame = FirstJumpFrame >= frame && Fidget.Checked ? FirstJumpFrame : int.MaxValue;
            setupgenerator();

            FuncUtil.getblinkflaglist(frame, frame, sfmt, (byte)(NPC.Value + 1));

            for (int i = 0; i < frame; i++)
            {
                sfmt.Next();
            }
            ModelStatus status = new ModelStatus((byte)(NPC.Value + 1), sfmt);

            status.raining = Raining.Checked;
            status.IsBoy   = Boy.Checked;

            RNGPool.CreateBuffer(sfmt);

            for (int i = 0; i <= loopcount; i++)
            {
                var f = new Frame_Misc();
                f.Frame    = frame;
                f.Rand64   = RNGPool.getcurrent64;
                f.realtime = 2 * i;
                f.status   = (int[])status.remain_frame.Clone();

                if (frame >= FirstJumpFrame) // Find the first call
                {
                    status.fidget_cd = 1;
                    FirstJumpFrame   = int.MaxValue; // Disable this part
                }
                if (status.fidget_cd == 1)
                {
                    f.Blink = 1;
                }

                // USUM v1.1 sub_421E4C eyes closed
                if (status.remain_frame[0] == -3 || status.remain_frame[0] == 33)
                {
                    f.Blink = 4;
                }

                RNGPool.Rewind(0); RNGPool.CopyStatus(status);
                getspecialinfo(f);

                frameadvance = status.NextState();
                frame       += frameadvance;
                for (int j = frameadvance; j > 0; j--)
                {
                    RNGPool.AddNext(sfmt);
                }

                if (!filter.check(f))
                {
                    continue;
                }

                Frames.Add(f);
            }
            if (Frames.FirstOrDefault()?.Frame == (int)StartingFrame.Value)
            {
                Frames[0].Blink = FuncUtil.blinkflaglist[0];
            }
        }
예제 #6
0
        private void Search7()
        {
            SFMT sfmt     = new SFMT(Seed.Value);
            int  min      = (int)StartingFrame.Value;
            int  max      = min + (int)MaxResults.Value;
            byte Modelnum = (byte)(NPC.Value + 1);

            setupgenerator();

            FuncUtil.getblinkflaglist(min, max, sfmt, Modelnum);

            for (int i = 0; i < min; i++)
            {
                sfmt.Next();
            }

            ModelStatus status = new ModelStatus(Modelnum, sfmt);
            ModelStatus stmp   = new ModelStatus(Modelnum, sfmt);

            RNGPool.CreateBuffer(sfmt);

            int frameadvance;
            int realtime  = 0;
            int frametime = 0;

            for (int i = min; i <= max;)
            {
                do
                {
                    frameadvance = status.NextState();
                    realtime++;
                }while (frameadvance == 0); // Keep the starting status of a longlife frame(for npc=0 case)
                do
                {
                    var f = new Frame_Misc();
                    f.Frame    = i;
                    f.Rand64   = RNGPool.getcurrent64;
                    f.Blink    = FuncUtil.blinkflaglist[i - min];
                    f.realtime = 2 * frametime;
                    f.status   = (int[])stmp.remain_frame.Clone();

                    RNGPool.Rewind(0); RNGPool.CopyStatus(stmp);
                    getspecialinfo(f);

                    RNGPool.AddNext(sfmt);
                    frameadvance--;
                    if (i++ > max)
                    {
                        return;
                    }
                    if (!filter.check(f))
                    {
                        continue;
                    }

                    Frames.Add(f);
                }while (frameadvance > 0);

                // Backup current status
                status.CopyTo(stmp);
                frametime = realtime;
            }
        }
예제 #7
0
        public bool check(Frame_Misc f)
        {
            if (Pokerus && f.Pokerus == 0)
            {
                return(false);
            }
            if (CurrentSeed != null && !System.Text.RegularExpressions.Regex.IsMatch(f.CurrentSeed, CurrentSeed))
            {
                return(false);
            }
            if (Random)
            {
                switch (CompareType)
                {
                case 0: if (f.RandN >= Value)
                    {
                        return(false);
                    }
                    break;

                case 1: if (f.RandN < Value)
                    {
                        return(false);
                    }
                    break;

                case 2: if (f.RandN != Value)
                    {
                        return(false);
                    }
                    break;
                }
            }
            if (SOS)
            {
                if (Success && !f.Srt.Success)
                {
                    return(false);
                }
                if (HA && !f.Srt.HA)
                {
                    return(false);
                }
                if (Sync && !f.Srt.Sync)
                {
                    return(false);
                }
                if (Slot.Any(n => n) && !Slot[f.Srt.Slot])
                {
                    return(false);
                }
            }
            if (Capture && Success && !f.Crt.Gotta)
            {
                return(false);
            }
            if (FacilityFilter?.IsDifferentFrom(f.frt) ?? false)
            {
                return(false);
            }
            if (TrainerFilter?.IsDifferentFrom(f.trt) ?? false)
            {
                return(false);
            }
            return(true);
        }
예제 #8
0
        public bool check(Frame_Misc f)
        {
            if (Pokerus && f.Pokerus == 0)
            {
                return(false);
            }
            if (BaseTime.Visible && (CurrentSeed != null && BaseTime.Text != ""))
            {
                string sum            = ((f.Rand32 + ulong.Parse(BaseTime.Text, NumberStyles.HexNumber)) & 0xFFFFFFFF).ToString();
                string currentSeedDec = ulong.Parse(CurrentSeed, NumberStyles.HexNumber).ToString();
                if (sum.Length >= 2 && currentSeedDec.Length >= 2 &&
                    sum.Length == currentSeedDec.Length &&
                    sum.Substring(sum.Length - 3) == currentSeedDec.Substring(currentSeedDec.Length - 3) &&
                    sum.Substring(0, 1) == currentSeedDec.Substring(0, 1))
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            if (CurrentSeed != null && !System.Text.RegularExpressions.Regex.IsMatch(f.CurrentSeed, CurrentSeed))
            {
                return(false);
            }
            if (Random)
            {
                switch (CompareType)
                {
                case 0: if (f.RandN >= Value)
                    {
                        return(false);
                    }
                    break;

                case 1: if (f.RandN < Value)
                    {
                        return(false);
                    }
                    break;

                case 2: if (f.RandN != Value)
                    {
                        return(false);
                    }
                    break;
                }
            }
            if (SOS)
            {
                if (Success && !f.Srt.Success)
                {
                    return(false);
                }
                if (HA && !f.Srt.HA)
                {
                    return(false);
                }
                if (Sync && !f.Srt.Sync)
                {
                    return(false);
                }
                if (Slot.Any(n => n) && !Slot[f.Srt.Slot])
                {
                    return(false);
                }
            }
            if (Capture && Success && !f.Crt.Gotta)
            {
                return(false);
            }
            if (FacilityFilter?.IsDifferentFrom(f.frt) ?? false)
            {
                return(false);
            }
            if (TrainerFilter?.IsDifferentFrom(f.trt) ?? false)
            {
                return(false);
            }
            return(true);
        }