Use language for checking IsNicknamed flag

This commit is contained in:
Kurt
2020-08-29 10:40:41 -07:00
parent dc9aa7b1df
commit 1ee459a46c
2 changed files with 15 additions and 2 deletions

View File

@@ -29,7 +29,7 @@ public abstract class G3PKM : PKM, IRibbonSetEvent3, IRibbonSetCommon3, IRibbonS
public override uint EncryptionConstant { get => PID; set { } }
public override int Nature { get => (int)(PID % 25); set { } }
public override int AltForm { get => Species == (int)Core.Species.Unown ? PKX.GetUnownForm(PID) : 0; set { } }
public override bool IsNicknamed { get => SpeciesName.IsNicknamedAnyLanguage(Species, Nickname, Format); set { } }
public override bool IsNicknamed { get => SpeciesName.IsNicknamed(Species, Nickname, Language, 3); set { } }
public override int Gender { get => PKX.GetGenderFromPID(Species, PID); set { } }
public override int Characteristic => -1;
public override int CurrentFriendship { get => OT_Friendship; set => OT_Friendship = value; }

View File

@@ -102,7 +102,20 @@ public static bool IsNicknamedAnyLanguage(int species, string nick, int generati
return false;
var langs = Language.GetAvailableGameLanguages(generation);
return langs.All(lang => GetSpeciesNameGeneration(species, lang, generation) != nick);
return langs.All(lang => IsNicknamed(species, nick, lang, generation));
}
/// <summary>
/// Checks if a nickname matches the species name of any language.
/// </summary>
/// <param name="species">National Dex number of the Pokémon. Should be 0 if an egg.</param>
/// <param name="nick">Current name</param>
/// <param name="lang">Language ID of the Pokémon</param>
/// <param name="generation">Generation specific formatting option</param>
/// <returns>True if it does not match any language name, False if not nicknamed</returns>
public static bool IsNicknamed(int species, string nick, int lang, int generation = PKX.Generation)
{
return GetSpeciesNameGeneration(species, lang, generation) != nick;
}
/// <summary>