PKHeX/PKHeX.Core/PKM/Shared
Kurt 1e86fdcea8
Fracture the encounter matching checks to allow progressive validation (#3137)
## Issue

We want to discard-but-remember any slots that aren't a perfect fit, on the off chance that a better one exists later in the search space. If there's no better match, then we gotta go with what we got.

## Example:
Wurmple exists in area `X`, and also has a more rare slot for Silcoon, with the same level for both slots. 
* We have a Silcoon that we've leveled up a few times.

Was our Silcoon originally a Wurmple, or was it caught as a Silcoon? 
* To be sure, we have to check the EC/PID if the Wurmple wouldn't evolve into Cascoon instead.
* We don't want to wholly reject that Wurmple slot, as maybe the Met Level isn't within Silcoon's slot range.

---

Existing implementation would store "deferred" matches in a list; we only need to keep 1 of these matches around (less allocation!). We also want to differentiate between a "good" deferral and a "bad" deferral; I don't think this is necessary but it's currently used by Mystery Gift matching (implemented for the Eeveelution mystery gifts which matter for evolution moves).

The existing logic didn't use inheritance, and instead had static methods being reused across generations. Quite kludgy. Also, the existing logic was a pain to modify the master encounter yield methods, as one generation's quirks had to not impact all other generations that used the method.

---

The new implementation splits out the encounter yielding methods to be separate for each generation / subset. Now, things don't have to check `WasLink` for Gen7 origin, because Pokémon Link wasn't a thing in Gen7.

---

## Future
Maybe refactoring yielders into "GameCores" that expose yielding behaviors / properties, rather than the static logic. As more generations and side-gamegroups get added (thanks LGPE/GO/GameCube), all this switch stuff gets annoying to maintain instead of just overriding/inheritance.

## Conclusion

This shouldn't impact any legality results negatively; if you notice any regressions, report them! This should reduce false flags where we didn't defer-discard an encounter when we should have (wild area mons being confused with raids).
2021-01-29 17:55:27 -08:00
..
AlcremieDecoration.cs Add alcremie form display for dex edit 2019-11-17 09:34:04 -08:00
G3PKM.cs Make ContestStat fields byte (from int) 2021-01-01 13:39:08 -08:00
G4PKM.cs Make ContestStat fields byte (from int) 2021-01-01 13:39:08 -08:00
G6PKM.cs Unify concepts with different names 2020-12-10 20:42:30 -08:00
GBPKM.cs moar is or 2020-12-25 12:30:26 -08:00
GBPKML.cs Simplify value passing 2021-01-16 13:56:37 -08:00
IAffection.cs Minor clean 2020-08-02 15:51:22 -07:00
IAwakened.cs Use more expression return style 2021-01-01 17:08:49 -08:00
IBattleVersion.cs Clamp generation fetch for battleversion 2021-01-29 09:56:31 -08:00
ICaughtData2.cs Add Stadium2 Support 2020-10-02 18:08:40 -07:00
IContestStats.cs Make ContestStat fields byte (from int) 2021-01-01 13:39:08 -08:00
IDynamaxLevel.cs Simplify more expressions 2021-01-04 17:31:43 -08:00
IFavorite.cs Minor tweaks 2019-11-28 14:00:55 -08:00
IFormArgument.cs Unify concepts with different names 2020-12-10 20:42:30 -08:00
IGameValueLimit.cs Minor tweaks 2019-11-28 14:00:55 -08:00
IGeneration.cs Unify concepts with different names 2020-12-10 20:42:30 -08:00
IGeoTrack.cs Reduce visibility of internal legality enum 2020-08-30 15:48:34 -07:00
IGigantamax.cs moar is or 2020-12-25 12:30:26 -08:00
IHandlerLanguage.cs Sword/Shield Update 2019-11-15 17:52:08 -08:00
IHomeTrack.cs Extract home tracker to interface 2020-02-12 18:52:48 -08:00
IHyperTrain.cs Delete duplicate HT bit fetch method 2021-01-01 16:39:33 -08:00
ILangNick.cs Rework mg nick/lang checks 2018-08-30 18:09:52 -07:00
IMemoryHT.cs Minor clean 2020-08-02 15:51:22 -07:00
IMemoryOT.cs Minor clean 2020-08-02 15:51:22 -07:00
INature.cs Sword/Shield Update 2019-11-15 17:52:08 -08:00
IRegionOrigin.cs Split Country/Region/ConsoleRegion from ITrainerInfo 2020-07-31 13:53:42 -07:00
IScaledSize.cs Sword/Shield Update 2019-11-15 17:52:08 -08:00
IShadowPKM.cs Revise Shadow state detection 2020-10-06 22:36:27 -07:00
ISpeciesForm.cs Unify concepts with different names 2020-12-10 20:42:30 -08:00
ITrainerID.cs Unify concepts with different names 2020-12-10 20:42:30 -08:00
ITrainerMemories.cs Split memories from main pkm class to interface 2020-07-31 17:25:14 -07:00
PokeList1.cs Target type'd new 2020-12-21 17:17:56 -08:00
PokeList2.cs Minor clean 2021-01-02 19:11:34 -08:00
PokeListGB.cs moar is or 2020-12-25 12:30:26 -08:00
PokeListType.cs Extract PokemonList* to inherited class 2018-08-05 17:28:54 -07:00
PokeSize.cs Use more expression return style 2021-01-01 17:08:49 -08:00
QRPK7.cs Fracture the encounter matching checks to allow progressive validation (#3137) 2021-01-29 17:55:27 -08:00
QRPKM.cs Remove QRText property 2018-12-26 17:31:23 -08:00