mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-05-09 04:24:36 -05:00
Simplify formchange calls
Don't use the dex chain for certain checks, it's unnecessary.
This commit is contained in:
parent
8493471793
commit
bfd9bf6b53
|
|
@ -246,7 +246,7 @@ public virtual bool IsMatch(PKM pkm, int lvl)
|
|||
if (CurrentLevel != -1 && CurrentLevel > pkm.CurrentLevel)
|
||||
return false;
|
||||
|
||||
if (Form != pkm.AltForm && !Legal.IsFormChangeable(pkm, pkm.Species))
|
||||
if (Form != pkm.AltForm && !Legal.IsFormChangeable(pkm, Species))
|
||||
return false;
|
||||
if (OTGender != -1 && OTGender != pkm.OT_Gender)
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -132,12 +132,12 @@ public abstract class MysteryGift : IEncounterable, IMoveset, IGeneration, ILoca
|
|||
public PKM ConvertToPKM(ITrainerInfo SAV) => ConvertToPKM(SAV, EncounterCriteria.Unrestricted);
|
||||
public abstract PKM ConvertToPKM(ITrainerInfo SAV, EncounterCriteria criteria);
|
||||
|
||||
protected abstract bool IsMatchExact(PKM pkm, IEnumerable<DexLevel> vs);
|
||||
protected abstract bool IsMatchExact(PKM pkm);
|
||||
protected abstract bool IsMatchDeferred(PKM pkm);
|
||||
|
||||
public EncounterMatchRating IsMatch(PKM pkm, IEnumerable<DexLevel> vs)
|
||||
{
|
||||
if (!IsMatchExact(pkm, vs))
|
||||
if (!IsMatchExact(pkm))
|
||||
return EncounterMatchRating.None;
|
||||
if (IsMatchDeferred(pkm))
|
||||
return EncounterMatchRating.Deferred;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace PKHeX.Core
|
||||
{
|
||||
|
|
@ -130,7 +128,7 @@ public override PKM ConvertToPKM(ITrainerInfo SAV, EncounterCriteria criteria)
|
|||
|
||||
public bool CanBeReceivedBy(int pkmVersion) => (CardCompatibility >> pkmVersion & 1) == 1;
|
||||
|
||||
protected override bool IsMatchExact(PKM pkm, IEnumerable<DexLevel> vs)
|
||||
protected override bool IsMatchExact(PKM pkm)
|
||||
{
|
||||
var wc = Gift.PK;
|
||||
if (!wc.IsEgg)
|
||||
|
|
@ -162,7 +160,7 @@ protected override bool IsMatchExact(PKM pkm, IEnumerable<DexLevel> vs)
|
|||
return false;
|
||||
}
|
||||
|
||||
if (wc.AltForm != pkm.AltForm && vs.All(dl => !Legal.IsFormChangeable(pkm, dl.Species)))
|
||||
if (wc.AltForm != pkm.AltForm && !Legal.IsFormChangeable(pkm, Species))
|
||||
return false;
|
||||
|
||||
if (wc.Ball != pkm.Ball) return false;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace PKHeX.Core
|
||||
|
|
@ -333,7 +331,7 @@ private void SetIVs(PKM pk)
|
|||
pk.IVs = finalIVs;
|
||||
}
|
||||
|
||||
protected override bool IsMatchExact(PKM pkm, IEnumerable<DexLevel> vs)
|
||||
protected override bool IsMatchExact(PKM pkm)
|
||||
{
|
||||
if (!IsEgg)
|
||||
{
|
||||
|
|
@ -366,7 +364,8 @@ protected override bool IsMatchExact(PKM pkm, IEnumerable<DexLevel> vs)
|
|||
return false;
|
||||
}
|
||||
|
||||
if (Form != pkm.AltForm && vs.All(dl => !Legal.IsFormChangeable(pkm, dl.Species))) return false;
|
||||
if (Form != pkm.AltForm && !Legal.IsFormChangeable(pkm, Species))
|
||||
return false;
|
||||
|
||||
if (Level != pkm.Met_Level) return false;
|
||||
if (Ball != pkm.Ball) return false;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace PKHeX.Core
|
||||
|
|
@ -263,7 +262,7 @@ public static bool IsRangerManaphy(PKM pkm)
|
|||
return met == Locations.LinkTrade4 || met == 0;
|
||||
}
|
||||
|
||||
protected override bool IsMatchExact(PKM pkm, IEnumerable<DexLevel> vs) => false;
|
||||
protected override bool IsMatchExact(PKM pkm) => false;
|
||||
protected override bool IsMatchDeferred(PKM pkm) => false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
|
|
@ -474,7 +473,7 @@ private void SetIVs(PKM pk)
|
|||
pk.IVs = finalIVs;
|
||||
}
|
||||
|
||||
protected override bool IsMatchExact(PKM pkm, IEnumerable<DexLevel> vs)
|
||||
protected override bool IsMatchExact(PKM pkm)
|
||||
{
|
||||
if (pkm.Egg_Location == 0) // Not Egg
|
||||
{
|
||||
|
|
@ -490,7 +489,7 @@ protected override bool IsMatchExact(PKM pkm, IEnumerable<DexLevel> vs)
|
|||
if (EncryptionConstant != 0 && EncryptionConstant != pkm.EncryptionConstant) return false;
|
||||
}
|
||||
|
||||
if (Form != pkm.AltForm && vs.All(dl => !Legal.IsFormChangeable(pkm, dl.Species)))
|
||||
if (Form != pkm.AltForm && !Legal.IsFormChangeable(pkm, Species))
|
||||
return false;
|
||||
|
||||
if (IsEgg)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace PKHeX.Core
|
||||
{
|
||||
|
|
@ -207,7 +206,7 @@ private static GameVersion GetRandomVersion(GameVersion version)
|
|||
}
|
||||
}
|
||||
|
||||
protected override bool IsMatchExact(PKM pkm, IEnumerable<DexLevel> vs)
|
||||
protected override bool IsMatchExact(PKM pkm)
|
||||
{
|
||||
// Gen3 Version MUST match.
|
||||
if (Version != 0 && !(Version).Contains((GameVersion)pkm.Version))
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
|
|
@ -454,7 +453,7 @@ private void SetIVs(PKM pk)
|
|||
pk.IVs = finalIVs;
|
||||
}
|
||||
|
||||
protected override bool IsMatchExact(PKM pkm, IEnumerable<DexLevel> vs)
|
||||
protected override bool IsMatchExact(PKM pkm)
|
||||
{
|
||||
if (pkm.Egg_Location == 0) // Not Egg
|
||||
{
|
||||
|
|
@ -475,7 +474,8 @@ protected override bool IsMatchExact(PKM pkm, IEnumerable<DexLevel> vs)
|
|||
if (EncryptionConstant != 0 && EncryptionConstant != pkm.EncryptionConstant) return false;
|
||||
if (Language != 0 && Language != pkm.Language) return false;
|
||||
}
|
||||
if (Form != pkm.AltForm && vs.All(dl => !Legal.IsFormChangeable(pkm, dl.Species))) return false;
|
||||
if (Form != pkm.AltForm && !Legal.IsFormChangeable(pkm, Species))
|
||||
return false;
|
||||
|
||||
if (IsEgg)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
|
|
@ -490,7 +489,7 @@ public bool IsAshGreninjaWC7(PKM pkm)
|
|||
return CardID == 2046 && (pkm.SID << 16 | pkm.TID) == 0x79F57B49;
|
||||
}
|
||||
|
||||
protected override bool IsMatchExact(PKM pkm, IEnumerable<DexLevel> vs)
|
||||
protected override bool IsMatchExact(PKM pkm)
|
||||
{
|
||||
if (pkm.Egg_Location == 0) // Not Egg
|
||||
{
|
||||
|
|
@ -506,7 +505,7 @@ protected override bool IsMatchExact(PKM pkm, IEnumerable<DexLevel> vs)
|
|||
if (Language != 0 && Language != pkm.Language) return false;
|
||||
}
|
||||
|
||||
if (Form != pkm.AltForm && vs.All(dl => !Legal.IsFormChangeable(pkm, dl.Species)))
|
||||
if (Form != pkm.AltForm && !Legal.IsFormChangeable(pkm, Species))
|
||||
{
|
||||
if (Species == (int)Core.Species.Rockruff && Form == 1 && pkm.Species == 745 && pkm.AltForm == 2)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using static PKHeX.Core.RibbonIndex;
|
||||
|
|
@ -487,7 +486,7 @@ private void SetIVs(PKM pk)
|
|||
pk.IVs = finalIVs;
|
||||
}
|
||||
|
||||
protected override bool IsMatchExact(PKM pkm, IEnumerable<DexLevel> vs)
|
||||
protected override bool IsMatchExact(PKM pkm)
|
||||
{
|
||||
if (pkm.Egg_Location == 0) // Not Egg
|
||||
{
|
||||
|
|
@ -503,7 +502,7 @@ protected override bool IsMatchExact(PKM pkm, IEnumerable<DexLevel> vs)
|
|||
if (EncryptionConstant != 0 && EncryptionConstant != pkm.EncryptionConstant) return false;
|
||||
}
|
||||
|
||||
if (Form != pkm.AltForm && vs.All(z => !Legal.IsFormChangeable(pkm, z.Species)))
|
||||
if (Form != pkm.AltForm && !Legal.IsFormChangeable(pkm, Species))
|
||||
return false;
|
||||
|
||||
if (IsEgg)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace PKHeX.Core
|
||||
|
|
@ -98,7 +97,7 @@ public LanguageID LanguageReceived
|
|||
|
||||
// Mystery Gift implementation
|
||||
public override int Format => 7;
|
||||
protected override bool IsMatchExact(PKM pkm, IEnumerable<DexLevel> vs) => false;
|
||||
protected override bool IsMatchExact(PKM pkm) => false;
|
||||
protected override bool IsMatchDeferred(PKM pkm) => false;
|
||||
public override int Location { get; set; }
|
||||
public override int EggLocation { get; set; }
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user