Commit graph

42 commits

Author SHA1 Message Date
Kurt
f6bcc8a216 Minor clean
StringBuilder.Append has some fancy interpolation handling in the latest NET8 so it's more clean than multiple append calls.
2024-06-15 00:57:44 -05:00
Kurt
08ed482555 Revise gender symbol remapping
Handles Nidoran's shenanigans as well as more clear method names
- Add normalization for PK7->PK8 (no more 0xE... usage for the gender symbols... maybe more chars?)
- Not sure if Gen3 gamecube encoding needs sanitizing. Who is transferring Nidoran to CXD? :)

Requires some silly usage of Language passing as arguments. Future improvements can be made to revise the half/full encoding determination when setting a string. Probably has issues since we're just doing a naive check without considering nicknames w/ special chars.

Closes #4174
2024-05-12 10:47:55 -05:00
Kurt
1b294f7c97
Refactor: Split Gen1/2 string & pokelist conversion methods (#4251)
* Split Gen1/2 string & pokelist conversion methods

* Refactor pokelist to direct read/write, skip on save if blanked

* Add settings editor for SaveLanguage overrides
2024-04-22 14:42:22 -06:00
Kurt
95fbf66a6e
Refactor: Gen3/4 Lead Encounters, property fixing (#4193)
In addition to the Method 1 (and other sibling PIDIV types) correlation, an encounter can only be triggered if the calls prior land on the Method {1} seed. The RNG community has dubbed these patterns as "Method J" (D/P/Pt), "Method K" (HG/SS), and "Method H" (Gen3, coined by yours truly). The basic gist of these is that they are pre-requisites, like the Shadow locks of Colosseum/XD. 

Rename/re-type a bunch of properties to get the codebase more in line with correct property names & more obvious underlying types.
2024-02-22 21:20:54 -06:00
Kurt
aba7c800b3 Add LCRNG distance calculating method
Solution known for over a decade, finally reminded myself that it'd be nice to have this available. Probably will use this for displaying Method J/K/H frame info when that branch is more mature.
2024-01-30 19:14:04 -08:00
abcboy101
01131e59f0
Modify G1/G2 character mappings (#4154)
### Treat 'ヘ' as katakana
- For consistency with ベ/ペ/リ which are treated as katakana here and in StringConverter12Transporter.cs, map 0xCD to katakana ヘ instead of hiragana へ.
- Allow input of hiragana べ/ぺ/へ/り, mapping them to katakana ベ/ペ/ヘ/リ. Previously, they would be treated as invalid and mapped to the string terminator.

### Swap mappings for 0xE8/0xF2
- Previously, 0xE8 was mapped to U+002E `.` FULL STOP, while 0xF2 was mapped to the special character U+2024 `․` ONE DOT LEADER. Since 0xF2 is used in user input while 0xE8 is only used in `MR.MIME`, swap these mappings so that normal keyboard input maps to the user-enterable character.
- Modifies SpeciesName.cs to produce U+2024 for Mr. Mime in G1/G2.
2024-01-07 23:27:03 -08:00
Kurt
d47bb1d297
Update .NET Runtime to .NET 8.0 (#4082)
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.
2023-12-03 20:13:20 -08:00
Kurt
abcaaa44cd Extract pokewalker logic from template ctor
Actually searching (instead of brute-forcing) for a spread will forever be haunting.

Add to Legality Check matching with vague partial match
2023-10-07 23:14:34 -07:00
Kurt
707898d4e2 Add Pokewalker IV validation methods
Not yet hooked into the legality analysis (MethodFinder doesn't know about encounter template info).
2023-10-07 00:00:36 -07:00
Kurt
998b8f1ce0 Minor tweaks
Add unit test for VC kata/hiragana edge case
De-duplicate some slot change notifications
Span in more spots
2023-04-22 17:51:32 -07:00
Kurt
ecef31f167 Minor clean 2023-04-13 00:05:10 -07:00
Kurt
c8909a4326 GB stats: Ceil instead of +1
Wrong: #2265
Edge case (exact sqrt); Closes #3841
2023-03-19 12:18:10 -07:00
Kurt
0f1fba86f7
S/V 1.2.0 Support (#3819) 2023-02-27 19:12:27 -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
92a50264cc
Refactor RNG advance/reverse methods (#3579)
The new LCRNG/GCRNG/ARNG classes are static, rather than singletons. Allows them to be inlined much better.
2022-09-04 12:03:37 -07:00
Kurt
44c8e772a3 Fix incorrect method call
Copypasta oops, previous commit at fault.
2022-08-18 01:17:03 -07:00
Kurt
12954a6369 Minor perf improvement (spans)
Remove PKM.EVs, do operations without heap allocation
Reduce usage of PKM.IVs/PKM.Moves, reuse spans if possible.
2022-06-25 23:08:28 -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
e6cf5d0baf Split PKMConverter into multiple classes
EntityFormat -> detects byte[] -> ctor() PKM
EntityConverter -> converts between pkm formats
RecentTrainerCache -> used by other classes (not within EntityConverter!)
EntityBlank -> creates blank PKM objects indirectly
2022-04-09 01:39:34 -07:00
Kurt
9cde291595
Enumerate ability permissions in encounter templates, misc updates (#3368) 2022-01-08 22:34:04 -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
f1fe2f6a8c Minor clean 2021-12-09 19:30:12 -08:00
Kurt
bedc52943e Trailing commas
No functional change
2021-08-20 13:49:20 -07:00
Kurt
103aa9aa4b
Revise EncounterArea and EncounterType for clarity (#3228)
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?
2021-06-29 20:58:06 -07:00
Kurt
390cf518b8 Revise 4->5 encode table (Half-width symbols)
Manually transferred from English Pt to English B

All revised indexes were the result in Black.

Differences that were not incorporated:
0EE=09794 ♂, not 09325 ⑭
0EF=09792 ♀, not 09326 ⑮
0F2=00215 ×, not 09319 ⑧
0F3=00247 ÷, not 09320 ⑨

Full-width and half-width symbols I think are related to full-width games, which English isn't. Probably has different handling for other language, plus it'd result in other duplicates of the half-width symbols.

Revise not-found char glyph to return ? instead of {terminator}, to match the game's behavior. Again, this might be language specific, but whatever.

Make the Convert char methods public, add a few unit tests.

Closes #3172

Co-Authored-By: Lusamine <30205550+Lusamine@users.noreply.github.com>
2021-06-11 19:38:34 -07:00
Kurt
01f75f8441 Add test for hex string (arbitrary length) convert 2021-05-09 23:33:54 -07:00
Kurt
ceede68861 Minor tweaks 2021-05-07 22:11:10 -07:00
Kurt
c67e01849a Extract 3ds chinese glyph remapping, only do on 3DS games
Optimize some functions within gen7zh for perf (no linq, no allocation)
2021-04-18 18:29:02 -07:00
Kurt
997e0751f3 Minor clean
Handle remainder of c#9 sugar
Fix some spelling mistakes
2020-12-21 23:37:07 -08:00
Kurt
df5ebd1f54 Minor clean
Resolve some messages
2020-11-11 21:01:41 -08:00
soopercool101
1a1cfbda4a
Fix Hidden Power Power calculations (and add to UI) (#2989)
* Fix broken hidden power power calculation

* Fix broken Gen 2 Hidden Power calculation

* Add parentheses

* WIP UI

* Finalize UI, only show on gens 1-5

* Inline some logic to reduce allocations

* Add unit tests for both hidden power calculation cases

Co-authored-by: Kurt <kaphotics@gmail.com>
2020-09-14 20:06:11 -07:00
Kurt
46640d48a3 Misc clean
un-nest classes,
move some logic to core,
update some get-only properties that return arrays to methods
2019-10-26 12:58:55 -07:00
Kurt
825e06130e Add nullable reftype compiler checks to test proj
New in c# 8
Assert.True(check for null) doesn't give a hint that the obj isnt null
afterwards.
Assert.NotNull does have the compiler hint attribute
could probably use fluentexpression syntax, but resharper doesn't pick
up on the nonnullable hint like vs does.
GeneratorTests: swap FirstOrDefault to First, can keep the fluent style
and resharper gets the hint.

tl;dr : resharper doesn't look at external lib for hints, gotta use
Assert.NotNull or something that doesn't return null
2019-09-23 18:13:51 -07:00
Kurt
c5ebbbbe15 Minor clean
Magic number -> const usage
default(T) -> default (c#7.x feature)
remove some unused stuff
fix indentation in some spots
2019-09-10 22:07:50 -07:00
Kurt
f37a587a1c Minor simplifications
move some pk3->pk4 stuff into object constructor
annotate pk3->pk4 string buffer (trash) quirks
split Heal into Party/PP method uses. Setting suggested stats no longer
refreshes PP
apply current level to Stat Level (wasn't being set previously)
2019-07-12 16:41:13 -07:00
Kurt
63c705061d Add recognition for Method 3 encounters
Pass them as Legal for wild encounters similar to M1/M2/M4.
Add test cases & test pkm validation
Add pid generator support

I decided against checking these PIDIVs after all others; inlined
methods.

Closes #2328 , thanks @pokecal !
2019-06-19 19:15:06 -07:00
Kurt
d681933a44 Minor tweaks
pkmtests same namespace as others
legalitytests assert that we check at least one file
extract repo base path fetch method
2019-03-18 19:33:56 -07:00
Kurt
fb818f203d Add gb pp/stat calc test
refer #2265
2019-02-25 17:39:41 -08:00
Kurt
d1f6a5a3ff Misc clean
no functional change
2019-02-15 11:46:46 -08:00
Kurt
c81a405efd Remove inheritance from tests 2018-11-20 13:46:12 -08:00
Kurt
ba1a7c2bcf Fix broken tests
rework getblank for version specific
2018-11-19 16:14:49 -08:00
Evan Dixon
9c87ad2977 Port tests to .Net Core (#2156)
* Rewrite tests with XUnit and .Net Core
* Add better "because" message
* Skipping test that was not ready & convert the fact to a theory
* Tweak casing
* Convert select date tests to theories
* Make the GetStringList load lock safer
2018-11-06 15:25:35 -08:00