public static void PostGeneration(ResultW7 rt) { while (rt.IVs.Count(iv => iv == 31) < FlawlessCount) { rt.IVs[getrand % 6] = 31; } if (getrand % 100 < HARate) { rt.Ability = 3; } }
public override RNGResult Generate() { ResultW7 rt = new ResultW7(); rt.Level = SpecialLevel; if (Fishing) { IsSpecial = rt.IsSpecial = getrand % 100 >= SpecialEnctr; time_elapse(12); if (IsSpecial) // Predict hooked item { int mark = RNGPool.index; time_elapse(34); rt.SpecialVal = (byte)(getrand % 100); RNGPool.Rewind(mark); // Don't need to put modelstatus back } } else if (SpecialEnctr > 0) { IsSpecial = rt.IsSpecial = getrand % 100 < SpecialEnctr; } if (SOS) { SOSRNG.Reset(); SOSRNG.Advance(2); // Call Rate Check CheckLeadAbility(getsosrand % 100); if (SOSRNG.Weather && (rt.Slot = slot = SOSRNG.getWeatherSlot(getsosrand % 100)) > 7) // No Electric/Steel Type in weather sos slots { rt.IsSpecial = true; } else { rt.Slot = StaticMagnetPass ? getsmslot(getsosrand) : getslot((int)(getsosrand % 100)); } rt.Level = (byte)(getsosrand % (uint)(Levelmax - Levelmin + 1) + Levelmin); FluteBoost = getFluteBoost(getsosrand % 100); ModifyLevel(rt); } else if (Crabrawler) { CheckLeadAbility(getrand % 100); rt.Slot = slot = 1; rt.Level = ModifiedLevel; } else if (NormalSlot) // Normal wild { CheckLeadAbility(getrand % 100); rt.Slot = StaticMagnetPass ? getsmslot(getrand) : getslot((int)(getrand % 100)); rt.Level = (byte)(getrand % (ulong)(Levelmax - Levelmin + 1) + Levelmin); FluteBoost = getFluteBoost(getrand % 100); ModifyLevel(rt); if (IsMinior) { rt.Forme = (byte)(getrand % 7); } } else // UB or QR { slot = 0; time_elapse(7); CheckLeadAbility(getrand % 100); time_elapse(3); } rt.Species = (short)(SpecForm[slot] & 0x7FF); if (DelayTime > 0) { InlineDelay(); } if (!SOS) { Advance(60); } //Encryption Constant rt.EC = (uint)getrand; //PID for (int i = PIDroll_count; i > 0; i--) { rt.PID = (uint)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;) { int tmp = (int)(getrand % 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 & 0x1F); } } //Ability rt.Ability = (byte)(IsUB ? 1 : (getrand & 1) + 1); //Nature rt.Nature = (rt.Synchronize = SynchroPass) && Synchro_Stat < 25 ? Synchro_Stat : (byte)(getrand % 25); //Gender rt.Gender = RandomGender[slot] ? (CuteCharmPass ? CuteCharmGender : (byte)(getrand % 252 >= Gender[slot] ? 1 : 2)) : Gender[slot]; //Item rt.Item = getHeldItem(SOS ? getsosrand % 100 : NormalSlot ? getrand % 100 : 100, CompoundEye); if (Fishing && rt.IsSpecial) { rt.Slot = getHookedItemSlot(rt.SpecialVal); //Fishing item slots } else if (SOS) { SOSRNG.PostGeneration(rt); // IVs and HA } return(rt); }
public override RNGResult Generate() { ResultW7 rt = new ResultW7(); rt.Level = SpecialLevel; if (SpecialEnctr > 0) { IsSpecial = rt.IsSpecial = (byte)(getrand % 100) < SpecialEnctr; } if (NormalSlot) // Normal wild { rt.Synchronize = (int)(getrand % 100) >= 50; rt.Slot = getslot((int)(getrand % 100)); rt.Level = (byte)(getrand % (ulong)(Levelmax - Levelmin + 1) + Levelmin); Advance(1); if (IsMinior) { Advance(1); } } else // UB or QR { slot = 0; time_elapse(7); rt.Synchronize = (int)(getrand % 100) >= 50; time_elapse(3); } Advance(60); //Encryption Constant rt.EC = (uint)getrand; //PID for (int i = PIDroll_count; i > 0; i--) { rt.PID = (uint)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;) { int tmp = (int)(getrand % 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 & 0x1F); } } //Ability rt.Ability = (byte)(IsUB ? 1 : (getrand & 1) + 1); //Nature rt.Nature = (byte)(rt.Synchronize && Synchro_Stat < 25 ? Synchro_Stat : getrand % 25); //Gender rt.Gender = (byte)(RandomGender[slot] ? ((int)(getrand % 252) >= Gender[slot] ? 1 : 2) : Gender[slot]); //Item rt.Item = (byte)(NormalSlot ? getrand % 100 : 100); rt.ItemStr = getitemstr(rt.Item); return(rt); }