Update dictionary to use proper format (yyyy-mm-dd), as well as verifier to properly check met year.
Also updated IsValidDateWC8 to clamp latest met date based on UTC, like with GO encounters.
## 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).
Closes#3133
not an ideal solution, but the encounter matching API is kinda limited in deferred-invalid vs deferred-notIdeal.
probably need to unify the match logic and generators so they can cache one secondary-check invalid
Nickname AND Trainer Name are verified in that method; we still want to execute it. If it has a fixed nickname, we can skip the wordfilter since it's already been checked.
Some special encounters don't set the Relearn Moves, so we can't really check the memory-moves unless we somehow late-reject a matching encounter. Not really worth the effort to try and verify cosmetic mismatches; just tag them as Fishy.
AltForm & Form & Forme => Form
GenNumber & Generation => Generation
Extract out SpeciesForm interface, and re-add IGeneration
For those using PKHeX as a dependency, this should be a pretty straightforward manual replacement... GenNumber and AltForm should be quick find-replace`s.
Transporter remaps certain locale specific chars depending on the source ROM's version.
Since VC can trade between languages, there are 2 Spanish in-game trades that have glyphs subject to remapping, if it's transferred from a French game.
If the spanish trade is transferred from a french game, it must match the mutated string.
ty @Lusamine & helpers :D
Move form-info logic from FormConverter to AltFormInfo; now FormConverter is entirely form=>string[]
Add a bunch of xmldoc
Make pogo no-end-date cmp agaisnt UTCnow rather than local now.
from 319 (max HP-1) to 9999 (max saved value).
Causes a little bit of GUI lag when loading 10k items to the combobox; could be a number entry but meh. Lazily allocate the 10k strings; wait until it's requested.
Adds Nickname checks, thanks @ShadowMario3 for grabbing these into separate text files from Bulbapedia.
I reordered all the encounters to match Bulbapedia; each level is denoted if different if it can be sourced from RBY.
PKHeX.Core now accepts generated pkl binaries from PoGoEncounterTool (PGET).
Refer to pporg's repo. This will be treated like event data; occasionally updated.
4 legends have A/A/H on form-0, and B/B/B on form-1. You can get a form-1 by applying the patch on the form-0, and changing it to form-1 will retain the AbilityNumber=4.
Co-Authored-By: Matt <17801814+sora10pls@users.noreply.github.com>
Closes#3070
Exclude all classified as Legends; everything else is permitted assuming it can exist in SW/SH.
Co-Authored-By: Chris <28743231+Bappsack@users.noreply.github.com>
Closes#3027
Roamers: Get PID generated externally
NPokemon: Get PID from a fixed value
Forced (Anti)Shiny: Get PID altered
Thanks @LegoFigure11 && Princess Emily (discord 4650) !
Handles conditions when Ability Patch has been used to modify the PKM's ability => hidden ability.
Per the description, it goes 1/2=>H, not the other way around.
Verify ability bit first, as mystery gift case handling skips the bit check logic :P
Rather than do backtracking logic to see if the slot can be yielded, don't acknowledge the slot exists if it can't be yielded.
See pk3DS commit where we check EscapeRate for the base wild slot prior to adding it to the exported slot list.
Starting in Generation 8, hatched language-traded eggs will take the Language from the trainer that hatched it.
Transferring from Gen7->Gen8 realigns the Nickname string to the Language, if not nicknamed.
now that stadium saves all expose registered teams, can just call from the parent class
rental sk2's have no TID; add that to the requirement to not get flagged for missing OT
Closes#3009
Make QRPK7 implement IEncounterable and remove hardcoded PKHeX strings
Let force hatching for WC3 eggs try to hatch from the savefile's language, then revert to english if failed to set an OT.
Use underscores for enum for ToString replacing with spaces
Don't flag empty-OT as SK2; Stadium0/1 use the "TRAINER" as rental, but leave it blank for SK2.
Don't set any terminators for an OT string if the string is empty; just wipe the buffer.
Closes#2990 ty @Atrius97 !
Remove the `object Content` accessor only used for Mystery Gifts (used to trickle up the PKM object since the two ribbon interfaces weren't implemented on the IEncounterable). Just make PCD/PGT implement the ribbon interfaces and delegate the get/set to PKM directly.
Rewrite the national ribbon check for clarity
Optimize invalid/missing ribbon string replace to operate on the final string rather than do linq and replace each input. With this we make 1 temp string only, rather than 1-per-ribbon.
Replace hardcoded "Ribbon" strings to use a shared const string in a central spot.
EncounterTrade: don't init Location to -1; keep as default 0 and use that as the pivot for default met location. Move Fateful property to the sub-type that uses it (EncounterTrade4, for Ranch).
Move some EncounterStatic->PKM logic that is per-type to the associated type overloaded methods. Rearrange order of properties to be more consistent with interfaces
Gen3: Initialize some classes without using post-constructor setters. The `init` setter functionality coming in c#9 won't be usable as the net46 runtime/netstandard2 doesn't support it on current previews. Do it this way so we can explicity initialize some required properties rather than apply version on a second iteration.
Change Ability array to IReadOnlyList, add method to check ability index in personal data
Suppress some message warnings
Change EvolutionChain short-circuit for VC to jump from gen6 directly down to gen2. There aren't any notradeback 1 situations, so a notradeback1 will always start with g=1, so no need for the other if-continue.
Simplify pk5 conversion
Move logic closer to where it is used rather than in larger static classes
EncounterStatic(7): move VC transfer template creation to class, simplify some sanity checks
EvoChain: g==2 case is never hit as the generation check at the top of the loop already skips
Still some pending stuff like bad mystery gifts
gen2 static encounters on g/s applying met level and not location
gen6 ralts trade (no nickname) being flagged as nicknamed when it shouldn't
gen4 manaphy egg not having a hatch location (worked fine if you transferred it up)
gen3 antishiny gifts not setting their PIDs (jirachi WC3)
gen5 N's pkm gifts setting the wrong nature
gen3 unown not being generated correctly, cosplay pikachu being allowed form0, non-BugCatchingContest no longer require Sport ball, oras dexnav marill now uses the azurill eggmove table
Remove RibbonWishing as property, just calc on the fly since it's a single case
Update type info for vc transfer to indicate it's an es7
Split up dreamworld encounters as intended, fix logic lol
* Rework gen1 slot loading
Slot templates are precomputed from ROM data and just loaded straight in, with tight coupling to the encounter area (grouped by slot types).
* Revise fuzzy met check for underleveled wild evos
Example: Level 23 poliwhirl in RBY as a level 50 poliwhirl, will assume the chain is 25-50 for poliwhirl (as poliwag evolves at 25). Instead of revising the origin chain, just ignore the evo min level in the comparison.
Previous commit fixed it for gen1.
* Rework gen2-4 slot loading
Gen4 not finished, Type Encounter data and some edge encounters not recognizing yet...
* Add feebas slots for old/good encounters
* Begin moving properties
Great news! Gen5-7 need to be de-dumbed like Gen1-4.
Then I can remove the bang (!) on the Area accessor and ensure that it's never null!
* Split off XD pokespot slot encounter table type
* Set area in constructor
* Deduplicate g3 roaming encounters
* Deduplicate xd encounter locations (rebattle)
Only difference is met location; no need to create 500 extra encounter objects. A simple contains check is ok (rarely in gen3 format).
* Make all slots have a readonly reference to their parent area
* Minor clean
* Remove "Safari" slot type flag
Can be determined via other means (generation-location), allows us to reduce the size of SlotType member to a byte
Output of slot binaries didn't preserve the Safari flag anyway.
* Update SlotType.cs
* Handle type encounters correctly
* Merge safari area into regular xy area
* Merge dexnav accessor logic
* fix some logic so that tests pass again
rearrange g5 dw init to be done outside of static constructor (initializer instead)
PIDGenerator: friend safari slots now generate with required flawless IV count
* Add cianwood tentacool gift encounter
* Remove unnecessary abstractions
Fake area just returned a slot; since Slots have a non-null reference to the area, we can just return the slot and use the API to grab a list of possible slots for the chain.
Increase restrictiveness of location/type get-set operations
* Minor tweaks, pass parameters
DexNav observed state isn't necessary to use, only need to see if it's possible to dexnav. Now that we have metadata for slots, we can.
* Remove unused legality tables
Check egg encounter for state rather than re-deriving some properties on the fly
Only check memories if memories are exposed
Remove debug assert (not always true?)
Results in a little more code, but each path is less tangled
simplify some expressions
remove RBDragonair content in favor of a strict filter for catch rate
Move gen1 trade trainer names to stringconverter, since pk1/pk2 shouldn't refer to legality classes