Commit graph

18 commits

Author SHA1 Message Date
Kurt
d54a9ba3a9 Fix mg8 partially restricted language check
Recipient language fetching a value of 0 will now be permitted to yield the recipient's language. Earlier logic in the method would check if any other language maps to the recipient language
2022-06-04 12:06:23 -07:00
Kurt
86814d014d Fix recog of Home fixed PID shinies
Not to be confused with Home fixed PID antishinies
WC8 is the only format to have fixed shinies, but let's copy the logic to WB8 and WA8 if they're ever added in the future.

Fix mgdb display filtering for SWSH & PLA (swapped oops)

Closes #3511
2022-06-02 19:04:27 -07:00
Kurt
f2356f1865 Update 22.06.01 2022-06-01 21:27:54 -07:00
Kurt
5bcccc6d92
HOME 2.0.0: Handle conversion behavior & restrictions (#3506)
* Revises legality checks to account for traveling between the three game islands (PLA/BDSP/SWSH)
* Adds conversion mechanisms between the three formats, as well as flexible conversion options to backfill missing data (thanks GameFreak/ILCA for opting for lossy conversion instead of updating the games).
* Adds API abstractions for HOME data storage format (EKH/PKH format 1, aka EH1/PH1).
* Revises some APIs for better usage:
  - `PKM` now exposes a `Context` to indicate the isolation context for legality purposes.
  - Some method signatures have changed to accept `Context` or `GameVersion` instead of a vague `int` for Generation.
  - Evolution History is now tracked in the Legality parse for specific contexts, rather than only per generation.
2022-05-30 21:43:52 -07:00
Kurt
ccf87242c1 Eliminate boxing on encounter search (criteria)
struct implementing interface is boxed when passed to method that accepts interface (not generic method).
Removes IDexLevel (no other inheritors but EvoCriteria) and uses the primitive the data is stored (array, not IReadOnlyList) for slightly better perf.
2022-05-07 18:29:36 -07:00
Kurt
ef3cb34387
Refactor EvoCriteria to be a struct, reduce allocation (#3483)
* Make EvolutionCriteria struct

8 bytes per object instead of 26
Unify LevelMin/LevelMax to match EncounterTemplate
bubble up precise array type for better iteration

* Inline queue operations, less allocation

* Inline some logic

* Update EvolutionChain.cs

* Improve clarity on duplicate move check

* Search reverse

For a dual stage chain, finds it first iteration rather than second.
2022-04-23 21:33:17 -07:00
Kurt
d91d242719 Stackalloc EV/AV checks 2022-03-13 22:33:17 -07:00
Kurt
d5ae6764aa Stackalloc IVs for template->pkm fill 2022-03-13 19:24:08 -07:00
Kurt
93255efcb8 Disassociate Shiny enum from WC6 PIDType (#3461)
Have `Shiny.Random` be `0`, so we can skip init on this field for EncounterStatic. Plus makes it a little less brittle for future expansion if shiny qualities change.
2022-03-12 17:38:59 -08:00
Kurt
4e1276a954 -8 bytes from each encounter template
saves about ~1MB RAM savings (>=179,142 objects)
2022-03-06 23:25:47 -08:00
Kurt
c51d51d381 More specific primitives for Memories/others 2022-03-06 12:01:47 -08:00
Kurt
9cde291595
Enumerate ability permissions in encounter templates, misc updates (#3368) 2022-01-08 22:34:04 -08:00
Kurt
f83a9bf833 Expose shiny potential value
Not really digging it currently as it doesn't cover multi-state like AlwaysStar-Or-Never, but that single edge case can be handled elsewhere
2022-01-07 17:48:12 -08:00
Kurt
47071b41f3
Refactoring: Span-based value writes and method signatures (#3361)
Existing `get`/`set` logic is flawed in that it doesn't work on Big Endian operating systems, and it allocates heap objects when it doesn't need to.

`System.Buffers.Binary.BinaryPrimitives` in the `System.Memory` NuGet package provides both Little Endian and Big Endian methods to read and write data; all the `get`/`set` operations have been reworked to use this new API. This removes the need for PKHeX's manual `BigEndian` class, as all functions are already covered by the BinaryPrimitives API.

The `StringConverter` has now been rewritten to accept a Span to read from & write to, no longer requiring a temporary StringBuilder.

Other Fixes included:
- The Super Training UI for Gen6 has been reworked according to the latest block structure additions.
- Cloning a Stadium2 Save File now works correctly (opening from the Folder browser list).
- Checksum & Sanity properties removed from parent PKM class, and is now implemented via interface.
2022-01-02 21:35:59 -08:00
Kurt
51c75dd102 Explicitly implement IFixedAbilityNumber on all templates 2021-12-09 00:46:59 -08:00
Kurt
d7ed6713c5 Update WB8.cs 2021-11-26 19:06:36 -08:00
Kurt
0254ae55b3 Don't set nickname flag for WB8 eggs
Closes #3311
2021-11-25 12:32:46 -08:00
Kurt
723514e89c
Update 21.11.19 - Brilliant Diamond & Shining Pearl (#3289)
Big thanks to @SciresM @sora10pls @Lusamine @architdate @ReignOfComputer for testing and contributing code / test cases. Can't add co-authors from the PR menu :(

Builds will fail because azure pipelines not yet updated with net6.
2021-11-19 18:23:49 -08:00