diff --git a/PKHeX.Core/Legality/Encounters/Information/ValidEncounterMoves.cs b/PKHeX.Core/Legality/Encounters/Information/ValidEncounterMoves.cs index 3ae58e08a..92f1b61c5 100644 --- a/PKHeX.Core/Legality/Encounters/Information/ValidEncounterMoves.cs +++ b/PKHeX.Core/Legality/Encounters/Information/ValidEncounterMoves.cs @@ -32,16 +32,14 @@ public ValidEncounterMoves(List[] levelup) public class LevelUpRestriction { - public readonly int EncounterSpecies; public readonly IReadOnlyList[] EvolutionChains; public readonly int MinimumLevelGen1; public readonly int MinimumLevelGen2; public LevelUpRestriction(PKM pkm, LegalInfo info) { - MinimumLevelGen1 = pkm.GenNumber <= 2 ? info.EncounterMatch.LevelMin + 1 : 0; + MinimumLevelGen1 = info.Generation <= 2 ? info.EncounterMatch.LevelMin + 1 : 0; MinimumLevelGen2 = ParseSettings.AllowGen2MoveReminder(pkm) ? 1 : info.EncounterMatch.LevelMin + 1; - EncounterSpecies = info.EncounterMatch.Species; EvolutionChains = info.EvoChainsAllGens; } } diff --git a/PKHeX.Core/Legality/Encounters/LegalInfo.cs b/PKHeX.Core/Legality/Encounters/LegalInfo.cs index b62f761db..ed713321b 100644 --- a/PKHeX.Core/Legality/Encounters/LegalInfo.cs +++ b/PKHeX.Core/Legality/Encounters/LegalInfo.cs @@ -11,10 +11,10 @@ public sealed class LegalInfo private readonly PKM pkm; /// The generation of games the originated from. - public int Generation { get; set; } + public int Generation { get; internal set; } /// The Game the originated from. - public GameVersion Game { get; set; } + public GameVersion Game { get; internal set; } /// The matched Encounter details for the . public IEncounterable EncounterMatch @@ -35,28 +35,28 @@ public IEncounterable EncounterMatch public bool WasXD => pkm?.Version == 15 && EncounterMatch is IVersion v && v.Version == GameVersion.XD; /// Base Relearn Moves for the . - public int[] RelearnBase { get; set; } + public int[] RelearnBase { get; internal set; } /// Top level Legality Check result list for the . public readonly List Parse = new List(); - public CheckResult[] Relearn { get; set; } = new CheckResult[4]; - public CheckMoveResult[] Moves { get; set; } = new CheckMoveResult[4]; + public CheckResult[] Relearn { get; internal set; } = new CheckResult[4]; + public CheckMoveResult[] Moves { get; internal set; } = new CheckMoveResult[4]; - public ValidEncounterMoves EncounterMoves { get; set; } + public ValidEncounterMoves EncounterMoves { get; internal set; } public IReadOnlyList[] EvoChainsAllGens => _evochains ?? (_evochains = EvolutionChain.GetEvolutionChainsAllGens(pkm, EncounterMatch)); private IReadOnlyList[] _evochains; /// related information that generated the / value(s). - public PIDIV PIDIV { get; set; } + public PIDIV PIDIV { get; internal set; } /// Indicates whether or not the can originate from the . /// This boolean is true until all valid encounters are tested, after which it is false. - public bool PIDIVMatches { get; set; } = true; + public bool PIDIVMatches { get; internal set; } = true; /// Indicates whether or not the can originate from the with explicit matching. /// This boolean is true until all valid entries are tested for all possible matches, after which it is false. - public bool FrameMatches { get; set; } = true; + public bool FrameMatches { get; internal set; } = true; public readonly bool Korean; diff --git a/PKHeX.Core/Legality/Evolutions/EvolutionChain.cs b/PKHeX.Core/Legality/Evolutions/EvolutionChain.cs index bb481f1cc..f37458f26 100644 --- a/PKHeX.Core/Legality/Evolutions/EvolutionChain.cs +++ b/PKHeX.Core/Legality/Evolutions/EvolutionChain.cs @@ -267,10 +267,11 @@ private static int GetMinLevelGeneration(PKM pkm, int generation) if (pkm.Format <= 2) return 2; - if (!pkm.HasOriginalMetLocation && generation != pkm.GenNumber) + var origin = pkm.GenNumber; + if (!pkm.HasOriginalMetLocation && generation != origin) return pkm.Met_Level; - if (pkm.GenNumber <= 3) + if (origin <= 3) return 2; return 1; diff --git a/PKHeX.Core/Legality/RNG/PIDGenerator.cs b/PKHeX.Core/Legality/RNG/PIDGenerator.cs index d4096ab81..aea564dba 100644 --- a/PKHeX.Core/Legality/RNG/PIDGenerator.cs +++ b/PKHeX.Core/Legality/RNG/PIDGenerator.cs @@ -339,7 +339,7 @@ private static PIDType GetPIDType(PKM pk, PIDType specific) return specific; if (pk.Version == 15) return PIDType.CXD; - if (pk.GenNumber == 3 && pk.Species == 201) + if (pk.Gen3 && pk.Species == 201) return PIDType.Method_1_Unown + Util.Rand.Next(3); return PIDType.Method_1; diff --git a/PKHeX.Core/PKM/PKM.cs b/PKHeX.Core/PKM/PKM.cs index 9637ac92a..02f95a95d 100644 --- a/PKHeX.Core/PKM/PKM.cs +++ b/PKHeX.Core/PKM/PKM.cs @@ -889,7 +889,7 @@ public virtual void SetShiny() { while (!IsShiny) PID = PKX.GetRandomPID(Species, Gender, Version, Nature, AltForm, PID); - if (Format >= 6 && 3 <= GenNumber && GenNumber <= 5) + if (Format >= 6 && (Gen3 || Gen4 || Gen5)) EncryptionConstant = PID; } @@ -913,7 +913,7 @@ public void SetShinySID() public void SetPIDGender(int gender) { do PID = PKX.GetRandomPID(Species, gender, Version, Nature, AltForm, PID); while (IsShiny); - if (Format >= 6 && 3 <= GenNumber && GenNumber <= 5) + if (Format >= 6 && (Gen3 || Gen4 || Gen5)) EncryptionConstant = PID; } @@ -927,7 +927,7 @@ public void SetPIDGender(int gender) public void SetPIDNature(int nature) { do PID = PKX.GetRandomPID(Species, Gender, Version, nature, AltForm, PID); while (IsShiny); - if (Format >= 6 && 3 <= GenNumber && GenNumber <= 5) + if (Format >= 6 && (Gen3 || Gen4 || Gen5)) EncryptionConstant = PID; } @@ -942,7 +942,7 @@ public void SetPIDNature(int nature) public void SetPIDUnown3(int form) { do PID = Util.Rand32(); while (PKX.GetUnownForm(PID) != form); - if (Format >= 6 && 3 <= GenNumber && GenNumber <= 5) + if (Format >= 6 && (Gen3 || Gen4 || Gen5)) EncryptionConstant = PID; } diff --git a/PKHeX.Core/PKM/Util/PKMConverter.cs b/PKHeX.Core/PKM/Util/PKMConverter.cs index 0e2f0bd98..a8227c35a 100644 --- a/PKHeX.Core/PKM/Util/PKMConverter.cs +++ b/PKHeX.Core/PKM/Util/PKMConverter.cs @@ -162,7 +162,7 @@ private static bool IsPK6FormatReallyPK7(PK6 pk, int preferredFormat) if (pk.CurrentLevel < 100) // can't be hyper trained return false; - if (pk.GenNumber != 4) // can't have encounter type + if (!pk.Gen4) // can't have encounter type return true; if (et > 24) // invalid encountertype return true; diff --git a/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.cs b/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.cs index 428f558aa..9d843e528 100644 --- a/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.cs +++ b/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.cs @@ -756,7 +756,7 @@ private bool SetSuggestedMetLocation(bool silent = false) TB_MetLevel.Text = level.ToString(); CB_MetLocation.SelectedValue = location; - if (pkm.GenNumber == 6 && pkm.WasEgg && ModifyPKM) + if (pkm.Gen6 && pkm.WasEgg && ModifyPKM) pkm.SetHatchMemory6(); } @@ -851,7 +851,7 @@ private void UpdateRandomPID(object sender, EventArgs e) pkm.SetAbilityIndex(CB_Ability.SelectedIndex); TB_PID.Text = pkm.PID.ToString("X8"); - if (pkm.Format >= 6 && 3 <= pkm.GenNumber && pkm.GenNumber <= 5) + if (pkm.Format >= 6 && (pkm.Gen3 || pkm.Gen4 || pkm.Gen5)) TB_EC.Text = TB_PID.Text; Update_ID(TB_EC, e); }