ShowdownSet: Fix indentation, use explicit const
ItemStorage8BDSP: Rename GetAll->GetAllHeld to match others
EncounterLearn: Guard against >4 length enumerables, use explicit versions for S/V
EggMoves: Read u16[] directly rather than manually
SaveFinder: simplify expression
SAV_Database: extract func
SAV_Encounters: use RoM to match Moveset generator
With the new version of Visual Studio bringing C# 12, we can revise our logic for better readability as well as use new methods/APIs introduced in the .NET 8.0 BCL.
Gift1: use IVs if required
Gift2: Enforce 0 TimeOfDay
Egg9: Require Egg Location to match encounter
PGT: keep requested gender in the event of antishiny
PGT: never yield Korean Ranger Manaphy for Format4
Simplify ushort range checks
Rename `EReader` bool to `IsEReader`
Extract Gender/Nature fetch for unfixed encounters
Remove Unown PIDIV branch when template has no Unown
Remove unnecessary loop for Pokewalker PID creation
We implement simple state machine iterators to iterate through every split type encounter array, and more finely control the path we iterate through. And, by using generics, we can have the compiler generate optimized code to avoid virtual calls.
In addition to this, we shift away from the big-5 encounter types and not inherit from an abstract class. This allows for creating a PK* of a specific type and directly writing properties (no virtual calls). Plus we can now fine-tune each encounter type to call specific code, and not have to worry about future game encounter types bothering the generation routines.
Move enum -> ushort instead of int
Redo handling of HOME Volt Tackle (disallow on SWSH Cap Pikachu)
Pass spans instead of strings to use span methods
Reset encounter filters on early abort
Like move validation, evolutions are the earliest thing we wish to traverse when determining what encounters may have originated the current Pokémon. To determine the permitted species-form-levels a Pokémon could originate with, we must devolve a Pokémon by traveling down-generation to origin. Once we have an encounter, we can then evolve it to the current species, traversing upwards from origin to the current format.
* Heavily rewrites the `PKH` abstractions.
* Uses HOME's core-side classes as the transfer middlemen instead of direct A->B transfers.
* Revises logic to account for most of HOME's quirks (scale/height copying, safe refuge PLA)
Future revisions hinge on better handling of evotree (need better metadata about existing as specific evolutions in each game).
---------
Co-authored-by: sora10pls <17801814+sora10pls@users.noreply.github.com>
Co-authored-by: Lusamine <30205550+Lusamine@users.noreply.github.com>
https://projectpokemon.org/home/forums/topic/63429-bdsp-slate/
The "Give All" cheat will skip adding unobtainable items.
Since the BDSP-exclusive Treasure (slate/shard) are unable to held, they were also skipped. Revise the logic to allow them to be added via "Give All", but still disallowed as held items (separate arrays needed).
Also condense the logic for BCAT-Dmax crystal IDs since they're all sequential. Just iterate a range instead of a span.
- Add HeldItems_XY
- Fix that HeldItem_AO pointed to what should have been HeldItems_XY
- Fix HeldItem_AO being inconsistent with the rest of the HeldItems
- Correct HeldItems_AO only having XY held items and not ones added in ORAS
* Uses LearnSource more throughout the codebase when appropriate, rather than loosely coupled pivot methods.
* Hides Learnset/EggMove data inside the LearnSource classes.
* Extracts functionality from the large Legal class & partial Table*.cs files into better performing helper classes.
* Cleans up some code from prior LearnSource commits.
* Extract/encapsulate inventory legal arrays to interface+class
Hiding them behind methods allows these to be left as ReadOnlySpan<ushort> and thus never allocate on the heap.
Also refactors out some logic for checking if an item is legal.
End result feels more maintainable and is less bloaty (no more passing in a nullable func)
Batch editing
* Add HasType filter
```
=HasType=11
.HeldItem=Meadow Plate
```
slaps a meadow plate on any pkm with grass type
Use `=PersonalType1=11` for only primary grass types; only-secondary-type grass will not match it.