Minor tweaks

Disallow OT handling when originated gen is 1/2
Cast the input not the const
Hide HighestGameID (Use the method instead)
This commit is contained in:
Kurt 2021-01-09 21:25:28 -08:00
parent a235cae9e0
commit 76ae6b2b3d
3 changed files with 18 additions and 11 deletions

View file

@ -25,7 +25,7 @@ namespace PKHeX.Core
/// <summary>
/// Most recent game ID utilized by official games.
/// </summary>
public const GameVersion HighestGameID = RB - 1;
private const GameVersion HighestGameID = RB - 1;
/// <summary>Determines the Version Grouping of an input Version ID</summary>
/// <param name="version">Version of which to determine the group</param>

View file

@ -37,7 +37,7 @@
internal static bool TransferSpeciesDefaultAbilityGen1(int species)
{
System.Diagnostics.Debug.Assert(species <= (uint)MaxSpeciesID_1);
System.Diagnostics.Debug.Assert((uint)species <= MaxSpeciesID_1);
return species is (int)Species.Gastly or (int)Species.Haunter or (int)Species.Gengar
or (int)Species.Koffing or (int)Species.Weezing
or (int)Species.Mew;

View file

@ -172,16 +172,23 @@ namespace PKHeX.Core
// ORAS contests mistakenly apply 20 affection to the OT instead of the current handler's value
private static bool IsInvalidContestAffection(IAffection pkm) => pkm.OT_Affection != 255 && pkm.OT_Affection % 20 != 0;
public static bool GetCanOTHandle(IEncounterable enc, PKM pkm, int generation) => generation < 6 || enc switch
public static bool GetCanOTHandle(IEncounterable enc, PKM pkm, int generation)
{
EncounterTrade => false,
EncounterSlot8GO => false,
WC6 wc6 when wc6.OT_Name.Length > 0 => false,
WC7 wc7 when wc7.OT_Name.Length > 0 && wc7.TID != 18075 => false, // Ash Pikachu QR Gift doesn't set Current Handler
WC8 wc8 when wc8.GetHasOT(pkm.Language) => false,
WC8 {IsHOMEGift: true} => false,
_ => true
};
// Handlers introduced in Generation 6. OT Handling was always the case for Generation 3-5 data.
if (generation < 6)
return generation >= 3;
return enc switch
{
EncounterTrade => false,
EncounterSlot8GO => false,
WC6 wc6 when wc6.OT_Name.Length > 0 => false,
WC7 wc7 when wc7.OT_Name.Length > 0 && wc7.TID != 18075 => false, // Ash Pikachu QR Gift doesn't set Current Handler
WC8 wc8 when wc8.GetHasOT(pkm.Language) => false,
WC8 {IsHOMEGift: true} => false,
_ => true
};
}
private static int GetBaseFriendship(int generation, int species, int form) => generation switch
{