Commit graph

33 commits

Author SHA1 Message Date
Kurt
2b0cfab31a Disallow shiny dream radar/forest shinies
Closes #1340
2017-07-16 10:15:12 -07:00
Kurt
29914c431e Misc capitalizations 2017-07-07 17:40:27 -07:00
javierhimura
7b1812f184 Added check for pokeradar shiny grass patch
Not allow cutecharm pid iv method for swarm pokemon
Fix loading time encounter for generation 2 and mark crystal location slots in any gen 2 tables
Typos in tree areas comments
2017-07-07 13:53:21 +02: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
5476b86a11 Misc performance tweaks
Switch encounter slot generator to yield style to not require the entire
method to finish iterating
Although the pressure slot may be best-matching, it isn't the typical
match. Defer pressure slot clone to the end (defers the orderby
calculation)

There's probably a better way to do the pre-work (gen 5+ only operate
off one encounterarea... usually. Past Gens end up repeating the same
work for each area tested

slot matching runs slightly faster now due to the deferred execution
2017-06-30 00:37:17 -07:00
Kurt
86d39f2c81 Tweak level/origin check for moves
Valid species/movepools are already determined via the dexlevel and
prior methods, no need to check again with current species.

edge case: sing froslass from CXD won't check gen3 moves (ie, sing)
2017-06-26 20:30:44 -07:00
Kurt
b4222c756a Refactoring
reduce cross-class chatter, simplifly large methods to smaller pieces
some speed improvements
2017-06-18 22:27:40 -07:00
Kurt
82c8bc01bd Add gen1-4 EV check for untrained pkm
Rework some checks for eggs, closes #1248

GetEggHatchLevel uses Format instead of Generation; should only be used
on IsEgg=true pkm
2017-06-18 21:13:53 -07:00
Kurt
b6d266824e Filter crystal statics in matching, not table fetch
Eggs from crystal traded to GS can hatch with no met location; skip
crystal-only encounters unless they are non-eggs

Closes #1245
2017-06-18 16:40:23 -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
Kurt
dc8639a31f Reinstate met location constraint for gen2 G/S
via discussion on
2979c4f7ec (comments)

edge case is for shiny egg gifts
2017-06-15 22:48:15 -07:00
Kurt
2064779d91 Add gsc bug catching contest slots
surfing still looks a little wonky, fixed fishing slots
2017-06-15 22:21:02 -07:00
Kurt
2979c4f7ec Misc gen2 fixes
still a few problems left:
surf encounters
roamer met locations
national park encounters
lake of rage all-gyarados encounters (?)

#1221
2017-06-12 22:16:20 -07:00
Kurt
1e9f5261b7 Misc pika line fixes
Closes #1213
add default cosplay form at end, add range checks
prevent cosplay/spiky eared pichu from transferring up generations
set pkm to legal info on error (checking legality no longer continues
exceptions).
2017-06-09 21:43:46 -07:00
Kurt
1f479310da Misc fixes
gen5 N pkm already checked, don't flag SID
mystery gift non-eggs already checked, don't flag SID
add used DNA splicers to b2w2 permitted key item list
fix b2w2 new-altform movesets; kyurem is tricky where the form does not
exist in bw's moveset, so both indexes have to be used.

Closes #1211 , thanks @sora10pls !
2017-06-09 17:52:20 -07:00
Kurt
63b18ff51f Fix misc problems
flag undistributed gen3 events
fix gen3 string writing (resized then expanded yields 00, missing
terminator), closes #1204
fix stackoverflow, fix pkmeditor template loading save prompt, closes
#1207
2017-06-08 20:57:30 -07:00
javierhimura
f8346eb7e1 Fix issue #1200 and added speculation for Gen2 VC without move reminder (#1201)
* Fix issue #1200
Minimum level for evolution moves in generation 7 is 2 thanks to the move reminder, also the evolution could be trigger at the minimum level and not the next level, except when the minimum level is the met level

* Gen 2 VC Speculation, it wont have Move Reminder because the only gen 2 move reminder was in Pokemon Stadium 2

* Missing variable

* Fix update generation 2 level moves
2017-06-07 16:15:13 -07:00
Kurt
94a315aa6d Speculation++
As if I would have insider knowledge...
┬┴┬┴┤ ͡° ͜ʖ ͡°)├┬┴┬┴

Prepping core for eventual VC2 support where Crystal data is not
retrievable.
2017-06-06 21:59:29 -07:00
Kurt
eaf2fd9198 Cleanup
little bit of simplification
2017-06-06 20:52:21 -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
234a3d2ed8 Simplify egg game generation
All gens that store version number do not change the version ID on
trade/hatch; this info is preserved and can directly imply which game
generated the egg.

the 'version' is ignored anyway, just useful to track for gen2 eggs.
2017-06-06 18:28:21 -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
c666183e6c Misc fixes
enhance evolution checking
add gen2 game corner static encounters
simplify relearn checking methods that did the same thing
2017-05-29 15:21:39 -07:00
Kurt
82750de1b8 Add initial gen3 event detection
egg events supported, only some gen3 event distros supported
will eventually flag for PIDIV type mismatching

@kamronbatman
2017-05-29 00:48:25 -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
Kurt
113001f280 Temp gen2 met location filter bypass
#978
crystal location data => no location values to compare to
2017-05-23 22:38:21 -07:00
Kurt
845d64cbc6 Add mystery gift species preference
insert to front of list if the species matches
eevee gift in gen7 has all species at 50 including eevee; not sure if
this strategy is needed for the other formats but just in case.
2017-05-17 22:10:19 -07:00
Kurt
4e1a520b0a Evolution check fixes
Evolution info was not checked for non-eggs; for mystery gifts check
that the level of the evolution is not less than the level of the
matched encounter
fix spacing (cosmetic)
add temp flagging for magnetpull/static slots (will eventually refactor
into something functional that considers a set of slots including
swarm/etc)
2017-05-16 21:09:53 -07:00
Kurt
5ec3521d48 More c#7 shorthand
outs & pattern matching, other simplifications
2017-05-13 10:20:25 -07:00
Kurt
aeb90d262c Cleanup 2017-05-12 09:33:12 -07:00
Evan Dixon
96e315c035 Fixed missing resource references 2017-05-11 23:40:57 -05:00
Evan Dixon
52c4fbbe97 Converted PKHeX.Core to .Net Standard
Refactored and rearranged things as needed to allow the change
2017-05-11 23:34:18 -05:00
Renamed from PKHeX/Legality/Core.cs (Browse further)