mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-09-13 01:25:22 -05:00
Handle MANôA and FALCçN SPA->FRE Gen2 Trades
Transporter remaps certain locale specific chars depending on the source ROM's version. Since VC can trade between languages, there are 2 Spanish in-game trades that have glyphs subject to remapping, if it's transferred from a French game. If the spanish trade is transferred from a french game, it must match the mutated string. ty @Lusamine & helpers :D
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
namespace PKHeX.Core
|
||||
using static PKHeX.Core.Species;
|
||||
|
||||
namespace PKHeX.Core
|
||||
{
|
||||
public sealed class EncounterTrade2 : EncounterTradeGB
|
||||
{
|
||||
@@ -52,15 +54,42 @@ private bool IsValidTradeOTName(PKM pkm)
|
||||
if (pkm.Korean)
|
||||
return GetOT((int)LanguageID.Korean) == OT;
|
||||
|
||||
var lang = GetInternationalLanguageID(OT);
|
||||
if (pkm.Format < 7)
|
||||
return lang != -1;
|
||||
|
||||
switch (Species)
|
||||
{
|
||||
case (int)Voltorb when pkm.Language == (int)LanguageID.French:
|
||||
if (lang == (int)LanguageID.Spanish)
|
||||
return false;
|
||||
if (lang != -1)
|
||||
return true;
|
||||
return OT == "FALCçN"; // FALCÁN
|
||||
|
||||
case (int)Shuckle when pkm.Language == (int)LanguageID.French:
|
||||
if (lang == (int)LanguageID.Spanish)
|
||||
return false;
|
||||
if (lang != -1)
|
||||
return true;
|
||||
return OT == "MANôA"; // MANÍA
|
||||
|
||||
default: return lang != -1;
|
||||
}
|
||||
}
|
||||
|
||||
private int GetInternationalLanguageID(string OT)
|
||||
{
|
||||
const int start = (int)LanguageID.English;
|
||||
const int end = (int)LanguageID.Spanish;
|
||||
|
||||
var tr = TrainerNames;
|
||||
for (int i = start; i <= end; i++)
|
||||
{
|
||||
if (TrainerNames[i] == OT)
|
||||
return true;
|
||||
if (tr[i] == OT)
|
||||
return i;
|
||||
}
|
||||
return false;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,12 +27,7 @@ private static IEnumerable<IEncounterable> GenerateRawEncounters12(PKM pkm, Game
|
||||
var deferred = new List<IEncounterable>();
|
||||
foreach (var t in EncounterTradeGenerator.GetValidEncounterTrades(pkm, chain, game))
|
||||
{
|
||||
// some OTs are longer than the keyboard entry; don't defer these
|
||||
if (pkm.Format >= 7 && pkm.OT_Name.Length <= (pkm.Japanese || pkm.Korean ? 5 : 7))
|
||||
{
|
||||
deferred.Add(t);
|
||||
continue;
|
||||
}
|
||||
// Gen2 trades are strictly matched (OT/Nick), while Gen1 trades allow for deferral (shrug).
|
||||
if (t is EncounterTrade1 t1 && t1.IsMatchDeferred(pkm))
|
||||
{
|
||||
deferred.Add(t);
|
||||
|
||||
@@ -128,7 +128,7 @@ private void VerifyG1OTWithinBounds(LegalityAnalysis data, string str)
|
||||
{
|
||||
if (StringConverter12.GetIsG1English(str))
|
||||
{
|
||||
if (str.Length > 7 && !(data.EncounterOriginal is EncounterTrade)) // OT already verified; GER shuckle has 8 chars
|
||||
if (str.Length > 7 && !(data.EncounterOriginal is EncounterTradeGB)) // OT already verified; GER shuckle has 8 chars
|
||||
data.AddLine(GetInvalid(LOTLong));
|
||||
}
|
||||
else if (StringConverter12.GetIsG1Japanese(str))
|
||||
@@ -141,7 +141,7 @@ private void VerifyG1OTWithinBounds(LegalityAnalysis data, string str)
|
||||
if (str.Length > 5)
|
||||
data.AddLine(GetInvalid(LOTLong));
|
||||
}
|
||||
else
|
||||
else if (!(data.EncounterOriginal is EncounterTrade2)) // OT already verified; SPA Shuckle/Voltorb transferred from French can yield 2 inaccessible chars
|
||||
{
|
||||
data.AddLine(GetInvalid(LG1CharOT));
|
||||
}
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user