Commit graph

82 commits

Author SHA1 Message Date
Kurt
40ed5898af Merge extended property patterns 2021-12-04 18:37:47 -08:00
Kurt
88ddc5822e c#10: readonly record structs
Reduces some boilerplate constructors/equality compares
2021-12-04 18:32:35 -08:00
Lusamine
aef7987f82 Enable SWSH restaurant memory
Obtained by eating at the Circhester restaurant in story mode!
2021-12-03 16:58:07 -06:00
Kurt
93aaad6cd4 Revert net6 to net5
would rather have pipeline builds for those keen right now
2021-11-19 23:19:41 -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
4b263bf9bb Fix pattern matching comparison
Wish I had an analyzer to catch this (missing parens) similar to boolean logic

#3271 - resolves the traded egg recognition issue
2021-10-13 20:05:19 -07:00
Kurt
3f438a8169 Min movecount: handle more edge cases with latest api
Still should be rewritten to traverse all possible moveset building actions
2021-10-03 18:10:53 -07:00
Lusamine
25313ad58d Eternatus can trigger legendary encounter memory 2021-09-15 20:04:09 -05:00
Lusamine
4e398322b0
More memory legality checks (#3256)
* Add more memory legality checks

Includes the following new memory checks:
- 4: met in link-trade, allows all possible genlocs except dangerous place
- 7: successful fishing, allows fishable species in gen 6 and 8
- 9: paying attention to another mon, allows only available species for gen 8
- 29: encountering legendary Pokémon, only seen on Zacian, Zamazenta, Calyrex so far
- 32: riding a bike, only in genlocs where biking is possible
- 75: taken to Nursery and placed with a mon, allows only available species for gen 8

Unstubs lotto check and applies it to gen 6.

Co-Authored-By: Skadiv <62726360+Skadiv@users.noreply.github.com>
Co-Authored-By: Matt <17801814+sora10pls@users.noreply.github.com>

* Loto-ID only has one t

* Crown Shrine has another genloc outside

* Consistent Loto name for array

Co-authored-by: Skadiv <62726360+Skadiv@users.noreply.github.com>
Co-authored-by: Matt <17801814+sora10pls@users.noreply.github.com>
2021-09-12 12:01:45 -07:00
Kurt
2575d73144 Add IFixedAbilityNumber, hide vivillon region flags
tfw can't using static a private class in the file, gotta be explicit.
2021-09-06 18:11:32 -07:00
Lusamine
4cb525aac1 Restrict memory 39 general locations for SWSH 2021-09-06 12:39:08 -05:00
Lusamine
2f2cb43bd0 Disallow memory 17 from SWSH
It's a 1% memory that is impossible to obtain normally, but was missed earlier since it occurs on the in-game Throh/Sawk trades.
2021-08-29 19:22:09 -05:00
Kurt
adb7466a22 More memory legality additions
probably worthwhile to move the checks into the context, and return an enum -> switch to generate checkresult
2021-08-29 15:56:09 -07:00
Kurt
1ac125d335 Add Gen8 memory table data
The middle table in poke_memory.prmb contains the analogue of Gen6's memory table data. All existing memory data is the same, with 20 memories added.

Feeling bitflags are the same as before, but as we've noticed, feeling 0 is not obtainable. All the feelings are value upshifted by 1. This is why the game shows a blank line for Gen6 Feeling-0, as that game was [0,23] not [1,24] for the span of feeling strings.

Memories with 1% chance are actually 0% due to how they if-abort in the game code. Nice bug, GameFreak! @Lusamine had previously committed the unobtainable memories, derived from the community's empirical data.
2021-08-29 13:06:44 -07:00
Lusamine
3627ff4104 Disallow specific memories from SWSH
Never observed these in 20k+ memories, and I wasn't able to trigger them myself either.
2021-08-29 10:42:16 -05:00
Skadiv
809557715d
Add Wyndon to the sign memory locations (#3252) 2021-08-29 09:38:15 -05:00
Lusamine
e85a75e796 Add Wyndon as a location for sitting on bench memory 2021-08-29 01:28:42 -05:00
Lusamine
81f2744af2 Add story raid species for Dynamax memory 2021-08-28 15:55:47 -05:00
Kurt
92f30e26cc Add misc memory checks for gen8 memID 42/51/70 args
Closes #3249

Co-Authored-By: Skadiv <62726360+Skadiv@users.noreply.github.com>
2021-08-26 21:20:52 -07:00
Kurt
87a268fa7f Clean up memory generation parameter fetching 2021-08-25 19:45:47 -07:00
Kurt
6ea0d9f3bb Handle bank transferred memory feelings 5->6
Apparently they don't use the bit-permission table in Bank to get a random feeling, and instead just do rand(0,10).

Our logic to set a random feeling for bank transfers is still fine, because we set [0,10) within the bit table.
2021-08-25 10:37:53 -07:00
Kurt
2e3a6cc719 Fix memory 6 (pokecenter) compare for gen8 2021-08-23 23:06:33 -07:00
Kurt
a3633bb562 Update MemoryContext8.cs 2021-08-23 19:15:39 -07:00
Kurt
86fde6d42e Memory 3 updates, revert todo 2021-08-22 23:39:23 -07:00
Kurt
3a8947cc59 Allow battleversion-ambiguous relearn move 2021-08-22 22:23:59 -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
b099b8d82c More genloc memory refinements
starting to see the flaws in how things are organized
2021-08-22 11:10:29 -07:00
Kurt
40d1249f1e Add genloc checks for gen8 memories 1,2,3
Can definitely be refined as these memories can restrict to capture/hatch/gift encounters. The multi-value arrays can also be restricted for non-hatches too (maybe first element if WasEgg?)

Co-Authored-By: Lusamine <30205550+Lusamine@users.noreply.github.com>
2021-08-22 01:40:08 -07:00
Kurt
cd12962a50 Remove Tradeback state caching in PKM data
Since we have more metadata with move learn sourcing, we can check if it was traded to gen2 to get new moves / deleted.

Adjust call sites appropriately
might have some issues, to be ironed out maybe
2021-08-20 15:59:54 -07:00
Kurt
bedc52943e Trailing commas
No functional change
2021-08-20 13:49:20 -07:00
Kurt
9f249ef4d6 Add bounds check for API purposes
chris doing things funkily, might as well range check ourselves before blindly accessing the array

Use a const value for vivillon max wild form value
2021-08-19 18:59:24 -07:00
Kurt
a0bdb1a40e Fix OT->HT memory string output for HT verifier
Use the `memory.Handler string` value rather than recomputing. (lines 51, 64 pf memverify)
2021-08-12 17:33:31 -07:00
Kurt
277b1b658d Un-nest 3ds console region bitflags
Insert 3DS into the name to indicate that it's for the 3DS
2021-08-02 20:59:40 -07:00
Lusamine
928abfac3e
Properly check Vivillon form legality (#3235)
This uses more current crowdsourced information to update the country
and subregion tables for Vivillon forms. It's possible to change the
country/subregion within a 3DS console region, so only forms that cannot
be obtained for a console region are flagged as illegal. If a form is
not native to the country/subregion, it is marked as Fishy instead.

https://docs.google.com/spreadsheets/d/e/2PACX-1vTVVOEZbXLVQvjIdzGACpZ_IrOWgVDBr_Wa-xULK3191BP9lf1tep-z-PsmcAfaH_aE56j3GHDX_9UO/pubhtml
2021-08-02 08:57:21 -07:00
Kurt
c9640f8561 Comments: forme->form 2021-07-26 14:14:39 -07:00
Kurt
7bd844d5c5 Move min level check for gen1/2 closer to move adder
Check per-evolution min level rather than basing it on the original encounter data.

Correctly parses stuff like a captured level 23 Nidorina that immediately evolves into Nidoqueen, then learns Body Slam.

Passing zero is better than passing 1, as 0 requires no value pushing.

tidy up method signatures in MoveLevelUp so that species is followed by form, and the lookups are textually aligned. Clarify "maxLevel" instead of max/lvl, same as min.
2021-07-22 21:25:15 -07:00
Kurt
8e5e4487ba Change interface for method call to less restricted
Don't need "Name" or "LongName" for these methods.
2021-07-13 18:22:04 -07:00
Kurt
8188208ca3 Add TMs to Item param list
Co-Authored-By: Lusamine <30205550+Lusamine@users.noreply.github.com>
2021-07-03 13:18:51 -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
652e9eb6da Add Eon Flute to observable used key items
Co-Authored-By: Lusamine <30205550+Lusamine@users.noreply.github.com>
2021-06-13 00:59:06 -07:00
Kurt
f984862f48 Extract catchrate check 2021-06-09 22:54:21 -07:00
Kurt
c98717bdc0 Fix namespaces 2021-06-06 23:34:15 -07:00
Kurt
927ccee613 Cache all created regexes
Regex objects aren't cheap, and the RegexCache has DefaultMaxCacheSize = 15.

We're checking 4,000 regexes for each unique string, so just keep the created regexes around instead of cycling new through the cache.

+4MB passive consumption, but each IsFiltered call no longer generates >4MB of discarded objects.

My unit tests run >25% faster now... nice?!
2021-06-03 17:24:45 -07:00
Kurt
8c970ec991 Minor tweaks
no functional change, readability++
add more xmldoc
2021-06-03 12:04:19 -07:00
Kurt
2c820bfbe9 Minor tweaks 2021-05-18 13:29:55 -07:00
Kurt
fbba64c0e6 Clean up catch rate comparisons
Add dragonite to the uncapturable list, removes catchrate comparison for dragonite since it's filtered out.

Skip some linq by doing the loop directly in the method. Replace local methods with captured variables with direct if-returns.
2021-05-18 10:38:01 -07:00
Kurt
4c8772ff14 Update EvolutionRestrictions.cs 2021-05-16 11:12:16 -07:00
Kurt
5a012e85a0 Fix gen8 move threshold evo checks
gen7 allows all moves to be reminded; gen8 reverted that.
add greedy minlevel return, and reduce array size allocation by 270 bytes
2021-05-16 00:00:29 -07:00
Kurt
0e2f070510 Clean up know-move-evolution checks
Looks like Mr. Rime case wasn't being handled, so I rewrote it. Better performance, less complexity. No need to double-reference the moves.

Cache a single Valid evolution result; every parse can reuse that object.
2021-05-15 21:41:04 -07:00
Kurt
25565e6f07 More pattern matching expressions
Shapes are fancy; nested pattern checks
2021-04-20 02:17:28 -07:00