Flag original catchrates on g1->g2->g1 transfers

Closes #3328
This commit is contained in:
Kurt 2021-12-25 18:33:14 -08:00
parent 13e0f35e00
commit fbb9e0bf0e
2 changed files with 14 additions and 3 deletions

View file

@ -493,7 +493,11 @@ namespace PKHeX.Core
{
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
if (moves.Any(z => z != null && z.Generation != enc.Generation && z.Generation <= 2))
{
if (pkm is PK1 {Catch_Rate: not 0} g1 && !IsTradebackCatchRate(g1.Catch_Rate))
return TimeCapsuleEvaluation.BadCatchRate;
return enc.Generation == 2 ? TimeCapsuleEvaluation.Transferred21 : TimeCapsuleEvaluation.Transferred12;
}
if (pkm is not GBPKM gb)
{
@ -518,9 +522,14 @@ namespace PKHeX.Core
if (gb is PK1 pk1)
{
var rate = pk1.Catch_Rate;
if (rate == 0)
return TimeCapsuleEvaluation.Transferred12;
bool isTradebackItem = IsTradebackCatchRate(rate);
if (IsCatchRateMatchEncounter(enc, pk1))
return IsTradebackCatchRate(pk1.Catch_Rate) ? TimeCapsuleEvaluation.Indeterminate : TimeCapsuleEvaluation.NotTransferred;
return IsTradebackCatchRate(pk1.Catch_Rate) ? TimeCapsuleEvaluation.Transferred12 : TimeCapsuleEvaluation.BadCatchRate;
return isTradebackItem ? TimeCapsuleEvaluation.Indeterminate : TimeCapsuleEvaluation.NotTransferred;
return isTradebackItem ? TimeCapsuleEvaluation.Transferred12 : TimeCapsuleEvaluation.BadCatchRate;
}
return TimeCapsuleEvaluation.Indeterminate;
}

View file

@ -168,7 +168,7 @@ namespace PKHeX.Core
{
var catch_rate = pk1.Catch_Rate;
var tradeback = GBRestrictions.IsTimeCapsuleTransferred(pk1, data.Info.Moves, data.EncounterMatch);
var result = tradeback == TimeCapsuleEvaluation.NotTransferred
var result = tradeback is TimeCapsuleEvaluation.NotTransferred or TimeCapsuleEvaluation.BadCatchRate
? GetWasNotTradeback(tradeback)
: GetWasTradeback(tradeback);
data.AddLine(result);
@ -185,6 +185,8 @@ namespace PKHeX.Core
CheckResult GetWasNotTradeback(TimeCapsuleEvaluation timeCapsuleEvalution)
{
if (data.Info.Moves.Any(z => z.Generation == 2))
return GetInvalid(LG1CatchRateItem);
var e = data.EncounterMatch;
if (e is EncounterStatic1E {Version: GameVersion.Stadium} or EncounterTrade1)
return GetValid(LG1CatchRateMatchPrevious); // Encounters detected by the catch rate, cant be invalid if match this encounters