mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-27 14:30:56 +00:00
add gen12 generator kadabra catch rate case
https://projectpokemon.org/home/forums/topic/46259-yellow-kadabra/ Thanks Cloud AC ! update misc verifier for catchrate to better indicate for any->nontradeback scenarios
This commit is contained in:
parent
fe7fea877b
commit
a100488142
2 changed files with 18 additions and 5 deletions
|
@ -184,6 +184,10 @@ namespace PKHeX.Core
|
|||
private static IEnumerable<GBEncounterData> GenerateFilteredEncounters(PKM pkm)
|
||||
{
|
||||
bool crystal = pkm.Format == 2 && pkm.Met_Location != 0 || pkm.Format >= 7 && pkm.OT_Gender == 1;
|
||||
bool kadabra = pkm.Species == 64 && pkm is PK1 pk1
|
||||
&& (pk1.Catch_Rate == PersonalTable.RB[64].CatchRate
|
||||
|| pk1.Catch_Rate == PersonalTable.Y[64].CatchRate); // catch rate outsider, return gen1 first always
|
||||
|
||||
var g1i = new PeekEnumerator<GBEncounterData>(get1());
|
||||
var g2i = new PeekEnumerator<GBEncounterData>(get2());
|
||||
var deferred = new List<GBEncounterData>();
|
||||
|
@ -193,7 +197,7 @@ namespace PKHeX.Core
|
|||
var obj = move.Peek();
|
||||
|
||||
if ((obj.Generation == 1 && (pkm.Korean || (obj.Encounter is EncounterTrade t && !IsEncounterTrade1Valid(pkm, t))))
|
||||
|| (obj.Generation == 2 && (pkm.Korean && (obj.Encounter is IVersion v && v.Version == GameVersion.C))))
|
||||
|| (obj.Generation == 2 && (pkm.Korean && (obj.Encounter is IVersion v && v.Version == GameVersion.C) || kadabra)))
|
||||
deferred.Add(obj);
|
||||
else
|
||||
yield return obj;
|
||||
|
|
|
@ -83,13 +83,13 @@ namespace PKHeX.Core
|
|||
}
|
||||
private void VerifyMiscG1CatchRate(LegalityAnalysis data, PK1 pk1)
|
||||
{
|
||||
var EncounterMatch = data.EncounterMatch;
|
||||
var e = data.EncounterMatch;
|
||||
var catch_rate = pk1.Catch_Rate;
|
||||
switch (pk1.TradebackStatus)
|
||||
{
|
||||
case TradebackType.Any:
|
||||
case TradebackType.WasTradeback:
|
||||
if (catch_rate == 0 || Legal.HeldItems_GSC.Contains((ushort)catch_rate))
|
||||
if (catch_rate == 0 || (Legal.HeldItems_GSC.Contains((ushort)catch_rate) && !RateMatchesEncounter(e.Species)))
|
||||
data.AddLine(GetValid(V394));
|
||||
else if (pk1.TradebackStatus == TradebackType.WasTradeback)
|
||||
data.AddLine(GetInvalid(V395));
|
||||
|
@ -97,17 +97,26 @@ namespace PKHeX.Core
|
|||
goto case TradebackType.Gen1_NotTradeback;
|
||||
break;
|
||||
case TradebackType.Gen1_NotTradeback:
|
||||
if ((EncounterMatch as EncounterStatic)?.Version == GameVersion.Stadium || EncounterMatch is EncounterTradeCatchRate)
|
||||
if ((e as EncounterStatic)?.Version == GameVersion.Stadium || e is EncounterTradeCatchRate)
|
||||
// Encounters detected by the catch rate, cant be invalid if match this encounters
|
||||
data.AddLine(GetValid(V398));
|
||||
else if (pk1.Species == 149 && catch_rate == PersonalTable.Y[149].CatchRate || Legal.Species_NotAvailable_CatchRate.Contains(pk1.Species) && catch_rate == PersonalTable.RB[pk1.Species].CatchRate)
|
||||
data.AddLine(GetInvalid(V396));
|
||||
else if (!data.Info.EvoChainsAllGens[1].Any(e => catch_rate == PersonalTable.RB[e.Species].CatchRate || catch_rate == PersonalTable.Y[e.Species].CatchRate))
|
||||
else if (!data.Info.EvoChainsAllGens[1].Any(c => RateMatchesEncounter(c.Species)))
|
||||
data.AddLine(GetInvalid(pk1.Gen1_NotTradeback ? V397 : V399));
|
||||
else
|
||||
data.AddLine(GetValid(V398));
|
||||
break;
|
||||
}
|
||||
|
||||
bool RateMatchesEncounter(int species)
|
||||
{
|
||||
if (catch_rate == PersonalTable.RB[species].CatchRate)
|
||||
return true;
|
||||
if (catch_rate == PersonalTable.Y[species].CatchRate)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
private static void VerifyMiscFatefulEncounter(LegalityAnalysis data)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue