diff --git a/PKHeX.Core/PKM/PKMConverter.cs b/PKHeX.Core/PKM/PKMConverter.cs index ce581380d..08bd0c813 100644 --- a/PKHeX.Core/PKM/PKMConverter.cs +++ b/PKHeX.Core/PKM/PKMConverter.cs @@ -213,6 +213,9 @@ public static PKM ConvertToType(PKM pk, Type PKMType, out string comment) return pk; } + if (IsNotTransferrable(pk, out comment)) + return null; + Debug.WriteLine($"Trying to convert {fromType.Name} to {PKMType.Name}."); int fromFormat = int.Parse(fromType.Name.Last().ToString()); @@ -279,11 +282,6 @@ public static PKM ConvertToType(PKM pk, Type PKMType, out string comment) pkm = ((PK4) pkm).ConvertToBK4(); break; } - if (pkm.Species == 172 && pkm.AltForm != 0) - { - comment = "Cannot transfer Spiky-Eared Pichu forward."; - return null; - } pkm = ((PK4) pkm).ConvertToPK5(); if (toFormat == 5) break; @@ -314,6 +312,28 @@ public static PKM ConvertToType(PKM pk, Type PKMType, out string comment) return pkm; } + /// + /// Checks to see if a PKM is transferrable relative to in-game restrictions and . + /// + /// PKM to convert + /// Comment indicating why the is not transferrable. + /// Indication if Not Transferrable + private static bool IsNotTransferrable(PKM pk, out string comment) + { + switch (pk.Species) + { + default: + comment = null; + return false; + case 025 when pk.AltForm != 0 && pk.GenNumber == 6: // Cosplay Pikachu + comment = "Cannot transfer Cosplay Pikachu forward."; + return true; + case 172 when pk.AltForm != 0 && pk.GenNumber == 4: // Spiky Eared Pichu + comment = "Cannot transfer Spiky-Eared Pichu forward."; + return true; + } + } + /// /// Converts a PKM from one Generation 3 format to another. If it matches the destination format, the conversion will automatically return. ///