Fix VC edge cases

transfers decapitalize ingame-trade trainer name
Special handling for static encounters should default to last
This commit is contained in:
Kurt 2017-02-24 23:15:16 -08:00
parent 2479cad6ea
commit 90300dccd2

View file

@ -203,7 +203,8 @@ namespace PKHeX.Core
if (et?.TID == 0) // Gen1 Trade
{
string ot = pkm.OT_Name;
if (ot != "トレーナー" && ot != "TRAINER")
string tr = pkm.Format <= 2 ? "TRAINER" : "Trainer"; // decaps on transfer
if (ot != "トレーナー" && ot != tr)
AddLine(Severity.Invalid, "Incorrect OT name for RBY in-game trade.", CheckIdentifier.Trainer);
}
else // Gen2
@ -546,6 +547,7 @@ namespace PKHeX.Core
{
// Since encounter matching is super weak due to limited stored data in the structure
// Calculate all 3 at the same time and pick the best result (by species).
// Favor special event move gifts as Static Encounters when applicable
var s = Legal.getValidStaticEncounter(pkm, gen1Encounter: true);
var e = Legal.getValidWildEncounters(pkm);
var t = Legal.getValidIngameTrade(pkm, gen1Encounter: true);
@ -569,14 +571,20 @@ namespace PKHeX.Core
EncounterMatch = e;
return verifyEncounterWild();
}
if (sm <= em && sm <= tm)
{
EncounterMatch = s;
return verifyEncounterStatic();
}
if (tm <= sm && tm <= em)
{
EncounterMatch = t;
return verifyEncounterTrade();
}
// else is trade
return new CheckResult(Severity.Valid, "Valid ingame trade.", CheckIdentifier.Encounter);
// shouldn't ever hit, above 3*invalid check should abort
Console.WriteLine($"Gen1 encounter fallthrough: {pkm.FileName}");
return new CheckResult(Severity.Invalid, "Unknown encounter.", CheckIdentifier.Encounter);
}
private CheckResult verifyEncounter()
{