Commit graph

11 commits

Author SHA1 Message Date
Kurt
3552e6396c Move pidivmatches check outside secondary check
gen3/4 generators auto-defer bad PIDIVs to end, so no need to keep
skipping to the very end
2017-09-30 13:42:57 -07:00
Kurt
d3a30ebf35 Refactoring +docs
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
2017-07-30 12:31:17 -07:00
Kurt
cb8777f767 Refactoring
now that the logic has become more stable, polish away some complexity
2017-07-29 11:54:52 -07:00
Kurt
23c4e81dea Add invalid match alternatives to verbose output
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.
2017-07-12 09:02:03 -07:00
Kurt
ca04abfca6 Refactoring
misc cleanup/breaking up large methods from recent PR
2017-07-06 17:01:29 -07:00
javierhimura
461fb70f90 Generation 1/2 Legal improvements (#1310)
* Added location to encounter slot to make verification againts the location of the encounter when the pokemon has lost met location, like generation 2 heabutt tree, jhoto surfing in route 45 and in the future generation 4 munchlax tree

Added version to generation 1 and 2 encounter locations to filter by catch rate based of the version of the encounter and check initial moves of the encounter only for the game that match the encounter

Filter generation 2 pokemon for crystal who have met location based of the time of day when it was captured

Completed version to static and traded encounters for gen 1 pokemon, to avoid check a red encounter with yellow initial moves, if an encounter is possible in both games with diferent moves it is duplicated (like eevee), if it is possible in both games with the same moves is left as RBY, the encounter will only use red/blue moveset

Verify some invalid gen 2 encounters. Crystall heabutt encounters based on the TID, using the tree selection algorithm of the game to determine if the encounter is possible for the TID (implemented base on https://bulbapedia.bulbagarden.net/wiki/Headbutt_tree#Mechanics). Coordinates of Crystal trees obtained with the programa G2Map

Added checks for fishing encounters for unreacheable water tiles in gen 2, route 14, national park and the beta safari zone.

* Fix gen 1 static encounters and trade encounters filter by version

* Missing strings
2017-07-06 16:03:41 -07:00
Kurt
3f38b123a3 Refactoring
mostly renaming things, includes a little bit of added sugar and
splitting methods to simplify the codebase.

all methods are now PascalCase
2017-06-17 18:37:19 -07:00
javierhimura
0b1fcbbe6d New legallity checks (#1196)
* 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
2017-06-06 20:10:05 -07:00
Kurt
4201e10a0e Misc cleanup
Add PCD fixed PID check
improve PID matching for CXD pkm
hide no-pidiv match seed (00000000)
fix matching fateful for wild pokespot pkm
don't generate eggs for c/xd
2017-06-03 15:16:27 -07:00
Kurt
5823425f42 Add PIDIV checking for encounters
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.
2017-06-03 00:12:05 -07:00
Kurt
858aa50689 Refactor encounter matching
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 😄
2017-05-27 21:17:57 -07:00