private void Search6_Timeline() { if (!TTT.HasSeed) { FormUtil.Error("Please Calibrate Timeline"); return; } var timeline = TTT.gettimeline(); int min = Math.Max((int)Frame_min.Value, timeline.Startingframe + 2); int max = (int)TimeSpan.Value * 60 + min; timeline.Maxframe = max; timeline.Generate(ForMainForm: true); int listlength = timeline.TinyLength; // Prepare var rng = new MersenneTwister(Seed.Value); for (int i = 0; i < min; i++) { rng.Next(); } getsetting(rng); Frame.standard = (int)(TargetFrame.Value - min); for (int i = 0; i < listlength; i++) { var tinyframe = timeline.results[i]; if (tinyframe.unhitable) { continue; } if (tinyframe.framemax < min) { continue; } RNGPool.TinySynced = tinyframe.sync == true; // For stationary for (int j = tinyframe.framemin + 2; j <= tinyframe.framemax; j += 2, RNGPool.AddNext(rng), RNGPool.AddNext(rng)) { while (j < min) { j += 2; } RNGPool.tinystatus = tinyframe.tinystate.Clone(); RNGPool.tinystatus.Currentframe = j; RNGResult result = RNGPool.Generate6(); if (!filter.CheckResult(result)) { continue; } Frames.Add(new Frame(result, frame: j, time: j - min)); Frames.Last()._tinystate = new PRNGState(tinyframe.tinystate.Status); if (Frames.Count > MAX_RESULTS_NUM) { return; } } } }
private void Search6_Normal() { var rng = new MersenneTwister(Seed.Value); int min = (int)Frame_min.Value; int max = (int)Frame_max.Value; if (AroundTarget.Checked) { min = (int)TargetFrame.Value - 100; max = (int)TargetFrame.Value + 100; } // Advance for (int i = 0; i < min; i++) { rng.Next(); } // Prepare getsetting(rng); // Start for (int i = min; i <= max; i++, RNGPool.AddNext(rng)) { RNGResult result = RNGPool.Generate6(); if (!filter.CheckResult(result)) { continue; } Frames.Add(new Frame(result, frame: i, time: i - min)); if (Frames.Count > 100000) { break; } } }
public Frame(RNGResult sc, int frame = -1, int time = -1, int eggnum = -1, byte blink = 0) { rt = sc; FrameNum = frame; realtime = time; EggNum = eggnum; Blink = blink; }
private void Search6_Timeline() { if (!TTT.HasSeed) { Error("Please Calibrate Timeline"); return; } RNGPool.timeline = TTT.gettimeline(); int min = Math.Max((int)Frame_min.Value, RNGPool.timeline.Startingframe + 2); int max = (int)TimeSpan.Value * 60 + min; RNGPool.timeline.Maxframe = max; RNGPool.timeline.Generate(Method == 0); // Consider Stationary delay int listlength = RNGPool.timeline.TinyLength; // Prepare var rng = new MersenneTwister(Seed.Value); for (int i = 0; i < min; i++) { rng.Next(); } getsetting(rng); for (int i = 0; i < listlength; i++) { var tinyframe = RNGPool.timeline.results[i]; if (tinyframe.unhitable) { continue; } if (tinyframe.framemax < min) { continue; } for (int j = tinyframe.framemin + 2; j <= tinyframe.framemax; j += 2, RNGPool.AddNext(rng), RNGPool.AddNext(rng)) { while (j < min) { j += 2; } RNGPool.tinystatus = (TinyStatus)tinyframe.tinystate.DeepCopy(); RNGPool.tinystatus.Currentframe = j; RNGResult result = RNGPool.Generate6(); if (!filter.CheckResult(result)) { continue; } Frames.Add(new Frame(result, frame: j, time: j - min)); Frames.Last()._tinystate = new PRNGState(tinyframe.state); if (Frames.Count > 100000) { return; } } } }
private void Search6_Normal() { int counter = 0; int min = (int)Frame_min.Value; int max = (int)Frame_max.Value; while (counter <= int.Parse(MaxSeeds.Text)) { var rng = new MersenneTwister(Seed.Value); if (AroundTarget.Checked) { min = (int)TargetFrame.Value - 100; max = (int)TargetFrame.Value + 100; } // Advance for (int i = 0; i < min; i++) { rng.Next(); } // Prepare getsetting(rng); // Start for (int i = min; i <= max; i++, RNGPool.AddNext(rng)) { RNGResult result = RNGPool.Generate6(); if (!filter.CheckResult(result)) { continue; } Frames.Add(new Frame(result, frame: i, time: i - min)); // found init seed+spread if (seedsearchCheckBox.Checked == true && Frames.Count >= 1) { counter = int.Parse(MaxSeeds.Text) + 1; break; } //normal search else if (Frames.Count > MAX_RESULTS_NUM) { break; } } if (seedsearchCheckBox.Checked == false) { counter = int.Parse(MaxSeeds.Text) + 1; } else if (counter != int.Parse(MaxSeeds.Text) + 1) { Seed.Value++; } counter++; } }
public void ModifyLevel(RNGResult rt, int levelboost = 0) { if (LevelModifierPass) { rt.Level = ModifiedLevel; } levelboost += Flute * FluteBoost; if (levelboost == 0) { return; } var level = rt.Level + levelboost; if (level > 100) { level = 100; } else if (level < 1) { level = 1; } rt.Level = (byte)level; }
public RNGResult Generate() { RNGResult st = new RNGResult(); index = 0; st.row_r = Rand[0]; st.Clock = (int)(st.row_r % 17); st.Blink = ((int)(st.row_r & 0x7F)) > 0 ? 0 : 1; // Reset NPC Status if (!createtimeline || Honey) { ResetNPCStatus(); } // ---Start here when press A button--- if (Considerdelay) { st.frameshift = getframeshift(); } // UB using honey if (Wild && UB && Honey) { st.UbValue = getUBValue(); } //Synchronize if (Wild && !UB_S) { st.Synchronize = (int)(getrand() % 100) >= 50; } else if (UB_S) { if (ConsiderBlink) { time_elapse(7); st.Synchronize = blink_process(); } } else if (!Wild) { if (AlwaysSynchro) { st.Synchronize = true; } else if (ConsiderBlink) { st.Synchronize = blink_process(); } } // Encounter if (Wild && !Honey) { st.Encounter = (int)(getrand() % 100); } // UB w/o Honey if (Wild && UB && !Honey) { st.UbValue = getUBValue(); if (UB_S) { Advance(1); st.Synchronize = blink_process(); } } //UB is determined above bool lengendary = UB_S || !Wild; bool ShinyLocked_S = UB_S || ShinyLocked; if (lengendary) { st.Lv = PokeLv; } // Wild Normal Pokemon bool Wild_S = Wild && !UB_S; if (Wild_S) { st.Slot = getslot((int)(getrand() % 100)); st.Lv = (int)(getrand() % (ulong)(Lv_max - Lv_min + 1)) + Lv_min; Advance(1); } //Something if (!AlwaysSynchro) { Advance(60); } //Encryption Constant st.EC = (uint)(getrand() & 0xFFFFFFFF); //PID int roll_count = ShinyCharm ? 3 : 1; if (lengendary) { roll_count = 1; } for (int i = 0; i < roll_count; i++) { st.PID = (uint)(getrand() & 0xFFFFFFFF); st.PSV = ((st.PID >> 16) ^ (st.PID & 0xFFFF)) >> 4; if (st.PSV == TSV) { st.Shiny = true; break; } } if (ShinyLocked_S && st.PSV == TSV) { st.Shiny = false; st.PID = st.PID ^ 0x10000000; st.PSV = ((st.PID >> 16) ^ (st.PID & 0xFFFF)) >> 4; } //IV st.IVs = new int[6] { -1, -1, -1, -1, -1, -1 }; int cnt = Fix3v ? 3 : 0; while (cnt > 0) { int ran = (int)(getrand() % 6); if (st.IVs[ran] < 0) { st.IVs[ran] = 31; cnt--; } } for (int i = 0; i < 6; i++) { if (st.IVs[i] < 0) { st.IVs[i] = (int)(getrand() & 0x1F); } } //Ability if (Wild_S || AlwaysSynchro) { st.Ability = (int)(getrand() & 1) + 1; } //Nature st.Nature = (int)(currentrand() % 25); if (st.Synchronize) { if (Synchro_Stat >= 0) { st.Nature = Synchro_Stat; } } else { index++; } //Gender if (nogender || UB_S) { st.Gender = 0; } else { st.Gender = ((int)(getrand() % 252) >= gender_ratio) ? 1 : 2; } //Item if (Wild_S) { st.Item = (int)(getrand() % 100); } return(st); }
public RNGResult GenerateEvent(EventRule e) { RNGResult st = new RNGResult(); index = 0; st.row_r = Rand[0]; st.Clock = (int)(st.row_r % 17); st.Blink = ((int)(st.row_r & 0x7F)) > 0 ? 0 : 1; // Reset NPC Status if (!createtimeline) { ResetNPCStatus(); } // ---Start here when press A button--- if (Considerdelay) { st.frameshift = getframeshift(e); } //Encryption Constant & PID switch (e.PIDType) { case 0: st.EC = (uint)(getrand() & 0xFFFFFFFF); st.PID = (uint)(getrand() & 0xFFFFFFFF); st.PSV = ((st.PID >> 16) ^ (st.PID & 0xFFFF)) >> 4; if (st.PSV == TSV) { st.Shiny = true; } break; case 1: Advance(2); st.Shiny = true; break; case 2: Advance(2); st.Shiny = false; break; case 3: break; } //IV st.IVs = (int[])e.IVs.Clone(); int cnt = e.IVsCount; while (cnt > 0) { int ran = (int)(getrand() % 6); if (st.IVs[ran] < 0) { st.IVs[ran] = 31; cnt--; } } for (int i = 0; i < 6; i++) { if (st.IVs[i] < 0) { st.IVs[i] = (int)(getrand() & 0x1F); } } //Ability if (!e.AbilityLocked) { st.Ability = (int)(getrand() & 1) + 1; } //Nature if (!e.NatureLocked) { st.Nature = (int)(currentrand() % 25); } //Gender if (nogender || e.GenderLocked) { st.Gender = 0; } else { st.Gender = ((int)(getrand() % 252) >= gender_ratio) ? 1 : 2; } return(st); }