Commit graph

115 commits

Author SHA1 Message Date
Kurt
3572097c96 Update 23.01.26
Hello .NET 7
2023-01-26 21:58:04 -08:00
Kurt
9ddfe3f629 Misc fixes
Allow dragon ascent bitfetch for gen6/7
Fix hidden power type parse/trim
Remove */ from hidden power type calc
allow longer set lines (full EVs specified for Gen2 is 74 chars
allow set lines of length 1-2 to fully support trash sets for all languages
Tweak pb8->pk8 to be more straightforward
2023-01-26 19:03:06 -08:00
Kurt
71eeb7072b Fix gen4 set all TMHM bits
oops
make other personalinfo consistent
show legality triangles if previous parse failed (oops)
2023-01-22 14:55:35 -08:00
Kurt
88830e0d00
Update from .NET Framework 4.6 to .NET 7 (#3729)
Updates from net46->net7, dropping support for mono in favor of using the latest runtime (along with the performance/API improvements). Releases will be posted as 64bit only for now.

Refactors a good amount of internal API methods to be more performant and more customizable for future updates & fixes.

Adds functionality for Batch Editor commands to `>`, `<` and <=/>=

TID/SID properties renamed to TID16/SID16 for clarity; other properties exposed for Gen7 / display variants.

Main window has a new layout to account for DPI scaling (8 point grid)

Fixed: Tatsugiri and Paldean Tauros now output Showdown form names as Showdown expects
Changed: Gen9 species now interact based on the confirmed National Dex IDs (closes #3724)
Fixed: Pokedex set all no longer clears species with unavailable non-base forms (closes #3720)
Changed: Hyper Training suggestions now apply for level 50 in SV. (closes #3714)
Fixed: B2/W2 hatched egg met locations exclusive to specific versions are now explicitly checked (closes #3691)
Added: Properties for ribbon/mark count (closes #3659)
Fixed: Traded SV eggs are now checked correctly (closes #3692)
2023-01-21 20:02:33 -08:00
Kurt
1c980a0434 Fetch form entries for gen4-6 learnsets
Silly Wormadam with different form permissions.
2022-12-17 20:36:44 -08:00
Kurt
03182ebd3d Update 22.11.24
Adds support for Scarlet & Violet.

Co-Authored-By: SciresM <8676005+SciresM@users.noreply.github.com>
Co-Authored-By: Matt <17801814+sora10pls@users.noreply.github.com>
Co-Authored-By: Lusamine <30205550+Lusamine@users.noreply.github.com>
2022-11-24 17:42:17 -08:00
Kurt
1960b335fd Remove PersonalInfo.Abilities, use interfaces
If you must get a list of abilities, then use the span extension methods.
Also reworks some initial moveset fetching to allocate less
2022-09-02 10:20:19 -07:00
Kurt
66e0613d82 Minor clean 2022-08-30 15:00:45 -07:00
Kurt
d8fe34011d Remove some bounds checks, int->byte form oops
https://github.com/kwsch/PKHeX/pull/3575#issuecomment-1229244453
ty @Kermalis !
2022-08-27 12:53:30 -07:00
Kurt
3c232505e5
Refactoring: Narrow some value types (Species, Move, Form) (#3575)
In this pull request I've changed a ton of method signatures to reflect the more-narrow types of Species, Move# and Form; additionally, I've narrowed other large collections that stored lists of species / permitted values, and reworked them to be more performant with the latest API spaghetti that PKHeX provides. Roamer met locations, usually in a range of [max-min]<64, can be quickly checked using a bitflag operation on a UInt64. Other collections (like "Is this from Colosseum or XD") were eliminated -- shadow state is not transferred COLO<->XD, so having a Shadow ID or matching the met location from a gift/wild encounter is a sufficient check for "originated in XD".
2022-08-26 23:43:36 -07:00
Kurt
2cb2531288 Add more xmldoc 2022-08-21 01:39:16 -07:00
Kurt
30f2450a30 Minor clean, xmldoc personal tables 2022-08-11 00:24:25 -07:00
Kurt
f53d468db2 Show complete form name if possible
Get rid of the pk3DS janky form naming :)
2022-08-09 19:16:55 -07:00
Kurt
538d651aef Misc tweaks
Add xmldoc, simplify some expressions
2022-08-05 11:23:28 -07:00
Kurt
9166d0eb64
Refactoring: Move Source (Legality) (#3560)
Rewrites a good amount of legality APIs pertaining to:
* Legal moves that can be learned
* Evolution chains & cross-generation paths
* Memory validation with forgotten moves

In generation 8, there are 3 separate contexts an entity can exist in: SW/SH, BD/SP, and LA. Not every entity can cross between them, and not every entity from generation 7 can exist in generation 8 (Gogoat, etc). By creating class models representing the restrictions to cross each boundary, we are able to better track and validate data.

The old implementation of validating moves was greedy: it would iterate for all generations and evolutions, and build a full list of every move that can be learned, storing it on the heap. Now, we check one game group at a time to see if the entity can learn a move that hasn't yet been validated. End result is an algorithm that requires 0 allocation, and a smaller/quicker search space.

The old implementation of storing move parses was inefficient; for each move that was parsed, a new object is created and adjusted depending on the parse. Now, move parse results are `struct` and store the move parse contiguously in memory. End result is faster parsing and 0 memory allocation.

* `PersonalTable` objects have been improved with new API methods to check if a species+form can exist in the game.
* `IEncounterTemplate` objects have been improved to indicate the `EntityContext` they originate in (similar to `Generation`).
* Some APIs have been extended to accept `Span<T>` instead of Array/IEnumerable
2022-08-03 16:15:27 -07:00
Kurt
54a7966c75 Update 22.06.26
Split the 2020 changelog out of the release binary; archived for posterity.
2022-06-26 22:18:19 -07:00
Kurt
b9b4eb1791 Minor tweaks
Bulk: Pass slot origin to legality analysis. Pass the proper personal data for good measure

Personal: check if the form truly does exist for presence check because sometimes the form will default to 0 on OOB

Showdown: Reduce some allocation, be more lenient in casing parse for Nature suffix and Hidden Power manually typed by user. Parse non-english hidden power sets (yay, now usable by all languages even though PS sets are English only!).
2022-06-26 20:02:57 -07:00
Kurt
fc754b346b
File scoped namespaces (#3529)
[Language Reference](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/proposals/csharp-10.0/file-scoped-namespaces)

Updates all the files, one less level of indentation.

Some small changes were made to API surfaces, renaming `PKM pkm` -> `PKM pk`, and `LegalityAnalysis.pkm` -> `LegalityAnalysis.Entity`
2022-06-18 11:04:24 -07:00
Kurt
10b27c9d95 Fiddle with tutors: no allocation
Besides expanding the move list, no more closures & linq.
2022-06-12 14:02:22 -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
3e8527f11a Minor tweaks
Reduce allocation in a few places, delete unused stuff, more concise expressions.
2022-05-07 21:25:26 -07:00
Kurt
ff2e890e69 Revise Overworld8a application of PIDIV
Instantiating from template now follows group seed -> spawn 1 correlation, including alpha move.
Differentiates static encounters that don't follow the ow8a correlation, scrambles EC to disassociate.
Adds rand64 to get initial seeds
Set correct level range to match slotSeed; not respecting the slot roll being valid, but whatever.
2022-04-22 21:11:11 -07:00
Kurt
3d759e1491 Move location lists to separate classes 2022-03-20 21:26:56 -07:00
Kurt
9137a03b50 Hide unavailable species for PLA saves (similar to LGPE) 2022-02-05 22:02:26 -08:00
Kurt
69ee363663 Fix EncounterSlot form set order, copy expgrowth for consistency
Closes #3387
ty @odin880 !
2022-02-05 00:47:17 -08:00
Kurt
0b32cbf132 Update PKHeX.Core abstractions with latest logic
Co-Authored-By: Matt <17801814+sora10pls@users.noreply.github.com>
Co-Authored-By: SciresM <8676005+SciresM@users.noreply.github.com>
Co-Authored-By: Lusamine <30205550+Lusamine@users.noreply.github.com>
2022-02-04 17:35:15 -08:00
Kurt
429c80e9f5 Add new abstractions for pkm/personal/mysterygift
Co-Authored-By: SciresM <8676005+SciresM@users.noreply.github.com>
2022-02-04 17:26:15 -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
cacd6e9965 More records/sealing 2021-12-05 23:54:59 -08:00
Kurt
f55c5bea66 Minor clean
no functional change
2021-12-04 17:56:56 -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
Kurt
92fe440208 Make bitflag get/set span-based
no temp array on write (unused in pkhex anyways)
no length checking on read
2021-10-08 17:48:34 -07:00
Kurt
c65fda5e7d Allow HM moves in gen2-4 eggs
Yay silly inheritance
ty atrius
2021-08-28 13:54:58 -07:00
Kurt
9793e9f1a0 Minor clean
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)
2021-08-13 15:36:30 -07:00
Kurt
4ed0e30ace Minor tweaks
Muh infinitesimally small perf gainz found while waiting for next dota match
2021-07-26 23:33:56 -07:00
Kurt
c9640f8561 Comments: forme->form 2021-07-26 14:14:39 -07:00
Kurt
46f50a3a56 Use named consts for magic gender values
More personal magic value comparisons
2021-07-13 18:22:04 -07:00
Kurt
f66662b8db More deferral tweaks for non-HA having HA 2021-04-22 13:47:33 -07:00
Kurt
645f2b4db5 Revert implicit casting
Looks like netstandard2.0 wasn't meant to receive that new c#9 goodie
2021-03-29 00:14:44 -07:00
Kurt
3822981590
Rework EncounterCriteria to be ability indexed rather than direct ability (#3179)
* 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
2021-03-23 17:05:15 -07:00
Kurt
09089da14e Use more expression return style
Reduces indentation & bracketing, a bit more concise
2021-01-01 17:08:49 -08:00
Kurt
46f3b17a67 Replace this[] indirect access with direct table access
The static constructor setup methods don't need to be maxSpecies aware, they always succeed. So just remove the self-imposed-safe bounds checks by accessing & mutating the table directly.
2021-01-01 15:24:11 -08:00
Kurt
24332b6979 Minor tweaks 2020-12-30 13:08:15 -08:00
Kurt
e8c23f6644 Simplify some repeated comparisons with expressions
Less prone for bugs since it uses the same value for all comparisons without re-specifying
2020-12-29 00:37:59 -08:00
Kurt
93910df2c6 Use new switch statements 2020-12-23 17:14:38 -08:00
Kurt
98be0f6739 Target type'd new 2020-12-21 17:17:56 -08:00
Kurt
5729718d68 Simplify ternary byte casts
No longer needed to explicitly cast, thanks c#9 !
2020-12-21 16:53:28 -08:00
Kurt
62018cce1a Unify concepts with different names
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.
2020-12-10 20:42:30 -08:00
Kurt
915727ed67 Add g-kanto formes
Probably will refactor things when shiny/ball legality is detailed
2020-11-11 13:27:08 -08:00
Kurt
36051e0f82 Minor clean 2020-10-25 10:02:52 -07:00