Commit graph

33 commits

Author SHA1 Message Date
sora10pls
1e985d6b26 Expose Gimmighoul form argument in editing tabs 2023-05-10 21:05:43 -07:00
Kurt
5bdc6b9ef8
Privatize some static fields, more robust legal helper classes. (#3865)
* 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.
2023-04-20 21:23:15 -07:00
Kurt
6182f889a6 Add learnset moves similar to games
Instead of looping, if the moveset is full and a new move is added, the game shifts all arr[1..] down one slot then adds the move at the end.
Since we don't need to keep track of PP/PP Ups, we can just defer the shifting and do n % 4 rotations at the end instead of n rotations (one on each move added).
2023-04-08 12:20:18 -07:00
Kurt
4384cadefc Add more xmldoc 2023-03-31 13:00:34 -07: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
50e7e3204c Show egg TID format based on SAV, egg met list=sav
Generation of version-less eggs is -1, so just default to the format it is.
Met location lists weren't reloading if the version was 0; could load a non-SV entity followed by an egg and it would keep the old lists. Fall back to the save file's group if no list is available.
2022-12-03 21:00:25 -08:00
Kurt
4761a07311 Suggest min formarg for Mankey/Pawniard->stage3 2022-11-27 18:47:18 -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
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
d0ca8403a9 Minor tweaks
Flag enigma berry on ck3/xk3
Suggest national ribbon if missing
Flag N's pkm if any IV is != 30, even if sum is 180.
2022-08-19 22:37:27 -07:00
Kurt
19b4a26cd7 Use evo history to check visitation
Previously, the history shared Gen8 for Gen8a/Gen8b; now they're distinct.

Add "HasVisited" for other gens
2022-08-03 18:17:46 -07:00
Kurt
50a64d8beb Add DynamaxLevel parsing for ShowdownSet 2022-08-03 17:10:00 -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
7d35517614 Revise AV check string to show which stat invalid 2022-07-10 17:34:46 -07:00
Kurt
79913a2474 Update IAwakened.cs 2022-07-10 17:16:48 -07:00
Kurt
3dbf46be92 Handle "random" AV gains from level up 2022-07-10 15:53:33 -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
78092e070d Allow PA8 HT from Gen7, prefer min from PLA
Closes #3527
ty @spacesonata !
2022-06-18 10:30:14 -07:00
Kurt
0093927e15 Use ReadOnlySpan instead of Span if appropriate 2022-06-13 00:04:20 -07:00
Kurt
5ce8938440 Use history for hypertraining possible check
Closes #3520
2022-06-12 09:26:45 -07:00
Kurt
893b5d5293 Revise more PB7/PK8->Interface type checks 2022-06-04 21:03:25 -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
ba19efb793 Fix gen8 mysterygift shiny xor check
lol oops
Closes #3500
2022-05-30 00:30:15 -07:00
Kurt
e34d03d2e5 Update 22.05.08 2022-05-07 14:30:16 -07:00
Kurt
a9443be8fa Add bypass for alpha move purchased
ty @Atrius97 for finally nailing the repro on this

Co-Authored-By: Atrius97 <39707481+Atrius97@users.noreply.github.com>
Co-Authored-By: Lusamine <30205550+Lusamine@users.noreply.github.com>
2022-05-07 13:48:47 -07:00
Kurt
124bbf98ad Allow seed of mastery toggling mastered flag
oops
2022-05-06 16:11:52 -07:00
Kurt
9deafa851a
Create initial movesets for Alpha entities correctly, verify initial mastery (#3489)
* Draft checks for encounter slot mastery

* Check encounter mastery flags

* Add moves for LA static encounters that don't follow learnset

* Add moves on crossover LA static encounters

* add alpha moveset population method

Now generates and applies moves as the game does
Updates some handling of other methods to use Span

* Show better message for bad mastery init flags

* Insert descending if candidates have same level

Level 78 Yanmega:
- [01] [10] Quick Attack
- [06] [15] Gust
- [11] [20] Silver Wind
- [18] [28] Hypnosis
- [25] [35] Air Slash
- [34] [45] Ancient Power
- [43] [54] Crunch
- [43] [54] Bug Buzz

Yields:
AlphaMove
Crunch*
Bug Buzz*
Ancient Power

* Descending order due to iteration

Co-authored-by: Lusamine <30205550+Lusamine@users.noreply.github.com>
2022-05-06 15:43:23 -07:00
Kurt
d3749bd4b6 Minor tweaks
Move sociability
inline dictionaries
2022-04-09 00:08:24 -07:00
Kurt
d91d242719 Stackalloc EV/AV checks 2022-03-13 22:33:17 -07:00
Kurt
e1414a0bea Move some interfaces to different folder
No code changes
2022-03-06 12:06:50 -08:00