mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-10 22:54:14 +00:00
858aa50689
exercise in deferred execution/state machine, only calculate possible
matches until a sufficiently valid match is obtained. Previous setup
would try to calculate the 'best match' and had band-aid workarounds in
cases where a subsequent check may determine it to be a false match.
There's still more ways to improve speed:
- precalculate relationships for Encounter Slots rather than iterating
over every area
- yielding individual slots instead of an entire area
- group non-egg wondercards by ID in a dict/hashtable for faster
retrieval
reworked some internals:
- EncounterMatch is always an IEncounterable instead of an object, for
easy pattern matching.
- Splitbreed checking is done per encounter and is stored in the
EncounterEgg result
- Encounter validation uses Encounter/Move/RelearnMove/Evolution to
whittle to the final encounter.
As a part of the encounter matching, a lazy peek is used to check if an
invalid encounter should be retained instead of discarded; if another
encounter has not been checked, it'll stop the invalid checks and move
on. If it is the last encounter, no other valid encounters exist so it
will keep the parse for the invalid encounter.
If no encounters are yielded, then there is no encountermatch. An
EncounterInvalid is created to store basic details, and the parse is
carried out.
Breaks some legality checking features for flagging invalid moves in
more detail, but those can be re-added in a separate check (if
splitbreed & any move invalid -> check for other split moves).
Should now be easier to follow the flow & maintain 😄
|
||
---|---|---|
.. | ||
PersonalInfo.cs | ||
PersonalInfoB2W2.cs | ||
PersonalInfoBW.cs | ||
PersonalInfoG1.cs | ||
PersonalInfoG2.cs | ||
PersonalInfoG3.cs | ||
PersonalInfoG4.cs | ||
PersonalInfoORAS.cs | ||
PersonalInfoSM.cs | ||
PersonalInfoXY.cs | ||
PersonalTable.cs |