Try and force destination language on transfer

Closes #2314
This commit is contained in:
Kurt 2019-05-27 11:23:47 -07:00
parent 88d7be62d9
commit 33a07a6fcd
3 changed files with 16 additions and 2 deletions

View file

@ -164,7 +164,7 @@ namespace PKHeX.Core
Geo1_Country = PKMConverter.Country,
Geo1_Region = PKMConverter.Region
};
pk7.Language = GuessedLanguage(PKMConverter.Language);
pk7.Language = TransferLanguage(PKMConverter.Language);
pk7.Nickname = PKX.GetSpeciesNameGeneration(pk7.Species, pk7.Language, pk7.Format);
if (otname[0] == StringConverter12.G1TradeOTCode) // Ingame Trade
pk7.OT_Name = Encounters1.TradeOTG1[pk7.Language];

View file

@ -163,7 +163,7 @@ namespace PKHeX.Core
Geo1_Country = PKMConverter.Country,
Geo1_Region = PKMConverter.Region
};
pk7.Language = GuessedLanguage(PKMConverter.Language);
pk7.Language = TransferLanguage(PKMConverter.Language);
pk7.Nickname = PKX.GetSpeciesNameGeneration(pk7.Species, pk7.Language, pk7.Format);
if (otname[0] == StringConverter12.G1TradeOTCode) // Ingame Trade
pk7.OT_Name = Encounters1.TradeOTG1[pk7.Language];

View file

@ -241,6 +241,20 @@ namespace PKHeX.Core
return (int)LanguageID.English;
}
/// <summary>
/// Tries to guess the source language ID when transferred to future generations (7+)
/// </summary>
/// <param name="destLanguage">Destination language ID</param>
/// <returns>Source language ID</returns>
protected int TransferLanguage(int destLanguage)
{
// if the Species name of the destination language matches the current nickname, transfer with that language.
var expect = PKX.GetSpeciesNameGeneration(Species, destLanguage, 2);
if (Nickname == expect)
return destLanguage;
return GuessedLanguage(destLanguage);
}
public override ushort[] GetStats(PersonalInfo p)
{
var lv = Stat_Level;