Commit graph

368 commits

Author SHA1 Message Date
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
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
528a377f84 Handle version restrict for new gen4 legend cards
The other existing Eiscue/Stonjourner dmax crystal gifts are version restricted too, using this byte with same values.
2022-08-25 13:10:39 -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
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
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
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
569010c402 Handle nicknamed PGT gifts
https://github.com/projectpokemon/EventsGallery/pull/278
2022-06-20 14:36:25 -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
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
267521cfdf Permit old WC8 HOME shinies again
code getting a little bit spaghetti'd
2022-06-05 11:09:49 -07:00
Kurt
bd5cc538c4 Check met date of WA8/WB8 less than current moment 2022-06-05 10:56:17 -07:00
Kurt
d54a9ba3a9 Fix mg8 partially restricted language check
Recipient language fetching a value of 0 will now be permitted to yield the recipient's language. Earlier logic in the method would check if any other language maps to the recipient language
2022-06-04 12:06:23 -07:00
Kurt
86814d014d Fix recog of Home fixed PID shinies
Not to be confused with Home fixed PID antishinies
WC8 is the only format to have fixed shinies, but let's copy the logic to WB8 and WA8 if they're ever added in the future.

Fix mgdb display filtering for SWSH & PLA (swapped oops)

Closes #3511
2022-06-02 19:04:27 -07:00
Kurt
f2356f1865 Update 22.06.01 2022-06-01 21:27:54 -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
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
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
75874b6b81 Show lock capsule slot in mystery gift editor
Closes #3487

editor getting hacky, but it works
2022-05-05 21:21:03 -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
b55d706785 Only encrypt pk4-based pgt data
Closes #3484
ty @DeadSkullzJr !
2022-04-26 19:50:02 -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
d91d242719 Stackalloc EV/AV checks 2022-03-13 22:33:17 -07:00
Kurt
d5ae6764aa Stackalloc IVs for template->pkm fill 2022-03-13 19:24:08 -07: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
4e1276a954 -8 bytes from each encounter template
saves about ~1MB RAM savings (>=179,142 objects)
2022-03-06 23:25:47 -08:00
Kurt
c51d51d381 More specific primitives for Memories/others 2022-03-06 12:01:47 -08:00
Kurt
3d9c7dc750 Reduce IAwakened from int->byte 2022-03-05 18:46:03 -08:00
Kurt
b20566eb59 Use actual primitive instead of int
Some interfaces aren't needed to be exposed as int
2022-03-05 18:30:35 -08:00
Kurt
6ae59c509f IGanbaru int->byte fields 2022-03-04 22:34:11 -08:00
Kurt
2267e1a879 Minor tweaks for api consumers
Indicate Shiny.Random on home shiny-possible gifts
More detailed exception message for GetLearnset/GetPersonal
2022-02-12 23:40:28 -08:00
Kurt
b72c5bbf1a Fix mystery gift alpha check
Implement IAlpha for good measure
2022-02-04 20:13:36 -08:00
Kurt
eed5bb04e3
Merge pull request #3382 from kwsch/pla
Update 22.02.04
Individual commits from this PR are not cherry-pickable in a vacuum; these were manually re-committed from a staging repo in order to group together changes for general public viewing. There were over 250 commits on the private development repo for this update.
2022-02-04 18:28: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
51090d0be8 Revise mystery gift Shiny potential for eggs
swsh+ now revise TIDSID on trade, so can't alter shiny state.
2022-01-17 20:06:46 -08:00
Kurt
9cde291595
Enumerate ability permissions in encounter templates, misc updates (#3368) 2022-01-08 22:34:04 -08:00
Kurt
f83a9bf833 Expose shiny potential value
Not really digging it currently as it doesn't cover multi-state like AlwaysStar-Or-Never, but that single edge case can be handled elsewhere
2022-01-07 17:48:12 -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
76cac85243 Minor clean 2021-12-27 13:50:21 -08:00
Kurt
cc8ac7a4f1 Remove unnecessary warning suppression
fixed dat .editorconfig in vs22
Catching general exceptions is okay because this program handles user modified data that can potentially be corrupt.
2021-12-27 12:09:15 -08:00
Kurt
51c75dd102 Explicitly implement IFixedAbilityNumber on all templates 2021-12-09 00:46:59 -08:00
Kurt
f55c5bea66 Minor clean
no functional change
2021-12-04 17:56:56 -08:00
Kurt
d7ed6713c5 Update WB8.cs 2021-11-26 19:06:36 -08:00
Kurt
0254ae55b3 Don't set nickname flag for WB8 eggs
Closes #3311
2021-11-25 12:32:46 -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
3e5cf73b78 Update WC7.cs 2021-10-03 19:58:34 -07:00
Kurt
d4b20b8082 Add nickname checks for WC3, add non-english ageto/colo
Closes #3260

Co-Authored-By: FeralFalcon <33670476+FeralFalcon@users.noreply.github.com>
2021-09-30 19:57:52 -07:00
Kurt
ca35623124 Remove phantom invisible character, fix de mattle ho-oh
#3260 part 1

I searched for more instances of the phantom character, and found the one instance in gen7 zh flags :D

Co-Authored-By: FeralFalcon <33670476+FeralFalcon@users.noreply.github.com>
2021-09-30 19:29:22 -07:00
Kurt
1d00e17217 Add properties for cleaner interaction 2021-09-07 15:31:54 -07:00
Kurt
d5c9ea978e Indicate version metadata for lgpe gifts
Just metadata, no functional change
2021-08-26 15:47:44 -07:00
Kurt
6e3bcd5b66 Encounter visualization: Show ball and differentiate visually 2021-08-24 14:03:20 -07:00
Kurt
5a53ae85bc Update WB7.cs 2021-08-24 13:12:14 -07:00
Kurt
47914c48c8 Update WB7.cs
https: //github.com/kwsch/PKHeX/commit/2a51eb174522754da51a5e1b059163e6a1ed9c6a#diff-8b09a6b11c41760f1242b597508eeb0ea4cde4a14cfd7e7ec1a0a37b146924c8L235-R228
Co-Authored-By: Matt <17801814+sora10pls@users.noreply.github.com>
2021-08-23 16:30:38 -07:00
Kurt
a631e5cb4e Rearrange how some memory info is checked
Split into different game contexts
2021-08-22 16:41:57 -07:00
Kurt
28e7473f1a Condense some expressions 2021-08-22 01:26:28 -07:00
Kurt
c9b838b492 Inline clone method
More obvious what it does
2021-08-21 16:52:06 -07:00
Kurt
8f0fb902d1 ArgumentException -> ArgumentOutOfRangeException 2021-08-21 16:51:50 -07:00
Kurt
8f4f86e88e Update WC8.cs 2021-08-21 11:50:24 -07:00
Kurt
bedc52943e Trailing commas
No functional change
2021-08-20 13:49:20 -07:00
Kurt
c6342a163f Minor clean
variable swaps, simplifications
2021-08-20 13:42:25 -07:00
Kurt
d8c2114770 Update PGT.cs 2021-07-31 19:50:27 -07:00
Kurt
6bed33f7f1 Minor tweaks 2021-07-15 20:40:00 -07:00
sora10pls
34c401b7a0 Revise IsHOMEGift, check Card ID for gift date range
Currently, HOME gifts present in wc8.pkl will not be flagged for invalid dates due to them missing their respective Card IDs. This will be fixed with the next stable release, so this works for now.
2021-07-13 18:22:04 -07:00
Kurt
49488bb503 Use invariant culture for ToUpper/ToLower
Turkish is quite the language; let's try to prevent any errors down the road for internal/game string case changes.
2021-06-24 09:16:36 -07:00
Kurt
a10b35190c Minor tweaks
off by 1 max range for gen2 slot -> pk2
SetRandomIVs already sets IVs inside the method, retval is for knowing what the new value sare
show WC8 restricted version rather than defaulting to SH
pass the rand object rather than fetching for the current thread every loop for Unown & random IV shuffling
Use ToLowerInvariant for resource fetching, should resolve the turkish issue
Check typeof(T) first, not that we check for ToolStripItem or ContextMenuStrip with this function.
2021-06-24 00:36:04 -07:00
Kurt
3e7775fc44
Track a PKM's Box,Slot,StorageFlags,Identifier metadata separately (#3222)
* Track a PKM's Box,Slot,StorageFlags,Identifier metadata separately

Don't store within the object, track the slot origin data separately.

Batch editing now pre-filters if using Box/Slot/Identifier logic; split up mods/filters as they're starting to get pretty hefty.

- Requesting a Box Data report now shows all slots in the save file (party, misc)
- Can now exclude backup saves from database search via toggle (separate from settings preventing load entirely)
- Replace some linq usages with direct code

* Remove WasLink virtual in PKM

Inline any logic, since we now have encounter objects to indicate matching, rather than the proto-legality logic checking properties of a PKM.

* Use Fateful to directly check gen5 mysterygift origins

No other encounter types in gen5 apply Fateful

* Simplify double ball comparison

Used to be separate for deferral cases, now no longer needed to be separate.

* Grab move/relearn reference and update locally

Fix relearn move identifier

* Inline defog HM transfer preference check

HasMove is faster than getting moves & checking contains. Skips allocation by setting values directly.

* Extract more met location metadata checks: WasBredEgg

* Replace Console.Write* with Debug.Write*

There's no console output UI, so don't include them in release builds.

* Inline WasGiftEgg, WasEvent, and WasEventEgg logic

Adios legality tags that aren't entirely correct for the specific format. Just put the computations in EncounterFinder.
2021-06-22 20:23:48 -07:00
Kurt
8222297da8 Remove enumerating when loading event templates
Just allocate the parent array and pass it to HashSet; having an ICollection, prevents resizing repeatedly and gc'ing the temp array is cheap.

Actually, only create a hashset if we're adding a gift from external DB. Saves on that allocation, and keeps the final result as an array (fastest iterating).
2021-06-04 13:48:02 -07:00
Kurt
138501da2f Minor clean
Condense some expressions
Use less linq
Rename some fields
2021-05-29 15:31:47 -07:00
Kurt
acdbda4e12 Split DateUtil from Util class 2021-05-14 16:46:48 -07:00
Kurt
50b15cd740 Use range/index
More in line with modernizing the codebase with latest c# syntax

improve web-qr decode speed slightly (no linq skiptake)
get money/coin mask without a temporary string (lol performance)
2021-05-14 15:30:55 -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
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
c7b997865c Minor clean 2021-04-09 14:52:49 -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
56f24bbe5a Fix deferral compare
neq -> defer
not like it matters for these
2021-03-20 17:47:31 -07:00
Kurt
6bce4eea14 Minor clean
Annotations (nullable), some switch cases for readability
2021-03-14 16:16:55 -07:00
Kurt
36670292ad Futureproof check regardless of packing filename
When making the wc8 bin, the filename v1/v2 may be first or second if the EventsGallery changes its syntax. Don't assume the v2 comes after v1. Just check for mismatch
2021-02-03 13:31:37 -08:00
Kurt
7d5596995d Update WC8.cs 2021-02-03 13:29:48 -08:00
Kurt
16ff74ccc0 Update WC8.cs 2021-02-02 22:57:44 -08:00
Kurt
33fc33a165 Add more nickname logic checks
Variant nicklang OT can nickname if it's the handler
2021-02-02 22:12:36 -08:00
Kurt
03940b54a5 Update WB7.cs 2021-02-01 18:39:34 -08:00
Kurt
9124a3c62b Improve handling of multi-nicknamed mystery gifts 2021-02-01 18:35:37 -08:00
Kurt
6d41d6a17c Fix casting issue for mystry seed fetch
rand32 -> int32 can yield negative, when modulo'd can be negative (bad index)
2021-02-01 10:53:40 -08:00
Kurt
fd4034272b Update WC8.cs 2021-01-31 10:36:33 -08:00
Kurt
33b671c636 Allow home gifts with T7SID > 0 2021-01-30 18:39:40 -08:00
Kurt
1e86fdcea8
Fracture the encounter matching checks to allow progressive validation (#3137)
## Issue

We want to discard-but-remember any slots that aren't a perfect fit, on the off chance that a better one exists later in the search space. If there's no better match, then we gotta go with what we got.

## Example:
Wurmple exists in area `X`, and also has a more rare slot for Silcoon, with the same level for both slots. 
* We have a Silcoon that we've leveled up a few times.

Was our Silcoon originally a Wurmple, or was it caught as a Silcoon? 
* To be sure, we have to check the EC/PID if the Wurmple wouldn't evolve into Cascoon instead.
* We don't want to wholly reject that Wurmple slot, as maybe the Met Level isn't within Silcoon's slot range.

---

Existing implementation would store "deferred" matches in a list; we only need to keep 1 of these matches around (less allocation!). We also want to differentiate between a "good" deferral and a "bad" deferral; I don't think this is necessary but it's currently used by Mystery Gift matching (implemented for the Eeveelution mystery gifts which matter for evolution moves).

The existing logic didn't use inheritance, and instead had static methods being reused across generations. Quite kludgy. Also, the existing logic was a pain to modify the master encounter yield methods, as one generation's quirks had to not impact all other generations that used the method.

---

The new implementation splits out the encounter yielding methods to be separate for each generation / subset. Now, things don't have to check `WasLink` for Gen7 origin, because Pokémon Link wasn't a thing in Gen7.

---

## Future
Maybe refactoring yielders into "GameCores" that expose yielding behaviors / properties, rather than the static logic. As more generations and side-gamegroups get added (thanks LGPE/GO/GameCube), all this switch stuff gets annoying to maintain instead of just overriding/inheritance.

## Conclusion

This shouldn't impact any legality results negatively; if you notice any regressions, report them! This should reduce false flags where we didn't defer-discard an encounter when we should have (wild area mons being confused with raids).
2021-01-29 17:55:27 -08:00
Kurt
b1c3526618 Update WC8.cs 2021-01-23 11:43:56 -08:00
Kurt
acfbef6cfa Disallow raids matching if has mark
Closes #3133
not an ideal solution, but the encounter matching API is kinda limited in deferred-invalid vs deferred-notIdeal.

probably need to unify the match logic and generators so they can cache one secondary-check invalid
2021-01-22 20:28:54 -08:00
Kurt
613e6db744 Use StringConverter api consistently; use stringbuilder when possible
Retain a stringbuilder to mutate the string rather than finalizing temporary strings

yields some speed improvements (less gen0 string objects allocated)
2021-01-14 22:50:13 -08:00
Kurt
c9f222bf38 Set valid mystry mew seed on creation
Uses a Method specific seed regardless of template.
2021-01-07 21:27:19 -08:00
Kurt
09089da14e Use more expression return style
Reduces indentation & bracketing, a bit more concise
2021-01-01 17:08:49 -08:00