Esempio n. 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();
     }
 }
Esempio n. 2
0
        private void Search7_AroundTarget()
        {
            SFMT sfmt   = new SFMT(Seed.Value);
            int  start  = (int)Frame_min.Value;
            int  target = (int)TargetFrame.Value;
            int  min    = target - 100;
            int  max    = target + 100;

            if (start > min)
            {
                start = min;
            }

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

            // Prepare
            int  i         = 0;
            byte blinkflag = 0;

            for (; i < start; i++)
            {
                sfmt.Next();
            }
            ModelStatus status = new ModelStatus(Modelnum, sfmt);
            ModelStatus stmp   = new ModelStatus(Modelnum, sfmt);

            status.raining = stmp.raining = Raining.Checked;
            getsetting(sfmt);
            int frameadvance = 0;
            int realtime     = 0;
            int frametime    = 0;

            // Calc frames around target
            for (; i <= max;)
            {
                for (; frameadvance == 0; frameadvance = status.NextState())
                {
                    realtime++;
                }
                for (; frameadvance > 0; frameadvance--, i++)
                {
                    if (min <= i && i <= max)
                    {
                        RNGPool.CopyStatus(stmp);
                        var result = RNGPool.Generate7();
                        blinkflag = FuncUtil.blinkflaglist[i - min];
                        Frames.Add(new Frame(result, frame: i, time: frametime * 2, blink: blinkflag));
                    }
                    RNGPool.AddNext(sfmt);
                }

                // Backup current status
                status.CopyTo(stmp);
                frametime = realtime;
            }

            // Get all possible results by EC matching
            // Can't identify MainRNGEggs by EC
            if (Method < 3)
            {
                Frames = Frames.OrderBy(f => f.FrameNum + (f.rt as Result7).FrameDelayUsed).ToList();

                var EClist = Frames.Select(f => f.rt.EC).ToArray();

                // Another Buffer
                sfmt = new SFMT(Seed.Value);
                int starting = Frames[0].FrameNum + (Frames[0].rt as Result7).FrameDelayUsed;
                for (i = 0; i < starting; i++)
                {
                    sfmt.Next();
                }
                RNGPool.CreateBuffer(sfmt);

                // Skip Delay
                RNGPool.Considerdelay = false;
                if (RNGPool.igenerator is Stationary7 st7)
                {
                    st7.AssumeSynced = Nature.CheckBoxItems[SyncNature.SelectedIndex].Checked;
                }

                uint  EC;
                uint  EClast = EClist.Last();
                int   Nframe = -1;
                ulong rand   = 0;
                do
                {
                    RNGPool.modelnumber = Modelnum;
                    RNGPool.ResetModelStatus();
                    var result = RNGPool.Generate7() as Result7;
                    EC = result.EC;
                    RNGPool.AddNext(sfmt);
                    if (EClist.Contains(EC))
                    {
                        var framenow = Frames.LastOrDefault(f => f.EC == EC);
                        Nframe    = framenow.FrameNum;
                        frametime = framenow.realtime;
                        rand      = framenow.Rand64;
                        continue;
                    }
                    else if (Nframe > -1)
                    {
                        result.RandNum = rand;
                        Frames.Add(new Frame(result, frame: Nframe, time: frametime, blink: 4));
                    }
                }while (EC != EClast);
            }

            // Filters
            RNGResult.IsPokemon = true;
            Frames = Frames.Where(f => filter.CheckResult(f.rt))
                     .OrderBy(f => f.FrameNum)
                     .ToList();
        }