public override RNGResult Generate() { // Generate Pokemon before target first if (Bank) { for (int i = 0; i < Target - 1; i++) { Generate_Once(GenderList[i]); } } Result6 rt = new Result6(); rt.Level = Level; int StartFrame = RNGPool.index; //Sync rt.Synchronize = getSync; if (!AlwaysSync) { Advance(60); } //Encryption Constant rt.EC = getrand; //PID for (int i = PIDroll_count; i > 0; i--) { rt.PID = getrand; if (rt.PSV == TSV) { if (IsShinyLocked) { rt.PID ^= 0x10000000; } else { rt.Shiny = true; } break; } else if (IsForcedShiny) { rt.Shiny = true; rt.PID = (uint)((((TSV << 4) ^ (rt.PID & 0xFFFF)) << 16) + (rt.PID & 0xFFFF)); // Not accurate } } //IV rt.IVs = (int[])IVs.Clone(); for (int i = PerfectIVCount; i > 0;) { uint tmp = rand(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 >> 27); } } //Ability rt.Ability = (byte)(Ability == 0 ? (getrand >> 31) + 1 : Ability); //Nature rt.Nature = (byte)(rt.Synchronize && Synchro_Stat < 25 ? Synchro_Stat : rand(25)); //Gender rt.Gender = (byte)(RandomGender ? (rand(252) >= Gender ? 1 : 2) : Gender); //For Pokemon Link rt.FrameUsed = (byte)(RNGPool.index - StartFrame); return(rt); }
private RNGResult Generate_Once() { Result6 rt = new Result6(); rt.Level = Level; //Encryption Constant rt.EC = EC > 0 ? EC : getrand; //PID switch (PIDType) { case 0: //Random PID rt.PID = getrand; if (rt.Shiny = rt.PSV == TSV) { rt.SquareShiny = true; } break; case 1: //Random NonShiny rt.PID = getrand; if (rt.PSV == TSV) { rt.PID ^= 0x10000000; } break; case 2: //Random Shiny rt.PID = getrand; if (OtherInfo) { rt.PID = (uint)(((TID ^ SID ^ (rt.PID & 0xFFFF)) << 16) + (rt.PID & 0xFFFF)); } rt.Shiny = true; rt.SquareShiny = true; break; case 3: //Specified rt.PID = PID; if (rt.Shiny = rt.PSV == TSV) { rt.SquareShiny = true; } break; } //IV rt.IVs = (int[])IVs.Clone(); for (int i = IVsCount; i > 0;) { uint tmp = rand(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 >> 27); } } //Ability rt.Ability = AbilityLocked ? Ability : (byte)(rand(Ability + 2) + 1); //Nature rt.Nature = NatureLocked ? Nature : (byte)rand(25); //Gender rt.Gender = GenderLocked ? Gender : (byte)(rand(252) >= Gender ? 1 : 2); //Advance rt.FrameUsed = (byte)(RNGPool.index + 1); return(rt); }