Add some documentation for the high-level encounter finding
Fix encounterstatics not being filtered for the associated game version
(closes#1372)
was a side effect of refactoring this week
shifts encounter data from Legal's split tables to individual files for
easier maintenance and initialization. Legal Core's init is so much
simpler now.
fix resource name typo
Indicates why another type of encounter to match to was rejected, mostly
useful for diagnosing past gen specimens to figure out what changes need
to be made for that encounter to persist.
* Add move source to the check result for current moves, it will be used for analysis of evolution with move to determine how many egg moves had the pokemon and determine if the evolution move could be a egg move that was forgotten
* Verify evolution for species that evolved leveling up with an specific move learned, the evolution must be at least one level after the pokemon could legally learn the move or one level after transfer to the first generation where it can evolve
* Check to detect traded unevolved Kadabra based in catch rate and moves exclusive from yellow or red/blue
If pokemon have data exclusive from one version but is in another version that means it should be evolved
* Check no tradeback moves for preevolutions, like Pichu exclusive non tradeback moves for a Pikachu, that Pikachu could not have at the same time Pichu gen 2 moves and gen 1 moves because move reminder do not allow to relearn Pichu moves and gen 2 moves must be forgotten to trade into generation 1 games
* Legallity strings for non tradeback checks
* https://bulbapedia.bulbagarden.net/wiki/Pok%C3%A9mon_breeding#Passing_moves_down
Eggs only inherit a level up move if both parents know the move, that means genderless and male only moves could not have any level up move as an egg except the base egg moves because Ditto is one parent
Nidoran male and Volbeat excluded because they can breed with Nidoran female and Illusime
* Small check to not search for egg moves in genderless pokemon, generation 2 data include egg moves for Starmie
* Fix female only species
* Stomp is not a possible egg moves of Stanee
* Fix Steenee evolution move, it cant be inherited as an egg
Fixes HGSS egg moves, and improves encounter detail detection.
example: togepi from FRLG transferred up, old detection couldn't
differentiate the gift egg from a regular egg; however, PIDIVs can lend
a hand -- eggs don't have a PIDIV!
fixed shiny BACD spread detection (in regards to antishiny rerolls).
Shiny WISHMKR now detected correctly.
Track gen1/2 origin game as well as generation
fix pk2 gender setting (incorrect bitmask & wasn't set from tabs)
extend female gender check for gen2 to apply to GS encounters -- if met
location is missing, was traded to gen1 which clears gender.
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 😄