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> /// <summary>
/// Most recent game ID utilized by official games. /// Most recent game ID utilized by official games.
/// </summary> /// </summary>
public const GameVersion HighestGameID = RB - 1; private const GameVersion HighestGameID = RB - 1;
/// <summary>Determines the Version Grouping of an input Version ID</summary> /// <summary>Determines the Version Grouping of an input Version ID</summary>
/// <param name="version">Version of which to determine the group</param> /// <param name="version">Version of which to determine the group</param>

View file

@ -37,7 +37,7 @@
internal static bool TransferSpeciesDefaultAbilityGen1(int species) 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 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.Koffing or (int)Species.Weezing
or (int)Species.Mew; or (int)Species.Mew;

View file

@ -172,7 +172,13 @@ namespace PKHeX.Core
// ORAS contests mistakenly apply 20 affection to the OT instead of the current handler's value // 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; 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)
{
// 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, EncounterTrade => false,
EncounterSlot8GO => false, EncounterSlot8GO => false,
@ -182,6 +188,7 @@ namespace PKHeX.Core
WC8 {IsHOMEGift: true} => false, WC8 {IsHOMEGift: true} => false,
_ => true _ => true
}; };
}
private static int GetBaseFriendship(int generation, int species, int form) => generation switch private static int GetBaseFriendship(int generation, int species, int form) => generation switch
{ {