mirror of
https://github.com/kwsch/PKHeX
synced 2025-02-17 05:48:44 +00:00
Use EncounterMatch when EncounterOriginal doesn't matter
This commit is contained in:
parent
7a4d8925f2
commit
97be69bca1
7 changed files with 18 additions and 18 deletions
|
@ -19,7 +19,7 @@
|
|||
if (la.Info.Generation == 2)
|
||||
return 0;
|
||||
|
||||
var v = la.EncounterOriginal;
|
||||
var v = la.EncounterMatch;
|
||||
switch (v)
|
||||
{
|
||||
case EncounterTrade1 c:
|
||||
|
|
|
@ -115,8 +115,8 @@ namespace PKHeX.Core
|
|||
{
|
||||
var dupes = AllAnalysis.Where(z =>
|
||||
z.Info.Generation >= 3
|
||||
&& z.EncounterOriginal is MysteryGift {EggEncounter: true} && !z.pkm.WasTradedEgg)
|
||||
.GroupBy(z => ((MysteryGift)z.EncounterOriginal).CardTitle);
|
||||
&& z.EncounterMatch is MysteryGift {EggEncounter: true} && !z.pkm.WasTradedEgg)
|
||||
.GroupBy(z => ((MysteryGift)z.EncounterMatch).CardTitle);
|
||||
|
||||
foreach (var dupe in dupes)
|
||||
{
|
||||
|
|
|
@ -114,7 +114,7 @@ namespace PKHeX.Core
|
|||
return new int[4];
|
||||
|
||||
var pkm = analysis.pkm;
|
||||
var enc = info.EncounterOriginal;
|
||||
var enc = info.EncounterMatch;
|
||||
var parsed = VerifyRelearnMoves.GetSuggestedRelearn(pkm, enc, info.Relearn);
|
||||
if (parsed.Count == 0) // Always true for Origins < 6 and encounters without relearn permitted.
|
||||
return new int[4];
|
||||
|
|
|
@ -49,7 +49,7 @@ namespace PKHeX.Core
|
|||
|
||||
private static readonly ValidEncounterMoves NONE = new();
|
||||
public ValidEncounterMoves EncounterMoves { get; internal set; } = NONE;
|
||||
public IReadOnlyList<EvoCriteria>[] EvoChainsAllGens => _evochains ??= EvolutionChain.GetEvolutionChainsAllGens(pkm, EncounterOriginal);
|
||||
public IReadOnlyList<EvoCriteria>[] EvoChainsAllGens => _evochains ??= EvolutionChain.GetEvolutionChainsAllGens(pkm, EncounterMatch);
|
||||
private IReadOnlyList<EvoCriteria>[]? _evochains;
|
||||
|
||||
/// <summary><see cref="RNG"/> related information that generated the <see cref="PKM.PID"/>/<see cref="PKM.IVs"/> value(s).</summary>
|
||||
|
|
|
@ -181,19 +181,19 @@ namespace PKHeX.Core
|
|||
// everything below here is not Form 0, so it has a form.
|
||||
if (format >= 7 && Info.Generation < 7)
|
||||
{
|
||||
if (species == 25 || Legal.AlolanOriginForms.Contains(species) || Legal.AlolanVariantEvolutions12.Contains(data.EncounterOriginal.Species))
|
||||
if (species == 25 || Legal.AlolanOriginForms.Contains(species) || Legal.AlolanVariantEvolutions12.Contains(data.EncounterMatch.Species))
|
||||
return GetInvalid(LFormInvalidGame);
|
||||
}
|
||||
if (format >= 8 && Info.Generation < 8)
|
||||
{
|
||||
var orig = data.EncounterOriginal.Species;
|
||||
var orig = data.EncounterMatch.Species;
|
||||
if (Legal.GalarOriginForms.Contains(species) || Legal.GalarVariantFormEvolutions.Contains(orig))
|
||||
{
|
||||
if (species == (int)Species.Meowth && data.EncounterOriginal.Form != 2)
|
||||
if (species == (int)Species.Meowth && data.EncounterMatch.Form != 2)
|
||||
{
|
||||
// We're okay here. There's also Alolan Meowth...
|
||||
}
|
||||
else if ((orig is (int) Species.MrMime or (int)Species.MimeJr) && pkm.CurrentLevel > data.EncounterOriginal.LevelMin && Info.Generation >= 4)
|
||||
else if ((orig is (int) Species.MrMime or (int)Species.MimeJr) && pkm.CurrentLevel > data.EncounterMatch.LevelMin && Info.Generation >= 4)
|
||||
{
|
||||
// We're okay with a Mime Jr. that has evolved via level up.
|
||||
}
|
||||
|
|
|
@ -12,8 +12,8 @@ namespace PKHeX.Core
|
|||
public override void Verify(LegalityAnalysis data)
|
||||
{
|
||||
var pkm = data.pkm;
|
||||
var EncounterMatch = data.EncounterOriginal;
|
||||
if (EncounterMatch is MysteryGift gift)
|
||||
var enc = data.EncounterOriginal;
|
||||
if (enc is MysteryGift gift)
|
||||
{
|
||||
if (gift.Level != pkm.Met_Level && pkm.HasOriginalMetLocation)
|
||||
{
|
||||
|
@ -39,14 +39,14 @@ namespace PKHeX.Core
|
|||
|
||||
if (pkm.IsEgg)
|
||||
{
|
||||
int elvl = EncounterMatch.LevelMin;
|
||||
int elvl = enc.LevelMin;
|
||||
if (elvl != pkm.CurrentLevel)
|
||||
{
|
||||
data.AddLine(GetInvalid(string.Format(LEggFMetLevel_0, elvl)));
|
||||
return;
|
||||
}
|
||||
|
||||
var reqEXP = EncounterMatch is EncounterStatic {Version: GameVersion.C}
|
||||
var reqEXP = enc is EncounterStatic {Version: GameVersion.C}
|
||||
? 125 // Gen2 Dizzy Punch gifts always have 125 EXP, even if it's more than the Lv5 exp required.
|
||||
: Experience.GetEXP(elvl, pkm.PersonalInfo.EXPGrowth);
|
||||
if (reqEXP != pkm.EXP)
|
||||
|
@ -57,7 +57,7 @@ namespace PKHeX.Core
|
|||
int lvl = pkm.CurrentLevel;
|
||||
if (lvl < pkm.Met_Level)
|
||||
data.AddLine(GetInvalid(LLevelMetBelow));
|
||||
else if (!EncounterMatch.IsWithinRange(pkm) && lvl != 100 && pkm.EXP == Experience.GetEXP(lvl, pkm.PersonalInfo.EXPGrowth))
|
||||
else if (!enc.IsWithinRange(pkm) && lvl != 100 && pkm.EXP == Experience.GetEXP(lvl, pkm.PersonalInfo.EXPGrowth))
|
||||
data.AddLine(Get(LLevelEXPThreshold, Severity.Fishy));
|
||||
else
|
||||
data.AddLine(GetValid(LLevelMetSane));
|
||||
|
@ -66,7 +66,7 @@ namespace PKHeX.Core
|
|||
public void VerifyG1(LegalityAnalysis data)
|
||||
{
|
||||
var pkm = data.pkm;
|
||||
var EncounterMatch = data.EncounterOriginal;
|
||||
var enc = data.EncounterMatch;
|
||||
if (pkm.IsEgg)
|
||||
{
|
||||
const int elvl = 5;
|
||||
|
@ -83,7 +83,7 @@ namespace PKHeX.Core
|
|||
|
||||
// There is no way to prevent a gen1 trade evolution as held items (everstone) did not exist.
|
||||
// Machoke, Graveler, Haunter and Kadabra captured in the second phase evolution, excluding in-game trades, are already checked
|
||||
if (pkm.Format <= 2 && EncounterMatch is not EncounterTrade && EncounterMatch.Species == pkm.Species && GBRestrictions.Trade_Evolution1.Contains(EncounterMatch.Species))
|
||||
if (pkm.Format <= 2 && enc is not EncounterTrade && enc.Species == pkm.Species && GBRestrictions.Trade_Evolution1.Contains(enc.Species))
|
||||
VerifyG1TradeEvo(data);
|
||||
}
|
||||
|
||||
|
|
|
@ -118,7 +118,6 @@ namespace PKHeX.Core
|
|||
|
||||
private void VerifyMiscG1CatchRate(LegalityAnalysis data, PK1 pk1)
|
||||
{
|
||||
var e = data.EncounterMatch;
|
||||
var catch_rate = pk1.Catch_Rate;
|
||||
var result = pk1.TradebackStatus == TradebackType.Gen1_NotTradeback
|
||||
? GetWasNotTradeback()
|
||||
|
@ -137,6 +136,7 @@ namespace PKHeX.Core
|
|||
|
||||
CheckResult GetWasNotTradeback()
|
||||
{
|
||||
var e = data.EncounterMatch;
|
||||
if (e is EncounterStatic1E {Version: GameVersion.Stadium} || e is EncounterTrade1)
|
||||
return GetValid(LG1CatchRateMatchPrevious); // Encounters detected by the catch rate, cant be invalid if match this encounters
|
||||
|
||||
|
@ -218,7 +218,7 @@ namespace PKHeX.Core
|
|||
if (pkm.Move1_PP != pkm.GetMovePP(pkm.Move1, 0) || pkm.Move2_PP != pkm.GetMovePP(pkm.Move2, 0) || pkm.Move3_PP != pkm.GetMovePP(pkm.Move3, 0) || pkm.Move4_PP != pkm.GetMovePP(pkm.Move4, 0))
|
||||
data.AddLine(GetInvalid(LEggPP, Egg));
|
||||
|
||||
var EncounterMatch = data.EncounterOriginal;
|
||||
var EncounterMatch = data.EncounterMatch;
|
||||
var HatchCycles = EncounterMatch is EncounterStatic s ? s.EggCycles : 0;
|
||||
if (HatchCycles == 0) // no value set
|
||||
HatchCycles = pkm.PersonalInfo.HatchCycles;
|
||||
|
|
Loading…
Add table
Reference in a new issue