Since we have more metadata with move learn sourcing, we can check if it was traded to gen2 to get new moves / deleted.
Adjust call sites appropriately
might have some issues, to be ironed out maybe
Slap on interface for EntreeSlot
De-magic some 💯 numbers to indicate what they're doing
Improve perf of move-match-relearn check
Add an "else" as valid is never both values (history verifier)
The Encounter verifier method rarely rejects as our inner encounter matching methods are all-or-nothing. Don't bother keeping references for this bloat.
Ran the unit tests and nothing hit this logic.
Old: when an encounter is found, we copied the contents of the list into our analysis list.
Since we stop when we find a suitable encounter, the old list is useless. By sharing the same list, there's no consequence. Reduces allocation by ~56B each analysis object!
Simplification reduces the amount of method calls by 1
Might result in some illegal matches as it includes it for all evolutions in the chain, but whatever. Could probably rewrite the generator to only generate for different starting-species, but it's fine now.
Inline the max level calc
Invert check for crossover to disallow hidden (there are more symbol
tables). Galar Mine No. 2 has hidden fishing slots as well as curry.
HiddenMain3 SlotType was never used so it was removed.
Updates pkl to remove HiddenMain3.
We don't do it for inaccessible static encounters in gen7/8, so anyone glitching/cheating will get an unrecognized encounter instead of "hey this exists, but you can't access it" error.
* Add weather types by location
Creates a dictionary of possible weather types for each SWSH location.
Unlisted locations may only have Normal weather or do not have any
encounter slots.
* Prune unused weather from static encounters
Some encounters were too permissive with weather, e.g. Sandstorm in
Fields of Honor and Challenge Beach; Snowstorm at Dyna Tree Hill.
A few crossover areas that would have limited the possible weathers were
marked with a "(c)". An example is Nidorina from Giant's Bed crossing
to Frostpoint Field, where Raining and Thunderstorm do not occur.
This additionally organizes encounters by location.
* Move location-weather dictionary to EncounterArea8
* Verify weather marks on encounterslot/static encounters
* Adds some static encounters available through weather bleed
Weathers aren't normally available, but these static encounters are
close enough to the boundary that the weather in an adjacent area can be
used to spawn them.
- Frostpoint Field Snorlax with Raining/Thunderstorm from Giant's Bed
- Snowslide Slope Amaura with Raining/Thunderstorm from Giant's Bed
- Frigid Sea Carracosta with Intense_Sun from Three-Point Pass
- Frigid Sea Magmortar with Intense_Sun from Three-Point Pass
- Ballimere Lake Corviknight with Snowstorm from Giant's Bed
- Ballimere Lake Cryogonal with Snowstorm from Giant's Bed
- Ballimere Lake Tyrunt with all weather from Giant's Bed
- Lakeside Cave Ferrothorn with all weather from Ballimere Lake
- Tunnel to the Top Golbat with all weather from Path to the Peak
* Defer weather marks if incompatible, enforce encounterslot weather
This uses the area weather to check fishing slots and tentatively adds
some tables for weather bleed encounterslots.
* Warm-Up Tunnel gets weather bleed from Training Lowlands
* Update for base PKHeX
* Handle weather bleed for SWSH encounter slots
Co-authored-by: Skadiv <62726360+Skadiv@users.noreply.github.com>
* Minor clean
Having duplicate weather marks is illegal, so just auto-partial match them instead of checking the other marks.
* Rearrange slot weather check logic
* Claim reserved byte in SWSH pkl
* No need for two variable names now
* Valid weather marks on tree/fishing should return with main weather
* Fix tree/fishing deferral and add another surf slot weather bleed
* Disallow tree/fishing encounters from using bleed tables
None are currently known at this time, and only hidden grass encounters
have a weather bleed table
* Condense bleed expression, combine tree/fish flag check
* Move weather-bleed check into EncounterArea8
Makes the dictionaries private instead of internal.
Co-authored-by: Skadiv <62726360+Skadiv@users.noreply.github.com>
Check per-evolution min level rather than basing it on the original encounter data.
Correctly parses stuff like a captured level 23 Nidorina that immediately evolves into Nidoqueen, then learns Body Slam.
Passing zero is better than passing 1, as 0 requires no value pushing.
tidy up method signatures in MoveLevelUp so that species is followed by form, and the lookups are textually aligned. Clarify "maxLevel" instead of max/lvl, same as min.
Currently, HOME gifts present in wc8.pkl will not be flagged for invalid dates due to them missing their respective Card IDs. This will be fixed with the next stable release, so this works for now.
EncounterArea now stores a more specific type'd array for encounter slots. Better iteration and less casting, as the nonspecific `Slots` fetch is rarely referenced.
EncounterType renamed to GroundTile to reflect how it actually works in Gen4. Was previously an ambiguous field that was clarified a little; we can describe it a little better now. Keep the GUI the same to not scare the end users.
Change Trash Byte properties to get/set a Span. Trash Byte legality checking easier on the garbage collector?
The sav.ApplyTo call above tries to set the current savefile language, but gen3 savs do not have a Language ID saved.
Just mimic what the encounter slots/static/etc do.
off by 1 max range for gen2 slot -> pk2
SetRandomIVs already sets IVs inside the method, retval is for knowing what the new value sare
show WC8 restricted version rather than defaulting to SH
pass the rand object rather than fetching for the current thread every loop for Unown & random IV shuffling
Use ToLowerInvariant for resource fetching, should resolve the turkish issue
Check typeof(T) first, not that we check for ToolStripItem or ContextMenuStrip with this function.
* Track a PKM's Box,Slot,StorageFlags,Identifier metadata separately
Don't store within the object, track the slot origin data separately.
Batch editing now pre-filters if using Box/Slot/Identifier logic; split up mods/filters as they're starting to get pretty hefty.
- Requesting a Box Data report now shows all slots in the save file (party, misc)
- Can now exclude backup saves from database search via toggle (separate from settings preventing load entirely)
- Replace some linq usages with direct code
* Remove WasLink virtual in PKM
Inline any logic, since we now have encounter objects to indicate matching, rather than the proto-legality logic checking properties of a PKM.
* Use Fateful to directly check gen5 mysterygift origins
No other encounter types in gen5 apply Fateful
* Simplify double ball comparison
Used to be separate for deferral cases, now no longer needed to be separate.
* Grab move/relearn reference and update locally
Fix relearn move identifier
* Inline defog HM transfer preference check
HasMove is faster than getting moves & checking contains. Skips allocation by setting values directly.
* Extract more met location metadata checks: WasBredEgg
* Replace Console.Write* with Debug.Write*
There's no console output UI, so don't include them in release builds.
* Inline WasGiftEgg, WasEvent, and WasEventEgg logic
Adios legality tags that aren't entirely correct for the specific format. Just put the computations in EncounterFinder.
GetCanKnowMove should be checking for Smeargle knowing thousand arrows/waves.
GetNeededMoves should also return 1ka/1kw for needed moves, and then no encounters.
All uses of InvalidSketch are behind that method, so any future Smeargle modifications (like sketching a dummied move) will be checked (yay BDSP considerations).
Removes duplicates if every encounter in the same index is the same as a
previous index. The following were affected, and only the first index
was retained.
- 5, 7 (Index 2 has 1 move different on 1 mon)
- 3, 4
- 11, 13
- 16, 18
- 27, 28, 30, 32
- 33, 35
- 36, 38
- 42, 44
- 45, 47
- 48, 50, 52
- 53, 55, 57
- 59, 61
Just allocate the parent array and pass it to HashSet; having an ICollection, prevents resizing repeatedly and gc'ing the temp array is cheap.
Actually, only create a hashset if we're adding a gift from external DB. Saves on that allocation, and keeps the final result as an array (fastest iterating).
Regex objects aren't cheap, and the RegexCache has DefaultMaxCacheSize = 15.
We're checking 4,000 regexes for each unique string, so just keep the created regexes around instead of cycling new through the cache.
+4MB passive consumption, but each IsFiltered call no longer generates >4MB of discarded objects.
My unit tests run >25% faster now... nice?!
hovering would grab ILocation, which didn't use the flexible met location fetch.
Just repoint stuff and have it as a virtual call, since most of these are fixed values, there's no point increasing the size of the classes besides those for gen4.
Add dragonite to the uncapturable list, removes catchrate comparison for dragonite since it's filtered out.
Skip some linq by doing the loop directly in the method. Replace local methods with captured variables with direct if-returns.
Looks like Mr. Rime case wasn't being handled, so I rewrote it. Better performance, less complexity. No need to double-reference the moves.
Cache a single Valid evolution result; every parse can reuse that object.
More in line with modernizing the codebase with latest c# syntax
improve web-qr decode speed slightly (no linq skiptake)
get money/coin mask without a temporary string (lol performance)
The EncDB doesn't specify form; the encounter methods verify Form.
This is actually a fix; pkm that can change forms aren't really encounter trades, but we shouldn't be strict matching here.
Rotom Bike water upgrade isn't available until you have sufficient progress, so you can't get these dens with the lowest rank.
Co-Authored-By: Lusamine <30205550+Lusamine@users.noreply.github.com>
Nice bug ya got there, gamefreak.
Coulda cleared the AffixedRibbon value instead of copying it on Shedinja creation, and it would have made this unnecessary.
Please ditch the Affixed Ribbon gimmick for future games, thanks!
Distribution raid encounters from before each of the DLC patches can only be captured in existing Wild Area locations.
Store the BCAT index in the encounter details and use it to compare when the BCAT was available.
Switch expression had an issue with interpreting the object's type (unboxing, yay)
should probably just return a typed object from the parse, but nah, this is a quick fix.
Farfetch’d uses the non-vertical apostrophe, still.
Showdown is consistent with their usage (in/outputting ’), but we'll keep the '->’ for that sanitization just in case other services/users enter the wrong char.
Closes#3185
- Settings now stored as json next to exe
- Settings now exposes all legality checking setttings that can be changed
- Slot hovering now can play cries in MGDB/PKMDB/etc, not just the main boxes.
- Enhanced hover text for mystery gifts and encounters that have movesets
- Show recently loaded save files in ctrl-f browser
- Toggle auto-load savefile setting to be none/detect-latest/last-loaded
- Custom extensions & extra backup paths can now be configured directly in the json settings
- Settings editor now uses propertygrid & tabs.
This change revises the logic for an Egg Move's RelearnMoves.
Removes a class that is no longer used
Passes the large value-passing struct byref via in keyword
Revises handling so that early-returned results from the MoveBreed processing are marked with their move source rather than leaving them unvisited.
The moveset processor uses depth search recursion, and returns false if the move that it is processing is not possible for the hatched moveset. If the depth search never reaches the check for base moves, all moves won't be marked for their origins, resulting in the result array not being accurate to use for suggestion purposes.
Yay multi-purpose logic (validation w/early returns & fixing needing fully processed data).
Base method checks wurmple (not available in swsh), removed.
Hidden ability check returns Partial for any species that cannot be patched, and Deferred for any patched; we don't care, because there aren't any wild species that can't be patched in swsh.
* Initial bred moveset validation logic
Unpeel the inheritance via recursion and permitted moves
* Volt tackle considerations
* Optimize out empty slot skips
* Add tests, fix off-by-one's
* Require all base moves if empty slot in moveset
* Add test to prove failure per Anubis' provided test
* Tweak enum labels for easier debugging
When two enums share the same underlying value, the ToString/name of the value may be either of the two (or the last defined one, in my debugging). Just give it a separate magic value.
* Fix recursion oopsie
Also check for scenario where no-base-moves but not enough moves to push base moves out
* Add Crystal tutor checks
* Add specialized gen2 verification method
Game loops through father's moves and pushes in one iteration, rather than checking by type.
* Add another case with returning base move
* Add push-out requirement for re-added base moves
* Minor tweaks
Condense tests, fix another off-by-one noticed when creating tests
* Disallow inherited parent levelup moves
Disallow volt tackle on Gen2/R/S
* Split MoveBreed into generation specific classes
Gen2 behaves slightly different from Gen3/4, which behaves slightly different from Gen5... and Gen6 behaves differently too.
Add some xmldoc as the api is starting to solidify
* Add method overload that returns the parse
Verify that the parse order is as expected
* Add reordering suggestion logic
Try sorting first, then go nuclear with rebuilding.
* Return base moves if complete fail
* Set base moves when generating eggs, only.
* Use breed logic to check for egg ordering legality
Don't bother helping for split-breed species
* Exploration: rework ability criteria to ability numbers desired
* Sync remaining changes
* Update EncounterCriteria.cs
* Add xmldoc
* Improve speed of IsDualGender check
* More xmldoc updates
Should be doing this on main but meh, this branch is gonna get merged later
* Fix typo
* Update WC7.cs
* Update PersonalInfo.cs
All slots are now initialized via constructor, property can now be init!
Optimize some value fetching for gen7b, as the input data has features that can be abused
Relocate the SetRandomEC at the tail end of the generator into the specific classes that set EC, so that our correlation generators don't have their EC overwritten at the end.
Disassociate pk4/pk6 backing byte[] when converting to pk5|pk7, as we no longer make a copy of the byte[] in the pkm's constructor.
Change UpdatePKM to include isParty, as we want it optional to update FormArgument too.
Change FormArgument saving to be handled by FormConverter; kinda not really good to have it there, but nothing else is handling FormArgument values.
Expand IFormArgument to have all FormArgument values exposed. "Maximum" is furfrou only.
PK6: Max is in the "FormArgument" u32, and the remain/elapsed is in party stats (hence the reverting when boxed)
PK7: u8 remain, u8 elapsed, u8 max, u8 unused.
PK8: assumedly the same as PK7, given the disassembly hints that it's the same as past games (even though Furfrou and Hoopa are not in SWSH).