mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-10 06:34:19 +00:00
Add duking glyph remap check for Colo Plusle
Only applies to Spanish; other languages don't use special accent-mark chars. make logic flow easier to understand for this if-duking case.
This commit is contained in:
parent
50930b0cc5
commit
3a131f61aa
3 changed files with 19 additions and 7 deletions
|
@ -13,6 +13,12 @@ internal static class Encounters3Colo
|
|||
|
||||
internal static readonly string[] TrainerNameDuking = [string.Empty, "ギンザル", "DUKING", "DOKING", "RODRIGO", "GRAND", string.Empty, "GERMÁN"];
|
||||
|
||||
/// <summary>
|
||||
/// When transferring from Gen3->Gen4, a Spanish OT:Duking has the Á char changed to い.
|
||||
/// </summary>
|
||||
/// <see cref="StringConverter345.TransferGlyphs34(System.ReadOnlySpan{byte},int,int,System.Span{byte})"/> cref=""/>
|
||||
internal const string TrainerNameDukingSpanish4 = "GERMいN";
|
||||
|
||||
internal static readonly EncounterGift3Colo[] Gifts =
|
||||
[
|
||||
// In-Game without Bonus Disk
|
||||
|
|
|
@ -170,14 +170,19 @@ public sealed record EncounterGift3Colo : IEncounterable, IEncounterMatch, IEnco
|
|||
if ((uint)language >= TrainerNames.Length)
|
||||
return false;
|
||||
|
||||
var max = language == 1 ? 5 : 7;
|
||||
var expect = TrainerNames[language].AsSpan();
|
||||
|
||||
if (pk is CK3 && expect.SequenceEqual(trainer))
|
||||
return true; // not yet transferred to mainline Gen3
|
||||
|
||||
var max = language == 1 ? 5 : 7;
|
||||
if (expect.Length > max)
|
||||
expect = expect[..max];
|
||||
return expect.SequenceEqual(trainer);
|
||||
if (pk.Context == EntityContext.Gen3)
|
||||
return trainer.SequenceEqual(expect);
|
||||
if (IsSpanishDuking(language)) // Gen4+
|
||||
return trainer is Encounters3Colo.TrainerNameDukingSpanish4;
|
||||
return trainer.SequenceEqual(expect);
|
||||
}
|
||||
|
||||
private bool IsSpanishDuking(int language) => language is (int)LanguageID.Spanish && Species is (int)Core.Species.Plusle;
|
||||
}
|
||||
|
|
|
@ -182,12 +182,13 @@ public sealed record EncounterTrade3XD : IEncounterable, IEncounterMatch, IEncou
|
|||
var name = TrainerNames[language];
|
||||
if (pk.Context == EntityContext.Gen3)
|
||||
return trainer.SequenceEqual(name);
|
||||
|
||||
Span<char> tmp = stackalloc char[name.Length];
|
||||
StringConverter345.TransferGlyphs34(name, language, tmp);
|
||||
return trainer.SequenceEqual(tmp);
|
||||
if (IsSpanishDuking(language)) // Gen4+
|
||||
return trainer is Encounters3Colo.TrainerNameDukingSpanish4;
|
||||
return trainer.SequenceEqual(name);
|
||||
}
|
||||
|
||||
private bool IsSpanishDuking(int language) => language is (int)LanguageID.Spanish && Species is not (int)Core.Species.Elekid;
|
||||
|
||||
public bool IsNicknameMatch(PKM pk, ReadOnlySpan<char> nickname, int language)
|
||||
{
|
||||
if (!IsFixedNickname)
|
||||
|
|
Loading…
Reference in a new issue