Commit graph

3000 commits

Author SHA1 Message Date
sora10pls
670b8e3c9f Update Master Rank Ribbon restrictions for SV
All Pokémon in the Paldea Pokédex are eligible, except for Legendaries, Sub-Legendaries, and Paradox.

Currently ineligible foreigners are Charmander/Charmeleon/Charizard, Wooper-0/Quagsire, Meowth-2/Perrserker
2022-12-03 10:53:48 -05:00
Kurt
2e67526db1 Update 22.12.01 2022-12-01 22:40:11 -08:00
Kurt
f10c914eac Swap RSBox pay day skitty moves 1 & 2
Thanks Soniktts & ICanSnake !
https://projectpokemon.org/home/forums/topic/62640-pokemon-box-skitty-egg-illegal/
2022-11-30 18:47:35 -08:00
sora10pls
a4abd94724 Unban Starf Berry
151 rounds in ESP Exercise Knockout
2022-11-29 21:53:34 -05:00
sora10pls
1ffd6872a8 Unban Lansat Berry 2022-11-29 21:47:42 -05:00
Kurt
c790212291 Add Gen9 to pkmdb generation dropdown 2022-11-27 13:40:25 -08:00
Kurt
607cbc5eb6 Check pre-evolution TM flag permit if highest not 2022-11-27 12:51:05 -08:00
Kurt
7e0aa44a9a Update MiscVerifier.cs 2022-11-27 12:38:32 -08:00
Kurt
5f12ba78c9 Update MiscVerifier.cs 2022-11-27 11:30:02 -08:00
Kurt
2fe8b63589 Disallow Avalugg+Lilligant hisui eggs 2022-11-27 10:43:21 -08:00
Kurt
762f7171cc Fix single-chain ability revert check 2022-11-26 22:21:33 -08:00
Kurt
7adf48982c Extract more Tera raid props to common interface 2022-11-26 14:23:32 -08:00
Kurt
51875d27b2 Fix HA possible abilities not being validated w/HA 2022-11-26 14:23:19 -08:00
Kurt
cee97ada26 Minor clean 2022-11-26 14:22:57 -08:00
Kurt
76ec39b75f Strict match encounter slot tera type 2022-11-26 08:31:58 -08:00
Kurt
c550d41630 Fix eevee dist check (missing rand100)
Reorder calls so the runtime can overwrite the xoroshiro registers if needed
2022-11-26 07:27:51 -08:00
Kurt
ccac23bb6d Initial raid eevee checks (wip) 2022-11-26 00:39:32 -08:00
Kurt
5d5d913a0b Handle lgpe base friendship case 2022-11-25 20:54:43 -08:00
Kurt
ccfbae357e Add evolve form predict message for dudu/maus 2022-11-25 20:33:14 -08:00
Kurt
310882f375 Extract toxtricity nature restriction 2022-11-25 19:55:44 -08:00
Kurt
78676a9cbd Ignore insufficient fixed IV matches
Wild vaporeon and glaceon can get mis-recognized with the fixed strong static teras.
2022-11-25 18:25:14 -08:00
Kurt
c1796da94b Ensure override tera is not set while egg 2022-11-25 16:01:54 -08:00
Kurt
10d0199521 Add EC for slot9 2022-11-25 16:01:40 -08:00
Kurt
981001b12e Clamp max obey level to current, slot tera recheck 2022-11-25 15:55:10 -08:00
Kurt
ddef07a4c2 Maus/Dudun 25->100 odds
What a confusing optimization
2022-11-25 14:49:51 -08:00
Kurt
00e174d240 Handle bred Oricorio original tera type eggs 2022-11-25 14:12:19 -08:00
Kurt
d904bfad4c Fix hidden ability patch possible check
Just return true when it is possible
2022-11-25 13:54:14 -08:00
Kurt
5faf861f82 Flag non-pokeball starter eggs 2022-11-25 11:15:40 -08:00
Kurt
459ee3db22 Invert Titan Mark missing/invalid msg
Now matches the Mightiest mark and other "isMissing" state checks.
Also indicate for Alpha marks since the logic check is the same != style.
Closes #3640

ty @Kitcham
2022-11-25 10:42:53 -08:00
Kurt
d2970c6a3a Force rotom default egg to form0
Silly rotom-Heat eggs are not legal :D
2022-11-24 22:06:36 -08:00
Kurt
9009439bb7 Set random personal tera type for egg>pk9 template 2022-11-24 21:39:11 -08:00
Kurt
94e8e0e958 Remove obey:0 for boxlegend, should be 68
Nice encounter spec sheet value (WazaConfirmLevel), gamefreak.
2022-11-24 20:19:40 -08:00
Kurt
1c93d601a4 Fix min egg hatch ctr for pk8/pk9
Oops, 8 instead 9.
2022-11-24 19:15:19 -08:00
Kurt
6993f9d661 Fix pk8 tr flag check (off by 100) 2022-11-24 19:13:34 -08:00
Kurt
140196d9ab Fix formarg check for stantler/bisharp/primeape 2022-11-24 18:07:17 -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
sora10pls
313f32a0d0 Add last-ever SWSH distribution raid data
rip 2019-2022
2022-10-31 20:07:05 -04:00
Kurt
49d40d2e26 Enhance traded eggs version sharing check
No longer indicate traded eggs from gen3 as sharing OT details.
2022-10-28 16:18:06 -07:00
Kurt
a88da9ee8d Update RibbonVerifierUnique4.cs
Closes #3618
2022-10-26 09:44:45 -07:00
sora10pls
56d3daa189 Add latest distribution raid data 🐴
good job shiny locking them this time
2022-10-20 20:05:57 -04:00
Kurt
3ab3f6ad53 Sanity check requested gender
Shedinja template in gen3 is gender:2, while the template needs to be gender:0/1

Closes #3612 ty @Kermalis !
2022-10-20 00:14:03 -07:00
Kurt
25b217c53d Skip first iteration check of stop condition
Can unroll the loop, but would look more ugly :)
JIT will probably do it for us.

Fix <= to < for IVs
Inline temp var (start is unused after assigning to low)
2022-10-16 20:10:32 -07:00
Kurt
2a190dd6b3 Improve LCRNG seed reversal speed ~50x
Big thanks to Parzival from the RNG discord community for chiseling the LCRNG search space down to the best performing implementation possible.

50x? Down from O(2^8) -> O(2^3) is 32x, but we no longer need to access two heap arrays (262KB no longer needed!). Everything can be calculated tightly with the stack.

f641f3eab2/RNG/LCG_Reversal.py (L31)

Rainbow tables is the only faster implementation. However, nobody is gonna hog many GB of RAM for O(1) reversals. This is ~O(2^3), down from O(2^8). Much better than the days of O(2^16)!
2022-10-16 18:52:43 -07:00
Kurt
ae6d53af7e Minor tweaks
Reduce allocation in gen8 static encounter init, single class
2022-10-15 01:14:50 -07:00
Kurt
8b0e93b42f Fix GetLowestLevel underflow condition
Check end before decrement

Closes #3605 thanks @InfoManiac742 !
2022-10-14 17:05:19 -07:00
Kurt
0bc7eeb5f5 Improve RNG frame detection for gen4
stupid bruteforce for slot4->pk4
2022-09-30 19:26:59 -07:00
Kurt
65baf92608 Only add encounter moves if context matches
Viewing a PLA thundurus template into SWSH, then clicking current moves would green-tag
2022-09-28 21:51:22 -07:00
Kurt
baf2ac22d7 Update EncounterStatic4Pokewalker.cs 2022-09-28 00:09:10 -07:00
Kurt
583f96a598 Specify full movesets & course for Pokewalker encs
Didn't trust the existing manual transcribing, and both Bulbapedia and Serebii contain errors that don't match the original raw data. So, let's rip the raw data ourselves and use our own parse pickle (just raw bytes) instead of 162 manual entries.

For ripping logic, see: 203874da12

Partial match if language cannot access walker course
Re-do language override for EncounterStatic->pkm:
- Override gen1/2 event OT/language only if requested language is not possible
- Override walker OT/language if requested language is not possible (->japanese)

Closes #3594
2022-09-27 23:14:42 -07:00
Kurt
b6f5723d40 Make const location IDs ushort 2022-09-27 09:57:42 -07:00
Kurt
eabd8fad02 Reformat met location tables
More coherent alignment
Fix LGPE duplicate Met0 locations
Remove sublocations from XY hatch locations
2022-09-27 09:57:28 -07:00
sora10pls
4fd73d201f Remove unused GBLZero PogoType
This was implemented because Niantic messed up some GBL encounters in the past, but it was fixed quick enough for it to not matter for legality, so no encounters actually use this PogoType.

Also rename GBLDay => GBLD to match other PogoTypes for consistency across enum names.
2022-09-26 20:37:55 -04:00
Kurt
83d6402fd4 Add gen3 unown form-pid check 2022-09-26 07:27:51 -07:00
Kurt
05d43cef7c Set pk2 time of day for EncounterEgg ctor 2022-09-24 19:23:52 -07:00
Kurt
7cbde296f8 Make GameVersion a byte enum 2022-09-24 19:23:23 -07:00
Kurt
19d062480a Verify time of day for gen2 encounters 2022-09-24 18:07:58 -07:00
Kurt
9c133d4e39 Allow emitting Crystal eggs for location-less pk2's
Closes #3591
ty @randomdice101 !
2022-09-24 18:07:41 -07:00
Kurt
8c93fd1cbd Fix honeytree RNG frame matching
See EncounterSlotDumper for associated change (forgot to retain SlotType)
2022-09-23 13:36:44 -07:00
Kurt
3a5aa22c6f Force alpha move state for below learn level 2022-09-18 22:00:46 -07:00
Kurt
84be9da49d Revise rotom form check 2022-09-18 17:07:43 -07:00
Kurt
98707b466c Bounds check move & species
searching for florges with dazzling gleam as a PK5 -> reject
2022-09-18 00:44:31 -07:00
Kurt
fddddcba28 Ban evos byref all the way down
https://github.com/kwsch/PKHeX/issues/2973#issuecomment-1247776541
2022-09-15 17:43:52 -07:00
Lusamine
eb51826243 Add date legality for Otsukimi Festival 2022 Clefairy 2022-09-13 18:51:20 -05:00
Kurt
61aa10a564 Require AtAnyTime for flagging original egg moves
https://projectpokemon.org/home/forums/topic/62305-egg-moves-are-deemed-legal-even-if-they-are-not-in-relearn-moves-list-before-gen-8/?do=findComment&comment=279269

ty liopds !

for gen8, require "Encounter" flag to match gen6/7
gen6/7 don't need to check IsMovesetDeleted as 8->7 will not traverse to 7-- if it was deleted.
2022-09-13 15:22:19 -07:00
Kurt
7d2808ea33 Requisite ribbon syndicate ribbons 2022-09-10 19:44:58 -07:00
Kurt
27eb68335b Update learn handling for side-game wiped movesets 2022-09-10 12:02:15 -07:00
Kurt
0a88cdc32e Update Encounters8.cs 2022-09-10 01:13:34 -07:00
sora10pls
39ccb50580 Add latest distribution raid data 2022-09-08 20:04:39 -04:00
Lusamine
f79560b8a2 Add Continental Vivillon pattern to Nagasaki, Japan for 3DS
Updated earlier this year:
https://docs.google.com/spreadsheets/d/e/2PACX-1vTVVOEZbXLVQvjIdzGACpZ_IrOWgVDBr_Wa-xULK3191BP9lf1tep-z-PsmcAfaH_aE56j3GHDX_9UO/pubhtml
2022-09-07 23:58:04 -05:00
Kurt
17b42219af Improve xd umbreon detection
Make PIDIV for xd starter indicate the TID/SID origin seed too.
2022-09-07 15:49:53 -07:00
Kurt
d6e83362b3 Fix binarysearch result compare
Method returns a negative number if not found; not always -1
https://projectpokemon.org/home/forums/topic/62246-g3-xd-move-tutor-legality/
2022-09-05 08:50:27 -07:00
Kurt
06196e0440 Minor tweaks
Less alloc
2022-09-04 22:23:35 -07:00
Kurt
6a61b0e449 Update EvolutionTree.cs 2022-09-04 22:20:35 -07: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
d9ad0052a1 Completely remove chatelaine memory check
Gen6 can get the memory on those who did not participate by being in the party with other participants.
This includes those who cannot enter into the Maison; having memory and no ribbon is entirely legal.
2022-09-03 10:12:42 -07:00
Kurt
fd27bde673 Update RibbonVerifierCommon6.cs 2022-09-03 08:25:12 -07:00
Kurt
da642ee16e Remap context for sidegame HT memory checks
gastrodon with recover as HT memory needs to verify within the context of SW/SH and prior learn environments.
2022-09-02 15:41:22 -07: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
Lusamine
a97e74e628 Correct Arceus Chronicles Growlithe dates 2022-09-02 02:40:40 -05:00
Lusamine
7bab0270bb Fix Wish Ralts moveset
Thanks @Kermalis !
2022-09-01 23:27:58 -05:00
Kurt
59c518f268 Condense moveset deletion check 2022-09-01 20:57:39 -07:00
Lusamine
8ecbd08efd Add start date for Arceus Chronicles Growlithe event 2022-09-01 21:04:56 -05:00
Kurt
e8aa2c8ed1 Correctly check xy/sm if not ao/usum levelup 2022-09-01 09:34:40 -07:00
Kurt
f4f9df3a81 Don't add new gs moves to pk1 permit array
Out of range
https://projectpokemon.org/home/forums/topic/62190-user-message-an-unhandled-exception-has-occurred-you-can-continue-running-pkhex-but-please-report-this-error
2022-08-31 21:03:26 -07:00
Kurt
88ac14946d Don't be as strict with shedinja evo moves
EncounterMovesetGenerator doesn't specify a clean encounter, don't check it as thoroughly.
2022-08-31 19:09:06 -07:00
Kurt
fb9deab202 Specify full gift egg wc3 moveset
PKHeX needs the exact moveset rather than a "permit this extra move" because our recent logic improvements check for strict moveset matching when it is still an egg.
Closes #3577 thanks @wararjey !
2022-08-31 18:55:17 -07:00
Kurt
71e08222cf Update 22.08.31 2022-08-30 22:49:54 -07:00
Kurt
d350bb7fee Misc fixes & pickle updates 2022-08-30 21:15:07 -07:00
Kurt
66e0613d82 Minor clean 2022-08-30 15:00:45 -07:00
Kurt
f18e884407 Remove unused BDSP bcat logic
ded game, underground distributions unused. no need to differentiate, no need to allocate unused collections.
2022-08-29 17:37:54 -07:00
Kurt
bf37be3ea1 Update LearnVerifierEgg.cs
Order of operations being spooky
2022-08-29 16:08:56 -07:00
Kurt
40649084b3 stackalloc temp unreleased item arrays 2022-08-29 16:08:30 -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
444c3d2209 Narrow more types 2022-08-26 10:07:24 -07:00
Kurt
6e4613a3a7 Narrow met location value checks for eggs s32->u16 2022-08-26 10:03:46 -07:00
Kurt
28d726da80 Simplify wild ball permitted checks 2022-08-26 01:20:49 -07:00
Kurt
e700a0e3e6 Handle traded BDSP egg transfers 2022-08-25 23:04:38 -07:00
Kurt
ad28f7b261 Delete old utility methods (unused)
MoveEgg: already range check in the Safe method
Inline some logic
2022-08-24 23:49:00 -07:00
Kurt
b241c19520 Simplify some memory args 2022-08-24 23:29:03 -07:00
Kurt
d3c2d77d11 Misc move/memory tweaks
Disallow max moves from Sketch
Hide dmax moves from legal dropdown lists
Pass ushort for moves for validating memories
Internal class for move pp (hide empty class from dll users)
2022-08-24 20:32:40 -07:00
Kurt
43871e856c Specify some lambdas as static
Rewrite some usages to be more clear
bikeshedding at its finest, ignoring more important things to update/fix :)
2022-08-23 23:11:26 -07:00
Kurt
26b1453002 Narrow ribbon count type from int->byte, split interface
Fix RibbonVerifier4 not checking gen4 contest ribbons correctly
Split IRibbonCommon6 to have memory ribbons separate, as they are not implemented in mystery gifts. Also, we can add the boolean flags to the interface, and check that the boolean is set if count is nonzero.
Fix adding ribbons to Gen8 gift templates
Improve Gen8 template ribbon fetch (no closure, faster IndexOf)
2022-08-23 21:25:22 -07:00
Kurt
eb2cef10c9 Minor clean
Stability intensifies
2022-08-22 23:18:53 -07:00
Kurt
0b458395f1 Fix handling for USUM banned species bypass
Tweak EReader check for Shadow3, more straightforward since we can just check the location ID (nothing else uses that location ID).
2022-08-21 19:15:02 -07:00
Kurt
6441bdadd8
Add specialized struct for Moveset and IV specs (#3572)
`Moveset` struct stores 4 moves, and exposes methods to interact with a moveset.
`IndividualValueSet` stores a 6 IV template (signed).

Performance impact:
* Less allocating on the heap: Moves - (8 bytes member ptr, 20 bytes heap->8 bytes member)
* Less allocating on the heap: IVs - (8 bytes member ptr, 28 bytes heap->8 bytes member)
* No heap pointers, no need to jump to grab data.
* Easy to inline logic for checking if moves are present (no linq usage with temporary collections).

End result is faster ctor times, less memory used, faster program.
2022-08-21 17:34:32 -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
db0b77c493 Update RibbonVerifierCommon7.cs
Closes #3571
2022-08-19 13:22:39 -07:00
Kurt
44c8e772a3 Fix incorrect method call
Copypasta oops, previous commit at fault.
2022-08-18 01:17:03 -07:00
Kurt
3dde8a7cfa Reduce linq usage, minor perf 2022-08-17 23:48:37 -07:00
Kurt
5140c47e84 Pass missing flag so that remove all can revert 2022-08-17 23:47:15 -07:00
Kurt
136f742299 Flag cross-transfer presence if tracker missing
Can't get a Pioneer Ribbon on SW/SH alolan vulpix lacking a HOME Tracker, assuming you have the HOME Tracker setting enabled.
2022-08-16 15:50:35 -07:00
Kurt
912023d756 Fix 7->prev EncounterMovesetGenerator traversal
The dummy EncounterInvalid has Generation:0, when 7->6/2 depends on which generation the encounter originated on. Change it so that the origin generation gets passed along.
2022-08-16 13:14:48 -07:00
Kurt
f62597cc24 Add shared egg moves to GetAllMoves fetch 2022-08-16 12:42:40 -07:00
Kurt
768047cd80
Legality: Rewrite Ribbon Verifier (#3570)
* Rewrite ribbon verification
* Explicitly verifies all ribbons instead of chained iterators.
* Verifies using only the stack, using `struct` and `Span<T>`. No allocation on heap, or `IEnumerable` iterators.
* Verifies all egg ribbons using a separate method, explicitly implemented. No reflection overhead.
* Separates each ribbon interface to separate `static` classes. Easier to identify code needing change on new game update.
* Extracted logic for specific ribbons. Can easily revise complicated ribbon's acquisition rules.
* Simplifies GiveAll/RemoveAll legal ribbon mutations. No reflection overhead, and no allocation.
* Can be expanded in the future if we need to track conditions for ribbon acquisition (was Sinnoh Champ received in BDSP or Gen4?)

End result is a more performant implementation and easier to maintain & reuse logic.
2022-08-15 21:04:30 -07:00
Kurt
3cccb3a9cd Revise alola champ ribbon check 2022-08-12 10:16:12 -07:00
Kurt
b900361ad3 Permit alolan champ ribbon from mystery gift
silly world pikachu gift
2022-08-11 21:03:08 -07:00
sora10pls
7ad70a04c7 Add latest distribution raid data 👿 2022-08-11 20:07:02 -04:00
Kurt
7c4e5e7b04 Add more xmldoc 2022-08-11 00:46:41 -07:00
Kurt
af87d038aa Delete unused logic 2022-08-11 00:25:16 -07:00
Kurt
d1959d90a4 Move files 2022-08-11 00:24:59 -07:00
Kurt
30f2450a30 Minor clean, xmldoc personal tables 2022-08-11 00:24:25 -07:00
Kurt
59fad0e8cf Minor tweaks
Extract some logic (origin markings)
Revise directives for NET7 targeting, remove old net5 refs
2022-08-05 16:18:42 -07:00
Kurt
54910b8fba Early return if no evos
GO transfers like Snivy can be viewed but shouldn't exist in Gen8. This avoids any exception being thrown for shared move check.
2022-08-05 16:18:06 -07:00
Kurt
999caedf6e Allow viewing of un-convertible GO encounters 2022-08-05 11:23:48 -07:00
Kurt
538d651aef Misc tweaks
Add xmldoc, simplify some expressions
2022-08-05 11:23:28 -07:00
Kurt
87e45b14c8 Disallow BD/SP Tower Master ribbon w/mythicals
Thanks TFSthegreat !
https://projectpokemon.org/home/forums/topic/57375-pkhex-new-update-legality-errors-contribution-page/?do=findComment&comment=278427
2022-08-03 20:27:13 -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
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
d1dad7b8eb Revise check for apply PID shinyxor
was checking stale value

make loop max adjustable by caller; knowingly requesting squares is 1:65,536, so a higher loop count than 50k might guarantee more successes.

Maybe in the future we'd have separate algorithms to pre-choose seeds by choosing a PID and unrolling -> rolling.

Co-Authored-By: Kermalis <29823718+Kermalis@users.noreply.github.com>
2022-08-03 16:11:49 -07:00
sora10pls
54babc2217 Allow Ranked Ribbon on Mythicals, extend availability 2022-08-02 09:23:07 -04:00
Lusamine
7ad9f68dda Add missing static Loop Lagoon Gyarados
Closes #3555
2022-07-22 18:15:24 -05:00
Kurt
7d35517614 Revise AV check string to show which stat invalid 2022-07-10 17:34:46 -07:00
Kurt
3dbf46be92 Handle "random" AV gains from level up 2022-07-10 15:53:33 -07:00
Kurt
42743d8c2f RS: Locations 75/77 unused
Remove from valid hatch location list
Mark as (unused) in text files

Closes #3544

Co-Authored-By: prof64 <80442784+prof64@users.noreply.github.com>
2022-07-04 01:02:47 -07:00
Kurt
cf86cafdf7 Add optional loop for generating min level 2022-07-02 17:10:30 -07:00
Kurt
0605a01b24 Remove unnecessary assignment
PIDIV.None is equivalent to a zeroed field.
2022-07-02 12:24:43 -07:00
Kurt
5c0498ddbe Don't recognize XD eevee->umbreon as colostarter 2022-06-30 17:23:27 -07:00
sora10pls
f3e0ebd163 Add latest distribution raid data 🐇 2022-06-30 20:07:03 -04:00
Kurt
10cfb45e55 BDSP: Allow bred beast ball if species not in SWSH
Remove unnecessary HashSet, all entries are not present in the first hashset comparison. Maybe was true back >4 years ago when initially implemented.
2022-06-29 19:39:08 -07:00
Kurt
6e46f567e9 Replace u16 read with lib 2022-06-29 00:01:14 -07:00
Kurt
41af1085ca Update EvolutionRestrictions.cs 2022-06-26 22:32:51 -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
4cc992b6ee Fix Valid bool set
oops
2022-06-26 16:04:55 -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
9c086260c6 Fix random level slots (PA8) initial move list 2022-06-22 16:24:11 -07:00
sora10pls
2e9f73ab4d Add PogoType for Ultra Beasts via Field Research
Will need to verify if Beast Balls can be used on other Pokémon, and if generic Poké Balls can be used on Ultra Beasts. We'll see when GO Fest Berlin starts.
2022-06-22 17:19:08 -04: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
51edaac704 Flag pokerus on LGPE, traded starter 2022-06-17 16:38:05 -07:00
sora10pls
b9c42aa56a Add latest distribution raid data 👊💧
Uncatchable Urshifu!
2022-06-16 20:10:56 -04:00
Lusamine
2ed1fc1e86 Poffins can be even worse 2022-06-14 08:22:49 -05:00
Kurt
ce935edcdf xmldoc
no functional change
2022-06-14 00:01:51 -07:00
Kurt
1a3a365d8a Relax gen4/8b poffin sheen max calc
Really bad burnt poffins.
2022-06-13 21:57:57 -07:00
Kurt
78d681751e Check tracker for WB8/WA8 HOME gifts
Refactor logic flow since Gen8 is done & dusted.
2022-06-13 20:39:29 -07:00
Kurt
f53cc768a6 Improve performance of TM fetch 2022-06-13 00:20:00 -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
5ce8938440 Use history for hypertraining possible check
Closes #3520
2022-06-12 09:26:45 -07:00
Kurt
436588eb10 Replace é->e for code symbols
Closes #3519
Usages weren't consistent; since `é` isn't accessible on usual english keyboards, just use regular `e` instead of alt-223 entry.

Not sure why VS preferred to save the text files without an encoding prefix; oh well.
2022-06-11 15:32:12 -07:00
Kurt
cc8cbeb749 Revise gen3 contest stat max sheen disparity
Closes #3517

Co-Authored-By: Atrius97 <39707481+Atrius97@users.noreply.github.com>
2022-06-11 09:36:50 -07:00
Kurt
c3117994cc Allow GO7 handler 0
New current handler verifier settings flag GO => LGPE transfers. Unlike GO => HOME, these transfers use your LGPE OT info, so it's legal to have no HT and have the current handler be OT

Co-Authored-By: Matt <17801814+sora10pls@users.noreply.github.com>
2022-06-08 00:27:24 -07:00
Kurt
c75f543f8b Minor tweaks 2022-06-07 23:32:57 -07:00
Kurt
5ccb678931 Permit Gen7b for GO even if location doesn't match
Feeling like the Move fetching needs to shift away from Generation too.
2022-06-07 20:15:32 -07:00
Kurt
54cb4dc8c8 Minor comment fixes 2022-06-07 03:21:04 -07:00
Kurt
428ce52c27 Add Current Handler checks & toggles
Default settings do not flag, as Database view does not track the savefile (LegalityAnalysis only indirectly references the latest loaded save file, not the true source).

Bulk Analysis will flag them correctly if run. Can be turned off.
2022-06-05 13:18:31 -07:00
Kurt
39a09fbbbe Defer BDSP->PK8 marsh ball mismatches 2022-06-05 11:28:17 -07:00
Kurt
bd5cc538c4 Check met date of WA8/WB8 less than current moment 2022-06-05 10:56:17 -07:00
Kurt
893b5d5293 Revise more PB7/PK8->Interface type checks 2022-06-04 21:03:25 -07:00
Kurt
9c5dc6e6e7 Add MarkValue verifier 2022-06-04 14:30:52 -07:00
Kurt
382ea5cd61 Extract move info api 2022-06-04 13:14:50 -07:00
Kurt
ab723af640 Expose Context for SaveFile/ITrainerInfo 2022-06-03 19:08:46 -07:00
Kurt
dde70f4962 Permit shared egg moves based on current type 2022-06-03 16:54:05 -07:00
Kurt
df02532697 Misc fixes
Simplify HM memory check (bit permission superset, just check directly)
Disallow BestFriends & Effort on PA8 exclusives
PA8 techrecord permits none.
2022-06-02 20:05:27 -07:00
Kurt
ead7c2d973 Update contest stat restrictions for BDSP visitors
Closes #3513
2022-06-02 19:11:37 -07:00
Kurt
e571a0b95f Check catchrate tradeback separately
Closes #3510
Thanks @CodeWithMa !
2022-06-02 18:32:22 -07:00
sora10pls
7d20363d6b Update プロポチャ Piplup end date 2022-05-31 20:21:55 -04: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
af2ac169e1 Only disallow catchrate enc if !tradeback
Closes #3501
2022-05-30 00:50:35 -07:00
Kurt
32e0bf95b0 Update LevelVerifier.cs
Closes #3499
ty @Ninjistix !
2022-05-19 22:07:09 -07:00
sora10pls
52082e0e9f Add latest distribution raid data 2022-05-19 20:03:48 -04:00
Kurt
a5b46d80f5 Minor tweaks
ShowdownSet: Lessen allocation
MoveTutor: Remove boxing by calling the generic method instead of object method
Xoro8b: Add more xmldoc, use positive constant instead of inverse negative for parity
StadiumUtil: Use built-in endianness reversal methods
2022-05-14 08:28:13 -07:00
Kurt
700236249f Treat random gendered slots correctly 2022-05-10 21:52:01 -07:00
Kurt
2a6026cc80 Load gender values for forced gender slots 2022-05-10 21:46:45 -07:00
Kurt
63784d748d Update LegendsArceusVerifier.cs 2022-05-09 21:24:10 -07:00
Kurt
a21d6c8248 Fix static8a move population 2022-05-08 19:08:44 -07:00
Kurt
0206475ba4 Update LegendsArceusVerifier.cs 2022-05-08 12:33:30 -07:00
Kurt
8c4db878dd Extract logic to set initial mastery move flags
Are we done yet
2022-05-08 10:28:22 -07:00
Kurt
178e5e8bc5 More mastery tweaks for db->pkm + alpha statics
in the RNG generator, defer alpha move mastery flag set for templates to set themselves
2022-05-08 10:06:38 -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
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
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
178069f889 Minor tweaks 2022-05-07 11:47:01 -07:00
Kurt
58caa37d58 Push alpha move for fixed statics
Oops
2022-05-07 08:52:00 -07:00
Kurt
a57f40ae7d Break up PKX into separate classes
Many years ago, PKX used to be a >4,000 line bloated file, which spun off multiple classes like CommonEdits and most of the early non-GUI PKM related logic. Now, it's just a stub to source the latest generation & personal table.

Separate files = more concise info, and more room to grow to do more advanced things.
Makes the IsPresent methods public (no longer internal).
2022-05-06 20:38:55 -07:00
Kurt
124bbf98ad Allow seed of mastery toggling mastered flag
oops
2022-05-06 16:11:52 -07:00
Kurt
59ceec3c65 Extract EffortValues class, add $rand + $suggest
Renames IV/EV verifier field objects for Legality Checks due to class name clashing.
2022-05-06 15:47:54 -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
232c65ed3a Update EncounterServerDate.cs
Closes #3488

Co-Authored-By: CanoeHope <43196464+CanoeHope@users.noreply.github.com>
2022-05-06 10:49:05 -07:00
Kurt
4c73f1c592 More strict alpha move check for statics 2022-05-05 20:21:21 -07:00
Kurt
ea87140aea Remove optional gameversion for enc generators
Simplifies some of the logic a little.
2022-05-04 22:28:39 -07:00
Kurt
824e868efe Flag non-pokeball GO shedinja (evo'd from nincada) 2022-05-03 20:17:28 -07:00
Kurt
7c8f52cbbf Minor clean
invert nesting, add missing if( space, group OT checks together
2022-05-02 23:48:25 -07:00
Kurt
b51cdfe72f Flag Marks on BDSP/PLA encounters
Note to self: Exclusion lists aren't futureproof; inclusion more resilient :)
2022-05-02 19:27:22 -07:00
Kurt
5132f961cc Add server date checks for WA8 gifts 2022-05-02 18:52:43 -07:00
Kurt
fa76da56c9 Inline some Rand32 calls
No functional change
2022-04-26 20:21:26 -07:00
Kurt
af141581ee Minor tweaks
Single underscore discards (one of the c# language revisions allowed reusing the single underscore discard).
Remove a temporary allocation in BDSP flag editor
2022-04-26 19:48:09 -07:00
Kurt
ecee948107 Add gender sprites for main GUI
Might trickle this out to the other editors that have gender toggles.
2022-04-24 20:28:56 -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
959b9e998b Only flag r45 roamer if tile is water
Grass Tile is okay.
2022-04-23 21:10:09 -07:00
Lusamine
9d3f61b708 Fix MMO roll count 2022-04-23 00:44:55 -05: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
ad249dbb76 Differentiate MO + MMO slot types 2022-04-22 20:33:12 -07:00
Kurt
841fcde2b2 Enhance Pokerus api functions
Fixes #3480 ; (0,0) is a valid state regardless of format.
2022-04-14 14:05:32 -07:00
Kurt
a601180821 Extract Pokerus util logic
Simplify some GUI interactions when changing strain. Changing the day selection will update the visibility, no need to manually do it again.
2022-04-09 12:27:16 -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
647b5a3f87 Remove duplicate home tracker flagging 2022-04-02 17:58:17 -07:00
sora10pls
1a082ecf04 Unban Darkrai, associated Met Locations, Sketch Dark Void
Also reformat Encounters8b to be consistent with other games' static encounter defs
2022-04-01 06:18:11 -04:00
sora10pls
1b39222edf Add April Fool's 2022 distribution raid data 🌲 2022-03-31 20:03:40 -04:00
Kurt
6deaf3cb74 More explicit type checks for Encounter class
A little more explicit on what it is actually checking for
2022-03-26 14:53:15 -07:00
Kurt
0dc641453b Condense some expressions
Getting close to weeding out all the easy inefficiencies to make me finally tackle the "stop gathering all moves instead of checking individual moves" allocation issue.
2022-03-20 23:28:18 -07:00
Kurt
3d759e1491 Move location lists to separate classes 2022-03-20 21:26:56 -07:00
Kurt
a4533b62d8 Reduce size of display-able met location arrays
shaves 5KB off the core DLL
2022-03-20 19:07:33 -07:00
Kurt
54f1e341f9 Spanify spawner object get 2022-03-20 01:46:24 -07:00
sora10pls
f94c16c40f Add new distribution raids 🦴 2022-03-17 20:04:14 -04:00
sora10pls
5b9b5e4faa Update Tables8bs.cs
Sweet Heart still unobtainable (why did they give it a sprite if it's not functional ingame?)
Azure Flute is now obtainable
Sacred Ash was never obtainable
2022-03-17 14:40:35 -04:00
Kurt
434f89fa0f Merge branch 'master' of https://github.com/kwsch/PKHeX 2022-03-15 19:23:20 -07:00
sora10pls
5c8d1ceeec Unban BDSP Ver. 1.3.0 locations + Sketch Judgment 2022-03-15 21:36:26 -04:00
Kurt
d91d242719 Stackalloc EV/AV checks 2022-03-13 22:33:17 -07:00
Kurt
d95ba482f3 Reduce allocation in methodfinder IV set 2022-03-13 19:39:38 -07:00
Kurt
d5ae6764aa Stackalloc IVs for template->pkm fill 2022-03-13 19:24:08 -07:00
Kurt
8f8726ac5e Disallow encstatic1 yield catchrate not tradeback 2022-03-13 18:29:47 -07:00
Kurt
8afc6814eb Disallow matching BU statics for non-JP 2022-03-13 17:45:01 -07:00
Kurt
4841a01b4e Update GO pickles, move Shiny.Never before Always 2022-03-12 17:39:01 -08:00
Kurt
801892b59e potential revisions for gible (#3462)
ddc6f414df caused it to be `<=` instead of `<`, but maybe the underlying issue was fixed a different way since all tests still pass with this reversion.
2022-03-12 17:39:01 -08:00
Kurt
69fafcab83 Performance: Slightly reduce allocations in moveset validation (#3460)
* Reuses move parse result objects for each encounter parsed in a LegalityCheck attempt, instead of creating a new object.
* Ensures the objects are never-null, and makes cleanup easier.

Slightly adjusts some other parts of the moveset validation to reduce allocations.
2022-03-12 17:39:00 -08: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
85b7541c9f Update EncounterArea1.cs 2022-03-10 18:04:39 -08:00
Kurt
5359a140a6 Handle fixed ability for 8b RNG 2022-03-08 08:44:55 -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
462ef70ffb SlotNumber/MagnetStatic int->byte
more size reductions
2022-03-06 22:47:03 -08:00
Kurt
8f9de86347 Span-ify BreedInfo, saves 10bytes heap alloc
the Actual result still needs to leave the stack, so that has to be heap allocated.
2022-03-06 13:04:56 -08:00
Kurt
9049ef99fd Minor allocation reduction 2022-03-06 13:03:39 -08:00
Kurt
7911cd6d5c Seal some classes 2022-03-06 12:16:36 -08:00
Kurt
e1414a0bea Move some interfaces to different folder
No code changes
2022-03-06 12:06:50 -08:00
Kurt
c51d51d381 More specific primitives for Memories/others 2022-03-06 12:01:47 -08:00
Kurt
41d2dd9294 Update EncounterTrade for Shiny metadata
Doesn't need to be stored in most cases
Now permits EncounterTrade1 to be shiny
2022-03-05 21:04:18 -08:00
Kurt
e17483fe46 some linq reduction 2022-03-05 20:03:52 -08:00
Kurt
1b266c1e4b Handle PLA MMO formarg deferral
Can capture formarg evolved stuff directly in wild
2022-03-05 18:54:50 -08:00