Commit graph

3898 commits

Author SHA1 Message Date
Kurt
2f078e6565 Minor tweaks
Make HP IV set use single array fetch, less memory required
add some xmldoc
2021-04-20 01:02:32 -07:00
Kurt
45f12bd924 Update FormVerifier.cs 2021-04-18 21:22:58 -07:00
Kurt
f61108ac4e Check gen1/2 female OTs a little more thoroughly
https://github.com/kwsch/PKHeX/issues/2687#issuecomment-822072999

celebi is a es2e, so just filter on specified TID

Co-Authored-By: FeralFalcon <33670476+FeralFalcon@users.noreply.github.com>
2021-04-18 19:31:22 -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
0e4848ad82 minor clean 2021-04-18 18:18:09 -07:00
Kurt
c6d6a52e0b '->’ stragglers 2021-04-18 14:04:26 -07:00
Lusamine
f2c2a77cfe
Check nest distribution encounters by patch epoch (#3195)
Distribution raid encounters from before each of the DLC patches can only be captured in existing Wild Area locations.
Store the BCAT index in the encounter details and use it to compare when the BCAT was available.
2021-04-18 11:01:42 -07:00
Kurt
fd8da81b4a Remove unnecessary setter 2021-04-18 11:00:40 -07:00
Kurt
0719320e33 Eggs: explicitly pass generation instead of calculating 2021-04-17 20:09:02 -07:00
Kurt
9171d7f87e move property to class that uses it 2021-04-17 20:08:20 -07:00
Kurt
f35a3ce03c Add overload for Totem check, simplify some flow 2021-04-17 13:24:57 -07:00
Kurt
5635e8f345 Unroll some loops, reduce allocations a little for hacked eggs 2021-04-17 13:13:03 -07:00
Kurt
893f22a664 Extract generation traversal list fetch to static class 2021-04-17 13:09:09 -07:00
Kurt
8e52d2fddb Xmldoc updates 2021-04-17 13:07:28 -07:00
Kurt
8b180c3122 Fix egg move source indications (were defaulting to gen2)
Switch expression had an issue with interpreting the object's type (unboxing, yay)

should probably just return a typed object from the parse, but nah, this is a quick fix.
2021-04-16 17:57:48 -07:00
Kurt
16406d7bba Allow Strongest Trainer memory on gen6-visitors banned from Maison
https://projectpokemon.org/home/forums/topic/57375-pkhex-new-update-legality-errors-contribution-page/?do=findComment&comment=265898

End result is only gen7-origin-in-gen7 are disallowed.

Co-Authored-By: Matt <17801814+sora10pls@users.noreply.github.com>
2021-04-16 08:53:50 -07:00
Kurt
aaae94b739 Fix Gen2 roamer location check
https://projectpokemon.org/home/forums/topic/57375-pkhex-new-update-legality-errors-contribution-page/?do=findComment&comment=265885

Location=>pkm.Met_Location

Change the array search for a bitwise and check, for muh efficiency
2021-04-14 13:29:23 -07:00
Kurt
c56ba76601 Expand jp table too
6754645a5f
2021-04-12 19:14:23 -07:00
Kurt
6754645a5f Minor optimization
Similar to the index hack done for array shuffling modulo 24 & 1f.
2021-04-12 17:08:57 -07:00
Kurt
758b6e6770 Remove '<->’ aliasing
Farfetch’d uses the non-vertical apostrophe, still.

Showdown is consistent with their usage (in/outputting ’), but we'll keep the '->’ for that sanitization just in case other services/users enter the wrong char.

Closes #3185
2021-04-12 17:04:02 -07:00
Kurt
b289c12918 Update Locations.cs 2021-04-12 15:43:21 -07:00
Kurt
7bc733c900 Update SK2 language coercion
Closes #3194
Exports are fine, imports with an ambiguous language (can be either JPN or INT) while illegal don't result in the above branches passing it.

Inputs with <=6 chars for OT&Nick will be ambiguous; PKM editor.
2021-04-11 20:50:34 -07:00
Kurt
0d45075d4b
Rewrite settings handling; enhance some user experiences (#3193)
- Settings now stored as json next to exe
- Settings now exposes all legality checking setttings that can be changed
- Slot hovering now can play cries in MGDB/PKMDB/etc, not just the main boxes.
- Enhanced hover text for mystery gifts and encounters that have movesets
- Show recently loaded save files in ctrl-f browser
- Toggle auto-load savefile setting to be none/detect-latest/last-loaded
- Custom extensions & extra backup paths can now be configured directly in the json settings
- Settings editor now uses propertygrid & tabs.
2021-04-11 18:09:54 -07:00
Kurt
aaa69eac15 Rename Gen3 Champ ribbon to be more accurate
been like this since mid 2016

this ribbon can be obtained in either Hoenn or Kanto within Gen3
https://bulbapedia.bulbagarden.net/wiki/List_of_Ribbons_in_the_games#League_Ribbons
2021-04-10 12:09:43 -07:00
Kurt
cfcefca14f Add splitbreed relearn suggest recursion 2021-04-10 11:03:21 -07:00
Kurt
c7b997865c Minor clean 2021-04-09 14:52:49 -07:00
Kurt
fb972b9782 Update MoveSetApplicator.cs
Closes #3191 , uses a better method
2021-04-09 11:22:10 -07:00
Kurt
a450b56878 Add Gen2 rock smash encounters
oops
2021-04-08 20:45:14 -07:00
Kurt
e9c9627ad5
Relearn suggestions + Headbutt Slot Fix (#3190)
This change revises the logic for an Egg Move's RelearnMoves.

Removes a class that is no longer used
Passes the large value-passing struct byref via in keyword
Revises handling so that early-returned results from the MoveBreed processing are marked with their move source rather than leaving them unvisited.
The moveset processor uses depth search recursion, and returns false if the move that it is processing is not possible for the hatched moveset. If the depth search never reaches the check for base moves, all moves won't be marked for their origins, resulting in the result array not being accurate to use for suggestion purposes.

Yay multi-purpose logic (validation w/early returns & fixing needing fully processed data).
2021-04-08 15:58:09 -07:00
Kurt
3e052987e2 Clean up emerald event info files
Closes #3188
Remove tabs from zh
Removes duplicate flag from es

Co-Authored-By: hard <62216646+kamisama6866@users.noreply.github.com>
2021-04-07 22:13:09 -07:00
Kurt
b0700ba281 Extract Gen7 HoF class, extend event flag count
4k flags exactly, and probably 4950 for USUM (alignment +1 byte for an even 4960)

The old flag + count (4 bytes total) are just +32 event flags.
2021-04-07 00:20:02 -07:00
Kermalis
0c982a725a
Fix FRLG flags (#3186) 2021-04-06 19:17:57 -07:00
Kurt
2f4b754505 Fix incorrect event flag reference
Thanks SneakyPeekyFox!

Also fix crash if pressing escape on the save differentiation popup.
2021-04-06 17:26:13 -07:00
Kurt
c05fc854b1 Update 21.04.06
Mostly because of Gen3 save editing bugfixes, forcing a new version.

Last version added the PID checks for Gen8; this one adds move ordering checks for eggs. More fun :)
2021-04-05 22:57:05 -07:00
Kurt
223b56d779 Fix gen3 save incorrect destination writes 2021-04-05 22:28:04 -07:00
Kurt
673c0d93a6 Extract event flag/work editing from GUI
now <200 lines for editing (ignoring the diff functions), yay
Opening the editor allocates less (no copying save file)
2021-04-05 20:52:49 -07:00
Kurt
d0258fa2f7 Add gs/c resources 2021-04-04 22:14:17 -07:00
Kurt
4579a66a38 Fix deferral for wild slots
Base method checks wurmple (not available in swsh), removed.
Hidden ability check returns Partial for any species that cannot be patched, and Deferred for any patched; we don't care, because there aren't any wild species that can't be patched in swsh.
2021-04-04 21:54:24 -07:00
Kurt
63639a1ec8 Add latest distribution raid templates 2021-04-04 20:38:26 -07:00
Kurt
0ad06c6359 Disallow Thousand Arrows/Waves for Format6 Smeargle
moves unavailable in that format, same as light of ruin

Closes #3182 ty @DaWoblefet
2021-04-04 19:39:31 -07:00
Kurt
0626b0c29b
Add Breeding move ordering logic, and use in legality analysis (#3183)
* Initial bred moveset validation logic

Unpeel the inheritance via recursion and permitted moves

* Volt tackle considerations

* Optimize out empty slot skips

* Add tests, fix off-by-one's

* Require all base moves if empty slot in moveset

* Add test to prove failure per Anubis' provided test

* Tweak enum labels for easier debugging

When two enums share the same underlying value, the ToString/name of the value may be either of the two (or the last defined one, in my debugging). Just give it a separate magic value.

* Fix recursion oopsie

Also check for scenario where no-base-moves but not enough moves to push base moves out

* Add Crystal tutor checks

* Add specialized gen2 verification method

Game loops through father's moves and pushes in one iteration, rather than checking by type.

* Add another case with returning base move

* Add push-out requirement for re-added base moves

* Minor tweaks

Condense tests, fix another off-by-one noticed when creating tests

* Disallow inherited parent levelup moves

Disallow volt tackle on Gen2/R/S

* Split MoveBreed into generation specific classes

Gen2 behaves slightly different from Gen3/4, which behaves slightly different from Gen5... and Gen6 behaves differently too.

Add some xmldoc as the api is starting to solidify

* Add method overload that returns the parse

Verify that the parse order is as expected

* Add reordering suggestion logic

Try sorting first, then go nuclear with rebuilding.

* Return base moves if complete fail

* Set base moves when generating eggs, only.

* Use breed logic to check for egg ordering legality

Don't bother helping for split-breed species
2021-04-04 18:30:01 -07:00
Kurt
8c4ca3134a Fix Gen3 coin get/set 2021-04-04 11:53:55 -07:00
Kurt
ba5bf463e0 Convert static dictionary to switch
probably ends up as a jumptable via jit, so better perf?
2021-04-02 16:47:37 -07:00
Kurt
1348f5deec Allocate smaller buffers for gen3 sav objects
n*0xF80 instead of n*0x1000
2021-04-02 14:57:30 -07:00
Lusamine
d3059218c9
Remove gen 8 static encounters from DB if no location (#3181) 2021-04-01 15:09:26 -07:00
Kurt
cdc9710869 Fix gen3 record get/set
FR and LG are separate version IDs now
2021-04-01 14:15:11 -07:00
Kurt
a92f92e1c5 Fix gen3 TMHM pouch 2021-04-01 14:14:47 -07:00
Kurt
9881beea1e Update EncounterStaticGenerator.cs 2021-04-01 13:51:00 -07:00
Kurt
1e38f55007 Fix changes not being saved completely 2021-04-01 13:43:06 -07:00
Kurt
4700fdd1e3 Set updated version when resetting personal
Closes #3180

Improves handling for corrupt gen3 saves (pokedex cheaters)
2021-04-01 13:37:39 -07:00